View | Details | Raw Unified | Return to bug 37344
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_37344.pl (-6 / +6 lines)
Lines 3-9 use Koha::Installer::Output qw(say_warning say_failure say_success say_info); Link Here
3
3
4
return {
4
return {
5
    bug_number  => "37344",
5
    bug_number  => "37344",
6
    description => "Add columns cancellation_reason and cancellation_date to discharge",
6
    description => "Add columns cancellation_reason and cancelled to discharge",
7
    up          => sub {
7
    up          => sub {
8
        my ($args) = @_;
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
Lines 14-20 return { Link Here
14
                q{
14
                q{
15
                ALTER TABLE discharges
15
                ALTER TABLE discharges
16
                ADD COLUMN cancelled timestamp NULL default NULL,
16
                ADD COLUMN cancelled timestamp NULL default NULL,
17
                ADD COLUMN cancellation_reason VARCHAR(80) NULL default NULL;
17
                ADD COLUMN cancellation_reason VARCHAR(80) NULL default NULL ;
18
            }
18
            }
19
            );
19
            );
20
20
Lines 27-34 return { Link Here
27
            $dbh->do(
27
            $dbh->do(
28
                q{
28
                q{
29
                    INSERT IGNORE INTO authorised_values (category, authorised_value, lib) VALUES
29
                    INSERT IGNORE INTO authorised_values (category, authorised_value, lib) VALUES
30
                    ('DISCHARGE_CANCELLATION','BORROWER_MISTAKE', 'Borrower asked a discharge by mistake'),
30
                    ('DISCHARGE_CANCELLATION','PATRON_MISTAKE', 'Patron asked a discharge by mistake'),
31
                    ('DISCHARGE_CANCELLATION','BORROWER_STILL_NEEDS_TO_BORROW','Administration required a discharge however the borrower still needs to borrow')
31
                    ('DISCHARGE_CANCELLATION','PATRON_STILL_NEEDS_ACCOUNT','Administration required a discharge however the patron still needs to use their account')
32
                }
32
                }
33
            );
33
            );
34
34
Lines 36-43 return { Link Here
36
            # tables
36
            # tables
37
            say $out "Added column 'discharges.cancelled'";
37
            say $out "Added column 'discharges.cancelled'";
38
            say $out "Added column 'discharges.cancellation_reason'";
38
            say $out "Added column 'discharges.cancellation_reason'";
39
            say $out "Added authorized values";
39
            say $out "Added authorized value category DISCHARGE_CANCELLATION";
40
            say $out "Added authorized values";
40
            say $out "Added authorized values PATRON_MISTAKE and PATRON_STILL_NEEDS_ACCOUNT";
41
        }
41
        }
42
    },
42
    },
43
};
43
};
(-)a/installer/data/mysql/en/optional/auth_val.yml (+10 lines)
Lines 333-335 tables: Link Here
333
        - category: "AR_CANCELLATION"
333
        - category: "AR_CANCELLATION"
334
          authorised_value: "OPAC"
334
          authorised_value: "OPAC"
335
          lib: "Cancelled from the OPAC user page"
335
          lib: "Cancelled from the OPAC user page"
336
337
338
        # Disharge cancellations
339
        - category: "DISCHARGE_CANCELLATION"
340
          authorised_value: "PATRON_MISTAKE"
341
          lib: "Patron asked a discharge by mistake"
342
343
        - category: "DISCHARGE_CANCELLATION"
344
          authorised_value: "PATRON_STILL_NEEDS_ACCOUNT"
345
          lib: "Administration required a discharge however the borrower still needs to use their account"
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 2874-2880 CREATE TABLE `discharges` ( Link Here
2874
  `needed` timestamp NULL DEFAULT NULL,
2874
  `needed` timestamp NULL DEFAULT NULL,
2875
  `validated` timestamp NULL DEFAULT NULL,
2875
  `validated` timestamp NULL DEFAULT NULL,
2876
  `cancelled` timestamp DEFAULT NULL,
2876
  `cancelled` timestamp DEFAULT NULL,
2877
  `cancellation_reason`varchar(32) DEFAULT NULL,
2877
  `cancellation_reason`varchar(80) DEFAULT NULL COMMENT 'authorised value CANCELLATION_REASON',
2878
  PRIMARY KEY (`discharge_id`),
2878
  PRIMARY KEY (`discharge_id`),
2879
  KEY `borrower_discharges_ibfk1` (`borrower`),
2879
  KEY `borrower_discharges_ibfk1` (`borrower`),
2880
  CONSTRAINT `borrower_discharges_ibfk1` FOREIGN KEY (`borrower`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2880
  CONSTRAINT `borrower_discharges_ibfk1` FOREIGN KEY (`borrower`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
(-)a/installer/data/mysql/mandatory/auth_val_cat.sql (-1 / +6 lines)
Lines 106-108 VALUES Link Here
106
INSERT IGNORE INTO authorised_value_categories (category_name, is_system)
106
INSERT IGNORE INTO authorised_value_categories (category_name, is_system)
107
VALUES
107
VALUES
108
    ('BOOKING_CANCELLATION', 1);
108
    ('BOOKING_CANCELLATION', 1);
109
- 
109
110
111
-- For discharges
112
INSERT IGNORE INTO authorised_value_categories (category_name, is_system)
113
VALUES
114
    ('DISCHARGE_CANCELLATION', 1);

Return to bug 37344