Bugzilla – Attachment 143988 Details for
Bug 32132
Missing budget_period_id in aqbudgets kills lateorders.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32132: Return undef if budget is not found
0001-Bug-32132-Return-undef-if-budget-is-not-found.patch (text/plain), 2.57 KB, created by
Emmi Takkinen
on 2022-11-17 10:00:21 UTC
(
hide
)
Description:
Bug 32132: Return undef if budget is not found
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2022-11-17 10:00:21 UTC
Size:
2.57 KB
patch
obsolete
>From f9bdff8499e94da5172f60ad1f9a24e0326113f8 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Wed, 9 Nov 2022 10:18:17 +0200 >Subject: [PATCH] Bug 32132: Return undef if budget is not found > >If budget_period_id column is set as NULL, "Late orders" >page dies on error 500. Logs read: > >Template process failed: undef error - DBIC result _type isn't of the _type Aqbudget at >/home/koha/Koha/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt line 157 > >Prevent this happening by returning undef from method "budget". > >To test: >1. Navigate to "Late orders" page. >2. Choose any order, take a note in which budget it belongs to. >3. Update chosen budget from database: >UPDATE aqbudgets SET budget_period_id WHERE budget_id = <budget_id>; >4. Reload "Late orders" page. >=> Page dies on error 500. >5. Apply this patch. >6. Reload page again. >=> Late orders should now be displayed correctly. > >Also prove t/db_dependent/Koha/Acquisition/Fund.t. > >Sponsored-by: Koha-Suomi Oy >--- > Koha/Acquisition/Fund.pm | 1 + > t/db_dependent/Koha/Acquisition/Fund.t | 11 ++++++++++- > 2 files changed, 11 insertions(+), 1 deletion(-) > >diff --git a/Koha/Acquisition/Fund.pm b/Koha/Acquisition/Fund.pm >index 80ef0b2f4a..498598be99 100644 >--- a/Koha/Acquisition/Fund.pm >+++ b/Koha/Acquisition/Fund.pm >@@ -42,6 +42,7 @@ associated to the fund. > sub budget { > my ( $self ) = @_; > my $budget_rs = $self->_result->budget; >+ return unless $budget_rs; > return Koha::Acquisition::Budget->_new_from_dbic( $budget_rs ); > } > >diff --git a/t/db_dependent/Koha/Acquisition/Fund.t b/t/db_dependent/Koha/Acquisition/Fund.t >index 38dae6297a..b83be07559 100755 >--- a/t/db_dependent/Koha/Acquisition/Fund.t >+++ b/t/db_dependent/Koha/Acquisition/Fund.t >@@ -25,6 +25,8 @@ use t::lib::TestBuilder; > > use Koha::Database; > >+use Koha::Acquisition::Budget; >+ > my $schema = Koha::Database->schema; > my $builder = t::lib::TestBuilder->new; > >@@ -44,7 +46,7 @@ subtest 'to_api() tests' => sub { > }; > > subtest 'budget' => sub { >- plan tests => 1; >+ plan tests => 2; > > $schema->storage->txn_begin; > my $f = $builder->build_object( >@@ -57,5 +59,12 @@ subtest 'budget' => sub { > is( ref( $fund->budget ), > 'Koha::Acquisition::Budget', > '->fund should return a Koha::Acquisition::Budget object' ); >+ >+ # Testing when budget_period_id is set as NULL >+ $fund->budget_period_id(undef); >+ $fund->update(); >+ is( $fund->budget, >+ undef, >+ '->fund->budget should return undef if budget_period_id is set as NULL' ); > $schema->storage->txn_rollback; > }; >-- >2.34.1 >
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 32132
:
143988
|
161721
|
162232
|
162233
|
162241
|
162584
|
165373
|
165374