projects
/
koha.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "(bug #3778) GetBranchesLoop and searchMyLibraryFirst"
[koha.git]
/
C4
/
Branch.pm
diff --git
a/C4/Branch.pm
b/C4/Branch.pm
index
73cd5fd
..
7dfd737
100644
(file)
--- a/
C4/Branch.pm
+++ b/
C4/Branch.pm
@@
-45,7
+45,7
@@
BEGIN {
&DelBranch
&DelBranchCategory
);
&DelBranch
&DelBranchCategory
);
- @EXPORT_OK = qw( &onlymine );
+ @EXPORT_OK = qw( &onlymine
&mybranch
);
}
=head1 NAME
}
=head1 NAME
@@
-141,12
+141,18
@@
sub onlymine {
return
C4::Context->preference('IndependantBranches') &&
C4::Context->userenv &&
return
C4::Context->preference('IndependantBranches') &&
C4::Context->userenv &&
- C4::Context->userenv->{flags}
!=1
&&
+ C4::Context->userenv->{flags}
%2 != 1
&&
C4::Context->userenv->{branch} ;
}
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} || '';
+}
+
sub GetBranchesLoop (;$$) { # since this is what most pages want anyway
sub GetBranchesLoop (;$$) { # since this is what most pages want anyway
- my $branch = @_ ? shift :
''
; # optional first argument is branchcode of "my branch", if preselection is wanted.
+ my $branch = @_ ? shift :
mybranch()
; # optional first argument is branchcode of "my branch", if preselection is wanted.
my $onlymine = @_ ? shift : onlymine();
my $branches = GetBranches($onlymine);
my @loop;
my $onlymine = @_ ? shift : onlymine();
my $branches = GetBranches($onlymine);
my @loop;
@@
-177,9
+183,9
@@
sub GetBranchName {
=head2 ModBranch
=head2 ModBranch
-&ModBranch($newvalue);
+
$error =
&ModBranch($newvalue);
-This function modify an existing branch
es.
+This function modify an existing branch
C<$newvalue> is a ref to an array wich is containt all the column from branches table.
C<$newvalue> is a ref to an array wich is containt all the column from branches table.
@@
-205,6
+211,7
@@
sub ModBranch {
$data->{'branchfax'}, $data->{'branchemail'},
$data->{'branchip'}, $data->{'branchprinter'},
);
$data->{'branchfax'}, $data->{'branchemail'},
$data->{'branchip'}, $data->{'branchprinter'},
);
+ return 1 if $dbh->err;
} else {
my $query = "
UPDATE branches
} else {
my $query = "
UPDATE branches
@@
-372,21
+379,18
@@
sub GetBranch ($$) {
=head2 GetBranchDetail
=head2 GetBranchDetail
-
$branchname
= &GetBranchDetail($branchcode);
+
$branch
= &GetBranchDetail($branchcode);
-Given the branch code, the function returns
the corresponding
-branch name for a comprehensive information display
+Given the branch code, the function returns
a
+hashref for the corresponding row in the branches table.
=cut
sub GetBranchDetail {
=cut
sub GetBranchDetail {
- my ($branchcode) = @_;
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("SELECT * FROM branches WHERE branchcode = ?");
+ my ($branchcode) = shift or return;
+ my $sth = C4::Context->dbh->prepare("SELECT * FROM branches WHERE branchcode = ?");
$sth->execute($branchcode);
$sth->execute($branchcode);
- my $branchname = $sth->fetchrow_hashref();
- $sth->finish();
- return $branchname;
+ return $sth->fetchrow_hashref();
}
=head2 get_branchinfos_of
}
=head2 get_branchinfos_of