Bladeren bron

[Admin] Distributions > Génération des bons de livraison : validation automatique (Paramètres > Facturation > Validation automatique des bons de livraison)

feature/souke
Guillaume Bourgeois 11 maanden geleden
bovenliggende
commit
b4ab04017b
9 gewijzigde bestanden met toevoegingen van 74 en 12 verwijderingen
  1. +2
    -1
      backend/views/document/download.php
  2. +5
    -5
      backend/views/producer-invoice/index.php
  3. +2
    -4
      backend/views/producer/update.php
  4. +3
    -1
      common/config/main.php
  5. +30
    -0
      common/logic/Document/DeliveryNote/Event/DeliveryNoteObserver.php
  6. +2
    -0
      common/logic/Document/DeliveryNote/Service/DeliveryNoteBuilder.php
  7. +1
    -0
      common/logic/Document/Document/Service/DocumentManager.php
  8. +3
    -1
      common/logic/Producer/Producer/Model/Producer.php
  9. +26
    -0
      console/migrations/m231130_082147_add_column_producer_delivery_note_automatic_validation.php

+ 2
- 1
backend/views/document/download.php Bestand weergeven

@@ -9,7 +9,8 @@ $userModule = $this->getUserModule();
$documentModule = $this->getDocumentModule();
$orderModule = $this->getOrderModule();

$displayPrices = Yii::$app->controller->getClass() != 'DeliveryNote' || (Yii::$app->controller->getClass() == 'DeliveryNote' && $producerModule->getConfig('document_display_prices_delivery_note'));
$isDocumentDeliveryNote = $documentModule->getSolver()->isDocumentDeliveryNote($document);
$displayPrices = !$isDocumentDeliveryNote || ($isDocumentDeliveryNote && $producerModule->getConfig('document_display_prices_delivery_note'));
$displayProductDescription = $producerModule->getConfig('document_display_product_description');
$documentPriceDecimals = (int) $producerModule->getConfig('option_document_price_decimals');


+ 5
- 5
backend/views/producer-invoice/index.php Bestand weergeven

@@ -44,11 +44,11 @@ $this->addBreadcrumb($this->getTitle()) ;

?>

<div class="callout callout-info">
<span class="glyphicon glyphicon-info-sign"></span> Les factures et les réglements sont saisis en début de mois.
</div>

<?php if($invoicesArray && count($invoicesArray)): ?>
<div class="callout callout-info">
<span class="glyphicon glyphicon-info-sign"></span> Les factures et les réglements sont saisis en début de mois.
</div>

<table class="table table-striped table-bordered">
<thead>
<tr>
@@ -76,7 +76,7 @@ $this->addBreadcrumb($this->getTitle()) ;
</tbody>
</table>
<?php else: ?>
<div class="alert alert-info">
<div class="callout callout-info">
<span class="glyphicon glyphicon-info-sign"></span> Vous n'avez encore aucune facture.
</div>
<?php endif; ?>

+ 2
- 4
backend/views/producer/update.php Bestand weergeven

@@ -425,10 +425,8 @@ $this->addBreadcrumb($this->getTitle());
<?= $form->field($model, 'document_invoice_first_reference'); ?>
<?= $form->field($model, 'document_delivery_note_prefix')->hint($hintKeywordsPrefix);; ?>
<?= $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, 'delivery_note_automatic_validation')->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'option_invoice_only_based_on_delivery_notes')->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'option_document_width_logo')
->dropDownList(Dropdown::numberChoices(50, 250, true, 'px', 50)); ?>
<?= $form->field($model, 'document_display_orders_invoice')->dropDownList(Dropdown::noYesChoices()); ?>

+ 3
- 1
common/config/main.php Bestand weergeven

