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

(-)a/C4/ILSDI/Services.pm (-2 / +1 lines)
Lines 393-400 sub GetPatronInfo { Link Here
393
393
394
    # Cleaning the borrower hashref
394
    # Cleaning the borrower hashref
395
    my $borrower = $patron->unblessed;
395
    my $borrower = $patron->unblessed;
396
    my $flags = C4::Members::patronflags( $borrower );
396
    $borrower->{charges} = sprintf "%.02f", $patron->account->non_issues_charges; # FIXME Formatting should not be done here
397
    $borrower->{'charges'} = $flags->{'CHARGES'}->{'amount'};
398
    my $library = Koha::Libraries->find( $borrower->{branchcode} );
397
    my $library = Koha::Libraries->find( $borrower->{branchcode} );
399
    $borrower->{'branchname'} = $library ? $library->branchname : '';
398
    $borrower->{'branchname'} = $library ? $library->branchname : '';
400
    delete $borrower->{'userid'};
399
    delete $borrower->{'userid'};
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt (-1 / +2 lines)
Lines 1-3 Link Here
1
[% USE Price %]
1
[% SET footerjs = 1 %]
2
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Delete patron [% patron.firstname %] [% patron.surname %]</title>
4
<title>Koha &rsaquo; Delete patron [% patron.firstname %] [% patron.surname %]</title>
Lines 22-28 Link Here
22
                <li>Patron has [% ItemsOnIssues %] item(s) checked out.</li>
23
                <li>Patron has [% ItemsOnIssues %] item(s) checked out.</li>
23
            [% END %]
24
            [% END %]
24
            [% IF ( charges ) %]
25
            [% IF ( charges ) %]
25
                <li>Patron has [% charges %] in fines.</li>
26
                <li>Patron has [% charges | $Prices %] in fines.</li>
26
            [% END %]
27
            [% END %]
27
            [% IF ( guarantees ) %]
28
            [% IF ( guarantees ) %]
28
                <li>Patron's record has guaranteed accounts attached.</li>
29
                <li>Patron's record has guaranteed accounts attached.</li>
(-)a/members/deletemem.pl (-4 / +5 lines)
Lines 77-83 if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preferen Link Here
77
my $issues = GetPendingIssues($member);     # FIXME: wasteful call when really, we only want the count
77
my $issues = GetPendingIssues($member);     # FIXME: wasteful call when really, we only want the count
78
my $countissues = scalar(@$issues);
78
my $countissues = scalar(@$issues);
79
79
80
my $flags = C4::Members::patronflags( $patron->unblessed );
80
my $patron = Koha::Patrons->find( $member );
81
my $charges = $patron->account->non_issues_charges;
81
my $userenv = C4::Context->userenv;
82
my $userenv = C4::Context->userenv;
82
83
83
 
84
 
Lines 115-122 if ( $op eq 'delete_confirm' or $countissues > 0 or $flags->{'CHARGES'} or $is_ Link Here
115
    if ($countissues >0) {
116
    if ($countissues >0) {
116
        $template->param(ItemsOnIssues => $countissues);
117
        $template->param(ItemsOnIssues => $countissues);
117
    }
118
    }
118
    if ($flags->{'CHARGES'} ne '') {
119
    if ( $charges > 0 ) {
119
        $template->param(charges => $flags->{'CHARGES'}->{'amount'});
120
        $template->param(charges => $charges);
120
    }
121
    }
121
    if ($is_guarantor) {
122
    if ($is_guarantor) {
122
        $template->param(guarantees => 1);
123
        $template->param(guarantees => 1);
Lines 125-131 if ( $op eq 'delete_confirm' or $countissues > 0 or $flags->{'CHARGES'} or $is_ Link Here
125
        $template->param(keeplocal => 1);
126
        $template->param(keeplocal => 1);
126
    }
127
    }
127
    # This is silly written but reflect the same conditions as above
128
    # This is silly written but reflect the same conditions as above
128
    if ( not $countissues > 0 and not $flags->{CHARGES} ne '' and not $is_guarantor and not $deletelocal == 0 ) {
129
    if ( not $countissues > 0 and not $charges and not $is_guarantor and not $deletelocal == 0 ) {
129
        $template->param(
130
        $template->param(
130
            op         => 'delete_confirm',
131
            op         => 'delete_confirm',
131
            csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
132
            csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
(-)a/members/member-flags.pl (-1 lines)
Lines 106-112 if ($input->param('newflags')) { Link Here
106
    print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member");
106
    print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member");
107
} else {
107
} else {
108
108
109
    my $flags = C4::Members::patronflags( $bor );
110
    my $accessflags;
109
    my $accessflags;
111
    my $dbh = C4::Context->dbh();
110
    my $dbh = C4::Context->dbh();
112
    # FIXME This needs to be improved to avoid doing the same query
111
    # FIXME This needs to be improved to avoid doing the same query
(-)a/misc/cronjobs/delete_patrons.pl (-4 / +6 lines)
Lines 66-79 for my $member (@$members) { Link Here
66
      if $verbose;
66
      if $verbose;
67
67
68
    my $borrowernumber = $member->{borrowernumber};
68
    my $borrowernumber = $member->{borrowernumber};
69
    my $flags = C4::Members::patronflags( $member );
69
    my $patron = Koha::Patrons->find( $borrowernumber );
70
    if ( my $charges = $flags->{CHARGES}{amount} ) {
70
    unless ( $patron ) {
71
        say "Patron with borrowernumber $borrowernumber does not exist";
72
        next;
73
    }
74
    if ( my $charges = $patron->account->non_issues_charges ) { # And what if we owe to this patron?
71
        say "Failed to delete patron $borrowernumber: patron has $charges in fines";
75
        say "Failed to delete patron $borrowernumber: patron has $charges in fines";
72
        next;
76
        next;
73
    }
77
    }
74
78
75
    if ( $confirm ) {
79
    if ( $confirm ) {
76
        my $patron = Koha::Patrons->find( $borrowernumber );
77
        my $deleted = eval { $patron->move_to_deleted; };
80
        my $deleted = eval { $patron->move_to_deleted; };
78
        if ($@ or not $deleted) {
81
        if ($@ or not $deleted) {
79
            say "Failed to delete patron $borrowernumber, cannot move it" . ( $@ ? ": ($@)" : "" );
82
            say "Failed to delete patron $borrowernumber, cannot move it" . ( $@ ? ": ($@)" : "" );
80
- 

Return to bug 19933