Kaynağa Gözat

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

feature/souke
Guillaume Bourgeois 1 yıl önce
ebeveyn
işleme
c4ffc3025d
4 değiştirilmiş dosya ile 42 ekleme ve 3 silme
  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 Dosyayı Görüntüle

@@ -418,6 +418,8 @@ class DocumentController extends BackendController
$userManager = $this->getUserManager();
$documentManager = $this->getDocumentManager();
$orderManager = $this->getOrderManager();
$producerManager = $this->getProducerManager();
$producerCurrent = $this->getProducerCurrent();

\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

@@ -460,8 +462,13 @@ class DocumentController extends BackendController
$json['delivery_note_create_array'] = $this->initDeliveryNoteArray('create', $deliveryNotesCreateArray);
$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') {

+ 4
- 0
backend/views/producer/update.php Dosyayı Görüntüle

@@ -458,6 +458,10 @@ $this->addBreadcrumb($this->getTitle());
<?= $form->field($model, 'document_invoice_first_reference'); ?>
<?= $form->field($model, 'document_delivery_note_prefix'); ?>
<?= $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([
0 => 'Non',
1 => 'Oui'

+ 3
- 1
common/logic/Producer/Producer/Model/Producer.php Dosyayı Görüntüle

@@ -268,7 +268,8 @@ class Producer extends ActiveRecordCommon
'option_export_evoliz',
'option_display_message_new_opendistrib_version',
'option_billing_permanent_transfer',
'option_export_display_column_delivery_note'
'option_export_display_column_delivery_note',
'option_invoice_only_based_on_delivery_notes'
],
'boolean'
],
@@ -435,6 +436,7 @@ class Producer extends ActiveRecordCommon
'dolibarr_product_id' => 'Dolibarr : id produit',
'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_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 Dosyayı Görüntüle

@@ -0,0 +1,26 @@
<?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');
}
}

Yükleniyor…
İptal
Kaydet