Bugzilla – Attachment 75225 Details for
Bug 20623
PDF export of a basket group fails when an item has an itemtype that is not in the itemtype table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20623: Fix basket group PDF when itemtype not itemtype table
Bug-20623-Fix-basket-group-PDF-when-itemtype-not-i.patch (text/plain), 3.35 KB, created by
Owen Leonard
on 2018-05-10 15:15:29 UTC
(
hide
)
Description:
Bug 20623: Fix basket group PDF when itemtype not itemtype table
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2018-05-10 15:15:29 UTC
Size:
3.35 KB
patch
obsolete
>From 5a90efc185b1effa43139001ee03f5d1ac8b4762 Mon Sep 17 00:00:00 2001 >From: Victor Grousset <victor.grousset@biblibre.com> >Date: Fri, 20 Apr 2018 11:17:26 +0200 >Subject: [PATCH] Bug 20623: Fix basket group PDF when itemtype not itemtype > table >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >When an item has an itemtype not in the itemtype table. Trying to fetch >it's description lead to an error. >Using authorized values like ccode to populate the itemtypes of the >biblioitems (instead of the itemtype table) can lead to such data. >Or importing records with invalid itemtype codes. Koha doesn't do enough >checks at import to at least warn about these issues. > >== Test plan == >1. first we need an item with an itype not in the item_types table > 1. download a record as MARCXML > 2. find it's item type in administration; and the related code > 3. open the MARCXML file and search for occurences of the code > and replace them by some non-existing value like "FOOBAR" > 4. also change the barcode so it won't be ignored because > it's a duplicate > 5. also change the title to easily find it later in the search > 6. tools â "Stage MARC records for import" > 7. upload your file > 8. "stage for import" > 9. click "Manage staged records" > You should end on the page related to your staged record > 10. "Import this batch into the catalog" > >2. now we need it in a basket group > 1. have/create a active budget > 2. have/create a fund > 3. have/create a vendor with minimal info > 4. create a basket with minimal info > 5. add our imported item to the basket > for example search it by name > 6. go to the basket. URL should be > /cgi-bin/koha/acqui/basket.pl?basketno=XXXXX > 7. close this basket > and tick "Attach this basket to a new basket group with the same name" > 8. you will end up in the basket groups lists > 9. go to the "closed" tab > 11. go to the basket group > your vendor page => Basket groups => Closed > >3. export as PDF, it should fail (internal server error) > this is the bug (no kidding ^_^) >4. apply this patch >5. reexport the basket as PDF >6. it should work >7. create an item type (in administration) > that has the same code as the one that you put in the MARCXML >8. reexport the basket as PDF >9. check that in the PDF that the description is here: > table at the bottom of the document â "Document" column > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > acqui/basketgroup.pl | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index df625af..386357b 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -194,7 +194,10 @@ sub printbasketgrouppdf{ > } > } > >- $ord->{itemtype} = ( $ord->{itemtype} and $biblioitem->itemtype ) ? Koha::ItemTypes->find( $biblioitem->itemtype )->description : undef; >+ my $item_has_type_description = ($ord->{itemtype} >+ and $biblioitem->itemtype >+ and Koha::ItemTypes->find( $biblioitem->itemtype )); >+ $ord->{itemtype} = $item_has_type_description ? Koha::ItemTypes->find( $biblioitem->itemtype )->description : undef; > $ord->{en} = $en ? $en : undef; > $ord->{edition} = $edition ? $edition : undef; > >-- >2.1.4
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 20623
:
74604
|
74605
|
74913
|
75225
|
75263
|
75264
|
75273