From fcb7684e8d7b777bc34703d264463c3d2079e5f5 Mon Sep 17 00:00:00 2001 From: Jonathan Niles Date: Mon, 11 May 2020 12:24:45 +0100 Subject: [PATCH] fix(purchase): make DECIMALs compatible with PJ/GL Fixes the purchase table to make unit price and total DECIMAL columns compatible with the DECIMAL values stored in the general_ledger and posting_journal. The previous iteration made the values far too small. Closes #4478. --- server/models/migrations/next/migrate.sql | 12 ++++++++++-- server/models/schema.sql | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/server/models/migrations/next/migrate.sql b/server/models/migrations/next/migrate.sql index a98f0b73e0..2469f02c23 100644 --- a/server/models/migrations/next/migrate.sql +++ b/server/models/migrations/next/migrate.sql @@ -5,10 +5,10 @@ INSERT INTO unit VALUES (269, 'Inventory Adjustment', 'TREE.INVENTORY_ADJUSTMENT', 'Inventory Adjustment', 160, '/modules/stock/inventory-adjustment/inventory-adjustment.html', '/stock/inventory-adjustment'); -INSERT INTO flux VALUES +INSERT INTO flux VALUES (14, 'STOCK_FLUX.INVENTORY_RESET'), (15, 'STOCK_FLUX.INVENTORY_ADJUSTMENT'); - + /* * @author: @lomamech @@ -19,3 +19,11 @@ INSERT INTO unit VALUES INSERT INTO `report` (`report_key`, `title_key`) VALUES ('invoicedReceivedStock', 'REPORT.COMPARE_INVOICED_RECEIVED.TITLE'); + + +/** +@author: jniles +@date: 2020-05-11 +*/ +ALTER TABLE `purchase_item` MODIFY COLUMN `unit_price` DECIMAL(19,8) UNSIGNED NOT NULL DEFAULT 0.00; +ALTER TABLE `purchase_item` MODIFY COLUMN `total` DECIMAL(19,8) UNSIGNED NULL DEFAULT 0.00; diff --git a/server/models/schema.sql b/server/models/schema.sql index de8da179f0..b7816b1fc3 100644 --- a/server/models/schema.sql +++ b/server/models/schema.sql @@ -1413,8 +1413,8 @@ CREATE TABLE `purchase_item` ( `purchase_uuid` BINARY(16) NOT NULL, `inventory_uuid` BINARY(16) NOT NULL, `quantity` INT(11) NOT NULL DEFAULT 0, - `unit_price` decimal(10,4) UNSIGNED NOT NULL, - `total` decimal(10,4) UNSIGNED DEFAULT NULL, + `unit_price` DECIMAL(19,8) UNSIGNED NOT NULL DEFAULT 0.00, + `total` DECIMAL(19,8) UNSIGNED NULL DEFAULT 0.00, PRIMARY KEY (`uuid`), UNIQUE KEY `purchase_item_1` (`purchase_uuid`, `inventory_uuid`), KEY `purchase_uuid` (`purchase_uuid`),