Bugzilla – Attachment 72352 Details for
Bug 19933
Move C4::Members::patronflags to the Koha namespace - part 1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19933: Remove patronflags - easy ones
Bug-19933-Remove-patronflags---easy-ones.patch (text/plain), 5.62 KB, created by
Kyle M Hall (khall)
on 2018-03-02 11:18:26 UTC
(
hide
)
Description:
Bug 19933: Remove patronflags - easy ones
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-03-02 11:18:26 UTC
Size:
5.62 KB
patch
obsolete
>From 5d31b2ee6cb25691070280f3ca8c3e30812b5e08 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sun, 7 Jan 2018 14:42:00 -0300 >Subject: [PATCH] Bug 19933: Remove patronflags - easy ones > >This patch replaces the easy occurrences of patronflags. > >These calls only need the CHARGES->amount value, that is the non issues >charges. Luckily we now have a Koha::Account->non_issues_charges that >deal with that. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/ILSDI/Services.pm | 3 +-- > koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt | 3 ++- > members/deletemem.pl | 9 +++++---- > members/member-flags.pl | 1 - > misc/cronjobs/delete_patrons.pl | 9 ++++++--- > 5 files changed, 14 insertions(+), 11 deletions(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index c9069af..7e021a5 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -393,8 +393,7 @@ sub GetPatronInfo { > > # Cleaning the borrower hashref > my $borrower = $patron->unblessed; >- my $flags = C4::Members::patronflags( $borrower ); >- $borrower->{'charges'} = $flags->{'CHARGES'}->{'amount'}; >+ $borrower->{charges} = sprintf "%.02f", $patron->account->non_issues_charges; # FIXME Formatting should not be done here > my $library = Koha::Libraries->find( $borrower->{branchcode} ); > $borrower->{'branchname'} = $library ? $library->branchname : ''; > delete $borrower->{'userid'}; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt >index 76b7bcd..6a53f30 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt >@@ -1,3 +1,4 @@ >+[% USE Price %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Delete patron [% patron.firstname %] [% patron.surname %]</title> >@@ -22,7 +23,7 @@ > <li>Patron has [% ItemsOnIssues %] item(s) checked out.</li> > [% END %] > [% IF ( charges ) %] >- <li>Patron has [% charges %] in fines.</li> >+ <li>Patron has [% charges | $Prices %] in fines.</li> > [% END %] > [% IF ( guarantees ) %] > <li>Patron's record has guaranteed accounts attached.</li> >diff --git a/members/deletemem.pl b/members/deletemem.pl >index 86ba249..95a560c 100755 >--- a/members/deletemem.pl >+++ b/members/deletemem.pl >@@ -77,7 +77,8 @@ if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preferen > my $issues = GetPendingIssues($member); # FIXME: wasteful call when really, we only want the count > my $countissues = scalar(@$issues); > >-my $flags = C4::Members::patronflags( $patron->unblessed ); >+my $patron = Koha::Patrons->find( $member ); >+my $charges = $patron->account->non_issues_charges; > my $userenv = C4::Context->userenv; > > >@@ -115,8 +116,8 @@ if ( $op eq 'delete_confirm' or $countissues > 0 or $flags->{'CHARGES'} or $is_ > if ($countissues >0) { > $template->param(ItemsOnIssues => $countissues); > } >- if ($flags->{'CHARGES'} ne '') { >- $template->param(charges => $flags->{'CHARGES'}->{'amount'}); >+ if ( $charges > 0 ) { >+ $template->param(charges => $charges); > } > if ($is_guarantor) { > $template->param(guarantees => 1); >@@ -125,7 +126,7 @@ if ( $op eq 'delete_confirm' or $countissues > 0 or $flags->{'CHARGES'} or $is_ > $template->param(keeplocal => 1); > } > # This is silly written but reflect the same conditions as above >- if ( not $countissues > 0 and not $flags->{CHARGES} ne '' and not $is_guarantor and not $deletelocal == 0 ) { >+ if ( not $countissues > 0 and not $charges and not $is_guarantor and not $deletelocal == 0 ) { > $template->param( > op => 'delete_confirm', > csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }), >diff --git a/members/member-flags.pl b/members/member-flags.pl >index 2398189..6f9780e 100755 >--- a/members/member-flags.pl >+++ b/members/member-flags.pl >@@ -106,7 +106,6 @@ if ($input->param('newflags')) { > print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member"); > } else { > >- my $flags = C4::Members::patronflags( $bor ); > my $accessflags; > my $dbh = C4::Context->dbh(); > # FIXME This needs to be improved to avoid doing the same query >diff --git a/misc/cronjobs/delete_patrons.pl b/misc/cronjobs/delete_patrons.pl >index ee015a6..4470746 100755 >--- a/misc/cronjobs/delete_patrons.pl >+++ b/misc/cronjobs/delete_patrons.pl >@@ -66,14 +66,17 @@ for my $member (@$members) { > if $verbose; > > my $borrowernumber = $member->{borrowernumber}; >- my $flags = C4::Members::patronflags( $member ); >- if ( my $charges = $flags->{CHARGES}{amount} ) { >+ my $patron = Koha::Patrons->find( $borrowernumber ); >+ unless ( $patron ) { >+ say "Patron with borrowernumber $borrowernumber does not exist"; >+ next; >+ } >+ if ( my $charges = $patron->account->non_issues_charges ) { # And what if we owe to this patron? > say "Failed to delete patron $borrowernumber: patron has $charges in fines"; > next; > } > > if ( $confirm ) { >- my $patron = Koha::Patrons->find( $borrowernumber ); > my $deleted = eval { $patron->move_to_deleted; }; > if ($@ or not $deleted) { > say "Failed to delete patron $borrowernumber, cannot move it" . ( $@ ? ": ($@)" : "" ); >-- >2.10.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19933
:
70347
|
70348
|
70349
|
70350
|
71803
|
71804
|
71805
|
71806
|
72004
|
72005
|
72006
|
72007
|
72094
|
72095
|
72350
|
72351
|
72352
|
72353
|
72354
|
72355
|
72356
|
72472
|
72473
|
72474
|
72475
|
72476
|
72477
|
72478