Browse Source

Option permettant de commander en tant que visiteur

dev
Guillaume 3 years ago
parent
commit
4aaa40d0c5
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      producer/controllers/OrderController.php

+ 5
- 3
producer/controllers/OrderController.php View File



public function actionOrder($id = 0, $date = '') public function actionOrder($id = 0, $date = '')
{ {

$params = []; $params = [];
$producer = $this->getProducer() ;


if ($id) { if ($id) {
$order = Order::searchOne([ $order = Order::searchOne([
if (strlen($date)) { if (strlen($date)) {
$distribution = Distribution::searchOne([ $distribution = Distribution::searchOne([
'date' => $date, 'date' => $date,
'id_producer' => GlobalParam::getCurrentProducerId()
'id_producer' => $producer->id
]); ]);


if($distribution) { if($distribution) {
*/ */
public function actionHistory($type = 'incoming') public function actionHistory($type = 'incoming')
{ {
$producer = $this->getProducer() ;

$query = Order::find() $query = Order::find()
->with('productOrder', 'pointSale', 'creditHistory') ->with('productOrder', 'pointSale', 'creditHistory')
->joinWith('distribution', 'distribution.producer') ->joinWith('distribution', 'distribution.producer')
->where([ ->where([
'id_user' => Yii::$app->user->id, 'id_user' => Yii::$app->user->id,
'distribution.id_producer' => GlobalParam::getCurrentProducerId()
'distribution.id_producer' => $producer->id
]) ])
->params([':date_today' => date('Y-m-d')]); ->params([':date_today' => date('Y-m-d')]);



Loading…
Cancel
Save