add feature payout_later

This commit is contained in:
2016-03-25 19:05:42 +01:00
parent b84ebf0177
commit 51b28134c1
14 changed files with 193 additions and 35 deletions

View File

@@ -960,7 +960,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
ShoppingCart::deleteAll(['id_transfer' => $this->id_transfer]);
UserSoldItem::deleteAll(['id_transfer' => $this->id_transfer]);
}
public function payout() {
public function payout($id_account = null) {
if ($this->status != Transfer::STATUS_NOT_PAID) {
return false;
@@ -970,14 +970,18 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
$this->paid_at = Helper::getDateTimeString ();
$this->paid_by = \Yii::$app->user->id;
if( Helper::isUserCartVisibilityAll() ){
$this->id_account = Account::readDefault();
if ( isset($id_account)){
$this->id_account = $id_account;
}else{
if( Helper::isUserCartVisibilityAll() ){
$this->id_account = Account::readDefault();
}
}
ShoppingCart::deleteAll ( [ 'id_transfer' => $this->id_transfer ] );
UserSoldItem::deleteAll ( [ 'id_transfer' => $this->id_transfer
] );
return $this->save ();
return $this->save (false);
}