Bug 10796: Handle can_change_password on the staff interface
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 20 Feb 2019 16:36:55 +0000 (13:36 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 12 Apr 2019 02:32:07 +0000 (02:32 +0000)
This patch makes the staff interface handle the new flag when editing
the categories. I didn't add the flag to the list of categories table
because it makes it too big, but can be easily added if required by
users or QA.

To test:
- Along with other patches from this bug, edit patron categories
=> SUCCESS: Notice the changes are correctly stored
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

admin/categories.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt

index b824b9b..f9144e7 100755 (executable)
@@ -93,9 +93,11 @@ elsif ( $op eq 'add_validate' ) {
     my $checkPrevCheckout = $input->param('checkprevcheckout');
     my $default_privacy = $input->param('default_privacy');
     my $reset_password = $input->param('reset_password');
+    my $change_password = $input->param('change_password');
     my @branches = grep { $_ ne q{} } $input->multi_param('branches');
 
     $reset_password = undef if $reset_password eq -1;
+    $change_password = undef if $change_password eq -1;
 
     my $is_a_modif = $input->param("is_a_modif");
 
@@ -126,6 +128,7 @@ elsif ( $op eq 'add_validate' ) {
         $category->checkprevcheckout($checkPrevCheckout);
         $category->default_privacy($default_privacy);
         $category->reset_password($reset_password);
+        $category->change_password($change_password);
         eval {
             $category->store;
             $category->replace_branch_limitations( \@branches );
@@ -153,6 +156,7 @@ elsif ( $op eq 'add_validate' ) {
             checkprevcheckout => $checkPrevCheckout,
             default_privacy => $default_privacy,
             reset_password => $reset_password,
+            change_password => $change_password,
         });
         eval {
             $category->store;
index 5cc99d7..143c1a6 100644 (file)
                       [% END %]
                     </select>
                 </li>
+                <li>
+                    <label for="change_password">Password change in OPAC: </label>
+                    <select name="change_password" id="change_password">
+                      [% IF category.change_password.defined %]
+                        [% IF category.change_password %]
+                          [% IF Koha.Preference('OpacPasswordChange') %]
+                            <option value="-1">Follow system preference OpacPasswordChange (enabled)</option>
+                          [% ELSE %]
+                            <option value="-1">Follow system preference OpacPasswordChange (disabled)</option>
+                          [% END %]
+                            <option value="1" selected="selected">Allowed</option>
+                            <option value="0">Not allowed</option>
+                        [% ELSE %]
+                          [% IF Koha.Preference('OpacPasswordChange') %]
+                            <option value="-1">Follow system preference OpacPasswordChange (enabled)</option>
+                          [% ELSE %]
+                            <option value="-1">Follow system preference OpacPasswordChange (disabled)</option>
+                          [% END %]
+                            <option value="1">Allowed</option>
+                            <option value="0" selected="selected">Not allowed</option>
+                        [% END %]
+                      [% ELSE %]
+                          [% IF Koha.Preference('OpacPasswordChange') %]
+                            <option value="-1" selected="selected">Follow system preference OpacPasswordChange (enabled)</option>
+                          [% ELSE %]
+                            <option value="-1" selected="selected">Follow system preference OpacPasswordChange (disabled)</option>
+                          [% END %]
+                            <option value="1">Allowed</option>
+                            <option value="0">Not allowed</option>
+                      [% END %]
+                    </select>
+                </li>
                 <li><label for="block_expired">Block expired patrons:</label>
                     <select name="BlockExpiredPatronOpacActions" id="block_expired">
                         [% IF not category or category.BlockExpiredPatronOpacActions == -1%]