From acd5f9ac9aa95299ac90e2f9e79143642c9ac305 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Fri, 27 Oct 2017 03:04:58 +0000 Subject: [PATCH] Bug 19532: Circulation rules Adding 3 new rules and columns to issuingrules - recall_due_date_interval - recall_overdue_fine - recall_shelf_time Signed-off-by: Nick Clemens --- Koha/Schema/Result/Issuingrule.pm | 22 ++++++++++++++++++++++ admin/smart-rules.pl | 8 +++++++- .../bug_19532_-_adding_recalls_circ_rules.perl | 15 +++++++++++++++ .../prog/en/modules/admin/smart-rules.tt | 13 +++++++++++++ 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_19532_-_adding_recalls_circ_rules.perl diff --git a/Koha/Schema/Result/Issuingrule.pm b/Koha/Schema/Result/Issuingrule.pm index f1470b9..a180057 100644 --- a/Koha/Schema/Result/Issuingrule.pm +++ b/Koha/Schema/Result/Issuingrule.pm @@ -226,6 +226,22 @@ __PACKAGE__->table("issuingrules"); extra: {list => ["no","yes","bib_only","item_only"]} is_nullable: 0 +=head2 recall_due_date_interval + + data_type: 'integer' + is_nullable: 1 + +=head2 recall_overdue_fine + + data_type: 'decimal' + is_nullable: 1 + size: [28,6] + +=head2 recall_shelf_time + + data_type: 'integer' + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -309,6 +325,12 @@ __PACKAGE__->add_columns( extra => { list => ["no", "yes", "bib_only", "item_only"] }, is_nullable => 0, }, + "recall_due_date_interval", + { data_type => "integer", is_nullable => 1 }, + "recall_overdue_fine", + { data_type => "decimal", is_nullable => 1, size => [28, 6] }, + "recall_shelf_time", + { data_type => "integer", is_nullable => 1 }, ); =head1 PRIMARY KEY diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 4975254..eb698dd 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -177,7 +177,7 @@ elsif ($op eq 'add') { $issuelength = $issuelength eq q{} ? undef : $issuelength; my $lengthunit = $input->param('lengthunit'); my $hardduedate = $input->param('hardduedate') || undef; - $hardduedate = eval { dt_from_string( $input->param('hardduedate') ) } if ( $hardduedate ); + $hardduedate = eval { dt_from_string( scalar $input->param('hardduedate') ) } if ( $hardduedate ); $hardduedate = output_pref( { dt => $hardduedate, dateonly => 1, dateformat => 'iso' } ) if ( $hardduedate ); my $hardduedatecompare = $input->param('hardduedatecompare'); my $rentaldiscount = $input->param('rentaldiscount'); @@ -185,6 +185,9 @@ elsif ($op eq 'add') { my $article_requests = $input->param('article_requests') || 'no'; my $overduefinescap = $input->param('overduefinescap') || undef; my $cap_fine_to_replacement_price = $input->param('cap_fine_to_replacement_price') eq 'on'; + 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'); $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price"; my $params = { @@ -219,6 +222,9 @@ elsif ($op eq 'add') { overduefinescap => $overduefinescap, cap_fine_to_replacement_price => $cap_fine_to_replacement_price, article_requests => $article_requests, + recall_due_date_interval => $recall_due_date_interval, + recall_overdue_fine => $recall_overdue_fine, + recall_shelf_time => $recall_shelf_time, }; my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype, branchcode => $br}); diff --git a/installer/data/mysql/atomicupdate/bug_19532_-_adding_recalls_circ_rules.perl b/installer/data/mysql/atomicupdate/bug_19532_-_adding_recalls_circ_rules.perl new file mode 100644 index 0000000..3cf6a20 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_19532_-_adding_recalls_circ_rules.perl @@ -0,0 +1,15 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + unless( column_exists( 'issuingrules', 'recall_due_date_interval' ) ) { + $dbh->do(q|ALTER TABLE issuingrules ADD recall_due_date_interval int(11) default NULL AFTER note|); + } + unless( column_exists( 'issuingrules', 'recall_overdue_fine' ) ) { + $dbh->do(q|ALTER TABLE issuingrules ADD recall_overdue_fine decimal(28,6) default NULL AFTER recall_due_date_interval|); + } + unless( column_exists( 'issuingrules', 'recall_shelf_time' ) ) { + $dbh->do(q|ALTER TABLE issuingrules ADD recall_shelf_time int(11) default NULL AFTER recall_overdue_fine|); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 19532: Add columns issuingrules.recall_due_date_interval, issuingrules.recall_overdue_fine and issuingrules.recall_shelf_time)\n"; +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt index 672a55f..1426474 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -95,6 +95,9 @@ Holds per record (count) On shelf holds allowed Item level holds + Recall due date interval (days) + Recall overdue fine amount + Recall pickup period (days) Article requests Rental discount (%) Actions @@ -211,6 +214,10 @@ Don't allow [% END %] + [% IF rule.opacitemholds == 'F'%]Force[% ELSIF rule.opacitemholds == 'Y'%]Allow[% ELSE %]Don't allow[% END %] + [% rule.recall_due_date_interval %] + [% rule.recall_overdue_fine FILTER format("%.2f") %] + [% rule.recall_shelf_time %] [% IF rule.article_requests == 'no' %] No @@ -315,6 +322,9 @@ + + +