Browse Source

[Backend] Documents : initialisation des prix de facturation (génération des BL par client)

refactoring
Guillaume Bourgeois 2 years ago
parent
commit
a93922d02d
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      backend/controllers/DistributionController.php

+ 15
- 0
backend/controllers/DistributionController.php View File

@@ -1466,6 +1466,7 @@ class DistributionController extends BackendController

if ($order && $order->distribution->id_producer == GlobalParam::getCurrentProducerId(
) && $order->id_user) {

$deliveryNote = null;
$idDeliveryNote = $order->id_delivery_note;
if ($idDeliveryNote) {
@@ -1498,6 +1499,20 @@ class DistributionController extends BackendController
if ($deliveryNote) {
$order->id_delivery_note = $deliveryNote->id;
$order->save();

// init invoice prices
$user = User::searchOne([
'id' => $deliveryNote->id_user
]);
$userProducer = UserProducer::searchOne([
'id_user' => $deliveryNote->id_user,
'id_producer' => GlobalParam::getCurrentProducerId()
]);
$order->initInvoicePrices([
'user' => $user,
'user_producer' => $userProducer,
'point_sale' => $order->pointSale
]);
}
}
}

Loading…
Cancel
Save