Bugzilla – Attachment 87075 Details for
Bug 22593
Cronjobs/Scripts dealing with accountlines need updating for bug 22008
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22593: Fix bad ternaries after bug 22008
Bug-22593-Fix-bad-ternaries-after-bug-22008.patch (text/plain), 5.27 KB, created by
Kyle M Hall (khall)
on 2019-03-27 15:04:00 UTC
(
hide
)
Description:
Bug 22593: Fix bad ternaries after bug 22008
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-03-27 15:04:00 UTC
Size:
5.27 KB
patch
obsolete
>From 36e0a1e11b5d029ee53f741faf84d88b9b2947af Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 27 Mar 2019 13:55:05 +0000 >Subject: [PATCH] Bug 22593: Fix bad ternaries after bug 22008 > >A series of ternaries were introduced when we moved to add_debit which >defaulted to 'user 0' should a userenv not be set. This was incorrect >as userenv may well not be set (during cronscript runs for example) and >the new constraint would not allow such a default. We switch to 'undef' >here to satisfy the constraint. > >Test plan >1) Ensure you have data in your system that would be caught by the >longoverdues cronjob. >2) Ensure you're sysprefs are setup to charge for lost items >3) Run the script and varify it runs to completion without errors > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Accounts.pm | 7 +++---- > C4/Circulation.pm | 2 +- > C4/Reserves.pm | 2 +- > Koha/Hold.pm | 2 +- > Koha/Patron.pm | 2 +- > 5 files changed, 7 insertions(+), 8 deletions(-) > >diff --git a/C4/Accounts.pm b/C4/Accounts.pm >index 3fdf2d71b3..39b2bda305 100644 >--- a/C4/Accounts.pm >+++ b/C4/Accounts.pm >@@ -106,7 +106,7 @@ sub chargelostitem{ > amount => $processfee, > description => $description, > note => $processingfeenote, >- user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, >+ user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, > library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, > type => 'processing', > item_id => $itemnumber, >@@ -121,7 +121,7 @@ sub chargelostitem{ > amount => $replacementprice, > description => $description, > note => undef, >- user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, >+ user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, > library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, > type => 'lost_item', > item_id => $itemnumber, >@@ -146,8 +146,7 @@ sub manualinvoice { > > deprecated "C4::Accounts::manualinvoice is deprecated in favor of Koha::Account->add_debit"; > >- my $manager_id = 0; >- $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; >+ my $manager_id = C4::Context->userenv ? C4::Context->userenv->{'number'} : undef; > my $dbh = C4::Context->dbh; > my $insert; > my $amountleft = $amount; >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 7ab1db7e82..e51bc33b7d 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3221,7 +3221,7 @@ sub AddIssuingCharge { > amount => $charge, > description => $description, > note => undef, >- user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, >+ user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, > library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, > type => 'rent', > item_id => $checkout->itemnumber, >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index de7e3f0a2c..09d36288e3 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -573,7 +573,7 @@ sub ChargeReserveFee { > amount => $fee, > description => "Reserve Charge - " . $title, > note => undef, >- user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, >+ user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, > library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, > sip => undef, > invoice_type => undef, >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 3b3aba8b26..37c7fa1c26 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -370,7 +370,7 @@ sub cancel { > $account->add_debit( > { > amount => $charge, >- user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, >+ user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, > library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, > type => 'hold_expired', > item_id => $self->itemnumber >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index eeaf0e4dc2..ea532d782a 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -849,7 +849,7 @@ sub add_enrolment_fee_if_needed { > $self->account->add_debit( > { > amount => $enrolment_fee, >- user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, >+ user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, > library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, > type => 'account' > } >-- >2.20.1 (Apple Git-117)
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 22593
:
87069
|
87075
|
87130