Browse Source

Merge branch 'fix/commandes_annulees' into dev

dev
Guillaume Bourgeois 6 years ago
parent
commit
a96de0a188
2 changed files with 20 additions and 2 deletions
  1. +1
    -2
      backend/controllers/CommandeController.php
  2. +19
    -0
      common/models/Commande.php

+ 1
- 2
backend/controllers/CommandeController.php View File

$commande->init(); $commande->init();


// remboursement de la commande // remboursement de la commande
if ($commande->id_user && $commande->getMontantPaye() && Etablissement::getConfig('credit_pain')) {
if ($commande->id_user && $commande->date_delete && $commande->getMontantPaye() && Etablissement::getConfig('credit_pain')) {
$commande->creditHistorique( $commande->creditHistorique(
CreditHistorique::TYPE_REMBOURSEMENT, CreditHistorique::TYPE_REMBOURSEMENT,
$commande->getMontantPaye(), $commande->getMontantPaye(),
// commandes // commandes
$commandes = Commande::findBy([ $commandes = Commande::findBy([
'date' => $date, 'date' => $date,
'date_delete' => 'NULL'
]); ]);


$recettes = 0; $recettes = 0;

+ 19
- 0
common/models/Commande.php View File



if (isset($params['date'])) if (isset($params['date']))
$commandes = $commandes->andWhere(['production.date' => $params['date']]); $commandes = $commandes->andWhere(['production.date' => $params['date']]);
if (isset($params['date_delete'])) {
if($params['date_delete'] == 'NULL') {
$commandes = $commandes->andWhere('commande.date_delete IS NULL');
}
else {
$commandes = $commandes->andWhere(['commande.date_delete' => $params['date_delete']]);
}
}
if (isset($params['date_update'])) {
if($params['date_update'] == 'NULL') {
$commandes = $commandes->andWhere('commande.date_update IS NULL');
}
else {
$commandes = $commandes->andWhere(['commande.date_update' => $params['date_update']]);
}
}


if (isset($params['type'])) if (isset($params['type']))
$commandes = $commandes->andWhere(['commande.type' => $params['type']]); $commandes = $commandes->andWhere(['commande.type' => $params['type']]);

Loading…
Cancel
Save