$userManager = $this->getUserManager(); | $userManager = $this->getUserManager(); | ||||
$documentManager = $this->getDocumentManager(); | $documentManager = $this->getDocumentManager(); | ||||
$orderManager = $this->getOrderManager(); | $orderManager = $this->getOrderManager(); | ||||
$producerManager = $this->getProducerManager(); | |||||
$producerCurrent = $this->getProducerCurrent(); | |||||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | ||||
$json['delivery_note_create_array'] = $this->initDeliveryNoteArray('create', $deliveryNotesCreateArray); | $json['delivery_note_create_array'] = $this->initDeliveryNoteArray('create', $deliveryNotesCreateArray); | ||||
$json['delivery_note_update_array'] = $this->initDeliveryNoteArray('update', $deliveryNotesUpdateArray); | $json['delivery_note_update_array'] = $this->initDeliveryNoteArray('update', $deliveryNotesUpdateArray); | ||||
$json['orders_create_array'] = $this->initOrdersArray($orderManager->findOrdersByUserNotInvoiced($user)); | |||||
$json['orders_update_array'] = $document ? $this->initOrdersArray($orderManager->findOrdersByUserAndInvoice($user, $document)) : []; | |||||
$json['orders_create_array'] = []; | |||||
$json['orders_update_array'] = []; | |||||
if(!$producerManager->getConfig('option_invoice_only_based_on_delivery_notes')) { | |||||
$json['orders_create_array'] = $this->initOrdersArray($orderManager->findOrdersByUserNotInvoiced($user)); | |||||
$json['orders_update_array'] = $document ? $this->initOrdersArray($orderManager->findOrdersByUserAndInvoice($user, $document)) : []; | |||||
} | |||||
} | } | ||||
if ($classDocument == 'DeliveryNote') { | if ($classDocument == 'DeliveryNote') { |
<?= $form->field($model, 'document_invoice_first_reference'); ?> | <?= $form->field($model, 'document_invoice_first_reference'); ?> | ||||
<?= $form->field($model, 'document_delivery_note_prefix'); ?> | <?= $form->field($model, 'document_delivery_note_prefix'); ?> | ||||
<?= $form->field($model, 'document_delivery_note_first_reference'); ?> | <?= $form->field($model, 'document_delivery_note_first_reference'); ?> | ||||
<?= $form->field($model, 'option_invoice_only_based_on_delivery_notes')->dropDownList([ | |||||
0 => 'Non', | |||||
1 => 'Oui' | |||||
]); ?> | |||||
<?= $form->field($model, 'document_display_orders_invoice')->dropDownList([ | <?= $form->field($model, 'document_display_orders_invoice')->dropDownList([ | ||||
0 => 'Non', | 0 => 'Non', | ||||
1 => 'Oui' | 1 => 'Oui' |
'option_export_evoliz', | 'option_export_evoliz', | ||||
'option_display_message_new_opendistrib_version', | 'option_display_message_new_opendistrib_version', | ||||
'option_billing_permanent_transfer', | 'option_billing_permanent_transfer', | ||||
'option_export_display_column_delivery_note' | |||||
'option_export_display_column_delivery_note', | |||||
'option_invoice_only_based_on_delivery_notes' | |||||
], | ], | ||||
'boolean' | 'boolean' | ||||
], | ], | ||||
'dolibarr_product_id' => 'Dolibarr : id produit', | 'dolibarr_product_id' => 'Dolibarr : id produit', | ||||
'option_export_display_column_delivery_note' => "Récapitulatif PDF : afficher une colonne bon de livraison", | 'option_export_display_column_delivery_note' => "Récapitulatif PDF : afficher une colonne bon de livraison", | ||||
'option_weeks_distributions_activated_in_advance' => "Semaines de distributions à activer à l'avance", | 'option_weeks_distributions_activated_in_advance' => "Semaines de distributions à activer à l'avance", | ||||
'option_invoice_only_based_on_delivery_notes' => 'Facturer uniquement sur la base des bons de livraison' | |||||
]; | ]; | ||||
} | } | ||||
<?php | |||||
use yii\db\Migration; | |||||
use yii\db\Schema; | |||||
/** | |||||
* Class m231004_083707_add_column_producer_option_invoice_only_based_on_delivery_notes | |||||
*/ | |||||
class m231004_083707_add_column_producer_option_invoice_only_based_on_delivery_notes extends Migration | |||||
{ | |||||
/** | |||||
* {@inheritdoc} | |||||
*/ | |||||
public function safeUp() | |||||
{ | |||||
$this->addColumn('producer', 'option_invoice_only_based_on_delivery_notes', Schema::TYPE_BOOLEAN); | |||||
} | |||||
/** | |||||
* {@inheritdoc} | |||||
*/ | |||||
public function safeDown() | |||||
{ | |||||
$this->dropColumn('producer', 'option_invoice_only_based_on_delivery_notes'); | |||||
} | |||||
} |