$tabsysprefs{previousIssuesDefaultSortOrder}="Circulation";
$tabsysprefs{todaysIssuesDefaultSortOrder}="Circulation";
$tabsysprefs{HomeOrHoldingBranch}="Circulation";
+ $tabsysprefs{RandomizeHoldsQueueWeight}="Circulation";
+ $tabsysprefs{StaticHoldsQueueWeight}="Circulation";
# Staff Client
$tabsysprefs{TemplateEncoding}="StaffClient";
--- /dev/null
+#!/usr/bin/perl
+
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+
+
+=head1 view_holdsqueue
+
+This script displays items in the tmp_holdsqueue table
+
+=cut
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Output;
+use C4::Biblio;
+use C4::Items;
+use C4::Koha; # GetItemTypes
+use C4::Branch; # GetBranches
+use C4::Dates qw/format_date/;
+
+my $query = new CGI;
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "circ/view_holdsqueue.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { circulation => 1 },
+ debug => 1,
+ }
+);
+
+my $params = $query->Vars;
+my $run_report = $params->{'run_report'};
+my $branchlimit = $params->{'branchlimit'};
+my $itemtypeslimit = $params->{'itemtypeslimit'};
+
+if ( $run_report ) {
+ my $items = GetHoldsQueueItems( $branchlimit,$itemtypeslimit );
+ $template->param(
+ branch => $branchlimit,
+ total => scalar @$items,
+ itemsloop => $items,
+ run_report => $run_report
+ );
+}
+
+# getting all branches.
+my $branches = GetBranches;
+my $branch = C4::Context->userenv->{"branchname"};
+my @branchloop;
+foreach my $thisbranch ( keys %$branches ) {
+ my $selected = 1 if $thisbranch eq $branch;
+ my %row = (
+ value => $thisbranch,
+ selected => $selected,
+ branchname => $branches->{$thisbranch}->{'branchname'},
+ );
+ push @branchloop, \%row;
+}
+
+# getting all itemtypes
+my $itemtypes = &GetItemTypes();
+my @itemtypesloop;
+foreach my $thisitemtype ( sort keys %$itemtypes ) {
+ my %row = (
+ value => $thisitemtype,
+ description => $itemtypes->{$thisitemtype}->{'description'},
+ );
+ push @itemtypesloop, \%row;
+}
+
+$template->param( branchloop => \@branchloop,
+ itemtypeloop => \@itemtypesloop,
+);
+
+sub GetHoldsQueueItems {
+ my ($branchlimit,$itemtypelimit) = @_;
+ my $dbh = C4::Context->dbh;
+ my $query = "SELECT * FROM tmp_holdsqueue";
+ $query.=" WHERE holdingbranch = \"$branchlimit\"" if $branchlimit;
+ my $sth = $dbh->prepare($query);
+ $sth->execute();
+ my $items = [];
+ while ( my $row = $sth->fetchrow_hashref ){
+ $row->{reservedate} = format_date($row->{reservedate});
+ push @$items, $row;
+ }
+ return $items;
+
+}
+# writing the template
+output_html_with_http_headers $query, $cookie, $template->output;
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RenewSerialAddsSuggestion','0','If ON, adds a new suggestion at serial subscription renewal',NULL,'YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('GoogleJackets','0','if ON, displays jacket covers from Google Books API',NULL,'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RandomizeHoldsQueueWeight','0','if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight',NULL,'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('StaticHoldsQueueWeight','0','Specify a list of library location codes separated by commas -- the list of codes will be traversed and weighted with first values given higher weight for holds fulfillment -- alternatively, if RandomizeHoldsQueueWeight is set, the list will be randomly selective',NULL,'TextArea');
+
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RenewSerialAddsSuggestion','0','Si activé, génère une suggestion d''achat à chaque Renouvellement d''abonnement',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('GoogleJackets','0','if ON, displays jacket covers from Google Books API',NULL,'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RandomizeHoldsQueueWeight','0','if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight',NULL,'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('StaticHoldsQueueWeight','0','Specify a list of library location codes separated by commas -- the list of codes will be traversed and weighted with first values given higher weight for holds fulfillment -- alternatively, if RandomizeHoldsQueueWeight is set, the list will be randomly selective',NULL,'TextArea');
`pickbranch` varchar(10) default NULL,
`notes` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8");
+
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RandomizeHoldsQueueWeight','0','if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight',NULL,'YesNo')");
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('StaticHoldsQueueWeight','0','Specify a list of library location codes separated by commas -- the list of codes will be traversed and weighted with first values given higher weight for holds fulfillment -- alternatively, if RandomizeHoldsQueueWeight is set, the list will be randomly selective',NULL,'TextArea')");
+
print "Upgrade to $DBversion done (Table structure for table `tmp_holdsqueue`)\n";
SetVersion ($DBversion);
}
<h5>Circulation Reports</h5>
<ul>
+ <li> <a href="/cgi-bin/koha/circ/view_holdsqueue.pl" title="holds queue">Holds Queue</a></li>
<li> <a href="/cgi-bin/koha/circ/pendingreserves.pl" title="holds to retrieve off the shelf">Holds to pull</a></li>
<li> <a href="/cgi-bin/koha/circ/waitingreserves.pl" title="holds waiting for patron pickup">Holds awaiting pickup</a></li>
<li> <a href="/cgi-bin/koha/circ/reserveratios.pl">Hold ratios</a></li>
--- /dev/null
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+<title>Koha › Circulation › Holds Queue</title>
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+</head>
+<body>
+<!-- TMPL_INCLUDE NAME="header.inc" -->
+<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
+
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a><!-- TMPL_IF NAME="run_report" --> › <a href="/cgi-bin/koha/circ/view_holdsqueue.pl">Holds Queue</a> › Results<!-- TMPL_ELSE --> › Holds Queue<!-- /TMPL_IF --></div>
+
+<div id="doc3" class="yui-t2">
+
+ <div id="bd">
+ <div id="yui-main">
+ <div class="yui-b">
+
+<h1>Holds Queue</h1>
+
+<!-- TMPL_IF NAME="run_report" -->
+
+<div class="results">
+ <!-- TMPL_IF NAME="total" -->
+ <!-- TMPL_VAR NAME="total" --> items found for <!-- TMPL_VAR NAME="branch" -->
+ <!-- TMPL_ELSE-->
+ No items found
+ <!-- /TMPL_IF -->
+</div>
+
+ <!-- TMPL_IF NAME="itemsloop" --><table>
+ <tr>
+ <th>Title</th>
+ <th>Call Number</th>
+ <th>Patron</th>
+ <th>Phone Number</th>
+ <th>Date</th>
+ <th>Send To</th>
+ </tr>
+ <!-- TMPL_LOOP NAME="itemsloop"-->
+ <tr>
+ <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber"-->">
+ <!-- TMPL_VAR NAME="title"--></td>
+ </a></td>
+ <td><!-- TMPL_VAR NAME="itemcallnumber"--></td>
+ <td><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->">
+ <!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR NAME="firstname" -->
+ <!-- TMPL_VAR NAME="barcode"-->
+ </a></td>
+
+ <td><!-- TMPL_VAR NAME="phone"--></td>
+ <td><!-- TMPL_VAR NAME="reservedate" --></td>
+ <td><!-- TMPL_VAR NAME="pickbranch" --></td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </table>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_ELSE -->
+
+ <form name="f" action="/cgi-bin/koha/circ/view_holdsqueue.pl" method="post">
+
+ <li><label for="branchlimit">Library: </label><select name="branchlimit" id="branchlimit">
+ <option value="">All</option>
+ <!-- TMPL_LOOP name="branchloop" -->
+ <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
+ <!-- TMPL_ELSE -->
+ <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_LOOP -->
+ </select></li>
+ <!-- Not working yet
+ <li><label for="itemtypeslimit">Item Type: </label><select name="itemtypeslimit" id="itemtypeslimit">
+ <option value="">All</option>
+ <!-- TMPL_LOOP name="itemtypeloop" -->
+ <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="description" --></option>
+ <!-- TMPL_ELSE -->
+ <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="description" --></option>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_LOOP -->
+ </select></li>
+ -->
+</ol></fieldset>
+<fieldset class="action"> <input type="submit" value="Submit" />
+ <input type="hidden" name="run_report" value="1" /></fieldset>
+</form>
+
+ <!-- /TMPL_IF -->
+
+</div>
+</div>
+<div class="yui-b">
+<!-- TMPL_INCLUDE NAME="circ-menu.inc" -->
+</div>
+</div>
+<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
WHERE reserves.found IS NULL
AND reserves.borrowernumber=borrowers.borrowernumber
AND priority=1
- AND cancellationdate IS NULL
GROUP BY biblionumber");
my $sth_load=$dbh->prepare("
# Item is not notforloan
(!$itm->{"notforloan"}) ) ) {
- warn "patron requested pickup at $pickbranch for item in ".$itm->{'holdingbranch'};
+ #warn "patron requested pickup at $pickbranch for item in ".$itm->{'holdingbranch'};
# This selects items for fulfilment, and weights them based on
# a static list
my $weight=0;
# always prefer a direct match
if ($itm->{'holdingbranch'} eq $pickbranch) {
- warn "Found match in pickuplibrary";
+ #warn "Found match in pickuplibrary";
$itemorder[$weight]=$itm;
}
else {
for my $branchcode (@branch_loop) {
$weight++;
if ($itm->{'homebranch'} eq $branchcode) {
- warn "Match found with weight $weight in ".$branchcode;
+ #warn "Match found with weight $weight in ".$branchcode;
$itemorder[$weight]=$itm;
}
}
}
}
my $count = @itemorder;
- warn "Empty array" if $count<1;
+ #warn "Empty array" if $count<1;
next GETIT if $count<1; # if the re-ordered array is empty, skip to next
PREP: