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

(-)a/installer/data/mysql/atomicupdate/bug_27946.pl (+34 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "27946",
5
    description => "Add article request fees",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        if ( !column_exists( 'article_requests', 'debit_id' ) ) {
11
12
            $dbh->do(
13
                q{
14
                ALTER TABLE `article_requests`
15
                    ADD COLUMN `debit_id` int(11) NULL DEFAULT NULL COMMENT 'Debit line with cost for article scan request' AFTER `cancellation_reason`
16
            }
17
            );
18
19
            $dbh->do(
20
                q{
21
                ALTER TABLE `article_requests`
22
                    ADD CONSTRAINT `article_requests_ibfk_5` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE SET NULL ON UPDATE CASCADE
23
            }
24
            );
25
        }
26
27
        $dbh->do(
28
            q{
29
            INSERT IGNORE INTO account_debit_types ( code, description, can_be_invoiced, can_be_sold, default_amount, is_system )
30
            VALUES ('ARTICLE_REQUEST', 'Article scan request fee', 0, 0, NULL, 1);
31
        }
32
        );
33
    },
34
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +3 lines)
Lines 784-789 CREATE TABLE `article_requests` ( Link Here
784
  `format` enum('PHOTOCOPY','SCAN') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PHOTOCOPY',
784
  `format` enum('PHOTOCOPY','SCAN') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PHOTOCOPY',
785
  `urls` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
785
  `urls` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
786
  `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION',
786
  `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION',
787
  `debit_id` int(11) NULL DEFAULT NULL COMMENT 'Debit line with cost for article scan request',
787
  `created_on` timestamp NULL DEFAULT NULL COMMENT 'Be careful with two timestamps in one table not allowing NULL',
788
  `created_on` timestamp NULL DEFAULT NULL COMMENT 'Be careful with two timestamps in one table not allowing NULL',
788
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
789
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
789
  `toc_request` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'borrower requested table of contents',
790
  `toc_request` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'borrower requested table of contents',
Lines 795-801 CREATE TABLE `article_requests` ( Link Here
795
  CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
796
  CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
796
  CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
797
  CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
797
  CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
798
  CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
798
  CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
799
  CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
800
  CONSTRAINT `article_requests_ibfk_5` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE SET NULL ON UPDATE CASCADE
799
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
801
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
800
/*!40101 SET character_set_client = @saved_cs_client */;
802
/*!40101 SET character_set_client = @saved_cs_client */;
801
803
(-)a/installer/data/mysql/mandatory/account_debit_types.sql (-2 / +2 lines)
Lines 13-16 INSERT INTO account_debit_types ( code, description, can_be_invoiced, can_be_sol Link Here
13
('RENT_DAILY_RENEW', 'Renewal of daily rental item', 0, 0, NULL, 1),
13
('RENT_DAILY_RENEW', 'Renewal of daily rental item', 0, 0, NULL, 1),
14
('RESERVE', 'Hold fee', 0, 0, NULL, 1),
14
('RESERVE', 'Hold fee', 0, 0, NULL, 1),
15
('RESERVE_EXPIRED', 'Hold waiting too long', 0, 0, NULL, 1),
15
('RESERVE_EXPIRED', 'Hold waiting too long', 0, 0, NULL, 1),
16
('VOID', 'Credit has been voided', 0, 0, NULL, 1);
16
('VOID', 'Credit has been voided', 0, 0, NULL, 1),
17
('ARTICLE_REQUEST', 'Article scan request fee', 0, 0, NULL, 1);
17
- 

Return to bug 27946