Bug 19532: DBRev 21.12.00.018
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
0e35ab911c
commit
9cb2ff97d2
8 changed files with 100 additions and 111 deletions
2
Koha.pm
2
Koha.pm
|
@ -29,7 +29,7 @@ use vars qw{ $VERSION };
|
|||
# - #4 : the developer version. The 4th number is the database subversion.
|
||||
# used by developers when the database changes. updatedatabase take care of the changes itself
|
||||
# and is automatically called by Auth.pm when needed.
|
||||
$VERSION = "21.12.00.017";
|
||||
$VERSION = "21.12.00.018";
|
||||
|
||||
sub version {
|
||||
return $VERSION;
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
$DBversion = 'XXX';
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
$dbh->do(q{ ALTER TABLE branchtransfers MODIFY COLUMN reason ENUM('Manual', 'StockrotationAdvance', 'StockrotationRepatriation', 'ReturnToHome', 'ReturnToHolding', 'RotatingCollection', 'Reserve', 'LostReserve', 'CancelReserve', 'Recall', 'CancelRecall') });
|
||||
|
||||
NewVersion( $DBversion, 19532, "Add Recall and CancelReserve ENUM options to branchtransfers.reason" );
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
$DBversion = 'XXX';
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
$dbh->do(q{ INSERT IGNORE INTO userflags (bit, flag, flagdesc, defaulton) VALUES (27, 'recalls', 'Recalls', 0) });
|
||||
$dbh->do(q{ INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (27, 'manage_recalls', 'Manage recalls for patrons') });
|
||||
|
||||
NewVersion( $DBversion, 19532, "Add recalls user flag and manage_recalls user permission" );
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
$DBversion = 'XXX';
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
$dbh->do(q{
|
||||
INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`) VALUES
|
||||
('circulation','RETURN_RECALLED_ITEM','','Notification to return a recalled item','0','Notification to return a recalled item','Date: <<today>>
|
||||
|
||||
<<borrowers.firstname>> <<borrowers.surname>>,
|
||||
|
||||
A recall has been placed on the following item: <<biblio.title>> / <<biblio.author>> (<<items.barcode>>). The due date has been updated, and is now <<issues.date_due>>. Please return the item before the due date.
|
||||
|
||||
Thank you!','email'),
|
||||
('circulation','PICKUP_RECALLED_ITEM','','Recalled item awaiting pickup','0','Recalled item awaiting pickup','Date: <<today>>
|
||||
|
||||
<<borrowers.firstname>> <<borrowers.surname>>,
|
||||
|
||||
A recall that you requested on the following item: <<biblio.title>> / <<biblio.author>> (<<items.barcode>>) is now ready for you to pick up at <<recalls.branchcode>>. Please pick up your item by <<recalls.expirationdate>>.
|
||||
|
||||
Thank you!','email'),
|
||||
('circulation','RECALL_REQUESTER_DET','','Details of patron who recalled item',0,'Details of patron who recalled item','Date: <<today>>
|
||||
|
||||
Recall for pickup at <<branches.branchname>>
|
||||
<<borrowers.surname>>, <<borrowers.firstname>> (<<borrowers.cardnumber>>)
|
||||
<<borrowers.phone>>
|
||||
<<borrowers.streetnumber>> <<borrowers.address>>, <<borrowers.address2>>, <<borrowers.city>> <<borrowers.zipcode>>
|
||||
<<borrowers.email>>
|
||||
|
||||
ITEM RECALLED
|
||||
<<biblio.title>> by <<biblio.author>>
|
||||
Barcode: <<items.barcode>>
|
||||
Callnumber: <<items.itemcallnumber>>
|
||||
Waiting since: <<recalls.waitingdate>>
|
||||
Notes: <<recalls.recallnotes>>', 'print')
|
||||
});
|
||||
|
||||
NewVersion( $DBversion, 19532, "Add recalls notices: RETURN_RECALLED_ITEM, PICKUP_RECALLED_ITEM, RECALL_REQUESTER_DET" );
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
$DBversion = 'XXX';
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
$dbh->do(q{
|
||||
INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES
|
||||
('RecallsLog','1',NULL,'If ON, log create/cancel/expire/fulfill actions on recalls','YesNo'),
|
||||
('RecallsMaxPickUpDelay','7',NULL,'Define the maximum time a recall can be awaiting pickup','Integer'),
|
||||
('UseRecalls','0',NULL,'Enable or disable recalls','YesNo')
|
||||
});
|
||||
|
||||
NewVersion( $DBversion, 19532, "Add RecallsLog, RecallsMaxPickUpDelay and UseRecalls system preferences");
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
$DBversion = 'XXX';
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
$dbh->do(q{ DROP TABLE IF EXISTS recalls });
|
||||
$dbh->do(q{
|
||||
CREATE TABLE recalls (
|
||||
recall_id int(11) NOT NULL auto_increment,
|
||||
borrowernumber int(11) NOT NULL DEFAULT 0,
|
||||
recalldate datetime DEFAULT NULL,
|
||||
biblionumber int(11) NOT NULL DEFAULT 0,
|
||||
branchcode varchar(10) DEFAULT NULL,
|
||||
cancellationdate datetime DEFAULT NULL,
|
||||
recallnotes mediumtext,
|
||||
priority smallint(6) DEFAULT NULL,
|
||||
status varchar(1) DEFAULT NULL,
|
||||
timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
itemnumber int(11) DEFAULT NULL,
|
||||
waitingdate datetime DEFAULT NULL,
|
||||
expirationdate datetime DEFAULT NULL,
|
||||
old TINYINT(1) DEFAULT NULL,
|
||||
item_level_recall TINYINT(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (recall_id),
|
||||
KEY borrowernumber (borrowernumber),
|
||||
KEY biblionumber (biblionumber),
|
||||
KEY itemnumber (itemnumber),
|
||||
KEY branchcode (branchcode),
|
||||
CONSTRAINT recalls_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT recalls_ibfk_2 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT recalls_ibfk_3 FOREIGN KEY (itemnumber) REFERENCES items (itemnumber) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT recalls_ibfk_4 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
});
|
||||
|
||||
NewVersion( $DBversion, 19532, "Add recalls table" );
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
use Modern::Perl;
|
||||
|
||||
return {
|
||||
bug_number => "19532",
|
||||
description => "Make recalls.status an enum",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ($dbh) = @$args{qw(dbh)};
|
||||
|
||||
$dbh->do(q{
|
||||
ALTER TABLE recalls
|
||||
MODIFY COLUMN
|
||||
status ENUM('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested' COMMENT "Request status"
|
||||
});
|
||||
},
|
||||
};
|
99
installer/data/mysql/db_revs/211200018.pl
Executable file
99
installer/data/mysql/db_revs/211200018.pl
Executable file
|
@ -0,0 +1,99 @@
|
|||
use Modern::Perl;
|
||||
|
||||
return {
|
||||
bug_number => "19532",
|
||||
description => "Add Recalls",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ($dbh, $out) = @$args{qw(dbh out)};
|
||||
|
||||
unless( TableExists('recalls') ) {
|
||||
|
||||
# Add recalls table
|
||||
$dbh->do(q{
|
||||
CREATE TABLE recalls (
|
||||
recall_id int(11) NOT NULL auto_increment,
|
||||
borrowernumber int(11) NOT NULL DEFAULT 0,
|
||||
recalldate datetime DEFAULT NULL,
|
||||
biblionumber int(11) NOT NULL DEFAULT 0,
|
||||
branchcode varchar(10) DEFAULT NULL,
|
||||
cancellationdate datetime DEFAULT NULL,
|
||||
recallnotes mediumtext,
|
||||
priority smallint(6) DEFAULT NULL,
|
||||
status status ENUM('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested',
|
||||
timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
itemnumber int(11) DEFAULT NULL,
|
||||
waitingdate datetime DEFAULT NULL,
|
||||
expirationdate datetime DEFAULT NULL,
|
||||
old TINYINT(1) DEFAULT NULL,
|
||||
item_level_recall TINYINT(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (recall_id),
|
||||
KEY borrowernumber (borrowernumber),
|
||||
KEY biblionumber (biblionumber),
|
||||
KEY itemnumber (itemnumber),
|
||||
KEY branchcode (branchcode),
|
||||
CONSTRAINT recalls_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT recalls_ibfk_2 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT recalls_ibfk_3 FOREIGN KEY (itemnumber) REFERENCES items (itemnumber) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT recalls_ibfk_4 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
});
|
||||
|
||||
# Add RecallsLog, RecallsMaxPickUpDelay and UseRecalls system preferences
|
||||
$dbh->do(q{
|
||||
INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES
|
||||
('RecallsLog','1',NULL,'If ON, log create/cancel/expire/fulfill actions on recalls','YesNo'),
|
||||
('RecallsMaxPickUpDelay','7',NULL,'Define the maximum time a recall can be awaiting pickup','Integer'),
|
||||
('UseRecalls','0',NULL,'Enable or disable recalls','YesNo')
|
||||
});
|
||||
|
||||
# Add recalls notices: RETURN_RECALLED_ITEM, PICKUP_RECALLED_ITEM, RECALL_REQUESTER_DET
|
||||
$dbh->do(q{
|
||||
INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`) VALUES
|
||||
('circulation','RETURN_RECALLED_ITEM','','Notification to return a recalled item','0','Notification to return a recalled item','Date: <<today>>
|
||||
|
||||
<<borrowers.firstname>> <<borrowers.surname>>,
|
||||
|
||||
A recall has been placed on the following item: <<biblio.title>> / <<biblio.author>> (<<items.barcode>>). The due date has been updated, and is now <<issues.date_due>>. Please return the item before the due date.
|
||||
|
||||
Thank you!','email'),
|
||||
('circulation','PICKUP_RECALLED_ITEM','','Recalled item awaiting pickup','0','Recalled item awaiting pickup','Date: <<today>>
|
||||
|
||||
<<borrowers.firstname>> <<borrowers.surname>>,
|
||||
|
||||
A recall that you requested on the following item: <<biblio.title>> / <<biblio.author>> (<<items.barcode>>) is now ready for you to pick up at <<recalls.branchcode>>. Please pick up your item by <<recalls.expirationdate>>.
|
||||
|
||||
Thank you!','email'),
|
||||
('circulation','RECALL_REQUESTER_DET','','Details of patron who recalled item',0,'Details of patron who recalled item','Date: <<today>>
|
||||
|
||||
Recall for pickup at <<branches.branchname>>
|
||||
<<borrowers.surname>>, <<borrowers.firstname>> (<<borrowers.cardnumber>>)
|
||||
<<borrowers.phone>>
|
||||
<<borrowers.streetnumber>> <<borrowers.address>>, <<borrowers.address2>>, <<borrowers.city>> <<borrowers.zipcode>>
|
||||
<<borrowers.email>>
|
||||
|
||||
ITEM RECALLED
|
||||
<<biblio.title>> by <<biblio.author>>
|
||||
Barcode: <<items.barcode>>
|
||||
Callnumber: <<items.itemcallnumber>>
|
||||
Waiting since: <<recalls.waitingdate>>
|
||||
Notes: <<recalls.recallnotes>>', 'print')
|
||||
});
|
||||
|
||||
# Add recalls user flag and manage_recalls user permission
|
||||
$dbh->do(q{
|
||||
INSERT IGNORE INTO userflags (bit, flag, flagdesc, defaulton) VALUES (27, 'recalls', 'Recalls', 0)
|
||||
});
|
||||
$dbh->do(q{
|
||||
INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (27, 'manage_recalls', 'Manage recalls for patrons')
|
||||
});
|
||||
|
||||
# Add Recall and CancelReserve ENUM options to branchtransfers.reason
|
||||
$dbh->do(q{
|
||||
ALTER TABLE branchtransfers MODIFY COLUMN reason
|
||||
ENUM('Manual', 'StockrotationAdvance', 'StockrotationRepatriation', 'ReturnToHome', 'ReturnToHolding', 'RotatingCollection', 'Reserve', 'LostReserve', 'CancelReserve', 'Recall', 'CancelRecall')
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Reference in a new issue