add reception global word listener,allow delete transactions, allow delete account_state
This commit is contained in:
@@ -471,6 +471,32 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
||||
return $status;
|
||||
}
|
||||
|
||||
public function beforeDelete(){
|
||||
parent::beforeDelete();
|
||||
if ( $this->type == Transfer::TYPE_TICKET){
|
||||
$ticket = $this->ticket;
|
||||
if ( $ticket != null ){
|
||||
$ticket->delete();
|
||||
}
|
||||
}else if ($this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT){
|
||||
$mm = $this->moneyMovement;
|
||||
$mm->delete();
|
||||
}else if ($this->type == Transfer::TYPE_PRODUCT){
|
||||
$sale = $this->sale;
|
||||
$product = $this->product;
|
||||
|
||||
$product->stock = $product->stock + $this->count;
|
||||
|
||||
$product->save();
|
||||
$sale->delete();
|
||||
}
|
||||
|
||||
ShoppingCart::deleteAll(['id_transfer' =>$this->id_transfer]);
|
||||
UserSoldItem::deleteAll(['id_transfer' =>$this->id_transfer]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mode The mode to load
|
||||
* Available modes
|
||||
|
||||
Reference in New Issue
Block a user