Lines 6-41
return {
Link Here
|
6 |
up => sub { |
6 |
up => sub { |
7 |
my ($args) = @_; |
7 |
my ($args) = @_; |
8 |
my ($dbh, $out) = @$args{qw(dbh out column_exists)}; |
8 |
my ($dbh, $out) = @$args{qw(dbh out column_exists)}; |
9 |
# Do you stuffs here |
|
|
10 |
$dbh->do(q{ |
9 |
$dbh->do(q{ |
11 |
INSERT IGNORE INTO authorised_value_categories( category_name, is_system ) |
10 |
INSERT IGNORE INTO authorised_value_categories( category_name, is_system ) |
12 |
VALUES ('AR_CANCELLATION', 0) |
11 |
VALUES ('AR_CANCELLATION', 0) |
13 |
}); |
12 |
}); |
14 |
# Print useful stuff here |
|
|
15 |
say $out "Add AR_CANCELLATION category for authorised values"; |
13 |
say $out "Add AR_CANCELLATION category for authorised values"; |
16 |
|
14 |
|
17 |
$dbh->do(q{ |
15 |
$dbh->do(q{ |
18 |
INSERT IGNORE INTO authorised_values (category, authorised_value, lib) VALUES ('AR_CANCELLATION','NOT_FOUND','Item could not be located on shelves'); |
16 |
INSERT IGNORE INTO authorised_values (category, authorised_value, lib) VALUES ('AR_CANCELLATION','NOT_FOUND','Item could not be located on shelves'); |
19 |
}); |
17 |
}); |
20 |
|
|
|
21 |
$dbh->do(q{ |
18 |
$dbh->do(q{ |
22 |
INSERT IGNORE INTO authorised_values (category, authorised_value, lib) VALUES ('AR_CANCELLATION','DAMAGED','Item was found to be too damaged to fill article request'); |
19 |
INSERT IGNORE INTO authorised_values (category, authorised_value, lib) VALUES ('AR_CANCELLATION','DAMAGED','Item was found to be too damaged to fill article request'); |
23 |
}); |
20 |
}); |
24 |
|
|
|
25 |
say $out "Add AR_CANCELLATION authorised values"; |
21 |
say $out "Add AR_CANCELLATION authorised values"; |
26 |
|
22 |
|
27 |
$dbh->do(q{ |
23 |
$dbh->do(q{ |
28 |
ALTER TABLE `article_requests` ADD COLUMN `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION' AFTER `urls` |
24 |
ALTER TABLE `article_requests` ADD COLUMN `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION' AFTER `urls` |
29 |
}) unless column_exists('article_requests', 'cancellation_reason'); |
25 |
}) unless column_exists('article_requests', 'cancellation_reason'); |
30 |
|
|
|
31 |
# Print useful stuff here |
32 |
say $out "Add cancellation_reason column in article_requests table"; |
26 |
say $out "Add cancellation_reason column in article_requests table"; |
33 |
|
27 |
|
34 |
$dbh->do(q{ |
28 |
$dbh->do(q{ |
35 |
UPDATE `letter` |
29 |
UPDATE letter SET content=REPLACE(content, '<<article_requests.notes>>', '<<reason>>') |
36 |
SET `content` = 'Dear <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>),\r\n\r\nYour request for an article from <<biblio.title>> (<<items.barcode>>) has been canceled for the following reason:\r\n\r\n<<reason>>\r\n\r\nArticle requested:\r\nTitle: <<article_requests.title>>\r\nAuthor: <<article_requests.author>>\r\nVolume: <<article_requests.volume>>\r\nIssue: <<article_requests.issue>>\r\nDate: <<article_requests.date>>\r\nPages: <<article_requests.pages>>\r\nChapters: <<article_requests.chapters>>\r\nNotes: <<article_requests.patron_notes>>\r\nFormat: [% IF article_request.format == ''PHOTOCOPY'' %]Copy[% ELSIF article_request.format == ''SCAN'' %]Scan[% END %]\r\n\r\nYour library' |
30 |
WHERE module = 'circulation' AND code = 'AR_CANCELED' |
37 |
WHERE `module` = 'circulation' |
31 |
}); |
38 |
AND `code` = 'AR_CANCELED' |
32 |
say $out "Replace notes by reason in notice AR_CANCELED"; |
39 |
}) |
|
|
40 |
}, |
33 |
}, |
41 |
} |
34 |
} |
42 |
- |
|
|