Bug 18942: Internal Server Error symptomatic of using system user

TEST PLAN
---------
1) sudo koha-shell -c bash kohadev
2) prove -v t/Budgets/CanUserUseBudget.t
   -- works
3) prove -v t/Budgets/CanUserModifyBudget.t
   -- works
4) exit
5) git bz apply 18942
   -- interactive just the test patch
6) repeat steps 1-4
   -- prove fails (similar message with 919 in comment #0)
7) git bz apply 18942
   -- interactive just the actual fix
8) repeat steps 1-4
   -- works
9) run koha qa test tools

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Mark Tompsett 2017-07-14 14:15:20 +00:00 committed by Jonathan Druart
parent 01f2440dcb
commit d2d784a917

View file

@ -916,7 +916,12 @@ sub CanUserUseBudget {
my ($borrower, $budget, $userflags) = @_;
if (not ref $borrower) {
$borrower = Koha::Patrons->find( $borrower )->unblessed;
$borrower = Koha::Patrons->find( $borrower );
if ( $borrower ) {
$borrower = $borrower->unblessed;
} else {
return 0;
}
}
if (not ref $budget) {
$budget = GetBudget($budget);
@ -999,7 +1004,12 @@ sub CanUserModifyBudget {
my ($borrower, $budget, $userflags) = @_;
if (not ref $borrower) {
$borrower = Koha::Patrons->find( $borrower )->unblessed;
$borrower = Koha::Patrons->find( $borrower );
if ( $borrower ) {
$borrower = $borrower->unblessed;
} else {
return 0;
}
}
if (not ref $budget) {
$budget = GetBudget($budget);