From 20d426b8cfdb13bb2b1bef8be64c46b539939d73 Mon Sep 17 00:00:00 2001 From: Baptiste Wojtkowski Date: Thu, 27 Mar 2025 12:46:17 +0100 Subject: [PATCH] Bug 37344: (follow-up) to be squashed Signed-off-by: David Nind --- installer/data/mysql/atomicupdate/bug_37344.pl | 12 ++++++------ installer/data/mysql/en/optional/auth_val.yml | 10 ++++++++++ installer/data/mysql/kohastructure.sql | 2 +- installer/data/mysql/mandatory/auth_val_cat.sql | 6 ++++++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_37344.pl b/installer/data/mysql/atomicupdate/bug_37344.pl index f7eed7be91..7e6e30d7bf 100755 --- a/installer/data/mysql/atomicupdate/bug_37344.pl +++ b/installer/data/mysql/atomicupdate/bug_37344.pl @@ -3,7 +3,7 @@ use Koha::Installer::Output qw(say_warning say_failure say_success say_info); return { bug_number => "37344", - description => "Add columns cancellation_reason and cancellation_date to discharge", + description => "Add columns cancellation_reason and cancelled to discharge", up => sub { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; @@ -14,7 +14,7 @@ return { q{ ALTER TABLE discharges ADD COLUMN cancelled timestamp NULL default NULL, - ADD COLUMN cancellation_reason VARCHAR(80) NULL default NULL; + ADD COLUMN cancellation_reason VARCHAR(80) NULL default NULL ; } ); @@ -27,8 +27,8 @@ return { $dbh->do( q{ INSERT IGNORE INTO authorised_values (category, authorised_value, lib) VALUES - ('DISCHARGE_CANCELLATION','BORROWER_MISTAKE', 'Borrower asked a discharge by mistake'), - ('DISCHARGE_CANCELLATION','BORROWER_STILL_NEEDS_TO_BORROW','Administration required a discharge however the borrower still needs to borrow') + ('DISCHARGE_CANCELLATION','PATRON_MISTAKE', 'Patron asked a discharge by mistake'), + ('DISCHARGE_CANCELLATION','PATRON_STILL_NEEDS_ACCOUNT','Administration required a discharge however the patron still needs to use their account') } ); @@ -36,8 +36,8 @@ return { # tables say $out "Added column 'discharges.cancelled'"; say $out "Added column 'discharges.cancellation_reason'"; - say $out "Added authorized values"; - say $out "Added authorized values"; + say $out "Added authorized value category DISCHARGE_CANCELLATION"; + say $out "Added authorized values PATRON_MISTAKE and PATRON_STILL_NEEDS_ACCOUNT"; } }, }; diff --git a/installer/data/mysql/en/optional/auth_val.yml b/installer/data/mysql/en/optional/auth_val.yml index 62197838f9..efb6aa97f4 100644 --- a/installer/data/mysql/en/optional/auth_val.yml +++ b/installer/data/mysql/en/optional/auth_val.yml @@ -333,3 +333,13 @@ tables: - category: "AR_CANCELLATION" authorised_value: "OPAC" lib: "Cancelled from the OPAC user page" + + + # Disharge cancellations + - category: "DISCHARGE_CANCELLATION" + authorised_value: "PATRON_MISTAKE" + lib: "Patron asked a discharge by mistake" + + - category: "DISCHARGE_CANCELLATION" + authorised_value: "PATRON_STILL_NEEDS_ACCOUNT" + lib: "Administration required a discharge however the borrower still needs to use their account" diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index f2aeae0c3f..0adca51d49 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2874,7 +2874,7 @@ CREATE TABLE `discharges` ( `needed` timestamp NULL DEFAULT NULL, `validated` timestamp NULL DEFAULT NULL, `cancelled` timestamp DEFAULT NULL, - `cancellation_reason`varchar(32) DEFAULT NULL, + `cancellation_reason`varchar(80) DEFAULT NULL COMMENT 'authorised value CANCELLATION_REASON', PRIMARY KEY (`discharge_id`), KEY `borrower_discharges_ibfk1` (`borrower`), CONSTRAINT `borrower_discharges_ibfk1` FOREIGN KEY (`borrower`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE diff --git a/installer/data/mysql/mandatory/auth_val_cat.sql b/installer/data/mysql/mandatory/auth_val_cat.sql index c1428e4a3c..5d2e1550ab 100644 --- a/installer/data/mysql/mandatory/auth_val_cat.sql +++ b/installer/data/mysql/mandatory/auth_val_cat.sql @@ -106,3 +106,9 @@ VALUES INSERT IGNORE INTO authorised_value_categories (category_name, is_system) VALUES ('BOOKING_CANCELLATION', 1); + + +-- For discharges +INSERT IGNORE INTO authorised_value_categories (category_name, is_system) +VALUES + ('DISCHARGE_CANCELLATION', 1); -- 2.39.5