From 9e71c714cfe9d411bee93fc7797cfb0ab5cd6cef Mon Sep 17 00:00:00 2001 From: Ere Maijala Date: Thu, 27 Jun 2024 22:19:23 +0300 Subject: [PATCH] Fix state information of "Sent offer" status. --- create_database.sql | 4 ++-- sqlfuncs.php | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/create_database.sql b/create_database.sql index c67ef71e..38638f1c 100644 --- a/create_database.sql +++ b/create_database.sql @@ -444,7 +444,7 @@ CREATE TABLE mlinvoice_default_value ( SET NAMES 'utf8'; -INSERT INTO mlinvoice_state (id, data) VALUES ('version', '66'); +INSERT INTO mlinvoice_state (id, data) VALUES ('version', '67'); INSERT INTO mlinvoice_state (id, data) VALUES ('tableconversiondone', '1'); @@ -457,7 +457,7 @@ INSERT INTO mlinvoice_invoice_state (id, name, order_no, invoice_open, invoice_u INSERT INTO mlinvoice_invoice_state (id, name, order_no, invoice_open, invoice_unpaid) VALUES (7, 'StateDebtCollection', 35, 0, 1); INSERT INTO mlinvoice_invoice_state (id, name, order_no, invoice_open, invoice_unpaid) VALUES (8, 'StatePaidInCash', 17, 0, 0); INSERT INTO mlinvoice_invoice_state (id, name, order_no, invoice_open, invoice_unpaid, invoice_offer) VALUES (9, 'StateOfferOpen', 40, 1, 0, 1); -INSERT INTO mlinvoice_invoice_state (id, name, order_no, invoice_open, invoice_unpaid, invoice_offer, invoice_offer_sent) VALUES (10, 'StateOfferSent', 45, 1, 0, 1, 1); +INSERT INTO mlinvoice_invoice_state (id, name, order_no, invoice_open, invoice_unpaid, invoice_offer, invoice_offer_sent) VALUES (10, 'StateOfferSent', 45, 0, 0, 1, 1); INSERT INTO mlinvoice_invoice_state (id, name, order_no, invoice_open, invoice_unpaid, invoice_offer, invoice_offer_sent) VALUES (11, 'StateOfferUnrealised', 50, 0, 0, 1, 1); INSERT INTO mlinvoice_invoice_state (id, name, order_no, invoice_open, invoice_unpaid, invoice_offer, invoice_offer_sent) VALUES (12, 'StateOfferRealised', 55, 0, 0, 1, 1); diff --git a/sqlfuncs.php b/sqlfuncs.php index 936209db..e4bf5e09 100755 --- a/sqlfuncs.php +++ b/sqlfuncs.php @@ -2674,6 +2674,16 @@ function verifyDatabase() ); } + if ($version < 67) { + $updates = array_merge( + $updates, + [ + "UPDATE {prefix}invoice_state SET invoice_open=0 WHERE name='StateOfferSent'", + "REPLACE INTO {prefix}state (id, data) VALUES ('version', '67')" + ] + ); + } + // phpcs:enable Generic.Files.LineLength if (!empty($updates)) { dbQueryCheck('SET AUTOCOMMIT = 0');