Browse Source

Bug 19532: Database and installer stuff

- Add recalls table
- Add recalls circulation rules - recalls allowed, recalls per record, on shelf recalls, recall due date interval, recall overdue fine, recall shelf time
- Add system preferences - useRecalls, RecallsMaxPickUpDelay, RecallsLog
- Add email notices (RETURN_RECALLED_ITEM, PICKUP_RECALLED_ITEM)
- Add print notice (RECALL_REQUESTER_DET)
- Add user permission - recalls, manage_recalls
- Add Recall and CancelRecall enum options for branchtransfers reason

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
22.05.x
Aleisha Amohia 4 years ago
committed by Fridolin Somers
parent
commit
53aa7b523b
  1. 1
      C4/Auth.pm
  2. 1
      C4/InstallAuth.pm
  3. 18
      Koha/CirculationRules.pm
  4. 1
      Makefile.PL
  5. 18
      admin/smart-rules.pl
  6. 6
      installer/data/mysql/atomicupdate/bug_19532-add_recalls_enum_branchtransfers.perl
  7. 7
      installer/data/mysql/atomicupdate/bug_19532-add_recalls_flags.perl
  8. 36
      installer/data/mysql/atomicupdate/bug_19532-add_recalls_notices.perl
  9. 11
      installer/data/mysql/atomicupdate/bug_19532-add_recalls_sysprefs.perl
  10. 34
      installer/data/mysql/atomicupdate/bug_19532-add_recalls_table.perl
  11. 58
      installer/data/mysql/en/mandatory/sample_notices.yml
  12. 30
      installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql
  13. 36
      installer/data/mysql/kohastructure.sql
  14. 4
      installer/data/mysql/mandatory/sysprefs.sql
  15. 3
      installer/data/mysql/mandatory/userflags.sql
  16. 3
      installer/data/mysql/mandatory/userpermissions.sql
  17. 6
      installer/onboarding.pl
  18. 9
      koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc
  19. 13
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
  20. 7
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref
  21. 51
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt

1
C4/Auth.pm

