Bug 28073: Patron modifications should auto-open panel for referring patron record
authorOwen Leonard <oleonard@myacpl.org>
Thu, 1 Apr 2021 21:14:37 +0000 (21:14 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 26 Jul 2021 10:46:32 +0000 (12:46 +0200)
This patch makes it possible to link directly to the correct panel on
the "Update patron records" page. The link on the checkout and patron
details screen has been updated to read "Patron has pending
modifications."

Also changed: Moved the "Patron's address in doubt" message so that it
is above the table of changed fields.

To test, apply the patch and if necessary submit patron modification
requests from multiple patrons via the OPAC.

 - Open the checkout page for one of these patrons.
   - If you are logged in as a user with permission to edit patron
     records you should see a message, "Pending modifications: Review
     pending modifications," which links to the pending modifications
     page.
     - Clicking the link should open the page for reviewing pending
       patron modifications, and the correct panel should be
       automatically expanded.
   - If you are logged in as a user without permission to edit patrons
     you should see the message "Pending modifications: Patron has
     pending modifications," which isn't linked.
 - The process should work exactly the same from the patron detail page.
 - Following the "Pending modifications" link from the staff interface
   home page or the patrons home page should work as before: The page
   opens with the first panel expanded.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc
koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt
members/members-update.pl

index 8f56ab2..72e747b 100644 (file)
@@ -6,9 +6,11 @@
     <ul>
         [% IF ( has_modifications ) %]
             <li class="has_modifications">
-                <span class="circ-hlt">Pending modifications:</span> Patron has pending modifications.
+                <span class="circ-hlt">Pending modifications:</span>
                 [% IF CAN_user_borrowers_edit_borrowers && ( !Koha.Preference('IndependentBranchesPatronModifications') || borrower.branch == branch ) %]
-                        <a href="/cgi-bin/koha/members/members-update.pl">View all pending patron modifications</a>
+                    <a href="/cgi-bin/koha/members/members-update.pl?active=[% patron.borrowernumber | uri %]">Review pending modifications</a>
+                [% ELSE %]
+                    Patron has pending modifications
                 [% END %]
             </li>
         [% END %]
index 5d0178d..6e90e23 100644 (file)
                     <div id="pending_updates">
                             [% FOREACH pm IN PendingModifications %]
                                 [% SET borrowernumber = pm.borrowernumber %]
-                                <h3><a href="#panel_modify_[% pm.borrowernumber | uri %]">[% borrowers.$borrowernumber.surname | html %][% IF ( borrowers.$borrowernumber.firstname ) %], [% borrowers.$borrowernumber.firstname | html %][% END %] - [% Categories.GetName( borrowers.$borrowernumber.categorycode ) | html %] ([% Branches.GetName( borrowers.$borrowernumber.branchcode ) | html %]) ([% borrowers.$borrowernumber.cardnumber | html %]) - Requested on [% pm.timestamp | $KohaDates with_hours = 1 %]</a></h3>
+                                <h3 class="panel-header" id="panel-header-[% pm.borrowernumber | html %]"><a href="#panel_modify_[% pm.borrowernumber | uri %]">[% borrowers.$borrowernumber.surname | html %][% IF ( borrowers.$borrowernumber.firstname ) %], [% borrowers.$borrowernumber.firstname | html %][% END %] - [% Categories.GetName( borrowers.$borrowernumber.categorycode ) | html %] ([% Branches.GetName( borrowers.$borrowernumber.branchcode ) | html %]) ([% borrowers.$borrowernumber.cardnumber | html %]) - Requested on [% pm.timestamp | $KohaDates with_hours = 1 %]</a></h3>
                                 <div id="panel_modify_[% pm.borrowernumber | html %]">
-                                    <div style="background-color:#E6F0F2;padding:.5em;margin:.3em 0;">
+                                    <div class="btn-toolbar">
                                         <input type="radio" id="approve_modify_[% pm.borrowernumber | html %]" name="modify_[% pm.borrowernumber | html %]" value="approve" />
                                         <label for="approve_modify_[% pm.borrowernumber | html %]">Approve</label>
 
                                         <label for="ignore_modify_[% pm.borrowernumber | html %]">Ignore</label>
                                         | <a target="_blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% pm.borrowernumber | html %]" >Patron details</a>
                                     </div>
+
+                                    [% IF borrowers.$borrowernumber.gonenoaddress > 0 %]
+                                        <div class="dialog message" style="margin-top:.8em">
+                                            <h4>Patron's address in doubt</h4>
+                                            <p>The <strong>Gone no address</strong> flag is set for this patron. If this modification request resolves the issue, please unset the flag.</p>
+                                            <input type="checkbox" id="unset_gna_[% pm.borrowernumber | html %]" name="unset_gna_[% pm.borrowernumber | html %]" value="unset_gna_[% pm.borrowernumber | html %]"/>
+                                            <label for="unset_gna_[% pm.borrowernumber | html %]">Unset Gone no address for this patron</label>
+                                        </div>
+                                    [% END %]
+
                                   [% IF !pm.extended_attributes and pm.size > 3 or pm.extended_attributes and pm.size > 4 %]
                                   [%# timestamp+verification_token+borrowernumber=3 %]
                                     <div class="members-update-table">
                                         </table>
                                     </div>
                                   [%  END %]
-                                  [% IF borrowers.$borrowernumber.gonenoaddress > 0 %]
-                                    <div class="dialog message" style="margin-top:.8em">
-                                        <h4>Patron's address in doubt</h4>
-                                        <p>The <strong>Gone no address</strong> flag is set for this patron. If this modification request resolves the issue, please unset the flag.</p>
-                                        <input type="checkbox" id="unset_gna_[% pm.borrowernumber | html %]" name="unset_gna_[% pm.borrowernumber | html %]" value="unset_gna_[% pm.borrowernumber | html %]"/>
-                                        <label for="unset_gna_[% pm.borrowernumber | html %]">Unset Gone no address for this patron</label>
-                                    </div>
-                                  [% END %]
                                 </div>
                             [% END %]
                         </div>
                     <fieldset class="action"><input type="submit" value="Submit" /></fieldset>
-
                 </form>
             [% ELSE %]
             <div class="dialog message">
     [% Asset.js("js/members-menu.js") | $raw %]
     <script>
         $(function() {
-            $( "#pending_updates" ).accordion();
+            $( "#pending_updates" ).accordion({
+                collapsible: true,
+                heightStyle: "content",
+                [%- IF ( active ) -%]
+                    active: $(".panel-header").index( $("#panel-header-[% active | html %]") )
+                [%- ELSE -%]
+                    active: 0
+                [%- END -%]
+            });
         });
     </script>
 [% END %]
index 9965d49..e6dffec 100755 (executable)
@@ -70,7 +70,8 @@ foreach my $pm (@$pending_modifications) {
 
 $template->param(
     PendingModifications => $pending_modifications,
-    borrowers            => $borrowers
+    borrowers            => $borrowers,
+    active               => ( $query->param('active') || 0 ),
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;