Browse Source

[Backend] Documents : affichage décimales #736

refactoring
Guillaume Bourgeois 1 year ago
parent
commit
9a0ef54ca1
5 changed files with 31 additions and 5 deletions
  1. +1
    -1
      backend/views/document/download.php
  2. +1
    -1
      backend/views/producer/update.php
  3. +1
    -1
      common/helpers/Price.php
  4. +2
    -2
      common/models/Producer.php
  5. +26
    -0
      console/migrations/m221212_143815_producer_add_option_document_price_decimals.php

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

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

?>


+ 1
- 1
backend/views/producer/update.php View File

@@ -463,7 +463,7 @@ $this->addBreadcrumb($this->getTitle());
0 => 'Non',
1 => 'Oui'
]); ?>
<?= $form->field($model, 'document_price_decimals')->dropDownList([
<?= $form->field($model, 'option_document_price_decimals')->dropDownList([
2 => '2',
3 => '3'
]); ?>

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

@@ -76,7 +76,7 @@ class Price

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

}

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

@@ -164,7 +164,7 @@ class Producer extends ActiveRecordCommon
'document_quotation_duration',
'option_dashboard_number_distributions',
'option_online_payment_minimum_amount',
'document_price_decimals'
'option_document_price_decimals'
],
'integer'
],
@@ -403,7 +403,7 @@ class Producer extends ActiveRecordCommon
'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',
'document_price_decimals' => 'Prix : nombre de décimales affichées'
'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

@@ -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…
Cancel
Save