Pārlūkot izejas kodu

Merge branch 'dev'

prodstable
Guillaume pirms 3 gadiem
vecāks
revīzija
8a3ffe4959
3 mainītis faili ar 19 papildinājumiem un 0 dzēšanām
  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 Parādīt failu

@@ -248,12 +248,14 @@ class DocumentController extends BackendController
$json['delivery_notes'] = [] ;

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

+ 13
- 0
common/models/DeliveryNote.php Parādīt failu

@@ -90,4 +90,17 @@ class DeliveryNote extends Document
];
}

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 Parādīt failu

@@ -77,6 +77,10 @@ class OrderController extends ProducerBaseController
$params = [];
$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) {
$order = Order::searchOne([
'id' => $id

Notiek ielāde…
Atcelt
Saglabāt