Bugzilla – Attachment 152044 Details for
Bug 8137
Checkout limit for all libraries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8137: (follow-up) Rebased on master
Bug-8137-follow-up-Rebased-on-master.patch (text/plain), 16.94 KB, created by
Thibaud Guillot (thibaud_g)
on 2023-06-06 09:26:30 UTC
(
hide
)
Description:
Bug 8137: (follow-up) Rebased on master
Filename:
MIME Type:
Creator:
Thibaud Guillot (thibaud_g)
Created:
2023-06-06 09:26:30 UTC
Size:
16.94 KB
patch
obsolete
>From f57e80b62dfa72bb2c0a9922ee9d324b74508ddd Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Thu, 5 Jan 2023 16:30:27 +0100 >Subject: [PATCH] Bug 8137: (follow-up) Rebased on master > >Made some adjustments to make the patch work, I tested it and apprently >it works as expected but I'm interested in your feedback otherwise >--- > admin/smart-rules.pl | 8 +- > .../Bug_8137-add-column-has_priority.pl | 17 ++ > .../Bug_8137-add-column-has_priority.sql | 2 - > .../prog/en/modules/admin/smart-rules.tt | 147 ++---------------- > 4 files changed, 30 insertions(+), 144 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.pl > delete mode 100644 installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.sql > >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index e323aed9f2..3dfa880d28 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -71,7 +71,7 @@ if ($op eq 'delete') { > my $itemtype = $input->param('itemtype'); > my $categorycode = $input->param('categorycode'); > my $has_priority = $input->param('has_priority') ? 1 : undef; >- $debug and warn "deleting $1 $2 $branch"; >+ warn "deleting $1 $2 $branch"; > > Koha::CirculationRules->set_rules( > { >@@ -387,12 +387,12 @@ elsif ($op eq "set-branch-defaults") { > branchcode => undef, > has_priority => $has_priority, > rules => { >- patron_maxissueqty => $patron_maxissueqty, >- patron_maxonsiteissueqty => $patron_maxonsiteissueqty, >- patron_has_priority => $has_priority, >+ patron_maxissueqty => $patron_maxissueqty, >+ patron_maxonsiteissueqty => $patron_maxonsiteissueqty, > } > } > ); >+ > } else { > Koha::CirculationRules->set_rules( > { >diff --git a/installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.pl b/installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.pl >new file mode 100644 >index 0000000000..85cdb1c89b >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.pl >@@ -0,0 +1,17 @@ >+ >+use Modern::Perl; >+ >+return { >+ bug_number => "BUG_NUMBER", >+ description => "A single line description", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ # Do you stuffs here >+ $dbh->do(q{ >+ ALTER TABLE circulation_rules ADD has_priority INT(1) DEFAULT NULL AFTER itemtype; >+ }); >+ # Print useful stuff here >+ say $out "Added column 'has_priority' to table circulation_rules"; >+ }, >+}; >diff --git a/installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.sql b/installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.sql >deleted file mode 100644 >index a368b4e69e..0000000000 >--- a/installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.sql >+++ /dev/null >@@ -1,2 +0,0 @@ >-ALTER TABLE circulation_rules ADD has_priority INT(1) DEFAULT NULL AFTER itemtype; >-ALTER TABLE circulation_rules ADD KEY (branchcode , categorycode, itemtype, has_priority); >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 da1f7733e9..33e361f0e2 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 >@@ -110,7 +110,7 @@ > <th class="fixed_sort">Item type</th> > <th class="noExport">Actions</th> > <th>Note</th> >- [% UNLESS humanbranch %]<th>Has priority</th>[% END %] >+ [% UNLESS humanbranch %]<th> Has priority</th>[% END %] > <th>Current checkouts allowed</th> > <th>Current on-site checkouts allowed</th> > <th>Loan period</th> >@@ -779,7 +779,7 @@ > </div> > [% IF ( show_branch_cat_rule_form ) %] > <div id="holds-policy-by-patron-category" class="container"> >- <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3> >+ <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3> > <p>For this library, you can specify the maximum number of loans that > a patron of a given category can make, regardless of the item type. > </p> >@@ -848,13 +848,12 @@ > [% END %] > </td> > [% END %] >- >- <td class="actions"> >- <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&categorycode=[% c | html %]&branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a> >- </td> >- </tr> >- [% END %] >- [% END %] >+ <td class="actions"> >+ <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&categorycode=[% c | html %]&branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a> >+ </td> >+ </tr> >+ [% END %] >+ [% END %] > <tr> > <td> > <select name="categorycode"> >@@ -866,6 +865,7 @@ > <td><input name="patron_maxissueqty" size="3" type="text" /></td> > <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td> > <td><input name="max_holds" size="3" type="text" /></td> >+ <td> </td> > <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td> > </tr> > </table> >@@ -1294,135 +1294,6 @@ > [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %] > [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %] > [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %] >- <tr> >- <td> >- <select> >- [% IF returnbranch == 'homebranch' %] >- <option value="homebranch" selected="selected"> >- [% ELSE %] >- <option value="homebranch"> >- [% END %] >- Item returns home >- </option> >- [% IF returnbranch == 'holdingbranch' %] >- <option value="holdingbranch" selected="selected"> >- [% ELSE %] >- <option value="holdingbranch"> >- [% END %] >- Item returns to issuing library >- </option> >- [% IF returnbranch == 'noreturn' %] >- <option value="noreturn" selected="selected"> >- [% ELSE %] >- <option value="noreturn"> >- [% END %] >- Item floats >- </option> >- </select> >- </td> >- <td class="actions"> >- <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button> >- <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&categorycode=*&branch=[% current_branch | html %]" id="unset"><i class="fa fa-undo"></i> Unset</a> >- </td> >- </tr> >- </table> >- </form> >- </div> >- [% IF ( show_branch_cat_rule_form ) %] >- <div id="holds-policy-by-patron-category" class="container"> >- <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3> >- <p>For this library, you can specify the maximum number of loans that >- a patron of a given category can make, regardless of the item type. >- </p> >- <p>If the total amount loanable for a given patron category is left blank, >- no limit applies, except possibly for a limit you define for a specific item type. >- </p> >- <p> >- <b>Has priority: </b>If checked, the rule will override those for all branches. Else >- it behaves like a default one: used if no rule existe for the coresponding branch. >- </p> >- <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> >- <input type="hidden" name="op" value="add-branch-cat" /> >- <input type="hidden" name="branch" value="[% current_branch | html %]"/> >- <table> >- <tr> >- <th>Patron category</th> >- <th>Total current checkouts allowed</th> >- <th>Total current on-site checkouts allowed</th> >- <th>Total holds allowed</th> >- [% UNLESS humanbranch %]<th>Has priority</th>[% END %] >- <th> </th> >- </tr> >- [% FOREACH c IN categorycodes %] >- [% NEXT UNLESS c %] >- [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %] >- [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %] >- [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %] >- >- [% IF ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %] >- <tr> >- <td> >- [% IF c == undef %] >- <em>Default</em> >- [% ELSE %] >- [% Categories.GetName(c) | html %] >- [% END %] >- </td> >- <td> >- [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %] >- [% patron_maxissueqty | html %] >- [% ELSE %] >- <span>Unlimited</span> >- [% END %] >- </td> >- <td> >- [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %] >- [% patron_maxonsiteissueqty | html %] >- [% ELSE %] >- <span>Unlimited</span> >- [% END %] >- </td> >- <td> >- [% IF max_holds.defined && max_holds != '' %] >- [% max_holds | html %] >- [% ELSE %] >- <span>Unlimited</span> >- [% END %] >- </td> >- [% UNLESS humanbranch %] >- <td> >- <input type="checkbox" [% IF branch_cat_rule_loo.has_priority %]checked[% END %] disabled/> >- </td> >- [% END %] >- >- <td class="actions"> >- <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&categorycode=[% c | html %]&branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a> >- </td> >- </tr> >- [% END %] >- [% END %] >- <tr> >- <td> >- <select name="categorycode"> >- [% FOREACH patron_category IN patron_categories%] >- <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option> >- [% END %] >- </select> >- </td> >- <td><input name="patron_maxissueqty" size="3" type="text" /></td> >- <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td> >- <td><input name="max_holds" size="3" type="text" /></td> >- [% UNLESS humanbranch %] >- <td> >- <input type="checkbox" name="has_priority"/> >- </td> >- [% END %] >- <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td> >- </tr> >- </table> >- </form> >- </div> >- [% END %] > > [% IF holdallowed || hold_fulfillment_policy || returnbranch %] > <tr> >-- >2.25.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 8137
:
9705
|
9706
|
11079
|
64703
|
64704
|
64791
|
64891
|
72831
|
72832
|
107207
|
107208
|
107209
|
107459
|
111368
|
111369
|
111370
|
112640
|
113797
|
113882
|
114531
|
114532
|
114533
|
114534
|
116676
|
116677
|
116678
|
116679
|
116680
|
145476
|
145477
|
145478
|
145479
|
145480
|
152040
|
152041
|
152042
|
152043
|
152044
|
152045
|
156316
|
156317
|
156318
|
156319
|
156320
|
156321
|
156322
|
159712
|
162367
|
167208
|
167923
|
168119
|
169084
|
169696
|
169700
|
169727
|
169927
|
169928
|
170411
|
173605
|
173608
|
175837
|
175838
|
177464