Skip to content

Commit

Permalink
increase precision of decimal fields
Browse files Browse the repository at this point in the history
  • Loading branch information
orthagh committed Jan 8, 2016
1 parent 862d6f4 commit c064692
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions inc/bill.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public static function install(Migration $migration) {
`validationdate` datetime DEFAULT NULL,
`comment` text COLLATE utf8_unicode_ci,
`plugin_order_billstates_id` int(11) NOT NULL DEFAULT '0',
`value` decimal(20,4) NOT NULL DEFAULT '0.0000',
`value` decimal(20,6) NOT NULL DEFAULT '0.000000',
`plugin_order_billtypes_id` int(11) NOT NULL DEFAULT '0',
`suppliers_id` int(11) NOT NULL DEFAULT '0',
`plugin_order_orders_id` int(11) NOT NULL DEFAULT '0',
Expand Down Expand Up @@ -458,7 +458,7 @@ public static function install(Migration $migration) {
}
}
}
$migration->changeField($table, "value", "value", "decimal(20,4) NOT NULL DEFAULT '0.0000'");
$migration->changeField($table, "value", "value", "decimal(20,6) NOT NULL DEFAULT '0.000000'");
$migration->migrationOneTable($table);
}
$migration->dropField("glpi_plugin_order_orders_suppliers", "num_bill");
Expand Down
16 changes: 8 additions & 8 deletions inc/order_item.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1348,10 +1348,10 @@ public static function install(Migration $migration) {
`plugin_order_ordertaxes_id` float NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_order_ordertaxes (id)',
`delivery_number` varchar(255) collate utf8_unicode_ci default NULL,
`delivery_comment` text collate utf8_unicode_ci,
`price_taxfree` decimal(20,4) NOT NULL DEFAULT '0.0000',
`price_discounted` decimal(20,4) NOT NULL DEFAULT '0.0000',
`discount` decimal(20,4) NOT NULL DEFAULT '0.0000',
`price_ati` decimal(20,4) NOT NULL DEFAULT '0.0000',
`price_taxfree` decimal(20,6) NOT NULL DEFAULT '0.000000',
`price_discounted` decimal(20,6) NOT NULL DEFAULT '0.000000',
`discount` decimal(20,6) NOT NULL DEFAULT '0.000000',
`price_ati` decimal(20,6) NOT NULL DEFAULT '0.000000',
`states_id` int(11) NOT NULL default 1,
`delivery_date` date default NULL,
`plugin_order_bills_id` INT( 11 ) NOT NULL DEFAULT '0',
Expand Down Expand Up @@ -1432,13 +1432,13 @@ public static function install(Migration $migration) {

//Change format for prices : from float to decimal
$migration->changeField($table, "price_taxfree", "price_taxfree",
"decimal(20,4) NOT NULL DEFAULT '0.0000'");
"decimal(20,6) NOT NULL DEFAULT '0.000000'");
$migration->changeField($table, "price_discounted", "price_discounted",
"decimal(20,4) NOT NULL DEFAULT '0.0000'");
"decimal(20,6) NOT NULL DEFAULT '0.000000'");
$migration->changeField($table, "price_ati", "price_ati",
"decimal(20,4) NOT NULL DEFAULT '0.0000'");
"decimal(20,6) NOT NULL DEFAULT '0.000000'");
$migration->changeField($table, "discount", "discount",
"decimal(20,4) NOT NULL DEFAULT '0.0000'");
"decimal(20,6) NOT NULL DEFAULT '0.000000'");

//Drop unused fields from previous migration
$migration->dropField($table, "price_taxfree2");
Expand Down
4 changes: 2 additions & 2 deletions inc/reference_supplier.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public static function install(Migration $migration)
`is_recursive` tinyint(1) NOT NULL default '0',
`plugin_order_references_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_order_references (id)',
`suppliers_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_suppliers (id)',
`price_taxfree` decimal(20,4) NOT NULL DEFAULT '0.0000',
`price_taxfree` decimal(20,6) NOT NULL DEFAULT '0.000000',
`reference_code` varchar(255) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`id`),
KEY `entities_id` (`entities_id`),
Expand Down Expand Up @@ -370,7 +370,7 @@ public static function install(Migration $migration)
$migration->changeField($table, "reference_code", "reference_code",
"varchar(255) collate utf8_unicode_ci default NULL");
$migration->changeField($table, "price_taxfree", "price_taxfree",
"decimal(20,4) NOT NULL DEFAULT '0.0000'");
"decimal(20,6) NOT NULL DEFAULT '0.000000'");
$migration->migrationOneTable($table);

Plugin::migrateItemType(array(3152 => 'PluginOrderReference_Supplier'),
Expand Down

0 comments on commit c064692

Please sign in to comment.