Bugzilla – Attachment 143750 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 members/memberentry.pl
Bug-31095-Remove-GetDebarments-from-membersmembere.patch (text/plain), 9.67 KB, created by
Martin Renvoize (ashimema)
on 2022-11-11 08:34:29 UTC
(
hide
)
Description:
Bug 31095: Remove GetDebarments from members/memberentry.pl
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-11-11 08:34:29 UTC
Size:
9.67 KB
patch
obsolete
>From 85692e7cfa4751c78000bb8b87664989fc11658f Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 24 Aug 2022 16:14:59 +0100 >Subject: [PATCH] Bug 31095: Remove GetDebarments from members/memberentry.pl > >This patch removes the use of GetDebarments from members/memberentry.pl >and replaces the references in the templates with patron.restrictions. > >Test plan >1. Add a new user and confirm that the patron restrictions section does > not appear on the form >2. Edit the user and confirm the patron restrictions section now appears >3. Add a manual restriction using the patron edit form >4. Confirm the restriction appears on the patron edit form >5. Confirm you can remove the restriction usine the patron edit form > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../prog/en/modules/members/memberentrygen.tt | 37 +++++++++---------- > members/memberentry.pl | 5 +-- > 2 files changed, 20 insertions(+), 22 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 48f62ddd52..e3839d8206 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -8,7 +8,7 @@ > [% PROCESS 'member-main-address-style.inc' %] > [% PROCESS 'member-alt-address-style.inc' %] > [% PROCESS 'member-alt-contact-style.inc' %] >-[% PROCESS 'patron_restrictions.inc' %] >+[% PROCESS 'restriction-types.inc' %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title> >@@ -1409,7 +1409,7 @@ legend:hover { > > <fieldset class="rows" id="memberentry_restrictions"> > <legend id="restrictions_lgd">Patron restrictions</legend> >- [% IF ( debarments ) %] >+ [% IF ( patron.restrictions.count ) %] > <table> > <thead> > <tr> >@@ -1423,28 +1423,27 @@ legend:hover { > </tr> > </thead> > <tbody> >- [% FOREACH d IN debarments %] >- [% dtype = d.type %] >+ [% FOREACH restriction IN patron.restrictions %] > <tr> >- <td>[% restriction_types.$dtype.display_text | html %]</td> >+ <td>[% PROCESS restriction_type_description restriction_type=restriction.type %]</td> > <td> >- [% IF d.comment.search('OVERDUES_PROCESS') %] >- Restriction added by overdues process [% d.comment.remove('OVERDUES_PROCESS ') | $raw %] >+ [% IF restriction.comment.search('OVERDUES_PROCESS') %] >+ Restriction added by overdues process [% restriction.comment.remove('OVERDUES_PROCESS ') | $raw %] > [% ELSE %] >- [% d.comment | $raw %] >+ [% restriction.comment | $raw %] > [% END %] > </td> > <td> >- [% IF d.expiration %] >- [% d.expiration | $KohaDates %] >+ [% IF restriction.expiration %] >+ [% restriction.expiration | $KohaDates %] > [% ELSE %] > <em>Indefinite</em> > [% END %] > </td> >- <td>[% d.created | $KohaDates %]</td> >+ <td>[% restriction.created | $KohaDates %]</td> > [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %] > <td> >- <input type="checkbox" id="debarment_[% d.borrower_debarment_id | html %]" name="remove_debarment" value="[% d.borrower_debarment_id | html %]" /> >+ <input type="checkbox" id="debarment_[% restriction.borrower_debarment_id | html %]" name="remove_debarment" value="[% restriction.borrower_debarment_id | html %]" /> > </td> > [% END %] > </tr> >@@ -1453,10 +1452,10 @@ legend:hover { > </table> > [% ELSE %] > <p>Patron is currently unrestricted.</p> >- [% END # /IF ( debarments ) %] >+ [% END # /IF ( patron.restrictions.count ) %] > > [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %] >- <p><a href="#" id="add_manual_restriction">Add manual restriction</a></p> >+ <p><a href="#" id="add_manual_restriction"><i class="fa fa-plus"></i> Add manual restriction</a></p> > <fieldset id="manual_restriction_form"> > <input type="hidden" id="add_debarment" name="add_debarment" value="0" /> > <legend id="manual_restriction_lgd">Add manual restriction</legend> >@@ -1465,12 +1464,12 @@ legend:hover { > <li> > <label for="debarred_type">Type:</label> > <select name="debarred_type"> >- [% FOREACH code IN restriction_types.keys %] >- [% IF !restriction_types.$code.is_system %] >- [% IF restriction_types.$code.is_default %] >- <option value="[% code | html %]" selected>[% PROCESS restriction_type_description restriction=restriction_types.$code %]</option> >+ [% 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 restriction=restriction_types.$code %]</option> >+ <option value="[% code | html %]">[% PROCESS restriction_type_description %]</option> > [% END %] > [% END %] > [% END %] >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 2ebf3b4335..0193cc3777 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -35,7 +35,7 @@ use C4::Form::MessagingPreferences; > use Koha::AuthUtils; > use Koha::AuthorisedValues; > use Koha::Email; >-use Koha::Patron::Debarments qw( AddDebarment DelDebarment GetDebarments ); >+use Koha::Patron::Debarments qw( AddDebarment DelDebarment ); > use Koha::Patron::Restriction::Types; > use Koha::Cities; > use Koha::DateUtils qw( dt_from_string ); >@@ -118,8 +118,7 @@ foreach my $id ( @delete_guarantor ) { > > ## Deal with debarments > $template->param( >- debarments => scalar GetDebarments( { borrowernumber => $borrowernumber } ), >- restriction_types => scalar Koha::Patron::Restriction::Types->keyed_on_code() >+ restriction_types => scalar Koha::Patron::Restriction::Types->search() > ); > my @debarments_to_remove = $input->multi_param('remove_debarment'); > foreach my $d ( @debarments_to_remove ) { >-- >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