瀏覽代碼

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

refactoring
Guillaume Bourgeois 2 年之前
父節點
當前提交
bb69939f18
共有 4 個文件被更改,包括 50 次插入1 次删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

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

Loading…
取消
儲存