Bugzilla – Attachment 54258 Details for
Bug 17099
GetSupportName and GetSupportList from C4/Koha.pm are no longer used
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17099: C4::Koha - Remove GetSupportName and GetSupportList
Bug-17099-C4Koha---Remove-GetSupportName-and-GetSu.patch (text/plain), 4.85 KB, created by
Jonathan Druart
on 2016-08-10 07:50:37 UTC
(
hide
)
Description:
Bug 17099: C4::Koha - Remove GetSupportName and GetSupportList
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-08-10 07:50:37 UTC
Size:
4.85 KB
patch
obsolete
>From fc6ecebe9eda04076fe1478b87fd02d4c6b33043 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 10 Aug 2016 08:46:33 +0100 >Subject: [PATCH] Bug 17099: C4::Koha - Remove GetSupportName and > GetSupportList > >Since bug 9468, these 2 subroutines are no longer in used and can be >removed. > >Test plan: > git grep GetSupportName >and > git grep GetSupportList >should not return entries (unless 1 in release notes) >--- > C4/Koha.pm | 74 -------------------------------------------- > t/db_dependent/Suggestions.t | 14 +-------- > 2 files changed, 1 insertion(+), 87 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index bb35811..d3bf323 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -41,7 +41,6 @@ BEGIN { > &GetPrinters &GetPrinter > &GetItemTypes &getitemtypeinfo > &GetItemTypesCategorized &GetItemTypesByCategory >- &GetSupportName &GetSupportList > &getframeworks &getframeworkinfo > &GetFrameworksLoop > &getallthemes >@@ -92,79 +91,6 @@ Koha.pm provides many functions for Koha scripts. > > =cut > >-=head2 GetSupportName >- >- $itemtypename = &GetSupportName($codestring); >- >-Returns a string with the name of the itemtype. >- >-=cut >- >-sub GetSupportName{ >- my ($codestring)=@_; >- return if (! $codestring); >- my $resultstring; >- my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); >- if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { >- my $query = qq| >- SELECT description >- FROM itemtypes >- WHERE itemtype=? >- order by description >- |; >- my $sth = C4::Context->dbh->prepare($query); >- $sth->execute($codestring); >- ($resultstring)=$sth->fetchrow; >- return $resultstring; >- } else { >- my $sth = >- C4::Context->dbh->prepare( >- "SELECT lib FROM authorised_values WHERE category = ? AND authorised_value = ?" >- ); >- $sth->execute( $advanced_search_types, $codestring ); >- my $data = $sth->fetchrow_hashref; >- return $$data{'lib'}; >- } >- >-} >-=head2 GetSupportList >- >- $itemtypes = &GetSupportList(); >- >-Returns an array ref containing informations about Support (since itemtype is rather a circulation code when item-level-itypes is used). >- >-build a HTML select with the following code : >- >-=head3 in PERL SCRIPT >- >- my $itemtypes = GetSupportList(); >- $template->param(itemtypeloop => $itemtypes); >- >-=head3 in TEMPLATE >- >- <select name="itemtype" id="itemtype"> >- <option value=""></option> >- [% FOREACH itemtypeloo IN itemtypeloop %] >- [% IF ( itemtypeloo.selected ) %] >- <option value="[% itemtypeloo.itemtype %]" selected="selected">[% itemtypeloo.description %]</option> >- [% ELSE %] >- <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option> >- [% END %] >- [% END %] >- </select> >- >-=cut >- >-sub GetSupportList{ >- my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); >- if (!$advanced_search_types or $advanced_search_types =~ /itemtypes/) { >- return GetItemTypes( style => 'array' ); >- } else { >- my $advsearchtypes = GetAuthorisedValues($advanced_search_types); >- my @results= map {{itemtype=>$$_{authorised_value},description=>$$_{lib},imageurl=>$$_{imageurl}}} @$advsearchtypes; >- return \@results; >- } >-} > =head2 GetItemTypes > > $itemtypes = &GetItemTypes( style => $style ); >diff --git a/t/db_dependent/Suggestions.t b/t/db_dependent/Suggestions.t >index 79e5cbe..63f390e 100644 >--- a/t/db_dependent/Suggestions.t >+++ b/t/db_dependent/Suggestions.t >@@ -28,12 +28,11 @@ use Koha::Library; > use Koha::Libraries; > > use DateTime::Duration; >-use Test::More tests => 106; >+use Test::More tests => 102; > use Test::Warn; > > BEGIN { > use_ok('C4::Suggestions'); >- use_ok('C4::Koha'); > } > > my $dbh = C4::Context->dbh; >@@ -349,17 +348,6 @@ $suggestions = GetSuggestionByStatus('CHECKED'); > is( @$suggestions, 1, 'DelSuggestion deletes one suggestion' ); > is( $suggestions->[0]->{title}, $del_suggestion->{title}, 'DelSuggestion deletes the correct suggestion' ); > >-## Bug 11466, making sure GetSupportList() returns itemtypes, even if AdvancedSearchTypes has multiple values >-t::lib::Mocks::mock_preference("AdvancedSearchTypes", 'itemtypes|loc|ccode'); >-my $itemtypes1 = C4::Koha::GetSupportList(); >-is(@$itemtypes1, 8, "Purchase suggestion itemtypes collected, multiple AdvancedSearchTypes"); >- >-t::lib::Mocks::mock_preference("AdvancedSearchTypes", 'itemtypes'); >-my $itemtypes2 = C4::Koha::GetSupportList(); >-is(@$itemtypes2, 8, "Purchase suggestion itemtypes collected, default AdvancedSearchTypes"); >- >-is_deeply($itemtypes1, $itemtypes2, 'same set of purchase suggestion formats retrieved'); >- > # Test budgetid fk > $my_suggestion->{budgetid} = ''; # If budgetid == '', NULL should be set in DB > my $my_suggestionid_test_budgetid = NewSuggestion($my_suggestion); >-- >2.8.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 17099
:
54258
|
54267
|
54434