Преглед изворни кода

Merge branch 'dev'

prodstable
Guillaume Bourgeois пре 1 година
родитељ
комит
3a6f9a4573
9 измењених фајлова са 64 додато и 15 уклоњено
  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 Прегледај датотеку

@@ -20,7 +20,7 @@

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

+ 7
- 5
backend/views/document/_form.php Прегледај датотеку

@@ -77,7 +77,7 @@ use common\models\Producer;
[
'@change' => 'changeUser',
'v-model' => 'idUser',
'class' => 'select2'
'class' => 'select2 select2-document-form'
]
); ?>
<?php endif; ?>
@@ -196,9 +196,11 @@ use common\models\Producer;
<div class="info-box-content">
<span class="info-box-text">Commandes</span>
<?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; ?>
</div>
</div>
@@ -297,7 +299,7 @@ use common\models\Producer;
</div>
<div class="panel-body">
<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>
<tr>
<th>Nom</th>

+ 5
- 2
backend/views/document/download.php Прегледај датотеку

@@ -2,6 +2,7 @@

$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');
$documentPriceDecimals = (int) Producer::getConfig('option_document_price_decimals');

?>

@@ -105,7 +106,8 @@ $displayProductDescription = Producer::getConfig('document_display_product_descr
'productOrder' => $productOrder,
'displayOrders' => true,
'displayPrices' => $displayPrices,
'displayProductDescription' => $displayProductDescription
'displayProductDescription' => $displayProductDescription,
'documentPriceDecimals' => $documentPriceDecimals
]) ?>
<?php endforeach; ?>
<?php endforeach; ?>
@@ -117,7 +119,8 @@ $displayProductDescription = Producer::getConfig('document_display_product_descr
'document' => $document,
'productOrder' => $productOrder,
'displayPrices' => $displayPrices,
'displayProductDescription' => $displayProductDescription
'displayProductDescription' => $displayProductDescription,
'documentPriceDecimals' => $documentPriceDecimals
]) ?>
<?php endforeach; ?>
<?php endforeach; ?>

+ 4
- 0
backend/views/producer/update.php Прегледај датотеку

@@ -463,6 +463,10 @@ $this->addBreadcrumb($this->getTitle());
0 => 'Non',
1 => 'Oui'
]); ?>
<?= $form->field($model, 'option_document_price_decimals')->dropDownList([
2 => '2',
3 => '3'
]); ?>
<?= $form->field($model, 'document_infos_bottom')
->textarea(['rows' => 15]) ?>
<?= $form->field($model, 'document_infos_quotation')

+ 9
- 1
backend/web/js/vuejs/document-form.js Прегледај датотеку

@@ -60,9 +60,10 @@ var app = new Vue({
methods: {
formatPrice: formatPrice,
init: function () {
var app = this;

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

+ 4
- 4
common/helpers/Price.php Прегледај датотеку

@@ -41,9 +41,9 @@ namespace common\helpers;
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)
@@ -74,9 +74,9 @@ class Price
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 Прегледај датотеку

@@ -172,6 +172,10 @@ class CreditHistory extends ActiveRecordCommon
*/
public function save($runValidation = true, $attributeNames = NULL)
{
if($this->amount > -0.01 && $this->amount < 0.01) {
return false;
}

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

+ 4
- 2
common/models/Producer.php Прегледај датотеку

@@ -163,7 +163,8 @@ class Producer extends ActiveRecordCommon
'id_tax_rate_default',
'document_quotation_duration',
'option_dashboard_number_distributions',
'option_online_payment_minimum_amount'
'option_online_payment_minimum_amount',
'option_document_price_decimals'
],
'integer'
],
@@ -401,7 +402,8 @@ class Producer extends ActiveRecordCommon
'latest_version_opendistrib' => 'Dernière version d\'Opendistrib',
'option_csv_separator' => 'Séparateur de colonnes (CSV)',
'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 Прегледај датотеку

@@ -0,0 +1,26 @@
<?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…
Откажи
Сачувај