Pārlūkot izejas kodu

[Backend] Documents : gérer le fait qu'un document a été envoyé #150

refactoring
Guillaume Bourgeois pirms 2 gadiem
vecāks
revīzija
bb69939f18
4 mainītis faili ar 50 papildinājumiem un 1 dzēšanām
  1. +4
    -0
      backend/controllers/DocumentController.php
  2. +13
    -0
      backend/views/invoice/index.php
  3. +3
    -1
      common/models/Document.php
  4. +30
    -0
      console/migrations/m221010_124540_document_is_sent.php

+ 4
- 0
backend/controllers/DocumentController.php Parādīt failu

@@ -320,6 +320,10 @@ class DocumentController extends BackendController
{
$document = $this->findModel($id);
if ($document->send()) {

$document->is_sent = true;
$document->save();

Yii::$app->getSession()->setFlash('success', $this->getFlashMessage('send', $document));
} else {
Yii::$app->getSession()->setFlash('danger', $this->getFlashMessage('send', $document));

+ 13
- 0
backend/views/invoice/index.php Parādīt failu

@@ -99,6 +99,19 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-
return $invoice->getAmountWithTax(Order::INVOICE_AMOUNT_TOTAL, true) ;
}
],
[
'attribute' => 'is_sent',
'header' => 'Envoyé',
'format' => 'raw',
'value' => function($model) {
if($model->is_sent) {
return '<span class="label label-success">Oui</span>';
}
else {
return '<span class="label label-danger">Non</span>';
}
}
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{validate} {update} {delete} {send} {download} {export-csv-evoliz}',

+ 3
- 1
common/models/Document.php Parādīt failu

@@ -67,6 +67,7 @@ class Document extends ActiveRecordCommon
[['date'], 'safe'],
[['comment', 'address', 'tax_calculation_method'], 'string'],
[['id_user', 'id_producer'], 'integer'],
['is_sent', 'boolean'],
[['name', 'reference', 'status'], 'string', 'max' => 255],
[['deliveryNotes'], 'safe']
];
@@ -87,7 +88,8 @@ class Document extends ActiveRecordCommon
'address' => 'Adresse',
'id_producer' => 'Producteur',
'status' => 'Statut',
'tax_calculation_method' => 'Méthode de calcul de la TVA'
'tax_calculation_method' => 'Méthode de calcul de la TVA',
'is_sent' => 'Envoyé'
];
}


+ 30
- 0
console/migrations/m221010_124540_document_is_sent.php Parādīt failu

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

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

/**
* Class m221010_124540_document_is_sent
*/
class m221010_124540_document_is_sent extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('quotation', 'is_sent', Schema::TYPE_BOOLEAN);
$this->addColumn('delivery_note', 'is_sent', Schema::TYPE_BOOLEAN);
$this->addColumn('invoice', 'is_sent', Schema::TYPE_BOOLEAN);
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('quotation', 'is_sent');
$this->dropColumn('delivery_note', 'is_sent');
$this->dropColumn('invoice', 'is_sent');
}
}

Notiek ielāde…
Atcelt
Saglabāt