Browse Source

Merge branch 'dev'

prodstable
Guillaume 3 years ago
parent
commit
8a3ffe4959
3 changed files with 19 additions and 0 deletions
  1. +2
    -0
      backend/controllers/DocumentController.php
  2. +13
    -0
      common/models/DeliveryNote.php
  3. +4
    -0
      producer/controllers/OrderController.php

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

$json['delivery_notes'] = [] ; $json['delivery_notes'] = [] ;


foreach($deliveryNotesArray as $deliveryNote) { foreach($deliveryNotesArray as $deliveryNote) {
if(!$deliveryNote->isInvoiced()) {
$json['delivery_notes'][] = array_merge( $json['delivery_notes'][] = array_merge(
$deliveryNote->getAttributes(), $deliveryNote->getAttributes(),
[ [
'total' => $deliveryNote->getAmountWithTax(Order::INVOICE_AMOUNT_TOTAL) 'total' => $deliveryNote->getAmountWithTax(Order::INVOICE_AMOUNT_TOTAL)
] ]
) ; ) ;
}
} }
} }
} }

+ 13
- 0
common/models/DeliveryNote.php View File

]; ];
} }


public function isInvoiced()
{
if($this->orders && count($this->orders) > 0) {
foreach($this->orders as $order) {
if($order->id_invoice) {
return true;
}
}
}

return false;
}

} }

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

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


if(\Yii::$app->user->isGuest && !$producer->option_allow_order_guest) {
return $this->redirect(Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/producer','id' => $producer->id])) ;
}

if ($id) { if ($id) {
$order = Order::searchOne([ $order = Order::searchOne([
'id' => $id 'id' => $id

Loading…
Cancel
Save