@EXPORT = qw(
&GetBranch
&GetBranches
- &mybranch
);
- @EXPORT_OK = qw( &onlymine &mybranch );
+ @EXPORT_OK = qw( &onlymine );
}
=head1 NAME
&& C4::Context->userenv->{branch};
}
-# always returns a string for OK comparison via "eq" or "ne"
-sub mybranch {
- C4::Context->userenv or return '';
- return C4::Context->userenv->{branch} || '';
-}
-
=head2 GetBranch
$branch = GetBranch( $query, $branches );
#
sub barcodedecode {
my ($barcode, $filter) = @_;
- my $branch = C4::Branch::mybranch();
+ my $branch = C4::Context::mybranch();
$filter = C4::Context->preference('itemBarcodeInputFilter') unless $filter;
$filter or return $barcode; # ensure filter is defined, else return untouched barcode
if ($filter eq 'whitespace') {
if ( my $item_data = $sth->fetchrow_hashref ) {
$item_type = $item_data->{itemtype};
$charge = $item_data->{rentalcharge};
- my $branch = C4::Branch::mybranch();
+ my $branch = C4::Context::mybranch();
my $discount_query = q|SELECT rentaldiscount,
issuingrules.itemtype, issuingrules.branchcode
FROM borrowers
my $dbh = C4::Context->dbh;
my $branchcode;
-if((!defined($input->param('branchcode'))) & mybranch() ne '')
+if((!defined($input->param('branchcode'))) & C4::Context::mybranch() ne '')
{
- $branchcode = mybranch();
+ $branchcode = C4::Context::mybranch();
}
else
{
my $branch = $input->param('branch');
unless ( $branch ) {
if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) {
- $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Branch::mybranch();
+ $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch();
}
else {
- $branch = C4::Branch::onlymine() ? ( C4::Branch::mybranch() || '*' ) : '*';
+ $branch = C4::Branch::onlymine() ? ( C4::Context::mybranch() || '*' ) : '*';
}
}
$branch = '*' if $branch eq 'NO_LIBRARY_SET';
'C4::Branch', qw(
GetBranch
GetBranches
- mybranch
)
);
Koha::LibraryCategory->new($cat2)->store;
is( Koha::LibraryCategories->search->count, $count_cat + 3, "Two categories added" );
-#TODO later: test mybranchine and onlymine
-# Actually we cannot mock C4::Context->userenv in unit tests
-
$schema->storage->txn_rollback;
unless ( defined $branchcode ) {
if ( C4::Context->preference('DefaultToLoggedInLibraryNoticesSlips') ) {
- $branchcode = C4::Branch::mybranch();
+ $branchcode = C4::Context::mybranch();
}
}
my $branch = $input->param('branch');
$branch =
defined $branch ? $branch
- : C4::Context->preference('DefaultToLoggedInLibraryOverdueTriggers') ? C4::Branch::mybranch()
+ : C4::Context->preference('DefaultToLoggedInLibraryOverdueTriggers') ? C4::Context::mybranch()
: Koha::Libraries->search->count() == 1 ? undef
: undef;
$branch ||= q{};