summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
efd9ed2)
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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
[% PROCESS 'member-main-address-style.inc' %]
[% PROCESS 'member-alt-address-style.inc' %]
[% PROCESS 'member-alt-contact-style.inc' %]
[% 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>
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>
<fieldset class="rows" id="memberentry_restrictions">
<legend id="restrictions_lgd">Patron restrictions</legend>
<fieldset class="rows" id="memberentry_restrictions">
<legend id="restrictions_lgd">Patron restrictions</legend>
- [% IF ( debarments ) %]
+ [% IF ( patron.restrictions.count ) %]
- [% FOREACH d IN debarments %]
- [% dtype = d.type %]
+ [% FOREACH restriction IN patron.restrictions %]
- <td>[% restriction_types.$dtype.display_text | html %]</td>
+ <td>[% PROCESS restriction_type_description restriction_type=restriction.type %]</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 %]
+ [% restriction.comment | $raw %]
- [% IF d.expiration %]
- [% d.expiration | $KohaDates %]
+ [% IF restriction.expiration %]
+ [% restriction.expiration | $KohaDates %]
[% ELSE %]
<em>Indefinite</em>
[% END %]
</td>
[% 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>
[% 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 %]" />
</table>
[% ELSE %]
<p>Patron is currently unrestricted.</p>
</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 %]
[% 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>
<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>
<li>
<label for="debarred_type">Type:</label>
<select name="debarred_type">
<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>
- <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 %]
[% END %]
[% END %]
[% END %]
use Koha::AuthUtils;
use Koha::AuthorisedValues;
use Koha::Email;
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 );
use Koha::Patron::Restriction::Types;
use Koha::Cities;
use Koha::DateUtils qw( dt_from_string );
## Deal with debarments
$template->param(
## 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 ) {
);
my @debarments_to_remove = $input->multi_param('remove_debarment');
foreach my $d ( @debarments_to_remove ) {