&bookfunds &curconvert &getcurrencies &bookfundbreakdown
&updatecurrencies &getcurrency
- &branches &updatesup &insertsup
+ &updatesup &insertsup
&bookseller &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);
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,
# 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 = ?");
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,
# 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;