Browse Source

[global] À la création d'une commande : set tiller_synchronization en fonction du statut de paiement de la commande

refactoring
Guillaume Bourgeois 4 years ago
parent
commit
2e96a96435
4 changed files with 26 additions and 1 deletions
  1. +2
    -0
      backend/controllers/OrderController.php
  2. +18
    -0
      common/models/Order.php
  3. +2
    -0
      common/models/Subscription.php
  4. +4
    -1
      producer/controllers/OrderController.php

+ 2
- 0
backend/controllers/OrderController.php View File

$order->processCredit(); $order->processCredit();
} }


$order->setTillerSynchronization() ;

// lien utilisateur / point de vente // lien utilisateur / point de vente
if ($idUser && $pointSale) { if ($idUser && $pointSale) {
$pointSale->linkUser($idUser); $pointSale->linkUser($idUser);

+ 18
- 0
common/models/Order.php View File

} }
} }


public function setTillerSynchronization()
{
$order = Order::searchOne(['id' => $this->id]);

$paymentStatus = $order->getPaymentStatus();

if ($paymentStatus == self::PAYMENT_PAID) {
$order->tiller_synchronization = 1 ;
}
else {
$order->tiller_synchronization = 0 ;
}

$order->save() ;

return $order ;
}

/** /**
* Retourne le statut de paiement de la commande (payée, surplus, ou impayée). * Retourne le statut de paiement de la commande (payée, surplus, ou impayée).
* *

+ 2
- 0
common/models/Subscription.php View File

} }
} }


$order->tiller_synchronization = $order->auto_payment ;

$userPointSale = UserPointSale::searchOne([ $userPointSale = UserPointSale::searchOne([
'id_point_sale' => $this->id_point_sale, 'id_point_sale' => $this->id_point_sale,
'id_user' => $this->id_user 'id_user' => $this->id_user

+ 4
- 1
producer/controllers/OrderController.php View File

User::getCurrentId() User::getCurrentId()
); );
} }
}else{
}
else{
$order->changeOrderStatus('waiting-paiement-on-delivery', 'user'); $order->changeOrderStatus('waiting-paiement-on-delivery', 'user');
} }

$order->setTillerSynchronization() ;
} }





Loading…
Cancel
Save