From e6ca0a3c132d246e665df340f62fc24775026a5b Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 5 Apr 2017 05:10:14 +0000 Subject: [PATCH] Bug 12365: Adding a note column to circ rules This patch adds a note column to the circ and fine rules to act as a description line for the rule. To test: 1) Apply patch, update database (may have to also update schema) 2) Go to Admin -> Circ and fine rules 3) Scroll to the right, notice new Note column 4) Confirm it works to create a brand new rule with a Note 5) Confirm it works to modify an existing rule with a Note Sponsored-by: Catalyst IT --- Koha/Schema/Result/Issuingrule.pm | 12 ++++++++++-- admin/smart-rules.pl | 2 ++ .../bug_12365_-_add_note_column_to_issuingrules.perl | 9 +++++++++ installer/data/mysql/kohastructure.sql | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt | 4 ++++ 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_12365_-_add_note_column_to_issuingrules.perl diff --git a/Koha/Schema/Result/Issuingrule.pm b/Koha/Schema/Result/Issuingrule.pm index 62f35f2..60c2e09 100644 --- a/Koha/Schema/Result/Issuingrule.pm +++ b/Koha/Schema/Result/Issuingrule.pm @@ -209,6 +209,12 @@ __PACKAGE__->table("issuingrules"); extra: {list => ["no","yes","bib_only","item_only"]} is_nullable: 0 +=head2 note + + data_type: 'varchar' + is_nullable: 1 + size: 100 + =cut __PACKAGE__->add_columns( @@ -286,6 +292,8 @@ __PACKAGE__->add_columns( extra => { list => ["no", "yes", "bib_only", "item_only"] }, is_nullable => 0, }, + "note", + { data_type => "varchar", is_nullable => 1, size => 100 }, ); =head1 PRIMARY KEY @@ -305,8 +313,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype"); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-11-02 10:33:37 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:t9AhZLbm4SE7mx25LAyhGA +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-04-05 05:08:10 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Tiy5b9/0Jg3UZ42OZlSNGw # 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 ba8b5bf..a47d17b 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -157,6 +157,7 @@ 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 $note = $input->param('note'); $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price"; my $params = { @@ -188,6 +189,7 @@ elsif ($op eq 'add') { overduefinescap => $overduefinescap, cap_fine_to_replacement_price => $cap_fine_to_replacement_price, article_requests => $article_requests, + note => $note, }; my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype, branchcode => $br}); diff --git a/installer/data/mysql/atomicupdate/bug_12365_-_add_note_column_to_issuingrules.perl b/installer/data/mysql/atomicupdate/bug_12365_-_add_note_column_to_issuingrules.perl new file mode 100644 index 0000000..6b4d671 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_12365_-_add_note_column_to_issuingrules.perl @@ -0,0 +1,9 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + unless( column_exists( 'issuingrules', 'note' ) ) { + $dbh->do(q|ALTER TABLE issuingrules ADD note varchar(100) default NULL AFTER article_requests|); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 12365: Add column issuingrules.note)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 076d745..9e228c7 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -879,6 +879,7 @@ CREATE TABLE `issuingrules` ( -- circulation and fine rules onshelfholds tinyint(1) NOT NULL default 0, -- allow holds for items that are on shelf opacitemholds char(1) NOT NULL default 'N', -- allow opac users to place specific items on hold article_requests enum('no','yes','bib_only','item_only') NOT NULL DEFAULT 'no', -- allow article requests to be placed, + `note` varchar(100) default NULL, -- description of rule, reason for setting rule PRIMARY KEY (`branchcode`,`categorycode`,`itemtype`), KEY `categorycode` (`categorycode`), KEY `itemtype` (`itemtype`) 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 286b12d..24fb83a 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,7 @@ $(document).ready(function() { Item level holds Article requests Rental discount (%) + Note Actions @@ -290,6 +291,7 @@ $(document).ready(function() { [% END %] [% rule.rentaldiscount %] + [% rule.note %] Edit Delete @@ -379,6 +381,7 @@ $(document).ready(function() { + @@ -413,6 +416,7 @@ $(document).ready(function() { Item level holds Article requests Rental discount (%) + Note   -- 2.1.4