Browse Source

Merge branch 'dev'

master
Guillaume 4 years ago
parent
commit
ed63c99ac2
2 changed files with 5 additions and 4 deletions
  1. +5
    -3
      common/models/Order.php
  2. +0
    -1
      producer/controllers/OrderController.php

+ 5
- 3
common/models/Order.php View File

'order_deadline', 'order_deadline',
$this->distribution->id_producer $this->distribution->id_producer
); );


$orderDate = strtotime($this->distribution->date); $orderDate = strtotime($this->distribution->date);
$today = strtotime(date('Y-m-d')); $today = strtotime(date('Y-m-d'));
$todayHour = date('G'); $todayHour = date('G');


$nbDays = (int)(($orderDate - $today) / (24 * 60 * 60));
$nbDays = (int) round((($orderDate - $today) / (24 * 60 * 60)));


if ($nbDays <= 0) { if ($nbDays <= 0) {
return self::STATE_DELIVERED; return self::STATE_DELIVERED;
($nbDays == $orderDelay && $todayHour < $orderDeadline))) { ($nbDays == $orderDelay && $todayHour < $orderDeadline))) {
return self::STATE_OPEN; return self::STATE_OPEN;
} }
return self::STATE_PREPARATION; return self::STATE_PREPARATION;
} }


return $username ; return $username ;
} }


}
}

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



if ($order && User::getCurrentId() == $order->id_user) { if ($order && User::getCurrentId() == $order->id_user) {
$order->delete(); $order->delete();
$order->changeOrderStatus('canceled', 'user');
Yii::$app->session->setFlash('success', 'Votre commande a bien été annulée.'); Yii::$app->session->setFlash('success', 'Votre commande a bien été annulée.');
} }



Loading…
Cancel
Save