Browse Source

Gestion des bons de livraison : formulaire de création #158

refactoring
Guillaume Bourgeois 4 years ago
parent
commit
b58982f2e9
3 changed files with 13 additions and 4 deletions
  1. +9
    -3
      backend/views/delivery-note/index.php
  2. +1
    -1
      common/models/DeliveryNoteSearch.php
  3. +3
    -0
      common/models/Document.php

+ 9
- 3
backend/views/delivery-note/index.php View File

@@ -38,7 +38,7 @@

$this->setTitle('Bons de livraison');
$this->addBreadcrumb($this->getTitle());
//$this->addButton(['label' => 'Nouveau bon de livraison <span class="glyphicon glyphicon-plus"></span>', 'url' => 'delivery-note/create', 'class' => 'btn btn-primary']);
$this->addButton(['label' => 'Nouveau bon de livraison <span class="glyphicon glyphicon-plus"></span>', 'url' => 'delivery-note/create', 'class' => 'btn btn-primary']);

?>

@@ -61,8 +61,14 @@ $this->addBreadcrumb($this->getTitle());
'header' => 'Point de vente',
'format' => 'raw',
'value' => function($model) {
return Html::encode($model->getPointSale()->name).'<br />'
.'le '.date('d/m/Y', strtotime($model->getDistribution()->date));
$pointSale = $model->getPointSale() ;
$distribution = $model->getDistribution() ;
if($pointSale && $distribution) {
return Html::encode($pointSale->name).'<br />'
.'le '.date('d/m/Y', strtotime($distribution->date));
}
return '' ;
}
],
[

+ 1
- 1
common/models/DeliveryNoteSearch.php View File

@@ -61,7 +61,7 @@ class DeliveryNoteSearch extends DeliveryNote
$query = DeliveryNote::find()
->with($optionsSearch['with'])
->joinWith($optionsSearch['join_with'], true)
->where(['distribution.id_producer' => GlobalParam::getCurrentProducerId()])
->where(['delivery_note.id_producer' => GlobalParam::getCurrentProducerId()])
->orderBy('delivery_note.reference DESC')
;

+ 3
- 0
common/models/Document.php View File

@@ -146,6 +146,9 @@ class Document extends ActiveRecordCommon
{
$class = $this->getClass() ;
$classLower = strtolower($class) ;
if($classLower == 'deliverynote') {
$classLower = 'delivery_note' ;
}
$prefix = Producer::getConfig('document_'.$classLower.'_prefix') ;
$oneDocumentExist = $class::searchOne([],['orderby'=> 'reference DESC']) ;

Loading…
Cancel
Save