removing branches sub, that should be in Koha.pm package (generic sub)

This commit is contained in:
tipaul 2005-09-02 14:30:28 +00:00
parent 07ea313528
commit 2ba136efd2
2 changed files with 13 additions and 40 deletions

View File

@ -62,7 +62,7 @@ orders, converting money to different currencies, and so forth.
&bookfunds &curconvert &getcurrencies &bookfundbreakdown
&updatecurrencies &getcurrency
&branches &updatesup &insertsup
&updatesup &insertsup
&bookseller &breakdown
);
@ -987,41 +987,6 @@ sub breakdown {
return(scalar(@results),\@results);
}
=item branches
($count, @results) = &branches();
Returns a list of all library branches.
C<$count> is the number of elements in C<@results>. C<@results> is an
array of references-to-hash, whose keys are the fields of the branches
table of the Koha database.
=cut
#'
sub branches {
my $dbh = C4::Context->dbh;
my $sth;
if (C4::Context->preference("IndependantBranches") && (C4::Context->userenv->{flags}!=1)){
my $strsth ="Select * from branches ";
$strsth.= " WHERE branchcode = ".$dbh->quote(C4::Context->userenv->{branch});
$strsth.= " order by branchname";
warn "C4::Acquisition->branches : ".$strsth;
$sth=$dbh->prepare($strsth);
} else {
$sth = $dbh->prepare("Select * from branches order by branchname");
}
my @results = ();
$sth->execute();
while (my $data = $sth->fetchrow_hashref) {
push(@results,$data);
} # while
$sth->finish;
return(scalar(@results), @results);
} # sub branches
=item updatesup
&updatesup($bookseller);

View File

@ -178,7 +178,7 @@ sub subfield_is_koha_internal_p ($) {
my $branches = getbranches;
my @branchloop;
foreach my $thisbranch (keys %$branches) {
foreach my $thisbranch (sort keys %$branches) {
my $selected = 1 if $thisbranch eq $branch;
my %row =(value => $thisbranch,
selected => $selected,
@ -202,7 +202,15 @@ sub getbranches {
# returns a reference to a hash of references to branches...
my %branches;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("select * from branches order by branchname");
my $sth;
if (C4::Context->preference("IndependantBranches") && (C4::Context->userenv->{flags}!=1)){
my $strsth ="Select * from branches ";
$strsth.= " WHERE branchcode = ".$dbh->quote(C4::Context->userenv->{branch});
$strsth.= " order by branchname";
$sth=$dbh->prepare($strsth);
} else {
$sth = $dbh->prepare("Select * from branches order by branchname");
}
$sth->execute;
while (my $branch=$sth->fetchrow_hashref) {
my $nsth = $dbh->prepare("select categorycode from branchrelations where branchcode = ?");
@ -236,7 +244,7 @@ build a HTML select with the following code :
my $itemtypes = getitemtypes;
my @itemtypesloop;
foreach my $thisitemtype (keys %$itemtypes) {
foreach my $thisitemtype (sort keys %$itemtypes) {
my $selected = 1 if $thisitemtype eq $itemtype;
my %row =(value => $thisitemtype,
selected => $selected,
@ -266,7 +274,7 @@ sub getitemtypes {
# returns a reference to a hash of references to branches...
my %itemtypes;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("select * from itemtypes order by description");
my $sth=$dbh->prepare("select * from itemtypes");
$sth->execute;
while (my $IT=$sth->fetchrow_hashref) {
$itemtypes{$IT->{'itemtype'}}=$IT;