View | Details | Raw Unified | Return to bug 15758
Collapse All | Expand All

(-)a/C4/Branch.pm (-73 lines)
Lines 1-73 Link Here
1
package C4::Branch;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
19
use strict;
20
#use warnings; FIXME - Bug 2505
21
require Exporter;
22
use C4::Context;
23
use Koha::LibraryCategories;
24
25
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
26
27
BEGIN {
28
	@ISA    = qw(Exporter);
29
	@EXPORT = qw(
30
		&GetBranch
31
	);
32
    @EXPORT_OK = qw( &onlymine );
33
}
34
35
=head1 NAME
36
37
C4::Branch - Koha branch module
38
39
=head1 SYNOPSIS
40
41
use C4::Branch;
42
43
=head1 DESCRIPTION
44
45
The functions in this module deal with branches.
46
47
=head1 FUNCTIONS
48
49
=cut
50
51
=head2 GetBranch
52
53
$branch = GetBranch( $query, $branches );
54
55
=cut
56
57
sub GetBranch {
58
    my ( $query, $branches ) = @_;    # get branch for this query from branches
59
    my $branch = $query->param('branch');
60
    my %cookie = $query->cookie('userenv');
61
    ($branch)                || ($branch = $cookie{'branchname'});
62
    ( $branches->{$branch} ) || ( $branch = ( keys %$branches )[0] );
63
    return $branch;
64
}
65
66
1;
67
__END__
68
69
=head1 AUTHOR
70
71
Koha Development Team <http://koha-community.org/>
72
73
=cut
(-)a/C4/HoldsQueue.pm (-1 lines)
Lines 25-31 use warnings; Link Here
25
use C4::Context;
25
use C4::Context;
26
use C4::Search;
26
use C4::Search;
27
use C4::Items;
27
use C4::Items;
28
use C4::Branch;
29
use C4::Circulation;
28
use C4::Circulation;
30
use C4::Members;
29
use C4::Members;
31
use C4::Biblio;
30
use C4::Biblio;
(-)a/C4/Items.pm (-1 lines)
Lines 739-745 item that has a given branch code. Link Here
739
739
740
sub CheckItemPreSave {
740
sub CheckItemPreSave {
741
    my $item_ref = shift;
741
    my $item_ref = shift;
742
    require C4::Branch;
743
742
744
    my %errors = ();
743
    my %errors = ();
745
744
(-)a/C4/Koha.pm (-1 lines)
Lines 24-30 use strict; Link Here
24
#use warnings; FIXME - Bug 2505
24
#use warnings; FIXME - Bug 2505
25
25
26
use C4::Context;
26
use C4::Context;
27
use C4::Branch; # Can be removed?
28
use Koha::Caches;
27
use Koha::Caches;
29
use Koha::DateUtils qw(dt_from_string);
28
use Koha::DateUtils qw(dt_from_string);
30
use Koha::Libraries;
29
use Koha::Libraries;
(-)a/C4/Letters.pm (-1 lines)
Lines 31-37 use Module::Load::Conditional qw(can_load); Link Here
31
use C4::Koha qw(GetAuthorisedValueByCode);
31
use C4::Koha qw(GetAuthorisedValueByCode);
32
use C4::Members;
32
use C4::Members;
33
use C4::Members::Attributes qw(GetBorrowerAttributes);
33
use C4::Members::Attributes qw(GetBorrowerAttributes);
34
use C4::Branch;
35
use C4::Log;
34
use C4::Log;
36
use C4::SMS;
35
use C4::SMS;
37
use C4::Debug;
36
use C4::Debug;
(-)a/C4/Utils/DataTables/Members.pm (-1 lines)
Lines 1-7 Link Here
1
package C4::Utils::DataTables::Members;
1
package C4::Utils::DataTables::Members;
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use C4::Branch qw/onlymine/;
5
use C4::Context;
4
use C4::Context;
6
use C4::Members qw/GetMemberIssuesAndFines/;
5
use C4::Members qw/GetMemberIssuesAndFines/;
7
use C4::Utils::DataTables;
6
use C4::Utils::DataTables;
(-)a/C4/Utils/DataTables/VirtualShelves.pm (-1 lines)
Lines 1-7 Link Here
1
package C4::Utils::DataTables::VirtualShelves;
1
package C4::Utils::DataTables::VirtualShelves;
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use C4::Branch qw/onlymine/;
5
use C4::Context;
4
use C4::Context;
6
use C4::Members qw/GetMemberIssuesAndFines/;
5
use C4::Members qw/GetMemberIssuesAndFines/;
7
use C4::Utils::DataTables;
6
use C4::Utils::DataTables;
(-)a/C4/XSLT.pm (-1 lines)
Lines 24-30 package C4::XSLT; Link Here
24
use Modern::Perl;
24
use Modern::Perl;
25
25
26
use C4::Context;
26
use C4::Context;
27
use C4::Branch;
28
use C4::Items;
27
use C4::Items;
29
use C4::Koha;
28
use C4::Koha;
30
use C4::Biblio;
29
use C4::Biblio;
(-)a/acqui/acqui-home.pl (-1 lines)
Lines 35-41 use C4::Output; Link Here
35
use C4::Acquisition;
35
use C4::Acquisition;
36
use C4::Budgets;
36
use C4::Budgets;
37
use C4::Members;
37
use C4::Members;
38
use C4::Branch;
39
use C4::Debug;
38
use C4::Debug;
40
use C4::Suggestions;
39
use C4::Suggestions;
41
use Koha::Acquisition::Currencies;
40
use Koha::Acquisition::Currencies;
(-)a/acqui/histsearch.pl (-1 lines)
Lines 56-62 use C4::Auth; # get_template_and_user Link Here
56
use C4::Output;
56
use C4::Output;
57
use C4::Acquisition;
57
use C4::Acquisition;
58
use C4::Debug;
58
use C4::Debug;
59
use C4::Branch;
60
use C4::Koha;
59
use C4::Koha;
61
use Koha::DateUtils;
60
use Koha::DateUtils;
62
61
(-)a/admin/smart-rules.pl (-1 lines)
Lines 25-31 use C4::Output; Link Here
25
use C4::Auth;
25
use C4::Auth;
26
use C4::Koha;
26
use C4::Koha;
27
use C4::Debug;
27
use C4::Debug;
28
use C4::Branch;
29
use Koha::DateUtils;
28
use Koha::DateUtils;
30
use Koha::Database;
29
use Koha::Database;
31
use Koha::IssuingRule;
30
use Koha::IssuingRule;
(-)a/catalogue/moredetail.pl (-1 lines)
Lines 26-32 use CGI qw ( -utf8 ); Link Here
26
use HTML::Entities;
26
use HTML::Entities;
27
use C4::Biblio;
27
use C4::Biblio;
28
use C4::Items;
28
use C4::Items;
29
use C4::Branch;
30
use C4::Acquisition;
29
use C4::Acquisition;
31
use C4::Output;
30
use C4::Output;
32
use C4::Auth;
31
use C4::Auth;
(-)a/cataloguing/linkitem.pl (-1 lines)
Lines 27-33 use C4::Biblio; Link Here
27
use C4::Items;
27
use C4::Items;
28
use C4::Context;
28
use C4::Context;
29
use C4::Koha;
29
use C4::Koha;
30
use C4::Branch;
31
30
32
31
33
my $query = CGI->new;
32
my $query = CGI->new;
(-)a/cataloguing/moveitem.pl (-1 lines)
Lines 28-34 use C4::Biblio; Link Here
28
use C4::Items;
28
use C4::Items;
29
use C4::Context;
29
use C4::Context;
30
use C4::Koha;
30
use C4::Koha;
31
use C4::Branch;
32
use C4::ClassSource;
31
use C4::ClassSource;
33
use C4::Acquisition qw/GetOrderFromItemnumber ModOrder GetOrder/;
32
use C4::Acquisition qw/GetOrderFromItemnumber ModOrder GetOrder/;
34
33
(-)a/cataloguing/value_builder/marc21_linking_section.pl (-1 lines)
Lines 31-37 use C4::Output; Link Here
31
use C4::Biblio;
31
use C4::Biblio;
32
use C4::Koha;
32
use C4::Koha;
33
use MARC::Record;
33
use MARC::Record;
34
use C4::Branch;
35
34
36
use Koha::ItemTypes;
35
use Koha::ItemTypes;
37
36
(-)a/circ/branchoverdues.pl (-1 lines)
Lines 26-32 use C4::Overdues; # AddNotifyLine Link Here
26
use C4::Biblio;
26
use C4::Biblio;
27
use C4::Koha;
27
use C4::Koha;
28
use C4::Debug;
28
use C4::Debug;
29
use C4::Branch;
30
use Koha::DateUtils;
29
use Koha::DateUtils;
31
use Data::Dumper;
30
use Data::Dumper;
32
31
(-)a/circ/overdue.pl (-1 lines)
Lines 24-30 use C4::Context; Link Here
24
use C4::Output;
24
use C4::Output;
25
use CGI qw(-oldstyle_urls -utf8);
25
use CGI qw(-oldstyle_urls -utf8);
26
use C4::Auth;
26
use C4::Auth;
27
use C4::Branch;
28
use C4::Debug;
27
use C4::Debug;
29
use Text::CSV_XS;
28
use Text::CSV_XS;
30
use Koha::DateUtils;
29
use Koha::DateUtils;
(-)a/debian/templates/plack.psgi (-1 lines)
Lines 29-35 use Mojo::Server::PSGI; Link Here
29
29
30
# Pre-load libraries
30
# Pre-load libraries
31
use C4::Boolean;
31
use C4::Boolean;
32
use C4::Branch;
33
use C4::Koha;
32
use C4::Koha;
34
use C4::Languages;
33
use C4::Languages;
35
use C4::Letters;
34
use C4::Letters;
(-)a/members/boraccount.pl (-1 lines)
Lines 29-35 use C4::Auth; Link Here
29
use C4::Output;
29
use C4::Output;
30
use CGI qw ( -utf8 );
30
use CGI qw ( -utf8 );
31
use C4::Members;
31
use C4::Members;
32
use C4::Branch;
33
use C4::Accounts;
32
use C4::Accounts;
34
use C4::Members::Attributes qw(GetBorrowerAttributes);
33
use C4::Members::Attributes qw(GetBorrowerAttributes);
35
use Koha::Patron::Images;
34
use Koha::Patron::Images;
(-)a/members/files.pl (-1 lines)
Lines 23-29 use warnings; Link Here
23
use CGI qw ( -utf8 );
23
use CGI qw ( -utf8 );
24
24
25
use C4::Auth;
25
use C4::Auth;
26
use C4::Branch;
27
use C4::Output;
26
use C4::Output;
28
use C4::Members;
27
use C4::Members;
29
use C4::Members::Attributes qw(GetBorrowerAttributes);
28
use C4::Members::Attributes qw(GetBorrowerAttributes);
(-)a/members/mancredit.pl (-1 lines)
Lines 30-36 use C4::Output; Link Here
30
use CGI qw ( -utf8 );
30
use CGI qw ( -utf8 );
31
31
32
use C4::Members;
32
use C4::Members;
33
use C4::Branch;
34
use C4::Accounts;
33
use C4::Accounts;
35
use C4::Items;
34
use C4::Items;
36
use C4::Members::Attributes qw(GetBorrowerAttributes);
35
use C4::Members::Attributes qw(GetBorrowerAttributes);
(-)a/members/maninvoice.pl (-1 lines)
Lines 31-37 use CGI qw ( -utf8 ); Link Here
31
use C4::Members;
31
use C4::Members;
32
use C4::Accounts;
32
use C4::Accounts;
33
use C4::Items;
33
use C4::Items;
34
use C4::Branch;
35
use C4::Members::Attributes qw(GetBorrowerAttributes);
34
use C4::Members::Attributes qw(GetBorrowerAttributes);
36
use Koha::Patron::Images;
35
use Koha::Patron::Images;
37
36
(-)a/members/member-flags.pl (-1 lines)
Lines 12-18 use C4::Output; Link Here
12
use C4::Auth qw(:DEFAULT :EditPermissions);
12
use C4::Auth qw(:DEFAULT :EditPermissions);
13
use C4::Context;
13
use C4::Context;
14
use C4::Members;
14
use C4::Members;
15
use C4::Branch;
16
use C4::Members::Attributes qw(GetBorrowerAttributes);
15
use C4::Members::Attributes qw(GetBorrowerAttributes);
17
#use C4::Acquisitions;
16
#use C4::Acquisitions;
18
17
(-)a/members/member-password.pl (-1 lines)
Lines 12-18 use Koha::AuthUtils; Link Here
12
use C4::Output;
12
use C4::Output;
13
use C4::Context;
13
use C4::Context;
14
use C4::Members;
14
use C4::Members;
15
use C4::Branch;
16
use C4::Circulation;
15
use C4::Circulation;
17
use CGI qw ( -utf8 );
16
use CGI qw ( -utf8 );
18
use C4::Members::Attributes qw(GetBorrowerAttributes);
17
use C4::Members::Attributes qw(GetBorrowerAttributes);
(-)a/members/member.pl (-1 lines)
Lines 27-33 use Modern::Perl; Link Here
27
use C4::Auth;
27
use C4::Auth;
28
use C4::Output;
28
use C4::Output;
29
use CGI qw( -utf8 );
29
use CGI qw( -utf8 );
30
use C4::Branch;
31
use C4::Members qw( GetMember );
30
use C4::Members qw( GetMember );
32
use Koha::DateUtils;
31
use Koha::DateUtils;
33
use Koha::List::Patron;
32
use Koha::List::Patron;
(-)a/members/members-update-do.pl (-1 lines)
Lines 24-30 use C4::Auth; Link Here
24
use C4::Output;
24
use C4::Output;
25
use C4::Context;
25
use C4::Context;
26
use C4::Members;
26
use C4::Members;
27
use C4::Branch;
28
use Koha::Patron::Modifications;
27
use Koha::Patron::Modifications;
29
28
30
my $query = new CGI;
29
my $query = new CGI;
(-)a/members/members-update.pl (-1 lines)
Lines 24-30 use C4::Auth; Link Here
24
use C4::Output;
24
use C4::Output;
25
use C4::Context;
25
use C4::Context;
26
use C4::Members;
26
use C4::Members;
27
use C4::Branch;
28
use Koha::Patron::Modifications;
27
use Koha::Patron::Modifications;
29
28
30
my $query = new CGI;
29
my $query = new CGI;
(-)a/members/printfeercpt.pl (-1 lines)
Lines 29-35 use C4::Auth; Link Here
29
use C4::Output;
29
use C4::Output;
30
use CGI qw ( -utf8 );
30
use CGI qw ( -utf8 );
31
use C4::Members;
31
use C4::Members;
32
use C4::Branch;
33
use C4::Accounts;
32
use C4::Accounts;
34
use Koha::DateUtils;
33
use Koha::DateUtils;
35
use Koha::Patron::Images;
34
use Koha::Patron::Images;
(-)a/members/printinvoice.pl (-1 lines)
Lines 28-34 use C4::Output; Link Here
28
use Koha::DateUtils;
28
use Koha::DateUtils;
29
use CGI qw ( -utf8 );
29
use CGI qw ( -utf8 );
30
use C4::Members;
30
use C4::Members;
31
use C4::Branch;
32
use C4::Accounts;
31
use C4::Accounts;
33
use Koha::Patron::Images;
32
use Koha::Patron::Images;
34
33
(-)a/members/purchase-suggestions.pl (-1 lines)
Lines 23-29 use CGI qw ( -utf8 ); Link Here
23
use C4::Auth;
23
use C4::Auth;
24
use C4::Context;
24
use C4::Context;
25
use C4::Output;
25
use C4::Output;
26
use C4::Branch;
27
use C4::Members;
26
use C4::Members;
28
use C4::Members::Attributes qw(GetBorrowerAttributes);
27
use C4::Members::Attributes qw(GetBorrowerAttributes);
29
use C4::Suggestions;
28
use C4::Suggestions;
(-)a/members/statistics.pl (-1 lines)
Lines 26-32 use Modern::Perl; Link Here
26
26
27
use CGI qw ( -utf8 );
27
use CGI qw ( -utf8 );
28
use C4::Auth;
28
use C4::Auth;
29
use C4::Branch;
30
use C4::Context;
29
use C4::Context;
31
use C4::Members;
30
use C4::Members;
32
use C4::Members::Statistics;
31
use C4::Members::Statistics;
(-)a/misc/plack/koha.psgi (-1 lines)
Lines 43-49 use C4::Boolean; Link Here
43
use C4::Letters;
43
use C4::Letters;
44
use C4::Koha;
44
use C4::Koha;
45
use C4::XSLT;
45
use C4::XSLT;
46
use C4::Branch;
47
use Koha::DateUtils;
46
use Koha::DateUtils;
48
use Koha::Caches;
47
use Koha::Caches;
49
use Koha::Cache::Memory::Lite;
48
use Koha::Cache::Memory::Lite;
(-)a/offline_circ/list.pl (-1 lines)
Lines 27-33 use C4::Auth; Link Here
27
use C4::Koha;
27
use C4::Koha;
28
use C4::Context;
28
use C4::Context;
29
use C4::Circulation;
29
use C4::Circulation;
30
use C4::Branch;
31
use C4::Members;
30
use C4::Members;
32
use C4::Biblio;
31
use C4::Biblio;
33
32
(-)a/opac/opac-detail.pl (-1 lines)
Lines 25-31 use Modern::Perl; Link Here
25
use CGI qw ( -utf8 );
25
use CGI qw ( -utf8 );
26
use C4::Acquisition qw( SearchOrders );
26
use C4::Acquisition qw( SearchOrders );
27
use C4::Auth qw(:DEFAULT get_session);
27
use C4::Auth qw(:DEFAULT get_session);
28
use C4::Branch;
29
use C4::Koha;
28
use C4::Koha;
30
use C4::Serials;    #uses getsubscriptionfrom biblionumber
29
use C4::Serials;    #uses getsubscriptionfrom biblionumber
31
use C4::Output;
30
use C4::Output;
(-)a/opac/opac-discharge.pl (-1 lines)
Lines 26-32 use C4::Context; Link Here
26
use C4::Output;
26
use C4::Output;
27
use C4::Log;
27
use C4::Log;
28
use C4::Debug;
28
use C4::Debug;
29
use C4::Branch;
30
use C4::Members;
29
use C4::Members;
31
use Koha::Patron::Discharge;
30
use Koha::Patron::Discharge;
32
use Koha::DateUtils;
31
use Koha::DateUtils;
(-)a/opac/opac-messaging.pl (-1 lines)
Lines 29-35 use C4::Circulation; Link Here
29
use C4::Output;
29
use C4::Output;
30
use C4::Members;
30
use C4::Members;
31
use C4::Members::Messaging;
31
use C4::Members::Messaging;
32
use C4::Branch;
33
use C4::Form::MessagingPreferences;
32
use C4::Form::MessagingPreferences;
34
use Koha::SMS::Providers;
33
use Koha::SMS::Providers;
35
34
(-)a/opac/opac-topissues.pl (-1 lines)
Lines 29-35 use C4::Languages; Link Here
29
use C4::Search;
29
use C4::Search;
30
use C4::Output;
30
use C4::Output;
31
use C4::Koha;
31
use C4::Koha;
32
use C4::Branch;
33
use C4::Circulation;
32
use C4::Circulation;
34
use Date::Manip;
33
use Date::Manip;
35
34
(-)a/serials/routing-preview.pl (-1 lines)
Lines 33-39 use C4::Biblio; Link Here
33
use C4::Items;
33
use C4::Items;
34
use C4::Serials;
34
use C4::Serials;
35
use URI::Escape;
35
use URI::Escape;
36
use C4::Branch;
37
use Koha::Libraries;
36
use Koha::Libraries;
38
37
39
my $query = new CGI;
38
my $query = new CGI;
(-)a/serials/serials-home.pl (-1 lines)
Lines 31-37 this script is the main page for serials/ Link Here
31
use Modern::Perl;
31
use Modern::Perl;
32
use CGI qw ( -utf8 );
32
use CGI qw ( -utf8 );
33
use C4::Auth;
33
use C4::Auth;
34
use C4::Branch;
35
use C4::Context;
34
use C4::Context;
36
use C4::Output;
35
use C4::Output;
37
use C4::Serials;
36
use C4::Serials;
(-)a/t/Branch.t (-14 lines)
Lines 1-14 Link Here
1
#!/usr/bin/perl
2
#
3
# This Koha test module is a stub!  
4
# Add more tests here!!!
5
6
use strict;
7
use warnings;
8
9
use Test::More tests => 1;
10
11
BEGIN {
12
        use_ok('C4::Branch');
13
}
14
(-)a/t/db_dependent/Branch.t (-196 lines)
Lines 1-196 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2013 Equinox Software, Inc.
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, see <http://www.gnu.org/licenses>.
18
19
use Modern::Perl;
20
21
use C4::Context;
22
use Data::Dumper;
23
24
use Test::More tests => 16;
25
26
use C4::Branch;
27
use Koha::Database;
28
use Koha::Library;
29
use Koha::Libraries;
30
use Koha::LibraryCategories;
31
32
BEGIN {
33
    use FindBin;
34
    use lib $FindBin::Bin;
35
    use_ok('C4::Branch');
36
}
37
can_ok(
38
    'C4::Branch', qw(
39
      GetBranch
40
      GetBranches
41
      )
42
);
43
44
my $schema = Koha::Database->new->schema;
45
$schema->storage->txn_begin;
46
47
my $dbh = C4::Context->dbh;
48
49
# clear the slate
50
$dbh->do('DELETE FROM branchcategories');
51
52
# Start test
53
54
my $count = Koha::Libraries->search->count;
55
like( $count, '/^\d+$/', "the count is a number" );
56
57
#add 2 branches
58
my $b1 = {
59
    branchcode     => 'BRA',
60
    branchname     => 'BranchA',
61
    branchaddress1 => 'adr1A',
62
    branchaddress2 => 'adr2A',
63
    branchaddress3 => 'adr3A',
64
    branchzip      => 'zipA',
65
    branchcity     => 'cityA',
66
    branchstate    => 'stateA',
67
    branchcountry  => 'countryA',
68
    branchphone    => 'phoneA',
69
    branchfax      => 'faxA',
70
    branchemail    => 'emailA',
71
    branchreplyto  => 'emailreply',
72
    branchreturnpath => 'branchreturn',
73
    branchurl      => 'urlA',
74
    branchip       => 'ipA',
75
    branchprinter  => undef,
76
    branchnotes    => 'noteA',
77
    opac_info      => 'opacA',
78
    issuing        => undef,
79
};
80
my $b2 = {
81
    branchcode     => 'BRB',
82
    branchname     => 'BranchB',
83
    branchaddress1 => 'adr1B',
84
    branchaddress2 => 'adr2B',
85
    branchaddress3 => 'adr3B',
86
    branchzip      => 'zipB',
87
    branchcity     => 'cityB',
88
    branchstate    => 'stateB',
89
    branchcountry  => 'countryB',
90
    branchphone    => 'phoneB',
91
    branchfax      => 'faxB',
92
    branchemail    => 'emailB',
93
    branchreplyto  => 'emailreply',
94
    branchreturnpath => 'branchreturn',
95
    branchurl      => 'urlB',
96
    branchip       => 'ipB',
97
    branchprinter  => undef,
98
    branchnotes    => 'noteB',
99
    opac_info      => 'opacB',
100
    issuing        => undef,
101
};
102
Koha::Library->new($b1)->store;
103
Koha::Library->new($b2)->store;
104
105
is( Koha::Libraries->search->count, $count + 2, "two branches added" );
106
107
is( Koha::Libraries->find( $b2->{branchcode} )->delete, 1,          "One row affected" );
108
is( Koha::Libraries->search->count,             $count + 1, "branch BRB deleted" );
109
110
#Test Getbranches
111
my $branches = GetBranches();
112
is( scalar( keys %$branches ),
113
    Koha::Libraries->search->count, "GetBranches returns the right number of branches" );
114
115
#Test modify a library
116
117
$b1 = {
118
    branchcode     => 'BRA',
119
    branchname     => 'BranchA modified',
120
    branchaddress1 => 'adr1A modified',
121
    branchaddress2 => 'adr2A modified',
122
    branchaddress3 => 'adr3A modified',
123
    branchzip      => 'zipA modified',
124
    branchcity     => 'cityA modified',
125
    branchstate    => 'stateA modified',
126
    branchcountry  => 'countryA modified',
127
    branchphone    => 'phoneA modified',
128
    branchfax      => 'faxA modified',
129
    branchemail    => 'emailA modified',
130
    branchreplyto  => 'emailreply modified',
131
    branchreturnpath => 'branchreturn modified',
132
    branchurl      => 'urlA modified',
133
    branchip       => 'ipA modified',
134
    branchprinter  => undef,
135
    branchnotes    => 'notesA modified',
136
    opac_info      => 'opacA modified',
137
    issuing        => undef,
138
};
139
140
Koha::Libraries->find($b1->{branchcode})->set($b1)->store;
141
is( Koha::Libraries->search->count, $count + 1,
142
    "A branch has been modified, no new branch added" );
143
144
#Test categories
145
my $count_cat  = Koha::LibraryCategories->search->count;
146
147
my $cat1 = {
148
    categorycode     => 'CAT1',
149
    categoryname     => 'catname1',
150
    codedescription  => 'catdesc1',
151
    categorytype     => 'cattype1',
152
    show_in_pulldown => 1
153
};
154
my $cat2 = {
155
    categorycode     => 'CAT2',
156
    categoryname     => 'catname2',
157
    categorytype     => 'catype2',
158
    codedescription  => 'catdesc2',
159
    show_in_pulldown => 1
160
};
161
162
my %new_category = (
163
    categorycode     => 'LIBCATCODE',
164
    categoryname     => 'library category name',
165
    codedescription  => 'library category code description',
166
    categorytype     => 'searchdomain',
167
    show_in_pulldown => 1,
168
);
169
170
Koha::LibraryCategory->new(\%new_category)->store;
171
Koha::LibraryCategory->new($cat1)->store;
172
Koha::LibraryCategory->new($cat2)->store;
173
174
my $categories = Koha::LibraryCategories->search;
175
is( $categories->count, $count_cat + 3, "Two categories added" );
176
177
my $del = Koha::LibraryCategories->find( $cat2->{categorycode} )->delete;
178
is( $del, 1, 'One row affected' );
179
180
is( Koha::LibraryCategories->search->count, $count_cat + 2, "Category CAT 2 deleted" );
181
182
my $b2_stored = Koha::Library->new($b2)->store;
183
my $CAT1 = Koha::LibraryCategories->find('CAT1');
184
$b2_stored->add_to_categories([$CAT1]);
185
is( Koha::Libraries->search->count, $count + 2, 'BRB added' );
186
187
my $b1info = Koha::Libraries->find( $b1->{branchcode} );
188
is_deeply( $b1info->get_categories->count, 0, 'BRA has no categories' );
189
190
my $b2info = Koha::Libraries->find( $b2->{branchcode} );
191
is_deeply( $b2info->get_categories->count, 1, 'BRB has the category CAT1' );
192
193
Koha::LibraryCategory->new($cat2)->store;
194
is( Koha::LibraryCategories->search->count, $count_cat + 3, "Two categories added" );
195
196
$schema->storage->txn_rollback;
(-)a/t/db_dependent/Circulation.t (-1 lines)
Lines 20-26 use Modern::Perl; Link Here
20
use DateTime;
20
use DateTime;
21
use t::lib::Mocks;
21
use t::lib::Mocks;
22
use C4::Biblio;
22
use C4::Biblio;
23
use C4::Branch;
24
use C4::Items;
23
use C4::Items;
25
use C4::Members;
24
use C4::Members;
26
use C4::Reserves;
25
use C4::Reserves;
(-)a/t/db_dependent/Circulation/TooMany.t (-1 lines)
Lines 20-26 use C4::Context; Link Here
20
20
21
use C4::Biblio;
21
use C4::Biblio;
22
use C4::Members;
22
use C4::Members;
23
use C4::Branch;
24
use C4::Circulation;
23
use C4::Circulation;
25
use C4::Items;
24
use C4::Items;
26
use C4::Context;
25
use C4::Context;
(-)a/t/db_dependent/Circulation/transfers.t (-1 lines)
Lines 4-10 use Modern::Perl; Link Here
4
use C4::Biblio;
4
use C4::Biblio;
5
use C4::Context;
5
use C4::Context;
6
use C4::Items;
6
use C4::Items;
7
use C4::Branch;
8
use C4::Circulation;
7
use C4::Circulation;
9
use Koha::Database;
8
use Koha::Database;
10
use Koha::DateUtils;
9
use Koha::DateUtils;
(-)a/t/db_dependent/Holds.t (-1 lines)
Lines 6-12 use t::lib::Mocks; Link Here
6
use t::lib::TestBuilder;
6
use t::lib::TestBuilder;
7
7
8
use C4::Context;
8
use C4::Context;
9
use C4::Branch;
10
9
11
use Test::More tests => 61;
10
use Test::More tests => 61;
12
use MARC::Record;
11
use MARC::Record;
(-)a/t/db_dependent/Holds/LocalHoldsPriority.t (-1 lines)
Lines 4-10 use Modern::Perl; Link Here
4
4
5
use t::lib::Mocks;
5
use t::lib::Mocks;
6
use C4::Context;
6
use C4::Context;
7
use C4::Branch;
8
7
9
use Test::More tests => 6;
8
use Test::More tests => 6;
10
use MARC::Record;
9
use MARC::Record;
(-)a/t/db_dependent/Holds/RevertWaitingStatus.t (-1 lines)
Lines 4-10 use Modern::Perl; Link Here
4
4
5
use t::lib::Mocks;
5
use t::lib::Mocks;
6
use C4::Context;
6
use C4::Context;
7
use C4::Branch;
8
7
9
use Test::More tests => 3;
8
use Test::More tests => 3;
10
use MARC::Record;
9
use MARC::Record;
(-)a/t/db_dependent/HoldsQueue.t (-1 lines)
Lines 11-17 use Modern::Perl; Link Here
11
use Test::More tests => 38;
11
use Test::More tests => 38;
12
use Data::Dumper;
12
use Data::Dumper;
13
13
14
use C4::Branch;
15
use C4::Calendar;
14
use C4::Calendar;
16
use C4::Context;
15
use C4::Context;
17
use C4::Members;
16
use C4::Members;
(-)a/t/db_dependent/Holidays.t (-1 lines)
Lines 23-29 use DateTime::TimeZone; Link Here
23
23
24
use t::lib::TestBuilder;
24
use t::lib::TestBuilder;
25
use C4::Context;
25
use C4::Context;
26
use C4::Branch;
27
use Koha::Database;
26
use Koha::Database;
28
use Koha::DateUtils;
27
use Koha::DateUtils;
29
28
(-)a/t/db_dependent/Reserves.t (-1 lines)
Lines 24-30 use Test::Warn; Link Here
24
use MARC::Record;
24
use MARC::Record;
25
use DateTime::Duration;
25
use DateTime::Duration;
26
26
27
use C4::Branch;
28
use C4::Biblio;
27
use C4::Biblio;
29
use C4::Items;
28
use C4::Items;
30
use C4::Members;
29
use C4::Members;
(-)a/t/db_dependent/Template/Plugin/Categories.t (-1 lines)
Lines 3-9 use Modern::Perl; Link Here
3
use Test::More tests => 5;
3
use Test::More tests => 5;
4
4
5
use C4::Context;
5
use C4::Context;
6
use C4::Branch;
7
use Koha::Template::Plugin::Categories;
6
use Koha::Template::Plugin::Categories;
8
7
9
my $dbh = C4::Context->dbh;
8
my $dbh = C4::Context->dbh;
(-)a/tools/batchMod.pl (-1 lines)
Lines 28-34 use C4::Items; Link Here
28
use C4::Circulation;
28
use C4::Circulation;
29
use C4::Context;
29
use C4::Context;
30
use C4::Koha;
30
use C4::Koha;
31
use C4::Branch;
32
use C4::BackgroundJob;
31
use C4::BackgroundJob;
33
use C4::ClassSource;
32
use C4::ClassSource;
34
use C4::Debug;
33
use C4::Debug;
(-)a/tools/viewlog.pl (-2 lines)
Lines 28-34 use C4::Koha; Link Here
28
use C4::Output;
28
use C4::Output;
29
use C4::Log;
29
use C4::Log;
30
use C4::Items;
30
use C4::Items;
31
use C4::Branch;
32
use C4::Debug;
31
use C4::Debug;
33
use C4::Search;    # enabled_staff_search_views
32
use C4::Search;    # enabled_staff_search_views
34
use Koha::Patron::Images;
33
use Koha::Patron::Images;
35
- 

Return to bug 15758