Bugzilla – Attachment 54909 Details for
Bug 15758
Move the C4::Branch related code to Koha::Libraries - part 4
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15758: [QA Follow-up] Some corrections related to GetBranchName
Bug-15758-QA-Follow-up-Some-corrections-related-to.patch (text/plain), 4.53 KB, created by
Marcel de Rooy
on 2016-08-26 08:47:09 UTC
(
hide
)
Description:
Bug 15758: [QA Follow-up] Some corrections related to GetBranchName
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-08-26 08:47:09 UTC
Size:
4.53 KB
patch
obsolete
>From 7f00683ae50075edb9a43728a6632e2bc97b195e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 26 Aug 2016 09:02:04 +0200 >Subject: [PATCH] Bug 15758: [QA Follow-up] Some corrections related to > GetBranchName >Content-Type: text/plain; charset=utf-8 > >[1] Acquisition.pm >The lines filling $row in GetBasketGroupAsCSV may have side-effects when >the library name is not found. This change restores former behavior. Just >theoretically more safe. >Note that it also contained a typo: $row->{deliveryplace} should have been >$row->{$place}. > >[2] Auth.pm >checkauth: $branchname = Koha::Libraries->find($branchcode)->branchname; >Should normally be fine, but I rather have an empty string here than >crashing on "Can't call method branchname on undefined value". >Same for sub check_api_auth. >Note that this holds for a larger number of calls, but I am adding a check >here because it is checkauth. >Also removed a duplicate use Koha::Libraries-statement. > >[3] Search.pm >Also removed a duplicate use statement for Libraries. > >[4] svc/holds >Added an (explicit) use statement for Koha::Libraries. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Acquisition.pm | 4 +++- > C4/Auth.pm | 7 ++++--- > C4/Search.pm | 1 - > svc/holds | 1 + > 4 files changed, 8 insertions(+), 5 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index ce7af71..b19d8d5 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -377,13 +377,15 @@ sub GetBasketGroupAsCSV { > booksellerpostal => $bookseller->{postal}, > contractnumber => $contract->{contractnumber}, > contractname => $contract->{contractname}, >+ }; >+ my $temp = { > basketgroupdeliveryplace => $basketgroup->{deliveryplace}, > basketgroupbillingplace => $basketgroup->{billingplace}, > basketdeliveryplace => $basket->{deliveryplace}, > basketbillingplace => $basket->{billingplace}, > }; > for my $place (qw( basketgroupdeliveryplace basketgroupbillingplace basketdeliveryplace basketbillingplace )) { >- if ( my $library = Koha::Libraries->find( $row->{deliveryplace} ) ) { >+ if ( my $library = Koha::Libraries->find( $temp->{$place} ) ) { > $row->{$place} = $library->branchname; > } > } >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 2a7b162..8d05bcf 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -34,7 +34,6 @@ use Koha; > use Koha::AuthUtils qw(get_script_name hash_password); > use Koha::Libraries; > use Koha::LibraryCategories; >-use Koha::Libraries; > use POSIX qw/strftime/; > use List::MoreUtils qw/ any /; > use Encode qw( encode is_utf8); >@@ -1075,7 +1074,8 @@ sub checkauth { > # if they specify at login, use that > if ( $query->param('branch') ) { > $branchcode = $query->param('branch'); >- $branchname = Koha::Libraries->find($branchcode)->branchname; >+ my $library = Koha::Libraries->find($branchcode); >+ $branchname = $library? $library->branchname: ''; > } > my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search }; > if ( C4::Context->boolean_preference('IndependentBranches') && C4::Context->boolean_preference('Autolocation') ) { >@@ -1525,7 +1525,8 @@ sub check_api_auth { > # if they specify at login, use that > if ( $query->param('branch') ) { > $branchcode = $query->param('branch'); >- $branchname = Koha::Libraries->find($branchcode)->branchname; >+ my $library = Koha::Libraries->find($branchcode); >+ $branchname = $library? $library->branchname: ''; > } > my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search }; > foreach my $br ( keys %$branches ) { >diff --git a/C4/Search.pm b/C4/Search.pm >index 4446349..7e71469 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -31,7 +31,6 @@ use C4::XSLT; > use C4::Reserves; # GetReserveStatus > use C4::Debug; > use C4::Charset; >-use Koha::Libraries; > use YAML; > use URI::Escape; > use Business::ISBN; >diff --git a/svc/holds b/svc/holds >index 5aefb6b..0a6f51d 100755 >--- a/svc/holds >+++ b/svc/holds >@@ -30,6 +30,7 @@ use C4::Context; > > use Koha::DateUtils; > use Koha::Holds; >+use Koha::Libraries; > > my $input = new CGI; > >-- >1.7.10.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 15758
:
47746
|
47747
|
47748
|
47749
|
47750
|
47751
|
47752
|
47753
|
47759
|
47760
|
47761
|
47762
|
47763
|
47764
|
47765
|
52723
|
52724
|
52726
|
52727
|
52728
|
52729
|
52730
|
52731
|
52736
|
52788
|
52789
|
52790
|
52791
|
52792
|
52793
|
52794
|
52795
|
52913
|
52914
|
52915
|
52916
|
52917
|
52918
|
52919
|
52920
|
53893
|
53894
|
53895
|
53896
|
53897
|
53898
|
53899
|
53900
|
53997
|
53998
|
53999
|
54000
|
54001
|
54002
|
54003
|
54004
|
54029
|
54030
|
54031
|
54032
|
54033
|
54034
|
54035
|
54036
|
54037
|
54038
|
54039
|
54040
|
54041
|
54042
|
54043
|
54044
|
54861
|
54862
|
54863
|
54864
|
54865
|
54866
|
54867
|
54868
|
54908
|
54909
|
54921
|
54925
|
55061
|
55062
|
55063
|
55064
|
55065
|
55066
|
55067
|
55068
|
55069
|
55070
|
55071
|
55072
|
55073
|
55346
|
55347
|
55348
|
55349
|
55350
|
55351
|
55352
|
55353
|
55354
|
55355
|
55356
|
55357
|
55358
|
55445