@@ -198,7 +198,9 @@ return [
],
DeliveryNote::class => [
// Order : assignation du bon de livraison aux commandes
common\logic\Order\Order\Event\DeliveryNoteObserver::class
common\logic\Order\Order\Event\DeliveryNoteObserver::class,
// DeliveryNote : validation automatique des bons de livraison
common\logic\Document\DeliveryNote\Event\DeliveryNoteObserver::class
],
Ticket::class => [
// User : envoi email nouveau ticket à l'administrateur

+ 30
- 0
common/logic/Document/DeliveryNote/Event/DeliveryNoteObserver.php Bestand weergeven

@@ -0,0 +1,30 @@
<?php

namespace common\logic\Document\DeliveryNote\Event;

use common\logic\Document\DeliveryNote\Event\DeliveryNoteCreateEvent;
use common\logic\Document\DeliveryNote\Model\DeliveryNote;
use common\logic\Document\Document\Module\DocumentModule;
use common\logic\Order\Order\Module\OrderModule;
use common\logic\Producer\Producer\Module\ProducerModule;
use justcoded\yii2\eventlistener\observers\Observer;

class DeliveryNoteObserver extends Observer
{
public function events()
{
return [
DeliveryNote::EVENT_CREATE => 'onDeliveryNoteCreate'
];
}

public function onDeliveryNoteCreate(DeliveryNoteCreateEvent $event)
{
$producerModule = ProducerModule::getInstance();
$documentModule = DocumentModule::getInstance();

if($producerModule->getSolver()->getConfig('delivery_note_automatic_validation')) {
$documentModule->getManager()->validateDocument($event->deliveryNote);
}
}
}

+ 2
- 0
common/logic/Document/DeliveryNote/Service/DeliveryNoteBuilder.php Bestand weergeven

@@ -6,6 +6,7 @@ use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\Document\DeliveryNote\Event\DeliveryNoteCreateEvent;
use common\logic\Document\DeliveryNote\Model\DeliveryNote;
use common\logic\Document\DeliveryNote\Repository\DeliveryNoteRepository;
use common\logic\Document\Document\Model\Document;
use common\logic\Document\Document\Service\DocumentBuilder;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\Order\Service\OrderSolver;
@@ -34,6 +35,7 @@ class DeliveryNoteBuilder extends DocumentBuilder
{
$deliveryNote = new DeliveryNote();

$deliveryNote->status = Document::STATUS_DRAFT;
$this->initDocumentProducer($deliveryNote);
$this->initTaxCalculationMethod($deliveryNote);


+ 1
- 0
common/logic/Document/Document/Service/DocumentManager.php Bestand weergeven

@@ -31,6 +31,7 @@ class DocumentManager extends AbstractManager

if ($status == Document::STATUS_VALID) {
$this->documentReferenceGenerator->generateReference($document);
$this->generatePdf($document, Pdf::DEST_FILE);
}

$this->documentBuilder->update($document);

+ 3
- 1
common/logic/Producer/Producer/Model/Producer.php Bestand weergeven

@@ -287,7 +287,8 @@ class Producer extends ActiveRecordCommon
'option_export_display_column_delivery_note',
'option_invoice_only_based_on_delivery_notes',
'option_document_display_price_unit_reference',
'option_check_by_default_prevent_user_credit'
'option_check_by_default_prevent_user_credit',
'delivery_note_automatic_validation'
],
'boolean'
],
@@ -468,6 +469,7 @@ class Producer extends ActiveRecordCommon
'option_document_display_price_unit_reference' => "Afficher les prix au kilogramme",
'id_user_group_default' => "Groupe utilisateur par défaut attribué à l'inscription",
'option_check_by_default_prevent_user_credit' => "Par défaut, prévenir l'utilisateur quand on crédite son compte",
'delivery_note_automatic_validation' => 'Validation automatique des bons de livraison'
];
}


+ 26
- 0
console/migrations/m231130_082147_add_column_producer_delivery_note_automatic_validation.php Bestand weergeven

@@ -0,0 +1,26 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m231130_082147_add_column_producer_delivery_note_automatic_validation
*/
class m231130_082147_add_column_producer_delivery_note_automatic_validation extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('producer', 'delivery_note_automatic_validation', Schema::TYPE_BOOLEAN);
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('producer', 'delivery_note_automatic_validation');
}
}

Laden…
Annuleren
Opslaan