$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('document_price_decimals'); | |||||
$documentPriceDecimals = (int) Producer::getConfig('option_document_price_decimals'); | |||||
?> | ?> | ||||
0 => 'Non', | 0 => 'Non', | ||||
1 => 'Oui' | 1 => 'Oui' | ||||
]); ?> | ]); ?> | ||||
<?= $form->field($model, 'document_price_decimals')->dropDownList([ | |||||
<?= $form->field($model, 'option_document_price_decimals')->dropDownList([ | |||||
2 => '2', | 2 => '2', | ||||
3 => '3' | 3 => '3' | ||||
]); ?> | ]); ?> |
public static function numberTwoDecimals($number, $decimals = 2) | public static function numberTwoDecimals($number, $decimals = 2) | ||||
{ | { | ||||
return number_format(( ($number * 100)) / 100, 2) ; | |||||
return number_format(( ($number * 100)) / 100, $decimals) ; | |||||
} | } | ||||
} | } |
'document_quotation_duration', | 'document_quotation_duration', | ||||
'option_dashboard_number_distributions', | 'option_dashboard_number_distributions', | ||||
'option_online_payment_minimum_amount', | 'option_online_payment_minimum_amount', | ||||
'document_price_decimals' | |||||
'option_document_price_decimals' | |||||
], | ], | ||||
'integer' | 'integer' | ||||
], | ], | ||||
'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', | ||||
'document_price_decimals' => 'Prix : nombre de décimales affichées' | |||||
'option_document_price_decimals' => 'Prix : nombre de décimales affichées' | |||||
]; | ]; | ||||
} | } | ||||
<?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'); | |||||
} | |||||
} |