add transfer unstorno

This commit is contained in:
2016-04-11 21:21:47 +02:00
parent 1d95d37373
commit 01ada90e8c
8 changed files with 120 additions and 47 deletions

View File

@@ -960,6 +960,36 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
ShoppingCart::deleteAll(['id_transfer' => $this->id_transfer]);
UserSoldItem::deleteAll(['id_transfer' => $this->id_transfer]);
}
public function unstorono(){
if ($this->type != Transfer::TYPE_TICKET) {
throw new NotAcceptableHttpException("Csak bérletet lehet visszaállítani");
}
$this->status = Transfer::STATUS_NOT_PAID;
$this->paid_at = null;
$this->paid_by = null;
$this->save ( false );
$ticket = $this->ticket;
$ticket->status = Ticket::STATUS_ACTIVE;
$ticket->save ( false );
TicketInstallmentRequest::updateAll ( [
'status' => TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL
], [
'id_ticket' => $ticket->id_ticket
] );
$item = new ShoppingCart();
$item->id_customer = $this->id_customer;
$item->id_transfer = $this->id_transfer;
$item->save(false);
}
public function payout($id_account = null) {
if ($this->status != Transfer::STATUS_NOT_PAID) {