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

(-)a/installer/data/mysql/atomicupdate/bug_27946.perl (+29 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    # you can use $dbh here like:
4
    # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" );
5
6
    # or perform some test and warn
7
    if( !column_exists( 'categories', 'article_request_fee' ) ) {
8
      $dbh->do(q{
9
        ALTER TABLE `categories` ADD COLUMN `article_request_fee` decimal(28,6) DEFAULT NULL COMMENT 'Cost for article scan request' AFTER `exclude_from_local_holds_priority`
10
      });
11
    }
12
13
    if( !column_exists( 'article_requests', 'debit_line_id' ) ) {
14
      $dbh->do(q{
15
        ALTER TABLE `article_requests` ADD COLUMN `debit_line_id` int(11) DEFAULT NULL COMMENT 'Debit line with cost for article scan request' AFTER `notes`
16
      });
17
      $dbh->do(q{
18
        ALTER TABLE `article_requests` ADD CONSTRAINT `article_requests_ibfk_5` FOREIGN KEY (`debit_line_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE SET NULL ON UPDATE CASCADE
19
      });
20
    }
21
22
    $dbh->do(q{
23
        INSERT IGNORE INTO account_debit_types ( code, description, can_be_invoiced, can_be_sold, default_amount, is_system ) VALUES
24
        ('ARTICLE_REQUEST', 'Article scan request fee', 0, 0, NULL, 1);
25
    });
26
27
    # Always end with this (adjust the bug info)
28
    NewVersion( $DBversion, 27946, "Add article_request_fee to categories table, add debit_line_id column to article_requests table and add ARTICLE_REQUEST as a debit type");
29
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +4 lines)
Lines 753-758 CREATE TABLE `article_requests` ( Link Here
753
  `notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
753
  `notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
754
  `format` enum('PHOTOCOPY', 'SCAN') NOT NULL DEFAULT 'PHOTOCOPY',
754
  `format` enum('PHOTOCOPY', 'SCAN') NOT NULL DEFAULT 'PHOTOCOPY',
755
  `urls` MEDIUMTEXT,
755
  `urls` MEDIUMTEXT,
756
  `debit_line_id` int(11) DEFAULT NULL COMMENT 'Debit line with cost for article scan request',
756
  `created_on` timestamp NULL DEFAULT NULL COMMENT 'Be careful with two timestamps in one table not allowing NULL',
757
  `created_on` timestamp NULL DEFAULT NULL COMMENT 'Be careful with two timestamps in one table not allowing NULL',
757
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
758
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
758
  PRIMARY KEY (`id`),
759
  PRIMARY KEY (`id`),
Lines 763-769 CREATE TABLE `article_requests` ( Link Here
763
  CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
764
  CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
764
  CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
765
  CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
765
  CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
766
  CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
766
  CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
767
  CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
768
  CONSTRAINT `article_requests_ibfk_5` FOREIGN KEY (`debit_line_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE SET NULL ON UPDATE CASCADE
767
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
769
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
768
/*!40101 SET character_set_client = @saved_cs_client */;
770
/*!40101 SET character_set_client = @saved_cs_client */;
769
771
Lines 1621-1626 CREATE TABLE `categories` ( Link Here
1621
  `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category',
1623
  `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category',
1622
  `require_strong_password` tinyint(1) DEFAULT NULL COMMENT 'set required password strength for patrons in this category',
1624
  `require_strong_password` tinyint(1) DEFAULT NULL COMMENT 'set required password strength for patrons in this category',
1623
  `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude patrons of this category from local holds priority',
1625
  `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude patrons of this category from local holds priority',
1626
  `article_request_fee` decimal(28,6) DEFAULT NULL COMMENT 'Cost for article scan request',
1624
  PRIMARY KEY (`categorycode`),
1627
  PRIMARY KEY (`categorycode`),
1625
  UNIQUE KEY `categorycode` (`categorycode`)
1628
  UNIQUE KEY `categorycode` (`categorycode`)
1626
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1629
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
(-)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