Bugzilla – Attachment 57630 Details for
Bug 17642
Authorised values code is broken because of the refactoring
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17642: use find_by_koha_field when needed
Bug-17642-use-findbykohafield-when-needed.patch (text/plain), 9.03 KB, created by
Marcel de Rooy
on 2016-11-18 10:21:20 UTC
(
hide
)
Description:
Bug 17642: use find_by_koha_field when needed
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-11-18 10:21:20 UTC
Size:
9.03 KB
patch
obsolete
>From 5c2bec56c5d8b906f4c6f209d540e21830469fa2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 16 Nov 2016 16:37:16 +0100 >Subject: [PATCH] Bug 17642: use find_by_koha_field when needed >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Items.pm | 10 ++++------ > acqui/orderreceive.pl | 20 ++++++++++---------- > catalogue/getitem-ajax.pl | 20 ++++++++++---------- > circ/circulation.pl | 4 ++-- > circ/returns.pl | 4 ++-- > 5 files changed, 28 insertions(+), 30 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 0fc7f10..8ed08d5 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1376,20 +1376,18 @@ sub GetItemsInfo { > > my $av; > # get notforloan complete status if applicable >- $av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.notforloan', authorised_value => $data->{itemnotforloan} }); >- $av = $av->count ? $av->next : undef; >+ $av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.notforloan', authorised_value => $data->{itemnotforloan} }); > $data->{notforloanvalue} = $av ? $av->lib : ''; > $data->{notforloanvalueopac} = $av ? $av->opac_description : ''; > > # get restricted status and description if applicable >- $av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.restricted', authorised_value => $data->{restricted} }); >- $av = $av->count ? $av->next : undef; >+ $av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.restricted', authorised_value => $data->{restricted} }); > $data->{restricted} = $av ? $av->lib : ''; > $data->{restrictedopac} = $av ? $av->opac_description : ''; > > # my stack procedures >- $av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.stack', authorised_value => $data->{stack} }); >- $data->{stack} = $av->count ? $av->next->lib : ''; >+ $av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.stack', authorised_value => $data->{stack} }); >+ $data->{stack} = $av ? $av->lib : ''; > > # Find the last 3 people who borrowed this item. > my $sth2 = $dbh->prepare("SELECT * FROM old_issues,borrowers >diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl >index 51017a4..1a48b3b 100755 >--- a/acqui/orderreceive.pl >+++ b/acqui/orderreceive.pl >@@ -129,20 +129,20 @@ if ($AcqCreateItem eq 'receiving') { > foreach (@itemnumbers) { > my $item = GetItem($_); > my $av; >- $av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $fw, kohafield => 'items.notforloan', authorised_value => $item->{notforloan} }); >- $item->{notforloan} = $av->count ? $av->next->lib : ''; >+ $av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $fw, kohafield => 'items.notforloan', authorised_value => $item->{notforloan} }); >+ $item->{notforloan} = $av ? $av->lib : ''; > >- $av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $fw, kohafield => 'items.restricted', authorised_value => $item->{restricted} }); >- $item->{restricted} = $av->count ? $av->next->lib : ''; >+ $av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $fw, kohafield => 'items.restricted', authorised_value => $item->{restricted} }); >+ $item->{restricted} = $av ? $av->lib : ''; > >- $av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $fw, kohafield => 'items.location', authorised_value => $item->{location} }); >- $item->{location} = $av->count ? $av->next->lib : ''; >+ $av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $fw, kohafield => 'items.location', authorised_value => $item->{location} }); >+ $item->{location} = $av ? $av->lib : ''; > >- $av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $fw, kohafield => 'items.collection', authorised_value => $item->{collection} }); >- $item->{collection} = $av->count ? $av->next->lib : ''; >+ $av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $fw, kohafield => 'items.collection', authorised_value => $item->{collection} }); >+ $item->{collection} = $av ? $av->lib : ''; > >- $av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} }); >- $item->{materials} = $av->count ? $av->next->lib : ''; >+ $av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} }); >+ $item->{materials} = $av ? $av->lib : ''; > > my $itemtype = getitemtypeinfo($item->{itype}); > $item->{itemtype} = $itemtype->{description}; >diff --git a/catalogue/getitem-ajax.pl b/catalogue/getitem-ajax.pl >index c296257..6974a8f 100755 >--- a/catalogue/getitem-ajax.pl >+++ b/catalogue/getitem-ajax.pl >@@ -56,20 +56,20 @@ if($itemnumber) { > } > > my $av; >- $av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $fw, kohafield => 'items.notforloan', authorised_value => $item->{notforloan} }); >- $item->{notforloan} = $av->count ? $av->next->lib : ''; >+ $av = Koha::AuthorisedValues->find_by_koha_field({ frameworkcode => $fw, kohafield => 'items.notforloan', authorised_value => $item->{notforloan} }); >+ $item->{notforloan} = $av ? $av->lib : ''; > >- $av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $fw, kohafield => 'items.restricted', authorised_value => $item->{restricted} }); >- $item->{restricted} = $av->count ? $av->next->lib : ''; >+ $av = Koha::AuthorisedValues->find_by_koha_field({ frameworkcode => $fw, kohafield => 'items.restricted', authorised_value => $item->{restricted} }); >+ $item->{restricted} = $av ? $av->lib : ''; > >- $av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $fw, kohafield => 'items.location', authorised_value => $item->{location} }); >- $item->{location} = $av->count ? $av->next->lib : ''; >+ $av = Koha::AuthorisedValues->find_by_koha_field({ frameworkcode => $fw, kohafield => 'items.location', authorised_value => $item->{location} }); >+ $item->{location} = $av ? $av->lib : ''; > >- $av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $fw, kohafield => 'items.collection', authorised_value => $item->{collection} }); >- $item->{collection} = $av->count ? $av->next->lib : ''; >+ $av = Koha::AuthorisedValues->find_by_koha_field({ frameworkcode => $fw, kohafield => 'items.collection', authorised_value => $item->{collection} }); >+ $item->{collection} = $av ? $av->lib : ''; > >- $av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} }); >- $item->{materials} = $av->count ? $av->next->lib : ''; >+ $av = Koha::AuthorisedValues->find_by_koha_field({ frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} }); >+ $item->{materials} = $av ? $av->lib : ''; > > my $itemtype = getitemtypeinfo($item->{itype}); > $item->{itemtype} = $itemtype->{description}; >diff --git a/circ/circulation.pl b/circ/circulation.pl >index ded56c4..340bae7 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -393,8 +393,8 @@ if (@$barcodes) { > unless($issueconfirmed){ > # Get the item title for more information > my $materials = $iteminfo->{'materials'}; >- my $av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $getmessageiteminfo->{frameworkcode}, kohafield => 'items.materials', authorised_value => $materials }); >- $materials = $av->count ? $av->next->lib : ''; >+ my $av = Koha::AuthorisedValues->find_by_koha_field({ frameworkcode => $getmessageiteminfo->{frameworkcode}, kohafield => 'items.materials', authorised_value => $materials }); >+ $materials = $av ? $av->lib : ''; > $template_params->{additional_materials} = $materials; > $template_params->{itemhomebranch} = $iteminfo->{'homebranch'}; > >diff --git a/circ/returns.pl b/circ/returns.pl >index 619228f..ca56080 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -279,8 +279,8 @@ if ($barcode) { > $returnbranch = $biblio->{$hbr}; > > my $materials = $biblio->{'materials'}; >- my $av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials }); >- $materials = $av->count ? $av->next->lib : ''; >+ my $av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials }); >+ $materials = $av ? $av->lib : ''; > > $template->param( > title => $biblio->{'title'}, >-- >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 17642
:
57533
|
57569
|
57570
|
57571
|
57572
|
57573
|
57574
|
57595
|
57616
|
57628
|
57629
|
57630
|
57631
|
57632
|
57633
|
57634
|
57635
|
57650
|
57651
|
57652
|
57653
|
57654
|
57655
|
57656
|
57657