From c840c9383558db8ebabfb9b84efccf72904ac061 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 5 Feb 2016 12:34:08 +0000 Subject: [PATCH] Bug 15758: Koha::Libraries - Ultimate duel for C4::Branch Signed-off-by: Owen Leonard Signed-off-by: Kyle M Hall --- C4/Branch.pm | 73 ------- C4/HoldsQueue.pm | 1 - C4/Items.pm | 1 - C4/Koha.pm | 1 - C4/Letters.pm | 1 - C4/Utils/DataTables/Members.pm | 1 - C4/Utils/DataTables/VirtualShelves.pm | 1 - C4/XSLT.pm | 1 - acqui/acqui-home.pl | 1 - acqui/histsearch.pl | 1 - admin/smart-rules.pl | 1 - catalogue/moredetail.pl | 1 - cataloguing/linkitem.pl | 1 - cataloguing/moveitem.pl | 1 - .../value_builder/marc21_linking_section.pl | 1 - circ/branchoverdues.pl | 1 - circ/overdue.pl | 1 - debian/templates/plack.psgi | 1 - members/boraccount.pl | 1 - members/files.pl | 1 - members/mancredit.pl | 1 - members/maninvoice.pl | 1 - members/member-flags.pl | 1 - members/member-password.pl | 1 - members/member.pl | 1 - members/members-update-do.pl | 1 - members/members-update.pl | 1 - members/printfeercpt.pl | 1 - members/printinvoice.pl | 1 - members/purchase-suggestions.pl | 1 - members/statistics.pl | 1 - misc/plack/koha.psgi | 1 - offline_circ/list.pl | 1 - opac/opac-detail.pl | 1 - opac/opac-discharge.pl | 1 - opac/opac-messaging.pl | 1 - opac/opac-topissues.pl | 1 - serials/routing-preview.pl | 1 - serials/serials-home.pl | 1 - t/Branch.t | 14 -- t/db_dependent/Branch.t | 196 ------------------ t/db_dependent/Circulation.t | 1 - t/db_dependent/Circulation/TooMany.t | 1 - t/db_dependent/Circulation/transfers.t | 1 - t/db_dependent/Holds.t | 1 - t/db_dependent/Holds/LocalHoldsPriority.t | 1 - t/db_dependent/Holds/RevertWaitingStatus.t | 1 - t/db_dependent/HoldsQueue.t | 1 - t/db_dependent/Holidays.t | 1 - t/db_dependent/Reserves.t | 1 - t/db_dependent/Template/Plugin/Categories.t | 1 - tools/batchMod.pl | 1 - tools/viewlog.pl | 1 - 53 files changed, 333 deletions(-) delete mode 100644 C4/Branch.pm delete mode 100755 t/Branch.t delete mode 100644 t/db_dependent/Branch.t diff --git a/C4/Branch.pm b/C4/Branch.pm deleted file mode 100644 index 1c912ab46d..0000000000 --- a/C4/Branch.pm +++ /dev/null @@ -1,73 +0,0 @@ -package C4::Branch; - -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# Koha is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Koha; if not, see . - - -use strict; -#use warnings; FIXME - Bug 2505 -require Exporter; -use C4::Context; -use Koha::LibraryCategories; - -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - -BEGIN { - @ISA = qw(Exporter); - @EXPORT = qw( - &GetBranch - ); - @EXPORT_OK = qw( &onlymine ); -} - -=head1 NAME - -C4::Branch - Koha branch module - -=head1 SYNOPSIS - -use C4::Branch; - -=head1 DESCRIPTION - -The functions in this module deal with branches. - -=head1 FUNCTIONS - -=cut - -=head2 GetBranch - -$branch = GetBranch( $query, $branches ); - -=cut - -sub GetBranch { - my ( $query, $branches ) = @_; # get branch for this query from branches - my $branch = $query->param('branch'); - my %cookie = $query->cookie('userenv'); - ($branch) || ($branch = $cookie{'branchname'}); - ( $branches->{$branch} ) || ( $branch = ( keys %$branches )[0] ); - return $branch; -} - -1; -__END__ - -=head1 AUTHOR - -Koha Development Team - -=cut diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index e523f16ab5..1a2de1de81 100755 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -25,7 +25,6 @@ use warnings; use C4::Context; use C4::Search; use C4::Items; -use C4::Branch; use C4::Circulation; use C4::Members; use C4::Biblio; diff --git a/C4/Items.pm b/C4/Items.pm index 728a2ec9b6..0bca944efc 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -739,7 +739,6 @@ item that has a given branch code. sub CheckItemPreSave { my $item_ref = shift; - require C4::Branch; my %errors = (); diff --git a/C4/Koha.pm b/C4/Koha.pm index e2d43b03e8..23cebca971 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -24,7 +24,6 @@ use strict; #use warnings; FIXME - Bug 2505 use C4::Context; -use C4::Branch; # Can be removed? use Koha::Caches; use Koha::DateUtils qw(dt_from_string); use Koha::Libraries; diff --git a/C4/Letters.pm b/C4/Letters.pm index cdf0860c15..26f3e46b4b 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -31,7 +31,6 @@ use Module::Load::Conditional qw(can_load); use C4::Koha qw(GetAuthorisedValueByCode); use C4::Members; use C4::Members::Attributes qw(GetBorrowerAttributes); -use C4::Branch; use C4::Log; use C4::SMS; use C4::Debug; diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm index 958e92117c..d63ce510b5 100644 --- a/C4/Utils/DataTables/Members.pm +++ b/C4/Utils/DataTables/Members.pm @@ -1,7 +1,6 @@ package C4::Utils::DataTables::Members; use Modern::Perl; -use C4::Branch qw/onlymine/; use C4::Context; use C4::Members qw/GetMemberIssuesAndFines/; use C4::Utils::DataTables; diff --git a/C4/Utils/DataTables/VirtualShelves.pm b/C4/Utils/DataTables/VirtualShelves.pm index bfda353812..2b37706359 100644 --- a/C4/Utils/DataTables/VirtualShelves.pm +++ b/C4/Utils/DataTables/VirtualShelves.pm @@ -1,7 +1,6 @@ package C4::Utils::DataTables::VirtualShelves; use Modern::Perl; -use C4::Branch qw/onlymine/; use C4::Context; use C4::Members qw/GetMemberIssuesAndFines/; use C4::Utils::DataTables; diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 364d6a130a..1da6ef1644 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -24,7 +24,6 @@ package C4::XSLT; use Modern::Perl; use C4::Context; -use C4::Branch; use C4::Items; use C4::Koha; use C4::Biblio; diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index b58c8f4d2b..fe53174e3f 100755 --- a/acqui/acqui-home.pl +++ b/acqui/acqui-home.pl @@ -35,7 +35,6 @@ use C4::Output; use C4::Acquisition; use C4::Budgets; use C4::Members; -use C4::Branch; use C4::Debug; use C4::Suggestions; use Koha::Acquisition::Currencies; diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl index 75949eee0f..9261379493 100755 --- a/acqui/histsearch.pl +++ b/acqui/histsearch.pl @@ -56,7 +56,6 @@ use C4::Auth; # get_template_and_user use C4::Output; use C4::Acquisition; use C4::Debug; -use C4::Branch; use C4::Koha; use Koha::DateUtils; diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 9b745b4477..1aa6b895c8 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -25,7 +25,6 @@ use C4::Output; use C4::Auth; use C4::Koha; use C4::Debug; -use C4::Branch; use Koha::DateUtils; use Koha::Database; use Koha::IssuingRule; diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index efa445772f..f663f85d08 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -26,7 +26,6 @@ use CGI qw ( -utf8 ); use HTML::Entities; use C4::Biblio; use C4::Items; -use C4::Branch; use C4::Acquisition; use C4::Output; use C4::Auth; diff --git a/cataloguing/linkitem.pl b/cataloguing/linkitem.pl index d3d82c80b4..082c7b0e1f 100755 --- a/cataloguing/linkitem.pl +++ b/cataloguing/linkitem.pl @@ -27,7 +27,6 @@ use C4::Biblio; use C4::Items; use C4::Context; use C4::Koha; -use C4::Branch; my $query = CGI->new; diff --git a/cataloguing/moveitem.pl b/cataloguing/moveitem.pl index 10b51a978c..79736a6034 100755 --- a/cataloguing/moveitem.pl +++ b/cataloguing/moveitem.pl @@ -28,7 +28,6 @@ use C4::Biblio; use C4::Items; use C4::Context; use C4::Koha; -use C4::Branch; use C4::ClassSource; use C4::Acquisition qw/GetOrderFromItemnumber ModOrder GetOrder/; diff --git a/cataloguing/value_builder/marc21_linking_section.pl b/cataloguing/value_builder/marc21_linking_section.pl index 448a609def..7efa49eee3 100755 --- a/cataloguing/value_builder/marc21_linking_section.pl +++ b/cataloguing/value_builder/marc21_linking_section.pl @@ -31,7 +31,6 @@ use C4::Output; use C4::Biblio; use C4::Koha; use MARC::Record; -use C4::Branch; use Koha::ItemTypes; diff --git a/circ/branchoverdues.pl b/circ/branchoverdues.pl index 22c46f0212..86f9ccafae 100755 --- a/circ/branchoverdues.pl +++ b/circ/branchoverdues.pl @@ -26,7 +26,6 @@ use C4::Overdues; # AddNotifyLine use C4::Biblio; use C4::Koha; use C4::Debug; -use C4::Branch; use Koha::DateUtils; use Data::Dumper; diff --git a/circ/overdue.pl b/circ/overdue.pl index 57865dd221..ab723e1c0e 100755 --- a/circ/overdue.pl +++ b/circ/overdue.pl @@ -24,7 +24,6 @@ use C4::Context; use C4::Output; use CGI qw(-oldstyle_urls -utf8); use C4::Auth; -use C4::Branch; use C4::Debug; use Text::CSV_XS; use Koha::DateUtils; diff --git a/debian/templates/plack.psgi b/debian/templates/plack.psgi index 796d3fe18d..baf0c5e85c 100644 --- a/debian/templates/plack.psgi +++ b/debian/templates/plack.psgi @@ -29,7 +29,6 @@ use Mojo::Server::PSGI; # Pre-load libraries use C4::Boolean; -use C4::Branch; use C4::Koha; use C4::Languages; use C4::Letters; diff --git a/members/boraccount.pl b/members/boraccount.pl index deedfe5f0e..ee8ea09cb4 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -29,7 +29,6 @@ use C4::Auth; use C4::Output; use CGI qw ( -utf8 ); use C4::Members; -use C4::Branch; use C4::Accounts; use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patron::Images; diff --git a/members/files.pl b/members/files.pl index 0e812849e2..709c2aabfc 100755 --- a/members/files.pl +++ b/members/files.pl @@ -23,7 +23,6 @@ use warnings; use CGI qw ( -utf8 ); use C4::Auth; -use C4::Branch; use C4::Output; use C4::Members; use C4::Members::Attributes qw(GetBorrowerAttributes); diff --git a/members/mancredit.pl b/members/mancredit.pl index e1e24191b4..76b34923ff 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -30,7 +30,6 @@ use C4::Output; use CGI qw ( -utf8 ); use C4::Members; -use C4::Branch; use C4::Accounts; use C4::Items; use C4::Members::Attributes qw(GetBorrowerAttributes); diff --git a/members/maninvoice.pl b/members/maninvoice.pl index 42328a6d67..906e2fe194 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -31,7 +31,6 @@ use CGI qw ( -utf8 ); use C4::Members; use C4::Accounts; use C4::Items; -use C4::Branch; use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patron::Images; diff --git a/members/member-flags.pl b/members/member-flags.pl index 5facc79711..1d73f3808b 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -12,7 +12,6 @@ use C4::Output; use C4::Auth qw(:DEFAULT :EditPermissions); use C4::Context; use C4::Members; -use C4::Branch; use C4::Members::Attributes qw(GetBorrowerAttributes); #use C4::Acquisitions; diff --git a/members/member-password.pl b/members/member-password.pl index 0290b8d9e1..7d2976e63a 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -12,7 +12,6 @@ use Koha::AuthUtils; use C4::Output; use C4::Context; use C4::Members; -use C4::Branch; use C4::Circulation; use CGI qw ( -utf8 ); use C4::Members::Attributes qw(GetBorrowerAttributes); diff --git a/members/member.pl b/members/member.pl index 93996ddc94..5a8639dcbf 100755 --- a/members/member.pl +++ b/members/member.pl @@ -27,7 +27,6 @@ use Modern::Perl; use C4::Auth; use C4::Output; use CGI qw( -utf8 ); -use C4::Branch; use C4::Members qw( GetMember ); use Koha::DateUtils; use Koha::List::Patron; diff --git a/members/members-update-do.pl b/members/members-update-do.pl index d07acdbec8..6a6e8268d6 100755 --- a/members/members-update-do.pl +++ b/members/members-update-do.pl @@ -24,7 +24,6 @@ use C4::Auth; use C4::Output; use C4::Context; use C4::Members; -use C4::Branch; use Koha::Patron::Modifications; my $query = new CGI; diff --git a/members/members-update.pl b/members/members-update.pl index f9d1b762e8..636b8b94bc 100755 --- a/members/members-update.pl +++ b/members/members-update.pl @@ -24,7 +24,6 @@ use C4::Auth; use C4::Output; use C4::Context; use C4::Members; -use C4::Branch; use Koha::Patron::Modifications; my $query = new CGI; diff --git a/members/printfeercpt.pl b/members/printfeercpt.pl index ba7e16adea..f2dad01fac 100755 --- a/members/printfeercpt.pl +++ b/members/printfeercpt.pl @@ -29,7 +29,6 @@ use C4::Auth; use C4::Output; use CGI qw ( -utf8 ); use C4::Members; -use C4::Branch; use C4::Accounts; use Koha::DateUtils; use Koha::Patron::Images; diff --git a/members/printinvoice.pl b/members/printinvoice.pl index cb206edc2c..d36746aae7 100755 --- a/members/printinvoice.pl +++ b/members/printinvoice.pl @@ -28,7 +28,6 @@ use C4::Output; use Koha::DateUtils; use CGI qw ( -utf8 ); use C4::Members; -use C4::Branch; use C4::Accounts; use Koha::Patron::Images; diff --git a/members/purchase-suggestions.pl b/members/purchase-suggestions.pl index 282362c92a..2f7ce49173 100755 --- a/members/purchase-suggestions.pl +++ b/members/purchase-suggestions.pl @@ -23,7 +23,6 @@ use CGI qw ( -utf8 ); use C4::Auth; use C4::Context; use C4::Output; -use C4::Branch; use C4::Members; use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Suggestions; diff --git a/members/statistics.pl b/members/statistics.pl index fcc537133b..f8ead9808f 100755 --- a/members/statistics.pl +++ b/members/statistics.pl @@ -26,7 +26,6 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Auth; -use C4::Branch; use C4::Context; use C4::Members; use C4::Members::Statistics; diff --git a/misc/plack/koha.psgi b/misc/plack/koha.psgi index bc2f99c6ff..330335dcb6 100644 --- a/misc/plack/koha.psgi +++ b/misc/plack/koha.psgi @@ -43,7 +43,6 @@ use C4::Boolean; use C4::Letters; use C4::Koha; use C4::XSLT; -use C4::Branch; use Koha::DateUtils; use Koha::Caches; use Koha::Cache::Memory::Lite; diff --git a/offline_circ/list.pl b/offline_circ/list.pl index 87e830aac4..4a130ed302 100755 --- a/offline_circ/list.pl +++ b/offline_circ/list.pl @@ -27,7 +27,6 @@ use C4::Auth; use C4::Koha; use C4::Context; use C4::Circulation; -use C4::Branch; use C4::Members; use C4::Biblio; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 8ef30410ff..072572dd1c 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -25,7 +25,6 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Acquisition qw( SearchOrders ); use C4::Auth qw(:DEFAULT get_session); -use C4::Branch; use C4::Koha; use C4::Serials; #uses getsubscriptionfrom biblionumber use C4::Output; diff --git a/opac/opac-discharge.pl b/opac/opac-discharge.pl index de1ca85bc4..3b75166dec 100755 --- a/opac/opac-discharge.pl +++ b/opac/opac-discharge.pl @@ -26,7 +26,6 @@ use C4::Context; use C4::Output; use C4::Log; use C4::Debug; -use C4::Branch; use C4::Members; use Koha::Patron::Discharge; use Koha::DateUtils; diff --git a/opac/opac-messaging.pl b/opac/opac-messaging.pl index 6a97ca6de5..47b09e53f9 100755 --- a/opac/opac-messaging.pl +++ b/opac/opac-messaging.pl @@ -29,7 +29,6 @@ use C4::Circulation; use C4::Output; use C4::Members; use C4::Members::Messaging; -use C4::Branch; use C4::Form::MessagingPreferences; use Koha::SMS::Providers; diff --git a/opac/opac-topissues.pl b/opac/opac-topissues.pl index 75e76d21d0..912c37296a 100755 --- a/opac/opac-topissues.pl +++ b/opac/opac-topissues.pl @@ -29,7 +29,6 @@ use C4::Languages; use C4::Search; use C4::Output; use C4::Koha; -use C4::Branch; use C4::Circulation; use Date::Manip; diff --git a/serials/routing-preview.pl b/serials/routing-preview.pl index e0cf0aae86..9c4238fed2 100755 --- a/serials/routing-preview.pl +++ b/serials/routing-preview.pl @@ -33,7 +33,6 @@ use C4::Biblio; use C4::Items; use C4::Serials; use URI::Escape; -use C4::Branch; use Koha::Libraries; my $query = new CGI; diff --git a/serials/serials-home.pl b/serials/serials-home.pl index ec64948774..cf59cb8b7d 100755 --- a/serials/serials-home.pl +++ b/serials/serials-home.pl @@ -31,7 +31,6 @@ this script is the main page for serials/ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Auth; -use C4::Branch; use C4::Context; use C4::Output; use C4::Serials; diff --git a/t/Branch.t b/t/Branch.t deleted file mode 100755 index 35295e6e8e..0000000000 --- a/t/Branch.t +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl -# -# This Koha test module is a stub! -# Add more tests here!!! - -use strict; -use warnings; - -use Test::More tests => 1; - -BEGIN { - use_ok('C4::Branch'); -} - diff --git a/t/db_dependent/Branch.t b/t/db_dependent/Branch.t deleted file mode 100644 index 9d4a5b94ba..0000000000 --- a/t/db_dependent/Branch.t +++ /dev/null @@ -1,196 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2013 Equinox Software, Inc. -# -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 3 of the License, or (at your option) any later -# version. -# -# Koha is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with Koha; if not, see . - -use Modern::Perl; - -use C4::Context; -use Data::Dumper; - -use Test::More tests => 16; - -use C4::Branch; -use Koha::Database; -use Koha::Library; -use Koha::Libraries; -use Koha::LibraryCategories; - -BEGIN { - use FindBin; - use lib $FindBin::Bin; - use_ok('C4::Branch'); -} -can_ok( - 'C4::Branch', qw( - GetBranch - GetBranches - ) -); - -my $schema = Koha::Database->new->schema; -$schema->storage->txn_begin; - -my $dbh = C4::Context->dbh; - -# clear the slate -$dbh->do('DELETE FROM branchcategories'); - -# Start test - -my $count = Koha::Libraries->search->count; -like( $count, '/^\d+$/', "the count is a number" ); - -#add 2 branches -my $b1 = { - branchcode => 'BRA', - branchname => 'BranchA', - branchaddress1 => 'adr1A', - branchaddress2 => 'adr2A', - branchaddress3 => 'adr3A', - branchzip => 'zipA', - branchcity => 'cityA', - branchstate => 'stateA', - branchcountry => 'countryA', - branchphone => 'phoneA', - branchfax => 'faxA', - branchemail => 'emailA', - branchreplyto => 'emailreply', - branchreturnpath => 'branchreturn', - branchurl => 'urlA', - branchip => 'ipA', - branchprinter => undef, - branchnotes => 'noteA', - opac_info => 'opacA', - issuing => undef, -}; -my $b2 = { - branchcode => 'BRB', - branchname => 'BranchB', - branchaddress1 => 'adr1B', - branchaddress2 => 'adr2B', - branchaddress3 => 'adr3B', - branchzip => 'zipB', - branchcity => 'cityB', - branchstate => 'stateB', - branchcountry => 'countryB', - branchphone => 'phoneB', - branchfax => 'faxB', - branchemail => 'emailB', - branchreplyto => 'emailreply', - branchreturnpath => 'branchreturn', - branchurl => 'urlB', - branchip => 'ipB', - branchprinter => undef, - branchnotes => 'noteB', - opac_info => 'opacB', - issuing => undef, -}; -Koha::Library->new($b1)->store; -Koha::Library->new($b2)->store; - -is( Koha::Libraries->search->count, $count + 2, "two branches added" ); - -is( Koha::Libraries->find( $b2->{branchcode} )->delete, 1, "One row affected" ); -is( Koha::Libraries->search->count, $count + 1, "branch BRB deleted" ); - -#Test Getbranches -my $branches = GetBranches(); -is( scalar( keys %$branches ), - Koha::Libraries->search->count, "GetBranches returns the right number of branches" ); - -#Test modify a library - -$b1 = { - branchcode => 'BRA', - branchname => 'BranchA modified', - branchaddress1 => 'adr1A modified', - branchaddress2 => 'adr2A modified', - branchaddress3 => 'adr3A modified', - branchzip => 'zipA modified', - branchcity => 'cityA modified', - branchstate => 'stateA modified', - branchcountry => 'countryA modified', - branchphone => 'phoneA modified', - branchfax => 'faxA modified', - branchemail => 'emailA modified', - branchreplyto => 'emailreply modified', - branchreturnpath => 'branchreturn modified', - branchurl => 'urlA modified', - branchip => 'ipA modified', - branchprinter => undef, - branchnotes => 'notesA modified', - opac_info => 'opacA modified', - issuing => undef, -}; - -Koha::Libraries->find($b1->{branchcode})->set($b1)->store; -is( Koha::Libraries->search->count, $count + 1, - "A branch has been modified, no new branch added" ); - -#Test categories -my $count_cat = Koha::LibraryCategories->search->count; - -my $cat1 = { - categorycode => 'CAT1', - categoryname => 'catname1', - codedescription => 'catdesc1', - categorytype => 'cattype1', - show_in_pulldown => 1 -}; -my $cat2 = { - categorycode => 'CAT2', - categoryname => 'catname2', - categorytype => 'catype2', - codedescription => 'catdesc2', - show_in_pulldown => 1 -}; - -my %new_category = ( - categorycode => 'LIBCATCODE', - categoryname => 'library category name', - codedescription => 'library category code description', - categorytype => 'searchdomain', - show_in_pulldown => 1, -); - -Koha::LibraryCategory->new(\%new_category)->store; -Koha::LibraryCategory->new($cat1)->store; -Koha::LibraryCategory->new($cat2)->store; - -my $categories = Koha::LibraryCategories->search; -is( $categories->count, $count_cat + 3, "Two categories added" ); - -my $del = Koha::LibraryCategories->find( $cat2->{categorycode} )->delete; -is( $del, 1, 'One row affected' ); - -is( Koha::LibraryCategories->search->count, $count_cat + 2, "Category CAT 2 deleted" ); - -my $b2_stored = Koha::Library->new($b2)->store; -my $CAT1 = Koha::LibraryCategories->find('CAT1'); -$b2_stored->add_to_categories([$CAT1]); -is( Koha::Libraries->search->count, $count + 2, 'BRB added' ); - -my $b1info = Koha::Libraries->find( $b1->{branchcode} ); -is_deeply( $b1info->get_categories->count, 0, 'BRA has no categories' ); - -my $b2info = Koha::Libraries->find( $b2->{branchcode} ); -is_deeply( $b2info->get_categories->count, 1, 'BRB has the category CAT1' ); - -Koha::LibraryCategory->new($cat2)->store; -is( Koha::LibraryCategories->search->count, $count_cat + 3, "Two categories added" ); - -$schema->storage->txn_rollback; diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 912c94b2b3..1433f4e744 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -20,7 +20,6 @@ use Modern::Perl; use DateTime; use t::lib::Mocks; use C4::Biblio; -use C4::Branch; use C4::Items; use C4::Members; use C4::Reserves; diff --git a/t/db_dependent/Circulation/TooMany.t b/t/db_dependent/Circulation/TooMany.t index 3b60ef50b2..d06680934e 100644 --- a/t/db_dependent/Circulation/TooMany.t +++ b/t/db_dependent/Circulation/TooMany.t @@ -20,7 +20,6 @@ use C4::Context; use C4::Biblio; use C4::Members; -use C4::Branch; use C4::Circulation; use C4::Items; use C4::Context; diff --git a/t/db_dependent/Circulation/transfers.t b/t/db_dependent/Circulation/transfers.t index e92cadf41e..459f651526 100644 --- a/t/db_dependent/Circulation/transfers.t +++ b/t/db_dependent/Circulation/transfers.t @@ -4,7 +4,6 @@ use Modern::Perl; use C4::Biblio; use C4::Context; use C4::Items; -use C4::Branch; use C4::Circulation; use Koha::Database; use Koha::DateUtils; diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t index ff87922e21..61b9e6e751 100755 --- a/t/db_dependent/Holds.t +++ b/t/db_dependent/Holds.t @@ -6,7 +6,6 @@ use t::lib::Mocks; use t::lib::TestBuilder; use C4::Context; -use C4::Branch; use Test::More tests => 61; use MARC::Record; diff --git a/t/db_dependent/Holds/LocalHoldsPriority.t b/t/db_dependent/Holds/LocalHoldsPriority.t index 241272caea..7ccc843dee 100755 --- a/t/db_dependent/Holds/LocalHoldsPriority.t +++ b/t/db_dependent/Holds/LocalHoldsPriority.t @@ -4,7 +4,6 @@ use Modern::Perl; use t::lib::Mocks; use C4::Context; -use C4::Branch; use Test::More tests => 6; use MARC::Record; diff --git a/t/db_dependent/Holds/RevertWaitingStatus.t b/t/db_dependent/Holds/RevertWaitingStatus.t index 90419df565..b9ee036b1f 100755 --- a/t/db_dependent/Holds/RevertWaitingStatus.t +++ b/t/db_dependent/Holds/RevertWaitingStatus.t @@ -4,7 +4,6 @@ use Modern::Perl; use t::lib::Mocks; use C4::Context; -use C4::Branch; use Test::More tests => 3; use MARC::Record; diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t index 056edb5365..0416c243df 100755 --- a/t/db_dependent/HoldsQueue.t +++ b/t/db_dependent/HoldsQueue.t @@ -11,7 +11,6 @@ use Modern::Perl; use Test::More tests => 38; use Data::Dumper; -use C4::Branch; use C4::Calendar; use C4::Context; use C4::Members; diff --git a/t/db_dependent/Holidays.t b/t/db_dependent/Holidays.t index 07e54cf273..6535535138 100755 --- a/t/db_dependent/Holidays.t +++ b/t/db_dependent/Holidays.t @@ -23,7 +23,6 @@ use DateTime::TimeZone; use t::lib::TestBuilder; use C4::Context; -use C4::Branch; use Koha::Database; use Koha::DateUtils; diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index e26e553f35..39ee8c56e4 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -24,7 +24,6 @@ use Test::Warn; use MARC::Record; use DateTime::Duration; -use C4::Branch; use C4::Biblio; use C4::Items; use C4::Members; diff --git a/t/db_dependent/Template/Plugin/Categories.t b/t/db_dependent/Template/Plugin/Categories.t index 3df848aa7d..6e495ed0c5 100644 --- a/t/db_dependent/Template/Plugin/Categories.t +++ b/t/db_dependent/Template/Plugin/Categories.t @@ -3,7 +3,6 @@ use Modern::Perl; use Test::More tests => 5; use C4::Context; -use C4::Branch; use Koha::Template::Plugin::Categories; my $dbh = C4::Context->dbh; diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 439e4243f7..2920da9eb3 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -28,7 +28,6 @@ use C4::Items; use C4::Circulation; use C4::Context; use C4::Koha; -use C4::Branch; use C4::BackgroundJob; use C4::ClassSource; use C4::Debug; diff --git a/tools/viewlog.pl b/tools/viewlog.pl index 276bd7f05c..3c371624b9 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -28,7 +28,6 @@ use C4::Koha; use C4::Output; use C4::Log; use C4::Items; -use C4::Branch; use C4::Debug; use C4::Search; # enabled_staff_search_views use Koha::Patron::Images; -- 2.39.5