Bugzilla – Attachment 43328 Details for
Bug 14045
Add specific quotas to on-site checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 14045: Introduce the maxonsiteissueqty field as a copy of maxissueqty
PASSED-QA-Bug-14045-Introduce-the-maxonsiteissueqt.patch (text/plain), 19.20 KB, created by
Katrin Fischer
on 2015-10-12 05:55:06 UTC
(
hide
)
Description:
[PASSED QA] Bug 14045: Introduce the maxonsiteissueqty field as a copy of maxissueqty
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-10-12 05:55:06 UTC
Size:
19.20 KB
patch
obsolete
>From 79fe3d8b6cf663eeacd81b804da882da0fc68c16 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@koha-community.org> >Date: Wed, 13 May 2015 17:07:28 +0200 >Subject: [PATCH] [PASSED QA] Bug 14045: Introduce the maxonsiteissueqty field > as a copy of maxissueqty > >This patch adds the new fields maxonsiteissueqty as a copy of the >existing maxissueqty field. > >There is no brainy code here, it only adds the ability to fill the new >field from the admin interface (admin/smart-rules.pl). > >Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > admin/smart-rules.pl | 118 +++++++++++++-------- > .../prog/en/modules/admin/smart-rules.tt | 25 ++++- > 2 files changed, 97 insertions(+), 46 deletions(-) > >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 9ef6ef6..bedaef3 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -111,6 +111,7 @@ elsif ($op eq 'add') { > my $firstremind = $input->param('firstremind'); > my $chargeperiod = $input->param('chargeperiod'); > my $maxissueqty = $input->param('maxissueqty'); >+ my $maxonsiteissueqty = $input->param('maxonsiteissueqty'); > my $renewalsallowed = $input->param('renewalsallowed'); > my $renewalperiod = $input->param('renewalperiod'); > my $norenewalbefore = $input->param('norenewalbefore'); >@@ -120,6 +121,8 @@ elsif ($op eq 'add') { > my $onshelfholds = $input->param('onshelfholds') || 0; > $maxissueqty =~ s/\s//g; > $maxissueqty = undef if $maxissueqty !~ /^\d+/; >+ $maxonsiteissueqty =~ s/\s//g; >+ $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/; > my $issuelength = $input->param('issuelength'); > my $lengthunit = $input->param('lengthunit'); > my $hardduedate = $input->param('hardduedate'); >@@ -128,7 +131,7 @@ elsif ($op eq 'add') { > my $rentaldiscount = $input->param('rentaldiscount'); > my $opacitemholds = $input->param('opacitemholds') || 0; > my $overduefinescap = $input->param('overduefinescap') || undef; >- $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty"; >+ $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty"; > > my $schema = Koha::Database->new()->schema(); > my $rs = $schema->resultset('Issuingrule'); >@@ -143,6 +146,7 @@ elsif ($op eq 'add') { > firstremind => $firstremind, > chargeperiod => $chargeperiod, > maxissueqty => $maxissueqty, >+ maxonsiteissueqty => $maxonsiteissueqty, > renewalsallowed => $renewalsallowed, > renewalperiod => $renewalperiod, > norenewalbefore => $norenewalbefore, >@@ -164,10 +168,13 @@ elsif ($op eq 'add') { > elsif ($op eq "set-branch-defaults") { > my $categorycode = $input->param('categorycode'); > my $maxissueqty = $input->param('maxissueqty'); >+ my $maxonsiteissueqty = $input->param('maxonsiteissueqty'); > my $holdallowed = $input->param('holdallowed'); > my $returnbranch = $input->param('returnbranch'); > $maxissueqty =~ s/\s//g; > $maxissueqty = undef if $maxissueqty !~ /^\d+/; >+ $maxonsiteissueqty =~ s/\s//g; >+ $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/; > $holdallowed =~ s/\s//g; > $holdallowed = undef if $holdallowed !~ /^\d+/; > >@@ -175,114 +182,137 @@ elsif ($op eq "set-branch-defaults") { > my $sth_search = $dbh->prepare("SELECT count(*) AS total > FROM default_circ_rules"); > my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules >- (maxissueqty, holdallowed, returnbranch) >- VALUES (?, ?, ?)"); >+ (maxissueqty, maxonsiteissueqty, holdallowed, returnbranch) >+ VALUES (?, ?, ?, ?)"); > my $sth_update = $dbh->prepare("UPDATE default_circ_rules >- SET maxissueqty = ?, holdallowed = ?, returnbranch = ?"); >+ SET maxissueqty = ?, maxonsiteissueqty = ?, holdallowed = ?, returnbranch = ?"); > > $sth_search->execute(); > my $res = $sth_search->fetchrow_hashref(); > if ($res->{total}) { >- $sth_update->execute($maxissueqty, $holdallowed, $returnbranch); >+ $sth_update->execute($maxissueqty, $maxonsiteissueqty, $holdallowed, $returnbranch); > } else { >- $sth_insert->execute($maxissueqty, $holdallowed, $returnbranch); >+ $sth_insert->execute($maxissueqty, $maxonsiteissueqty, $holdallowed, $returnbranch); > } > } else { > my $sth_search = $dbh->prepare("SELECT count(*) AS total > FROM default_branch_circ_rules > WHERE branchcode = ?"); > my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules >- (branchcode, maxissueqty, holdallowed, returnbranch) >- VALUES (?, ?, ?, ?)"); >+ (branchcode, maxissueqty, maxonsiteissueqty, holdallowed, returnbranch) >+ VALUES (?, ?, ?, ?, ?)"); > my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules >- SET maxissueqty = ?, holdallowed = ?, returnbranch = ? >+ SET maxissueqty = ?, maxonsiteissueqty = ?, holdallowed = ?, returnbranch = ? > WHERE branchcode = ?"); > $sth_search->execute($branch); > my $res = $sth_search->fetchrow_hashref(); > if ($res->{total}) { >- $sth_update->execute($maxissueqty, $holdallowed, $returnbranch, $branch); >+ $sth_update->execute($maxissueqty, $maxonsiteissueqty, $holdallowed, $returnbranch, $branch); > } else { >- $sth_insert->execute($branch, $maxissueqty, $holdallowed, $returnbranch); >+ $sth_insert->execute($branch, $maxissueqty, $maxonsiteissueqty, $holdallowed, $returnbranch); > } > } > } > elsif ($op eq "add-branch-cat") { > my $categorycode = $input->param('categorycode'); > my $maxissueqty = $input->param('maxissueqty'); >+ my $maxonsiteissueqty = $input->param('maxonsiteissueqty'); > $maxissueqty =~ s/\s//g; > $maxissueqty = undef if $maxissueqty !~ /^\d+/; >+ $maxonsiteissueqty =~ s/\s//g; >+ $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/; > > if ($branch eq "*") { > if ($categorycode eq "*") { > my $sth_search = $dbh->prepare("SELECT count(*) AS total > FROM default_circ_rules"); >- my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules >- (maxissueqty) >- VALUES (?)"); >- my $sth_update = $dbh->prepare("UPDATE default_circ_rules >- SET maxissueqty = ?"); >+ my $sth_insert = $dbh->prepare(q| >+ INSERT INTO default_circ_rules >+ (maxissueqty, maxonsiteissueqty) >+ VALUES (?, ?) >+ |); >+ my $sth_update = $dbh->prepare(q| >+ UPDATE default_circ_rules >+ SET maxissueqty = ?, >+ maxonsiteissueqty = ? >+ |); > > $sth_search->execute(); > my $res = $sth_search->fetchrow_hashref(); > if ($res->{total}) { >- $sth_update->execute($maxissueqty); >+ $sth_update->execute($maxissueqty, $maxonsiteissueqty); > } else { >- $sth_insert->execute($maxissueqty); >+ $sth_insert->execute($maxissueqty, $maxonsiteissueqty); > } > } else { > my $sth_search = $dbh->prepare("SELECT count(*) AS total > FROM default_borrower_circ_rules > WHERE categorycode = ?"); >- my $sth_insert = $dbh->prepare("INSERT INTO default_borrower_circ_rules >- (categorycode, maxissueqty) >- VALUES (?, ?)"); >- my $sth_update = $dbh->prepare("UPDATE default_borrower_circ_rules >- SET maxissueqty = ? >- WHERE categorycode = ?"); >+ my $sth_insert = $dbh->prepare(q| >+ INSERT INTO default_borrower_circ_rules >+ (categorycode, maxissueqty, maxonsiteissueqty) >+ VALUES (?, ?, ?) >+ |); >+ my $sth_update = $dbh->prepare(q| >+ UPDATE default_borrower_circ_rules >+ SET maxissueqty = ?, >+ maxonsiteissueqty = ? >+ WHERE categorycode = ? >+ |); > $sth_search->execute($branch); > my $res = $sth_search->fetchrow_hashref(); > if ($res->{total}) { >- $sth_update->execute($maxissueqty, $categorycode); >+ $sth_update->execute($maxissueqty, $maxonsiteissueqty, $categorycode); > } else { >- $sth_insert->execute($categorycode, $maxissueqty); >+ $sth_insert->execute($categorycode, $maxissueqty, $maxonsiteissueqty); > } > } > } elsif ($categorycode eq "*") { > my $sth_search = $dbh->prepare("SELECT count(*) AS total > FROM default_branch_circ_rules > WHERE branchcode = ?"); >- my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules >- (branchcode, maxissueqty) >- VALUES (?, ?)"); >- my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules >- SET maxissueqty = ? >- WHERE branchcode = ?"); >+ my $sth_insert = $dbh->prepare(q| >+ INSERT INTO default_branch_circ_rules >+ (branchcode, maxissueqty, maxonsiteissueqty) >+ VALUES (?, ?, ?) >+ |); >+ my $sth_update = $dbh->prepare(q| >+ UPDATE default_branch_circ_rules >+ SET maxissueqty = ?, >+ maxonsiteissueqty = ? >+ WHERE branchcode = ? >+ |); > $sth_search->execute($branch); > my $res = $sth_search->fetchrow_hashref(); > if ($res->{total}) { >- $sth_update->execute($maxissueqty, $branch); >+ $sth_update->execute($maxissueqty, $maxonsiteissueqty, $branch); > } else { >- $sth_insert->execute($branch, $maxissueqty); >+ $sth_insert->execute($branch, $maxissueqty, $maxonsiteissueqty); > } > } else { > my $sth_search = $dbh->prepare("SELECT count(*) AS total > FROM branch_borrower_circ_rules > WHERE branchcode = ? > AND categorycode = ?"); >- my $sth_insert = $dbh->prepare("INSERT INTO branch_borrower_circ_rules >- (branchcode, categorycode, maxissueqty) >- VALUES (?, ?, ?)"); >- my $sth_update = $dbh->prepare("UPDATE branch_borrower_circ_rules >- SET maxissueqty = ? >- WHERE branchcode = ? >- AND categorycode = ?"); >+ my $sth_insert = $dbh->prepare(q| >+ INSERT INTO branch_borrower_circ_rules >+ (branchcode, categorycode, maxissueqty, maxonsiteissueqty) >+ VALUES (?, ?, ?, ?) >+ |); >+ my $sth_update = $dbh->prepare(q| >+ UPDATE branch_borrower_circ_rules >+ SET maxissueqty = ?, >+ maxonsiteissueqty = ? >+ WHERE branchcode = ? >+ AND categorycode = ? >+ |); > > $sth_search->execute($branch, $categorycode); > my $res = $sth_search->fetchrow_hashref(); > if ($res->{total}) { >- $sth_update->execute($maxissueqty, $branch, $categorycode); >+ $sth_update->execute($maxissueqty, $maxonsiteissueqty, $branch, $categorycode); > } else { >- $sth_insert->execute($branch, $categorycode, $maxissueqty); >+ $sth_insert->execute($branch, $categorycode, $maxissueqty, $maxonsiteissueqty); > } > } > } >@@ -455,6 +485,7 @@ my @sorted_branch_cat_rules = sort { $a->{'humancategorycode'} cmp $b->{'humanca > # note undef maxissueqty so that template can deal with them > foreach my $entry (@sorted_branch_cat_rules, @sorted_row_loop) { > $entry->{unlimited_maxissueqty} = 1 unless defined($entry->{maxissueqty}); >+ $entry->{unlimited_maxonsiteissueqty} = 1 unless defined($entry->{maxonsiteissueqty}); > } > > @sorted_row_loop = sort by_category_and_itemtype @row_loop; >@@ -516,6 +547,7 @@ if ($defaults) { > $template->param(default_holdallowed_same => 1) if($defaults->{holdallowed} == 1); > $template->param(default_holdallowed_any => 1) if($defaults->{holdallowed} == 2); > $template->param(default_maxissueqty => $defaults->{maxissueqty}); >+ $template->param(default_maxonsiteissueqty => $defaults->{maxonsiteissueqty}); > $template->param(default_returnbranch => $defaults->{returnbranch}); > } > >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 84ffcd8..cc1d8e8 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 >@@ -38,7 +38,7 @@ $(document).ready(function() { > itm = $(this).text(); > itm = itm.replace(/^\s*|\s*$/g,''); > var current_column = $("#edit_row td:eq("+i+")"); >- if ( i != 5 ) { >+ if ( i != 6 ) { > $(current_column).find("input[type='text']").val(itm); > // select the corresponding option > $(current_column).find("select option").each(function(){ >@@ -58,8 +58,8 @@ $(document).ready(function() { > // Remove potential previous input added > $(current_column).find("input").remove(); > $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />"); >- } else if ( i == 2 ) { >- // If the value is not an integer for "Current checkouts allowed" >+ } else if ( i == 2 || i == 3 ) { >+ // If the value is not an integer for "Current checkouts allowed" or "Current on-site checkouts allowed" > // The value is "Unlimited" (or an equivalent translated string) > // an it should be set to an empty string > if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) { >@@ -142,6 +142,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <th>Patron category</th> > <th>Item type</th> > <th>Current checkouts allowed</th> >+ <th>Current on-site checkouts allowed</th> > <th>Loan period</th> > <th>Unit</th> > <th>Hard due date</th> >@@ -183,6 +184,12 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > [% rule.maxissueqty %] > [% END %] > </td> >+ <td>[% IF rule.unlimited_maxonsiteissueqty %] >+ Unlimited >+ [% ELSE %] >+ [% rule.maxonsiteissueqty %] >+ [% END %] >+ </td> > <td>[% rule.issuelength %]</td> > <td> > [% rule.lengthunit %] >@@ -247,6 +254,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > </select> > </td> > <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td> >+ <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td> > <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td> > <td> > <select name="lengthunit" id="lengthunit"> >@@ -338,6 +346,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <tr> > <th> </th> > <th>Total current checkouts allowed</th> >+ <th>Total current on-site checkouts allowed</th> > <th>Hold policy</th> > <th>Return policy</th> > <th> </th> >@@ -346,6 +355,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <tr> > <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td> > <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td> >+ <td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_onsitemaxissueqty %]"/></td> > <td> > <select name="holdallowed"> > [% IF ( default_holdallowed_any ) %] >@@ -420,6 +430,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <tr> > <th>Patron category</th> > <th>Total current checkouts allowed</th> >+ <th>Total current on-site checkouts allowed</th> > <th> </th> > </tr> > [% FOREACH branch_cat_rule_loo IN branch_cat_rule_loop %] >@@ -440,6 +451,13 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > [% branch_cat_rule_loo.maxissueqty %] > [% END %] > </td> >+ <td>[% IF ( branch_cat_rule_loo.unlimited_maxonsiteissueqty ) %] >+ Unlimited >+ [% ELSE %] >+ [% branch_cat_rule_loo.maxonsiteissueqty %] >+ [% END %] >+ </td> >+ > <td> > <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&categorycode=[% branch_cat_rule_loo.categorycode %]&branch=[% current_branch %]">Delete</a> > </td> >@@ -454,6 +472,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > </select> > </td> > <td><input name="maxissueqty" size="3" /></td> >+ <td><input name="maxonsiteissueqty" size="3" /></td> > <td><input type="submit" value="Add" class="submit" /></td> > </tr> > </table> >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14045
:
39147
|
39148
|
39149
|
39150
|
39151
|
39152
|
39572
|
39573
|
39574
|
39575
|
39576
|
39577
|
39578
|
39579
|
42317
|
42318
|
42319
|
42320
|
42321
|
42322
|
43178
|
43326
|
43327
| 43328 |
43329
|
43330
|
43331
|
43332
|
43423
|
44557