Skip to content

Commit

Permalink
Fix state information of "Sent offer" status.
Browse files Browse the repository at this point in the history
  • Loading branch information
emaijala committed Jun 27, 2024
1 parent a1d7ef8 commit 9e71c71
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions create_database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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);

Expand Down
10 changes: 10 additions & 0 deletions sqlfuncs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 9e71c71

Please sign in to comment.