Koha/installer/data/mysql/atomicupdate/bug_27946.pl
Tomas Cohen Arazi 2946891d21 Bug 27946: Add article_requests.debit_id and ARTICLE_REQUEST account debit type
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-01-28 11:09:07 -10:00

34 lines
1.1 KiB
Perl
Executable file

use Modern::Perl;
return {
bug_number => "27946",
description => "Add article request fees",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
if ( !column_exists( 'article_requests', 'debit_id' ) ) {
$dbh->do(
q{
ALTER TABLE `article_requests`
ADD COLUMN `debit_id` int(11) NULL DEFAULT NULL COMMENT 'Debit line with cost for article scan request' AFTER `cancellation_reason`
}
);
$dbh->do(
q{
ALTER TABLE `article_requests`
ADD CONSTRAINT `article_requests_ibfk_5` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE SET NULL ON UPDATE CASCADE
}
);
}
$dbh->do(
q{
INSERT IGNORE INTO account_debit_types ( code, description, can_be_invoiced, can_be_sold, default_amount, is_system )
VALUES ('ARTICLE_REQUEST', 'Article scan request fee', 0, 0, NULL, 1);
}
);
},
};