View | Details | Raw Unified | Return to bug 10910
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt (-5 / +5 lines)
Lines 37-43 Link Here
37
    [% ELSIF op == 'delete_confirm' and patron %]
37
    [% ELSIF op == 'delete_confirm' and patron %]
38
        [%# TODO add "patron does not exist" unless patron %]
38
        [%# TODO add "patron does not exist" unless patron %]
39
        <div class="dialog alert">
39
        <div class="dialog alert">
40
            [% IF ItemsOnHold or credits %]
40
            [% IF ItemsOnHold or credits or pending_suggestions > 0 %]
41
                <ul>
41
                <ul>
42
                    [% IF ItemsOnHold %]
42
                    [% IF ItemsOnHold %]
43
                        <li>Patron has [% ItemsOnHold | html %] hold(s). Deleting patron cancels all their holds.</li>
43
                        <li>Patron has [% ItemsOnHold | html %] hold(s). Deleting patron cancels all their holds.</li>
Lines 45-56 Link Here
45
                    [% IF credits %]
45
                    [% IF credits %]
46
                        <li>Patron has a [% credits | $Price %] credit.</li>
46
                        <li>Patron has a [% credits | $Price %] credit.</li>
47
                    [% END %]
47
                    [% END %]
48
                <ul>
48
                    [% IF pending_suggestions > 0 %]
49
                        <li>Patron has [% pending_suggestions | html %] pending suggestions.</li>
50
                    [% END %]
51
                </ul>
49
            [% END %]
52
            [% END %]
50
            <h3>Are you sure you want to delete the patron [% patron.firstname | html %] [% patron.surname | html %]? This cannot be undone.</h3>
53
            <h3>Are you sure you want to delete the patron [% patron.firstname | html %] [% patron.surname | html %]? This cannot be undone.</h3>
51
            [% IF pending_suggestions > 0 %]
52
                <h3>Note that this patron has [% pending_suggestions %] pending suggestions.</h3>
53
            [% END %]
54
            <form action="/cgi-bin/koha/members/deletemem.pl">
54
            <form action="/cgi-bin/koha/members/deletemem.pl">
55
                <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
55
                <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
56
                <input type="hidden" name="member" value="[% patron.borrowernumber | html %]"/>
56
                <input type="hidden" name="member" value="[% patron.borrowernumber | html %]"/>
(-)a/members/deletemem.pl (-9 / +9 lines)
Lines 89-94 my $dbh = C4::Context->dbh; Link Here
89
my $is_guarantor = $patron->guarantee_relationships->count;
89
my $is_guarantor = $patron->guarantee_relationships->count;
90
my $countholds = $dbh->selectrow_array("SELECT COUNT(*) FROM reserves WHERE borrowernumber=?", undef, $member);
90
my $countholds = $dbh->selectrow_array("SELECT COUNT(*) FROM reserves WHERE borrowernumber=?", undef, $member);
91
91
92
# Add warning if patron has pending suggestions
93
$template->param(
94
    pending_suggestions => scalar @{
95
    C4::Suggestions::SearchSuggestion(
96
            { suggestedby => $member, STATUS => 'ASKED' }
97
        )
98
    }
99
);
100
92
$template->param(
101
$template->param(
93
    patron        => $patron,
102
    patron        => $patron,
94
    ItemsOnIssues => $countissues,
103
    ItemsOnIssues => $countissues,
Lines 104-117 if ( $op eq 'delete_confirm' or $countissues > 0 or $debits or $is_guarantor ) { Link Here
104
        csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
113
        csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
105
    );
114
    );
106
115
107
    # Add warning if patron has pending suggestions
108
    $template->param(
109
        pending_suggestions => scalar @{
110
        C4::Suggestions::SearchSuggestion(
111
                { suggestedby => $member, STATUS => 'ASKED' }
112
            )
113
        }
114
    );
115
} elsif ( $op eq 'delete_confirmed' ) {
116
} elsif ( $op eq 'delete_confirmed' ) {
116
    output_and_exit( $input, $cookie, $template, 'wrong_csrf_token' )
117
    output_and_exit( $input, $cookie, $template, 'wrong_csrf_token' )
117
        unless Koha::Token->new->check_csrf( {
118
        unless Koha::Token->new->check_csrf( {
118
- 

Return to bug 10910