Bugzilla – Attachment 139722 Details for
Bug 31095
Remove Koha::Patron::Debarment::GetDebarments and use $patron->restrictions in preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31095: Remove GetDebarments from circ/circulation.pl
Bug-31095-Remove-GetDebarments-from-circcirculatio.patch (text/plain), 8.63 KB, created by
Martin Renvoize (ashimema)
on 2022-08-24 15:24:38 UTC
(
hide
)
Description:
Bug 31095: Remove GetDebarments from circ/circulation.pl
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-08-24 15:24:38 UTC
Size:
8.63 KB
patch
obsolete
>From a217b0c97bd8f1cedcbffac3548aa9c18c0e2fa8 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 24 Aug 2022 16:11:43 +0100 >Subject: [PATCH] Bug 31095: Remove GetDebarments from circ/circulation.pl > >This patch remove the use of GetDebarments from circ/circulation.pl, >replacing it with a reference to patron.restrictions in the template and >includes. >--- > circ/circulation.pl | 6 +- > .../en/includes/patron-restrictions-tab.inc | 81 +++++++++++++++++++ > .../prog/en/includes/restriction-types.inc | 10 +++ > .../prog/en/modules/circ/circulation.tt | 4 +- > 4 files changed, 95 insertions(+), 6 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/restriction-types.inc > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index b7270bfe56..e5735ad7c1 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -44,7 +44,6 @@ use CGI::Session; > use Koha::AuthorisedValues; > use Koha::CsvProfiles; > use Koha::Patrons; >-use Koha::Patron::Debarments qw( GetDebarments ); > use Koha::DateUtils qw( dt_from_string ); > use Koha::Patron::Restriction::Types; > use Koha::Plugins; >@@ -625,10 +624,9 @@ my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber => > $template->param( > debt_confirmed => $debt_confirmed, > SpecifyDueDate => $duedatespec_allow, >- PatronAutoComplete => C4::Context->preference("PatronAutoComplete"), >- debarments => scalar GetDebarments({ borrowernumber => $borrowernumber }), >+ PatronAutoComplete => C4::Context->preference("PatronAutoComplete"), > todaysdate => dt_from_string()->set(hour => 23)->set(minute => 59), >- restriction_types => scalar Koha::Patron::Restriction::Types->keyed_on_code(), >+ restriction_types => scalar Koha::Patron::Restriction::Types->search(), > has_modifications => $has_modifications, > override_high_holds => $override_high_holds, > nopermission => scalar $query->param('nopermission'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc >new file mode 100644 >index 0000000000..89e893ea2b >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc >@@ -0,0 +1,81 @@ >+[% USE raw %] >+[% USE Koha %] >+[% PROCESS 'restriction-types.inc' %] >+<div id="reldebarments"> >+ [% IF ( patron.restrictions.count == 0 ) %] >+ <p>Patron is currently unrestricted.</p> >+ [% ELSE %] >+ <table> >+ <thead> >+ <tr> >+ <th>Type</th> >+ <th>Comment</th> >+ <th>Expiration</th> >+ <th>Created</th> >+ [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %] >+ <th> </th> >+ [% END %] >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH restriction IN patron.restrictions %] >+ <tr> >+ <td> >+ [% PROCESS restriction_type_description restriction_type=restriction.type %] >+ </td> >+ <td> >+ [% IF restriction.comment.search('OVERDUES_PROCESS') %] >+ <span>Restriction added by overdues process [% restriction.comment.remove('OVERDUES_PROCESS ') | $raw %]</span> >+ [% ELSE %] >+ [% restriction.comment | $raw %] >+ [% END %] >+ </td> >+ <td>[% IF restriction.expiration %] [% restriction.expiration | $KohaDates %] [% ELSE %] <em>Indefinite</em> [% END %]</td> >+ <td>[% restriction.created | $KohaDates %]</td> >+ [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %] >+ <td> >+ <a class="remove_restriction btn btn-default btn-xs" href="/cgi-bin/koha/members/mod_debarment.pl?borrowernumber=[% patron.borrowernumber | html %]&borrower_debarment_id=[% restriction.borrower_debarment_id | html %]&action=del"> >+ <i class="fa fa-trash"></i> Remove >+ </a> >+ </td> >+ [% END %] >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% END %] >+ [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %] >+ <p><a href="#" id="add_manual_restriction"><i class="fa fa-plus"></i> Add manual restriction</a></p> >+ <form method="post" action="/cgi-bin/koha/members/mod_debarment.pl" class="clearfix"> >+ <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" /> >+ <input type="hidden" name="action" value="add" /> >+ <fieldset class="rows" id="manual_restriction_form"> >+ <legend>Add manual restriction</legend> >+ <ol> >+ [% IF Koha.Preference('PatronRestrictionTypes') %] >+ <li> >+ <label for="debarred_type">Type:</label> >+ <select name="debarred_type"> >+ [% FOREACH restriction_type IN restriction_types %] >+ [% IF !restriction_type.is_system %] >+ [% IF restriction_type.is_default %] >+ <option value="[% code | html %]" selected>[% PROCESS restriction_type_description %]</option> >+ [% ELSE %] >+ <option value="[% code | html %]">[% PROCESS restriction_type_description %]</option> >+ [% END %] >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ [% END %] >+ <li><label for="rcomment">Comment:</label> <input type="text" id="rcomment" name="comment" /></li> >+ <li> >+ <label for="rexpiration">Expiration:</label> >+ <input name="expiration" id="rexpiration" size="20" value="" class="flatpickr" data-flatpickr-futuredate="true" type="text" /> >+ </li> >+ </ol> >+ <fieldset class="action"><input type="submit" value="Add restriction" /> <a href="#" class="cancel" id="cancel_manual_restriction">Cancel</a></fieldset> >+ </fieldset> >+ </form> >+ [% END %] >+</div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/restriction-types.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/restriction-types.inc >new file mode 100644 >index 0000000000..321bde9116 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/restriction-types.inc >@@ -0,0 +1,10 @@ >+[%- BLOCK restriction_type_description -%] >+ [%- ddisplay = restriction_type.display_text -%] >+ [%- SWITCH ddisplay -%] >+ [%- CASE 'Manual' -%]<span>Manual</span> >+ [%- CASE 'Overdues' -%]<span>Overdues</span> >+ [%- CASE 'Suspension' -%]<span>Suspension</span> >+ [%- CASE 'Discharge' -%]<span>Discharge</span> >+ [%- CASE -%]<span>[% ddisplay | html %]</span> >+ [%- END -%] >+[%- END -%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index e194dfc3d5..dc012d24f8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -869,7 +869,7 @@ > [% END %] > > <li> >- <a id="debarments-tab-link" href="#reldebarments">Restrictions ([% debarments.size || 0 | html %])</a> >+ <a id="debarments-tab-link" href="#reldebarments">Restrictions ([% patron.restrictions.count || 0 | html %])</a> > </li> > > [% SET enrollments = patron.get_club_enrollments %] >@@ -895,7 +895,7 @@ > </div> <!-- /#clubs-tab --> > [% END %] > >- [% INCLUDE borrower_debarments.inc %] >+ [% INCLUDE "patron-restrictions-tab.inc" %] > > <div id="reserves"> > [% IF ( holds_count ) %] >-- >2.20.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 31095
:
139614
|
139719
|
139720
|
139721
|
139722
|
139723
|
139724
|
139725
|
139726
|
139727
|
139728
|
139742
|
139743
|
139744
|
139745
|
139746
|
139747
|
139748
|
139749
|
139750
|
139751
|
139752
|
139753
|
139754
|
139755
|
139756
|
139757
|
139758
|
140714
|
140715
|
140716
|
140717
|
140718
|
140719
|
140720
|
140721
|
140722
|
140723
|
140724
|
140725
|
140726
|
140727
|
140728
|
140729
|
140730
|
140731
|
142059
|
142060
|
142061
|
142062
|
142063
|
142064
|
142065
|
142066
|
142067
|
142068
|
142069
|
142070
|
142071
|
142072
|
142073
|
142074
|
142075
|
142076
|
143745
|
143746
|
143747
|
143748
|
143749
|
143750
|
143751
|
143752
|
143753
|
143754
|
143755
|
143756
|
143757
|
143758
|
143759
|
143760
|
143761
|
143762
|
143763
|
144903
|
144904
|
144905
|
144906
|
144907
|
144908
|
144909
|
144910
|
144911
|
144912
|
144913
|
144914
|
144915
|
144916
|
144917
|
144918
|
144919
|
144920
|
144921
|
145800
|
145801
|
145803
|
145845