=cut
use strict;
+use warnings;
use CGI;
use C4::Auth;
use C4::Output;
query => $query,
type => "intranet",
authnotrequired => 0,
- flagsrequired => { circulation => 1 },
+ flagsrequired => { circulate => 1 },
debug => 1,
}
);
branch => $branchlimit,
total => scalar @$items,
itemsloop => $items,
- run_report => $run_report
+ run_report => $run_report,
+ dateformat => C4::Context->preference("dateformat"),
);
}
my $branches = GetBranches;
my $branch = C4::Context->userenv->{"branchname"};
my @branchloop;
-foreach my $thisbranch ( keys %$branches ) {
+foreach my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches ) {
my $selected = 1 if $thisbranch eq $branch;
my %row = (
value => $thisbranch,
sub GetHoldsQueueItems {
my ($branchlimit,$itemtypelimit) = @_;
my $dbh = C4::Context->dbh;
- my $query = "SELECT * FROM tmp_holdsqueue";
- $query.=" WHERE holdingbranch = \"$branchlimit\"" if $branchlimit;
+
+ my @bind_params = ();
+ my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.location, items.enumchron, items.cn_sort
+ FROM tmp_holdsqueue
+ JOIN biblio USING (biblionumber)
+ LEFT JOIN items USING (itemnumber)
+ /;
+ if ($branchlimit) {
+ $query .=" WHERE holdingbranch = ?";
+ push @bind_params, $branchlimit;
+ }
+ $query .= " ORDER BY ccode, location, cn_sort, author, title, pickbranch, reservedate";
my $sth = $dbh->prepare($query);
- $sth->execute();
+ $sth->execute(@bind_params);
my $items = [];
while ( my $row = $sth->fetchrow_hashref ){
$row->{reservedate} = format_date($row->{reservedate});