Bug 15629: Koha::Libraries - Remove GetBranchesInCategory (1)
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 20 Jan 2016 11:21:12 +0000 (11:21 +0000)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Wed, 24 Feb 2016 03:55:05 +0000 (03:55 +0000)
For consistency, the branchcodes method of Koha::LibraryCategory should be
named libraries.
At the moment, there is only one occurrence, in admin/branches.pl

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
Koha/LibraryCategory.pm
admin/branches.pl
t/db_dependent/Koha/Libraries.t

index 030b6c1..79341be 100644 (file)
@@ -41,7 +41,7 @@ sub new {
     return $self->SUPER::new( $params );
 }
 
-sub branchcodes{
+sub libraries{
     my ( $self, $params ) = @_;
     # TODO  This should return Koha::Libraries
     return $self->{_result}->branchcodes( $params );
index 918b10c..a655fc6 100755 (executable)
@@ -194,7 +194,7 @@ if ( $op eq 'add_form' ) {
     $op = 'list';
 } elsif ( $op eq 'delete_confirm_category' ) {
     my $category = Koha::LibraryCategories->find($categorycode);
-    if ( my $libraries_count = scalar( $category->branchcodes ) ) {
+    if ( my $libraries_count = scalar( $category->libraries ) ) {
         push @messages,
           { type => 'error',
             code => 'cannot_delete_category',
index 8e21567..8126b8c 100644 (file)
@@ -77,7 +77,7 @@ $retrieved_library_1->update_categories( [ $new_category_2, $new_category_3 ] );
 is( Koha::Libraries->find( $new_library_1->branchcode )->get_categories->count, 2, '2 libraries should have been linked to the category 2' );
 
 my $retrieved_category_2 = Koha::LibraryCategories->find( $new_category_2->categorycode );
-is( $retrieved_category_2->branchcodes->count, 2, '2 libraries should have been linked to the category_2' );
+is( $retrieved_category_2->libraries->count, 2, '2 libraries should have been linked to the category_2' );
 is( $retrieved_category_2->categorycode, uc('my_cc_2'), 'The Koha::LibraryCategory constructor should have upercased the categorycode' );
 
 $retrieved_library_1->delete;