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

(-)a/installer/data/mysql/atomicupdate/bug_7317_ill.perl (+69 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    
4
    if ( !TableExists( 'illrequests' ) ) {
5
        $dbh->do(q{
6
            CREATE TABLE illrequests (
7
               illrequest_id serial PRIMARY KEY,           -- ILL request number
8
               borrowernumber integer DEFAULT NULL,        -- Patron associated with request
9
               biblio_id integer DEFAULT NULL,             -- Potential bib linked to request
10
               branchcode varchar(50) NOT NULL,            -- The branch associated with the request
11
               status varchar(50) DEFAULT NULL,            -- Current Koha status of request
12
               placed date DEFAULT NULL,                   -- Date the request was placed
13
               replied date DEFAULT NULL,                  -- Last API response
14
               updated timestamp DEFAULT CURRENT_TIMESTAMP -- Last modification to request
15
                 ON UPDATE CURRENT_TIMESTAMP,
16
               completed date DEFAULT NULL,                -- Date the request was completed
17
               medium varchar(30) DEFAULT NULL,            -- The Koha request type
18
               accessurl varchar(500) DEFAULT NULL,        -- Potential URL for accessing item
19
               cost varchar(20) DEFAULT NULL,              -- Cost of request
20
               notesopac text DEFAULT NULL,                -- Patron notes attached to request
21
               notesstaff text DEFAULT NULL,               -- Staff notes attached to request
22
               orderid varchar(50) DEFAULT NULL,           -- Backend id attached to request
23
               backend varchar(20) DEFAULT NULL,           -- The backend used to create request
24
               CONSTRAINT `illrequests_bnfk`
25
                 FOREIGN KEY (`borrowernumber`)
26
                 REFERENCES `borrowers` (`borrowernumber`)
27
                 ON UPDATE CASCADE ON DELETE CASCADE,
28
               CONSTRAINT `illrequests_bcfk_2`
29
                 FOREIGN KEY (`branchcode`)
30
                 REFERENCES `branches` (`branchcode`)
31
                 ON UPDATE CASCADE ON DELETE CASCADE
32
           ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
33
        });
34
    }
35
36
    if ( !TableExists( 'illrequestattributes' ) ) {
37
        $dbh->do(q{
38
            CREATE TABLE illrequestattributes (
39
                illrequest_id bigint(20) unsigned NOT NULL, -- ILL request number
40
                type varchar(200) NOT NULL,                 -- API ILL property name
41
                value text NOT NULL,                        -- API ILL property value
42
                PRIMARY KEY  (`illrequest_id`,`type`),
43
                CONSTRAINT `illrequestattributes_ifk`
44
                  FOREIGN KEY (illrequest_id)
45
                  REFERENCES `illrequests` (`illrequest_id`)
46
                  ON UPDATE CASCADE ON DELETE CASCADE
47
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
48
        });
49
    }
50
51
    # System preferences
52
    $dbh->do(q{
53
        INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES
54
            ('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo');
55
    });
56
57
    $dbh->do(q{
58
        INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES
59
            ('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea');
60
    });
61
    # userflags
62
    $dbh->do(q{
63
        INSERT IGNORE INTO userflags (bit,flag,flagdesc,defaulton) VALUES
64
            (22,'ill','The Interlibrary Loans Module',0);
65
    });
66
67
    SetVersion( $DBversion );
68
    print "Upgrade to $DBversion done (Bug 7317 - Add an Interlibrary Loan Module to Circulation and OPAC)\n";
69
}
(-)a/installer/data/mysql/atomicupdate/ill_tables.sql (-56 lines)
Lines 1-55 Link Here
1
-- ILL Requests
2
3
CREATE TABLE illrequests (
4
    illrequest_id serial PRIMARY KEY,           -- ILL request number
5
    borrowernumber integer DEFAULT NULL,        -- Patron associated with request
6
    biblio_id integer DEFAULT NULL,             -- Potential bib linked to request
7
    branchcode varchar(50) NOT NULL,            -- The branch associated with the request
8
    status varchar(50) DEFAULT NULL,            -- Current Koha status of request
9
    placed date DEFAULT NULL,                   -- Date the request was placed
10
    replied date DEFAULT NULL,                  -- Last API response
11
    updated timestamp DEFAULT CURRENT_TIMESTAMP -- Last modification to request
12
      ON UPDATE CURRENT_TIMESTAMP,
13
    completed date DEFAULT NULL,                -- Date the request was completed
14
    medium varchar(30) DEFAULT NULL,            -- The Koha request type
15
    accessurl varchar(500) DEFAULT NULL,        -- Potential URL for accessing item
16
    cost varchar(20) DEFAULT NULL,              -- Cost of request
17
    notesopac text DEFAULT NULL,                -- Patron notes attached to request
18
    notesstaff text DEFAULT NULL,               -- Staff notes attached to request
19
    orderid varchar(50) DEFAULT NULL,           -- Backend id attached to request
20
    backend varchar(20) DEFAULT NULL,           -- The backend used to create request
21
    CONSTRAINT `illrequests_bnfk`
22
      FOREIGN KEY (`borrowernumber`)
23
      REFERENCES `borrowers` (`borrowernumber`)
24
      ON UPDATE CASCADE ON DELETE CASCADE,
25
    CONSTRAINT `illrequests_bcfk_2`
26
      FOREIGN KEY (`branchcode`)
27
      REFERENCES `branches` (`branchcode`)
28
      ON UPDATE CASCADE ON DELETE CASCADE
29
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
30
31
-- ILL Request Attributes
32
33
CREATE TABLE illrequestattributes (
34
    illrequest_id bigint(20) unsigned NOT NULL, -- ILL request number
35
    type varchar(200) NOT NULL,                 -- API ILL property name
36
    value text NOT NULL,                        -- API ILL property value
37
    PRIMARY KEY  (`illrequest_id`,`type`),
38
    CONSTRAINT `illrequestattributes_ifk`
39
      FOREIGN KEY (illrequest_id)
40
      REFERENCES `illrequests` (`illrequest_id`)
41
      ON UPDATE CASCADE ON DELETE CASCADE
42
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
43
44
-- System preferences
45
46
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES
47
       ('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo');
48
49
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES
50
       ('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea');
51
52
-- Userflags
53
54
INSERT INTO userflags (bit,flag,flagdesc,defaulton)
55
VALUES (22,'ill','The Interlibrary Loans Module',0);
56
- 

Return to bug 7317