Browse Source

Merge branch 'dev'

prodstable
Guillaume Bourgeois 1 year ago
parent
commit
3a6f9a4573
9 changed files with 64 additions and 15 deletions
  1. +1
    -1
      backend/views/document/_download_product_line.php
  2. +7
    -5
      backend/views/document/_form.php
  3. +5
    -2
      backend/views/document/download.php
  4. +4
    -0
      backend/views/producer/update.php
  5. +9
    -1
      backend/web/js/vuejs/document-form.js
  6. +4
    -4
      common/helpers/Price.php
  7. +4
    -0
      common/models/CreditHistory.php
  8. +4
    -2
      common/models/Producer.php
  9. +26
    -0
      console/migrations/m221212_143815_producer_add_option_document_price_decimals.php

+ 1
- 1
backend/views/document/_download_product_line.php View File



<?php if($displayPrices): ?> <?php if($displayPrices): ?>
<td class="align-center"> <td class="align-center">
<?= Price::format($price) ?>
<?= Price::format($price, $documentPriceDecimals) ?>
</td> </td>
<?php endif; ?> <?php endif; ?>
<td class="align-center"> <td class="align-center">

+ 7
- 5
backend/views/document/_form.php View File

[ [
'@change' => 'changeUser', '@change' => 'changeUser',
'v-model' => 'idUser', 'v-model' => 'idUser',
'class' => 'select2'
'class' => 'select2 select2-document-form'
] ]
); ?> ); ?>
<?php endif; ?> <?php endif; ?>
<div class="info-box-content"> <div class="info-box-content">
<span class="info-box-text">Commandes</span> <span class="info-box-text">Commandes</span>
<?php foreach($model->orders as $order): ?> <?php foreach($model->orders as $order): ?>
<a class="btn btn-sm btn-default" href="<?= Yii::$app->urlManager->createUrl(['distribution/index', 'idOrderUpdate' => $order->id]); ?>">
<?= date('d/m/Y', strtotime($order->distribution->date)) ?>
</a>
<?php if($order->distribution): ?>
<a class="btn btn-sm btn-default" href="<?= Yii::$app->urlManager->createUrl(['distribution/index', 'idOrderUpdate' => $order->id]); ?>">
<?= date('d/m/Y', strtotime($order->distribution->date)) ?>
</a>
<?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
</div> </div>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<div id="block-list-products"> <div id="block-list-products">
<table class="table table-bordered" v-if="total > 0">
<table class="table table-bordered" v-if="Object.keys(ordersArray).length > 0">
<thead> <thead>
<tr> <tr>
<th>Nom</th> <th>Nom</th>

+ 5
- 2
backend/views/document/download.php View File



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


?> ?>


'productOrder' => $productOrder, 'productOrder' => $productOrder,
'displayOrders' => true, 'displayOrders' => true,
'displayPrices' => $displayPrices, 'displayPrices' => $displayPrices,
'displayProductDescription' => $displayProductDescription
'displayProductDescription' => $displayProductDescription,
'documentPriceDecimals' => $documentPriceDecimals
]) ?> ]) ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php endforeach; ?> <?php endforeach; ?>
'document' => $document, 'document' => $document,
'productOrder' => $productOrder, 'productOrder' => $productOrder,
'displayPrices' => $displayPrices, 'displayPrices' => $displayPrices,
'displayProductDescription' => $displayProductDescription
'displayProductDescription' => $displayProductDescription,
'documentPriceDecimals' => $documentPriceDecimals
]) ?> ]) ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php endforeach; ?> <?php endforeach; ?>

+ 4
- 0
backend/views/producer/update.php View File

0 => 'Non', 0 => 'Non',
1 => 'Oui' 1 => 'Oui'
]); ?> ]); ?>
<?= $form->field($model, 'option_document_price_decimals')->dropDownList([
2 => '2',
3 => '3'
]); ?>
<?= $form->field($model, 'document_infos_bottom') <?= $form->field($model, 'document_infos_bottom')
->textarea(['rows' => 15]) ?> ->textarea(['rows' => 15]) ?>
<?= $form->field($model, 'document_infos_quotation') <?= $form->field($model, 'document_infos_quotation')

+ 9
- 1
backend/web/js/vuejs/document-form.js View File

methods: { methods: {
formatPrice: formatPrice, formatPrice: formatPrice,
init: function () { init: function () {
var app = this;


if (this.getDocumentId()) { if (this.getDocumentId()) {
var app = this;
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-init", { axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-init", {
params: { params: {
idDocument: this.getDocumentId(), idDocument: this.getDocumentId(),
} }
}); });
} }
else {
$('.select2-document-form').on('select2:select', function (e) {
var idUser = e.params.data.id;
app.idUser = idUser;
app.changeUser();
});
}
}, },
getProductById: function(idProduct) { getProductById: function(idProduct) {
var app = this; var app = this;

+ 4
- 4
common/helpers/Price.php View File

class Price class Price
{ {


public static function format($number)
public static function format($number, $decimals = 2)
{ {
return self::numberTwoDecimals($number).' €';
return self::numberTwoDecimals($number, $decimals).' €';
} }


public static function round($number) public static function round($number)
return $vat; return $vat;
} }


public static function numberTwoDecimals($number)
public static function numberTwoDecimals($number, $decimals = 2)
{ {
return number_format(( ($number * 100)) / 100, 2) ;
return number_format(( ($number * 100)) / 100, $decimals) ;
} }


} }

+ 4
- 0
common/models/CreditHistory.php View File

*/ */
public function save($runValidation = true, $attributeNames = NULL) public function save($runValidation = true, $attributeNames = NULL)
{ {
if($this->amount > -0.01 && $this->amount < 0.01) {
return false;
}

// initialisation du commentaire avant sauvegarde // initialisation du commentaire avant sauvegarde
$this->comment .= $this->getStrComment() ; $this->comment .= $this->getStrComment() ;

+ 4
- 2
common/models/Producer.php View File

'id_tax_rate_default', 'id_tax_rate_default',
'document_quotation_duration', 'document_quotation_duration',
'option_dashboard_number_distributions', 'option_dashboard_number_distributions',
'option_online_payment_minimum_amount'
'option_online_payment_minimum_amount',
'option_document_price_decimals'
], ],
'integer' 'integer'
], ],
'latest_version_opendistrib' => 'Dernière version d\'Opendistrib', 'latest_version_opendistrib' => 'Dernière version d\'Opendistrib',
'option_csv_separator' => 'Séparateur de colonnes (CSV)', 'option_csv_separator' => 'Séparateur de colonnes (CSV)',
'option_display_message_new_opendistrib_version' => 'Afficher les messages de mise à jour du logiciel Opendistrib', 'option_display_message_new_opendistrib_version' => 'Afficher les messages de mise à jour du logiciel Opendistrib',
'option_online_payment_minimum_amount' => 'Paiement en ligne : montant minimum'
'option_online_payment_minimum_amount' => 'Paiement en ligne : montant minimum',
'option_document_price_decimals' => 'Prix : nombre de décimales affichées'
]; ];
} }



+ 26
- 0
console/migrations/m221212_143815_producer_add_option_document_price_decimals.php View File

<?php

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

/**
* Class m221212_143815_producer_add_option_document_price_decimals
*/
class m221212_143815_producer_add_option_document_price_decimals extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('producer', 'option_document_price_decimals', Schema::TYPE_INTEGER . ' DEFAULT 2');
}

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

Loading…
Cancel
Save