Browse Source

[Administration] Factures > ajouter : pouvoir facturer uniquement sur base des bons de livraison #1287

feature/souke
Guillaume Bourgeois 1 year ago
parent
commit
c4ffc3025d
4 changed files with 42 additions and 3 deletions
  1. +9
    -2
      backend/controllers/DocumentController.php
  2. +4
    -0
      backend/views/producer/update.php
  3. +3
    -1
      common/logic/Producer/Producer/Model/Producer.php
  4. +26
    -0
      console/migrations/m231004_083707_add_column_producer_option_invoice_only_based_on_delivery_notes.php

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

$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') {

+ 4
- 0
backend/views/producer/update.php View File

<?= $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'

+ 3
- 1
common/logic/Producer/Producer/Model/Producer.php View File

'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'
]; ];
} }



+ 26
- 0
console/migrations/m231004_083707_add_column_producer_option_invoice_only_based_on_delivery_notes.php View File

<?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');
}
}

Loading…
Cancel
Save