From 28495793ea91ed76a20b6691bd83566df3ef3eb6 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 --- Koha/Schema/Result/Issuingrule.pm | 26 ++++++++++++++++++++-- admin/smart-rules.pl | 8 ++++++- .../bug_19532_-_adding_recalls_circ_rules.perl | 15 +++++++++++++ .../prog/en/modules/admin/smart-rules.tt | 14 +++++++++++- 4 files changed, 59 insertions(+), 4 deletions(-) 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 b677b15..bc066ee 100644 --- a/Koha/Schema/Result/Issuingrule.pm +++ b/Koha/Schema/Result/Issuingrule.pm @@ -221,6 +221,22 @@ __PACKAGE__->table("issuingrules"); is_nullable: 1 size: 100 +=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( @@ -302,6 +318,12 @@ __PACKAGE__->add_columns( }, "note", { data_type => "varchar", is_nullable => 1, size => 100 }, + "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 @@ -321,8 +343,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype"); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-10-27 00:07:53 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2+Buk29soRlr1o0CaAIGWA +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-10-27 03:00:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1EXjmhkG47JNAOshMjdRqg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 6a55b7b..ccb86c8 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -152,7 +152,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'); @@ -160,6 +160,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 = { @@ -192,6 +195,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 5bc44ba..575106e 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 @@ -192,6 +192,9 @@ $(document).ready(function() { 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 @@ -286,6 +289,9 @@ $(document).ready(function() { If any unavailable [% 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 @@ -388,6 +394,9 @@ $(document).ready(function() { + + +