Bug 10910: (follow-up) Move the suggestions note with the other non-blocking notes
authorKatrin Fischer <katrin.fischer.83@web.de>
Fri, 1 May 2020 16:28:25 +0000 (16:28 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 15 Jun 2020 09:53:36 +0000 (11:53 +0200)
To test:
- Add a credit to the patron's account
- Make sure they got a pending suggestion
- Try to delete
- Verify you notes for both as list items

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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/modules/members/deletemem.tt
members/deletemem.pl

index e27af52..23c59cd 100644 (file)
@@ -37,7 +37,7 @@
     [% ELSIF op == 'delete_confirm' and patron %]
         [%# TODO add "patron does not exist" unless patron %]
         <div class="dialog alert">
-            [% IF ItemsOnHold or credits %]
+            [% IF ItemsOnHold or credits or pending_suggestions > 0 %]
                 <ul>
                     [% IF ItemsOnHold %]
                         <li>Patron has [% ItemsOnHold | html %] hold(s). Deleting patron cancels all their holds.</li>
                     [% IF credits %]
                         <li>Patron has a [% credits | $Price %] credit.</li>
                     [% END %]
-                <ul>
+                    [% IF pending_suggestions > 0 %]
+                        <li>Patron has [% pending_suggestions | html %] pending suggestions.</li>
+                    [% END %]
+                </ul>
             [% END %]
             <h3>Are you sure you want to delete the patron [% patron.firstname | html %] [% patron.surname | html %]? This cannot be undone.</h3>
-            [% IF pending_suggestions > 0 %]
-                <h3>Note that this patron has [% pending_suggestions %] pending suggestions.</h3>
-            [% END %]
             <form action="/cgi-bin/koha/members/deletemem.pl">
                 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
                 <input type="hidden" name="member" value="[% patron.borrowernumber | html %]"/>
index bd8a043..8593a76 100755 (executable)
@@ -89,6 +89,15 @@ my $dbh = C4::Context->dbh;
 my $is_guarantor = $patron->guarantee_relationships->count;
 my $countholds = $dbh->selectrow_array("SELECT COUNT(*) FROM reserves WHERE borrowernumber=?", undef, $member);
 
+# Add warning if patron has pending suggestions
+$template->param(
+    pending_suggestions => scalar @{
+    C4::Suggestions::SearchSuggestion(
+            { suggestedby => $member, STATUS => 'ASKED' }
+        )
+    }
+);
+
 $template->param(
     patron        => $patron,
     ItemsOnIssues => $countissues,
@@ -104,14 +113,6 @@ if ( $op eq 'delete_confirm' or $countissues > 0 or $debits or $is_guarantor ) {
         csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
     );
 
-    # Add warning if patron has pending suggestions
-    $template->param(
-        pending_suggestions => scalar @{
-        C4::Suggestions::SearchSuggestion(
-                { suggestedby => $member, STATUS => 'ASKED' }
-            )
-        }
-    );
 } elsif ( $op eq 'delete_confirmed' ) {
     output_and_exit( $input, $cookie, $template, 'wrong_csrf_token' )
         unless Koha::Token->new->check_csrf( {