@ -347,6 +347,7 @@ sub get_template_and_user {
$template->param( CAN_user_stockrotation => 1 );
$template->param( CAN_user_cash_management => 1 );
$template->param( CAN_user_problem_reports => 1 );
$template->param( CAN_user_recalls => 1 );
foreach my $module ( keys %$all_perms ) {
foreach my $subperm ( keys %{ $all_perms->{$module} } ) {

1
C4/InstallAuth.pm

@ -142,6 +142,7 @@ sub get_template_and_user {
$template->param( CAN_user_serials => 1 );
$template->param( CAN_user_reports => 1 );
$template->param( CAN_user_problem_reports => 1 );
$template->param( CAN_user_recalls => 1 );
}
my $minPasswordLength = C4::Context->preference('minPasswordLength');

18
Koha/CirculationRules.pm

@ -177,6 +177,24 @@ our $RULE_KINDS = {
decreaseloanholds => {
scope => [ 'branchcode', 'categorycode', 'itemtype' ],
},
recalls_allowed => {
scope => [ 'branchcode', 'categorycode', 'itemtype' ],
},
recalls_per_record => {
scope => [ 'branchcode', 'categorycode', 'itemtype' ],
},
on_shelf_recalls => {
scope => [ 'branchcode', 'categorycode', 'itemtype' ],
},
recall_due_date_interval => {
scope => [ 'branchcode', 'categorycode', 'itemtype' ],
},
recall_overdue_fine => {
scope => [ 'branchcode', 'categorycode', 'itemtype' ],
},
recall_shelf_time => {
scope => [ 'branchcode', 'categorycode', 'itemtype' ],
},
# Not included (deprecated?):
# * accountsent
# * reservecharge

1
Makefile.PL

@ -352,6 +352,7 @@ my $target_map = {
'./patron_lists' => 'INTRANET_CGI_DIR',
'./plugins' => 'INTRANET_CGI_DIR',
'./pos' => 'INTRANET_CGI_DIR',
'./recalls' => 'INTRANET_CGI_DIR',
'./reports' => 'INTRANET_CGI_DIR',
'./reserve' => 'INTRANET_CGI_DIR',
'./reviews' => 'INTRANET_CGI_DIR',

18
admin/smart-rules.pl

@ -109,6 +109,12 @@ if ($op eq 'delete') {
cap_fine_to_replacement_price => undef,
article_requests => undef,
note => undef,
recalls_allowed => undef,
recalls_per_record => undef,
on_shelf_recalls => undef,
recall_due_date_interval => undef,
recall_overdue_fine => undef,
recall_shelf_time => undef,
}
}
);
@ -287,6 +293,12 @@ elsif ($op eq 'add') {
my $cap_fine_to_replacement_price = ($input->param('cap_fine_to_replacement_price') || '') eq 'on';
my $note = $input->param('note');
my $decreaseloanholds = $input->param('decreaseloanholds') || undef;
my $recalls_allowed = $input->param('recalls_allowed');
my $recalls_per_record = $input->param('recalls_per_record');
my $on_shelf_recalls = $input->param('on_shelf_recalls');
my $recall_due_date_interval = $input->param('recall_due_date_interval');
my $recall_overdue_fine = $input->param('recall_overdue_fine');
my $recall_shelf_time = $input->param('recall_shelf_time');
my $rules = {
maxissueqty => $maxissueqty,
@ -321,6 +333,12 @@ elsif ($op eq 'add') {
article_requests => $article_requests,
note => $note,
decreaseloanholds => $decreaseloanholds,
recalls_allowed => $recalls_allowed,
recalls_per_record => $recalls_per_record,
on_shelf_recalls => $on_shelf_recalls,
recall_due_date_interval => $recall_due_date_interval,
recall_overdue_fine => $recall_overdue_fine,
recall_shelf_time => $recall_shelf_time,
};
Koha::CirculationRules->set_rules(

6
installer/data/mysql/atomicupdate/bug_19532-add_recalls_enum_branchtransfers.perl

@ -0,0 +1,6 @@
$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" );
}

7
installer/data/mysql/atomicupdate/bug_19532-add_recalls_flags.perl

@ -0,0 +1,7 @@
$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" );
}

36
installer/data/mysql/atomicupdate/bug_19532-add_recalls_notices.perl

@ -0,0 +1,36 @@
$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" );
}

11
installer/data/mysql/atomicupdate/bug_19532-add_recalls_sysprefs.perl

@ -0,0 +1,11 @@
$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");
}

34
installer/data/mysql/atomicupdate/bug_19532-add_recalls_table.perl

@ -0,0 +1,34 @@
$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" );
}

58
installer/data/mysql/en/mandatory/sample_notices.yml

@ -1576,3 +1576,61 @@ tables:
- "This item must be renewed at the library."
- "[% END %]"
- "[% END %]"
- module: circulation
code: RETURN_RECALLED_ITEM
branchcode: ""
name: "Notification to return a recalled item"
is_html: 0
title: "Notification to return a recalled item"
message_transport_type: email
lang: default
content:
- "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!"
- module: circulation
code: PICKUP_RECALLED_ITEM
branchcode: ""
name: "Recalled item awaiting pickup"
is_html: 0
title: "Recalled item awaiting pickup"
message_transport_type: email
lang: default
content:
- "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!"
- module: circulation
code: RECALL_REQUESTER_DET
branchcode: ""
name: "Details of patron who recalled item"
is_html: 0
title: "Details of patron who recalled item"
message_transport_type: print
lang: default
content:
- "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>>"

30
installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql

@ -217,7 +217,35 @@ INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`
('circulation', 'AR_SLIP', '', 'Article request - print slip', 0, 'Article request', 'Article request:\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>),\r\n\r\nTitle: <<biblio.title>>\r\nBarcode: <<items.barcode>>\r\n\r\nArticle requested:\r\nTitle: <<article_requests.title>>\r\nAuthor: <<article_requests.author>>\r\nVolume: <<article_requests.volume>>\r\nIssue: <<article_requests.issue>>\r\nDate: <<article_requests.date>>\r\nPages: <<article_requests.pages>>\r\nChapters: <<article_requests.chapters>>\r\nNotes: <<article_requests.patron_notes>>\r\nFormat: [% IF article_request.format == \'PHOTOCOPY\' %]Copy[% ELSIF article_request.format == \'SCAN\' %]Scan[% END %]\r\n', 'print'),
('circulation', 'AR_PROCESSING', '', 'Article request - processing', 0, 'Article request processing', 'Dear <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>),\r\n\r\nWe are now processing your request for an article from <<biblio.title>> (<<items.barcode>>).\r\n\r\nArticle requested:\r\nTitle: <<article_requests.title>>\r\nAuthor: <<article_requests.author>>\r\nVolume: <<article_requests.volume>>\r\nIssue: <<article_requests.issue>>\r\nDate: <<article_requests.date>>\r\nPages: <<article_requests.pages>>\r\nChapters: <<article_requests.chapters>>\r\nNotes: <<article_requests.patron_notes>>\r\nFormat: [% IF article_request.format == \'PHOTOCOPY\' %]Copy[% ELSIF article_request.format == \'SCAN\' %]Scan[% END %]\r\n\r\nThank you!', 'email'),
('circulation', 'AR_REQUESTED', '', 'Article request - new', 0, 'Article request received', 'Dear <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>),\r\n\r\nWe have received your request for an article from <<biblio.title>> (<<items.barcode>>)..\r\n\r\nArticle requested:\r\nTitle: <<article_requests.title>>\r\nAuthor: <<article_requests.author>>\r\nVolume: <<article_requests.volume>>\r\nIssue: <<article_requests.issue>>\r\nDate: <<article_requests.date>>\r\nPages: <<article_requests.pages>>\r\nChapters: <<article_requests.chapters>>\r\nNotes: <<article_requests.patron_notes>>\r\nFormat: [% IF article_request.format == \'PHOTOCOPY\' %]Copy[% ELSIF article_request.format == \'SCAN\' %]Scan[% END %]\r\n\r\nThank you!', 'email'),
('circulation', 'CHECKOUT_NOTE', '', 'Checkout note on item set by patron', '0', 'Checkout note', '<<borrowers.firstname>> <<borrowers.surname>> has added a note to the item <<biblio.title>> - <<biblio.author>> (<<biblio.biblionumber>>).','email');
('circulation', 'CHECKOUT_NOTE', '', 'Checkout note on item set by patron', '0', 'Checkout note', '<<borrowers.firstname>> <<borrowers.surname>> has added a note to the item <<biblio.title>> - <<biblio.author>> (<<biblio.biblionumber>>).','email'),
('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,'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');
INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES
('circulation', 'ACCOUNT_PAYMENT', '', 'Account payment', 0, 'Account payment', '[%- USE Price -%]\r\nA payment of [% credit.amount * -1 | $Price %] has been applied to your account.\r\n\r\nThis payment affected the following fees:\r\n[%- FOREACH o IN offsets %]\r\nDescription: [% o.debit.description %]\r\nAmount paid: [% o.amount * -1 | $Price %]\r\nAmount remaining: [% o.debit.amountoutstanding | $Price %]\r\n[% END %]', 'email', 'default'),

36
installer/data/mysql/kohastructure.sql

@ -1554,8 +1554,8 @@ CREATE TABLE `branchtransfers` (
`datecancelled` datetime DEFAULT NULL COMMENT 'the date the transfer was cancelled',
`tobranch` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the branch the transfer was going to',
`comments` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any comments related to the transfer',
`reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'what triggered the transfer',
`cancellation_reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','ItemLost','WrongTransfer') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'what triggered the transfer cancellation',
`reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','CancelRecall') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'what triggered the transfer',
`cancellation_reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','ItemLost', 'WrongTransfer','Recall','CancelRecall') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'what triggered the transfer cancellation',
PRIMARY KEY (`branchtransfer_id`),
KEY `frombranch` (`frombranch`),
KEY `tobranch` (`tobranch`),
@ -4277,6 +4277,38 @@ CREATE TABLE `ratings` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `recalls`
--
DROP TABLE IF EXISTS recalls;
CREATE TABLE recalls ( -- information related to recalls in Koha
recall_id int(11) NOT NULL auto_increment, -- primary key
borrowernumber int(11) NOT NULL DEFAULT 0, -- foreign key from the borrowers table defining which patron requested a recall
recalldate datetime DEFAULT NULL, -- the date the recall request was placed
biblionumber int(11) NOT NULL DEFAULT 0, -- foreign key from the biblio table defining which bib record this request is for
branchcode varchar(10) DEFAULT NULL, -- foreign key from the branches table defining which branch the patron wishes to pick up their recall from
cancellationdate datetime DEFAULT NULL, -- the date this recall was cancelled
recallnotes mediumtext, -- notes related to this recall
priority smallint(6) DEFAULT NULL, -- where in the queue the patron sits
status varchar(1) DEFAULT NULL, -- a one letter code defining the status of the recall. R=requested, O=overdue, W=awaiting pickup, T=in transit, E=expired, C=cancelled, F=finished/completed
timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- the date and time this recall was last updated
itemnumber int(11) DEFAULT NULL, -- foreign key from the items table defining the specific item the recall request was placed on
waitingdate datetime DEFAULT NULL, -- the date the item was marked as waiting for the patron at the library
expirationdate datetime DEFAULT NULL, -- the date the recall expires
old TINYINT(1) DEFAULT NULL, -- flag if the recall is old and no longer active, i.e. expired, cancelled or completed
item_level_recall TINYINT(1) NOT NULL DEFAULT 0, -- flag if item-level recall
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;
--
-- Table structure for table `repeatable_holidays`
--

4
installer/data/mysql/mandatory/sysprefs.sql

@ -549,7 +549,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('QueryWeightFields','1',NULL,'If ON, enables field weighting','YesNo'),
('QuoteOfTheDay','','intranet,opac','Enable or disable display of Quote of the Day on the OPAC and staff interface home page','multiple'),
('RandomizeHoldsQueueWeight','0',NULL,'if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight','YesNo'),
('RecordStaffUserOnCheckout','0',NULL,'If ON, when an item is checked out, the user who checked out the item is recorded','YesNo'),
('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'),
('RecordLocalUseOnReturn','0',NULL,'If ON, statistically record returns of unissued items as local use, instead of return','YesNo'),
('Reference_NFL_Statuses','1|2',NULL,'Contains not for loan statuses considered as available for reference','Free'),
('RefundLostOnReturnControl','CheckinLibrary','CheckinLibrary|ItemHomeBranch|ItemHoldingBranch','If a lost item is returned, choose which branch to pick rules for refunding.','Choice'),
@ -722,6 +723,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('useDischarge','0','','Allows librarians to discharge borrowers and borrowers to request a discharge','YesNo'),
('UseEmailReceipts','0','','Send email receipts for payments and write-offs','YesNo'),
('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'),
('UseRecalls','0',NULL,'Enable or disable recalls','YesNo'),
('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'),
('viewISBD','1','','Allow display of ISBD view of bibiographic records','YesNo'),

3
installer/data/mysql/mandatory/userflags.sql

@ -23,5 +23,6 @@ INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES
(23,'self_check','Self check modules',0),
(24, 'stockrotation', 'Manage stockrotation operations', 0),
(25, 'cash_management', 'Cash management', 0),
(26, 'problem_reports', 'Manage problem reports', 0)
(26, 'problem_reports', 'Manage problem reports', 0),
(27, 'recalls', 'Recalls', 0)
;

3
installer/data/mysql/mandatory/userpermissions.sql

@ -137,5 +137,6 @@ INSERT INTO permissions (module_bit, code, description) VALUES
(25, 'anonymous_refund', 'Perform refund actions from cash registers'),
(25, 'cashup', 'Perform cash register cashup action'),
(25, 'takepayment', 'Access the point of sale page and take payments'),
(26, 'manage_problem_reports', 'Manage OPAC problem reports')
(26, 'manage_problem_reports', 'Manage OPAC problem reports'),
(27, 'manage_recalls', 'Manage recalls for patrons')
;

6
installer/onboarding.pl

@ -288,6 +288,12 @@ if ( $step == 5 ) {
reservesallowed => $reservesallowed,
suspension_chargeperiod => undef,
decreaseloanholds => undef,
recalls_allowed => undef,
recalls_per_record => undef,
on_shelf_recalls => undef,
recall_due_date_interval => undef,
recall_overdue_fine => undef,
recall_shelf_time => undef,
}
};

9
koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc

@ -75,6 +75,9 @@
[%- CASE 'problem_reports' -%]
<span class="main_permission problem_reports_permission">OPAC problem reports management</span>
<span class="permissioncode">([% name | html %])</span>
[%- CASE 'recalls' -%]
<span class="main_permission recalls_permission">Recalls</span>
<span class="permissioncode">([% name | html %])</span>
[%- END -%]
[%- END -%]
@ -783,5 +786,11 @@
Manage OPAC problem reports
</span>
<span class="permissioncode">([% name | html %])</span>
[%# recalls %]
[%- CASE 'manage_recalls' -%]
<span class="sub_permission place_recalls_subpermission">
Manage recalls for patrons
</span>
<span class="permissioncode">([% name | html %])</span>
[%- END -%]
[%- END -%]

13
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref

@ -1271,3 +1271,16 @@ Circulation:
class: integer
- days.
- <span class="hint">This system preference is used by the cleanup_database.pl cronjob.</span>
Recalls:
-
- Mark a recall as problematic if it has been waiting to be picked up for
- pref: RecallsMaxPickUpDelay
- class: integer
- days.
-
- pref: UseRecalls
choices:
yes: Use
no: "Don't use"
- recalls. Make sure you configure <a href="/cgi-bin/koha/admin/smart-rules.pl">circulation and fines rules</a> for recalls once enabled.

7
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref

@ -108,6 +108,13 @@ Logging:
1: Log
0: "Don't log"
- " changes to news entries and other contents managed in the news tool."
-
- pref: RecallsLog
choices:
on: Log
off: "Don't log"
- any actions on recalls (create, cancel, expire, fulfill).
Debugging:
-
- pref: DumpTemplateVarsIntranet

51
koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt

@ -142,6 +142,14 @@
<th>OPAC item level holds</th>
<th>Article requests</th>
<th>Rental discount (%)</th>
[% IF Koha.Preference('UseRecalls') %]
<th>Recalls allowed (total)</th>
<th>Recalls per record (count)</th>
<th>On shelf recalls allowed</th>
<th>Recall due date interval (day)</th>
<th>Recall overdue fine amount</th>
<th>Recall pickup period (day)</th>
[% END %]
<th class="noExport">Actions</th>
</tr>
</thead>
@ -183,8 +191,14 @@
[% SET article_requests = all_rules.$c.$i.article_requests %]
[% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
[% SET decreaseloanholds = all_rules.$c.$i.decreaseloanholds %]
[% SET recalls_allowed = all_rules.$c.$i.recalls_allowed %]
[% SET recalls_per_record = all_rules.$c.$i.recalls_per_record %]
[% SET on_shelf_recalls = all_rules.$c.$i.on_shelf_recalls %]
[% SET recall_due_date_interval = all_rules.$c.$i.recall_due_date_interval %]
[% SET recall_overdue_fine = all_rules.$c.$i.recall_overdue_fine %]
[% SET recall_shelf_time = all_rules.$c.$i.recall_shelf_time %]
[% SET show_rule = note || maxissueqty || maxonsiteissueqty || issuelength || daysmode || lengthunit || hardduedate || hardduedatecompare || fine || chargeperiod || chargeperiod_charge_at || firstremind || overduefinescap || cap_fine_to_replacement_price || finedays || maxsuspensiondays || suspension_chargeperiod || renewalsallowed || unseenrenewalsallowed || renewalperiod || norenewalbefore || auto_renew || no_auto_renewal_after || no_auto_renewal_after_hard_limit || reservesallowed || holds_per_day || holds_per_record || onshelfholds || opacitemholds || article_requests || rentaldiscount || decreaseloanholds %]
[% SET show_rule = note || maxissueqty || maxonsiteissueqty || issuelength || daysmode || lengthunit || hardduedate || hardduedatecompare || fine || chargeperiod || chargeperiod_charge_at || firstremind || overduefinescap || cap_fine_to_replacement_price || finedays || maxsuspensiondays || suspension_chargeperiod || renewalsallowed || unseenrenewalsallowed || renewalperiod || norenewalbefore || auto_renew || no_auto_renewal_after || no_auto_renewal_after_hard_limit || reservesallowed || holds_per_day || holds_per_record || onshelfholds || opacitemholds || article_requests || rentaldiscount || decreaseloanholds || recalls_allowed || recalls_per_record || on_shelf_recalls || recall_due_date_interval || recall_overdue_fine || recall_shelf_time %]
[% IF show_rule %]
[% SET row_count = row_count + 1 %]
<tr row_countd="row_[% row_count | html %]">
@ -344,6 +358,20 @@
[% END %]
</td>
<td>[% rentaldiscount | html %]</td>
[% IF Koha.Preference('UseRecalls') %]
<td>[% recalls_allowed | html %]</td>
<td>[% recalls_per_record | html %]</td>
<td>
[% IF on_shelf_recalls == 'all' %]
<span>If all unavailable</span>
[% ELSE %]
<span>If any unavailable</span>
[% END %]
</td>
<td>[% recall_due_date_interval | html %]</td>
<td>[% recall_overdue_fine FILTER format("%.2f") %]</td>
<td>[% recall_shelf_time | html %]</td>
[% END %]
<td class="actions">
<a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
<a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% i || '*' | uri %]&amp;categorycode=[% c || '*' | uri %]&amp;branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
@ -473,6 +501,19 @@
</select>
</td>
<td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
[% IF Koha.Preference('UseRecalls') %]
<td><input type="text" name="recalls_allowed" id="recalls_allowed" size="3"></td>
<td><input type="text" name="recalls_per_record" id="recalls_per_record" size="3"></td>
<td>
<select name="on_shelf_recalls" id="on_shelf_recalls">
<option value="any">If any unavailable</option>
<option value="all">If all unavailable</option>
</select>
</td>
<td><input type="text" name="recall_due_date_interval" id="recall_due_date_interval" size="3"></td>
<td><input type="text" name="recall_overdue_fine" id="recall_overdue_fine" size="6"></td>
<td><input type="text" name="recall_shelf_time" id="recall_shelf_time" size="3"></td>
[% END %]
<td class="actions">
<input type="hidden" name="branch" value="[% current_branch | html %]"/>
<button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
@ -519,6 +560,14 @@
<th>OPAC item level holds</th>
<th>Article requests</th>
<th>Rental discount (%)</th>
[% IF Koha.Preference('UseRecalls') %]
<th>Recalls allowed (total)</th>
<th>Recalls per record (count)</th>
<th>On shelf recalls allowed</th>
<th>Recall due date interval (day)</th>
<th>Recall overdue fine amount</th>
<th>Recall pickup period (day)</th>
[% END %]
<th>&nbsp;</th>
</tr>
</tfoot>

Loading…
Cancel
Save