sub CancelExpiredReserves {
+ # Cancel reserves that have passed their expiration date.
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare( "
SELECT * FROM reserves WHERE DATE(expirationdate) < DATE( CURDATE() )
AND expirationdate IS NOT NULL
+ AND found IS NULL
" );
$sth->execute();
CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} );
}
+ # Cancel reserves that have been waiting too long
+ if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
+ my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
+ my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
+
+ my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
+ $sth = $dbh->prepare( $query );
+ $sth->execute( $max_pickup_delay );
+
+ while (my $res = $sth->fetchrow_hashref ) {
+ if ( $charge ) {
+ manualinvoice($res->{'borrowernumber'}, $res->{'itemnumber'}, 'Hold waiting too long', 'F', $charge);
+ }
+
+ CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} );
+ }
+ }
+
}
=head2 CancelReserve
#first : check if we have a reservation for this item .
my ($itemnumber, $newstatus) = @_;
- my $dbh = C4::Context->dbh;
- my $query = " UPDATE reserves
- SET found=?,waitingdate = now()
- WHERE itemnumber=?
- AND found IS NULL
- AND priority = 0
- ";
+ my $dbh = C4::Context->dbh;
+
+ my $query = "UPDATE reserves SET found = ?, waitingdate = NOW() WHERE itemnumber = ? AND found IS NULL AND priority = 0";
my $sth_set = $dbh->prepare($query);
$sth_set->execute( $newstatus, $itemnumber );
}
else {
# affect the reserve to Waiting as well.
- $query = "
- UPDATE reserves
- SET priority = 0,
- found = 'W',
- waitingdate=now(),
- itemnumber = ?
- WHERE borrowernumber = ?
- AND biblionumber = ?
- ";
+ $query = "
+ UPDATE reserves
+ SET priority = 0,
+ found = 'W',
+ waitingdate = NOW(),
+ itemnumber = ?
+ WHERE borrowernumber = ?
+ AND biblionumber = ?
+ ";
}
$sth = $dbh->prepare($query);
$sth->execute( $itemnumber, $borrowernumber,$biblionumber);
}
}
-
=head2 ReserveSlip
ReserveSlip($branchcode, $borrowernumber, $biblionumber)
if ( my $first = $dbh->selectrow_array("SELECT itemcallnumber
FROM items
WHERE itemcallnumber = ?", undef, $padded) ) {
- my $icn = $dbh->selectcol_arrayref("SELECT itemcallnumber
+ my $icn = $dbh->selectcol_arrayref("SELECT DISTINCT itemcallnumber
FROM items
WHERE itemcallnumber LIKE ?
AND itemcallnumber > ?
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('LinkerRelink',1,'If ON the authority linker will relink headings that have previously been linked every time it runs.',NULL,'YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('LinkerKeepStale',0,'If ON the authority linker will keep existing authority links for headings where it is unable to find a match.',NULL,'YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogModuleRelink',0,'If OFF the linker will never replace the authids that are set in the cataloging module.',NULL,'YesNo');
+INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelay', '0', '', 'Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay', 'YesNo');
+INSERT INTO systempreferences` (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelayCharge', '0', NULL , 'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.', 'free')
SetVersion($DBversion);
}
+$DBversion = "3.07.00.024";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelayCharge', '0', NULL , 'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.', 'free')");
+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelay', '0', '', 'Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay', 'YesNo')");
+ print "Upgrade to $DBversion done (Added system preference ExpireReservesMaxPickUpDelay, system preference ExpireReservesMaxPickUpDelayCharge, add reseves.charge_if_expired)\n";
+ SetVersion($DBversion);
+}
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)
[% IF ( books_loo.suggestionid ) %]
<br/>
Suggested by: [% books_loo.surnamesuggestedby %][% IF ( books_loo.firstnamesuggestedby ) %], [% books_loo.firstnamesuggestedby %] [% END %]
- (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% books_loo.suggestionid %]">suggestion #[% books_loo.suggestionid %]</a>)
+ (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% books_loo.suggestionid %]&op=show">suggestion #[% books_loo.suggestionid %]</a>)
[% END %]
[% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
</p>
<ol>
<li>
<span class="label">Suggested by: </span>
- [% surnamesuggestedby %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid %]">suggestion #[% suggestionid %]</a>)
+ [% surnamesuggestedby %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid %]&op=show">suggestion #[% suggestionid %]</a>)
</li>
</ol>
</fieldset>
<ol>
<li>
<span class="label">Suggested by: </span>
- [% surnamesuggestedby %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid %]">suggestion #[% suggestionid %]</a>)
+ [% surnamesuggestedby %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid %]&op=show">suggestion #[% suggestionid %]</a>)
</li>
</ol>
</fieldset>
[% IF ( loop_order.suggestionid ) %]
<br/>
Suggested by: [% loop_order.surnamesuggestedby %][% IF ( loop_order.firstnamesuggestedby ) %], [% loop_order.firstnamesuggestedby %] [% END %]
- (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_order.suggestionid %]">suggestion #[% loop_order.suggestionid %]</a>)
+ (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_order.suggestionid %]&op=show">suggestion #[% loop_order.suggestionid %]</a>)
[% END %]
</td>
<td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
[% IF ( loop_receive.suggestionid ) %]
<br/>
Suggested by: [% loop_receive.surnamesuggestedby %][% IF ( loop_receive.firstnamesuggestedby ) %], [% loop_receive.firstnamesuggestedby %] [% END %]
- (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_receive.suggestionid %]">suggestion #[% loop_receive.suggestionid %]</a>)
+ (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_receive.suggestionid %]&op=show">suggestion #[% loop_receive.suggestionid %]</a>)
[% END %]
</td>
<td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
class: integer
- days.
-
+ - pref: ExpireReservesMaxPickUpDelay
+ choices:
+ yes: Allow
+ no: "Don't allow"
+ - "holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay"
+ -
+ - If using ExpireReservesMaxPickUpDelay, charge a borrower who allows his or her waiting hold to expire a fee of
+ - pref: ExpireReservesMaxPickUpDelayCharge
+ class: currency
+ - [% local_currency %].
+ -
- Satisfy holds from the libraries
- pref: StaticHoldsQueueWeight
class: multi
-[% INCLUDE 'doc-head-open.inc' %]<title>Koha › Acquisitions ›
-[% IF ( op_save ) %][% IF ( suttesionid ) %]Edit purchase suggestion #[% suggestionid %][% ELSE %]Enter a new purchase suggestion[% END %][% ELSE %]Suggestions Management[% END %]</title>
+[% INCLUDE 'doc-head-open.inc' %]
+<title>Koha › Acquisitions ›
+ [% IF ( op_save ) %]
+ [% IF ( suggestionid) %]
+ [% IF ( op == 'show' ) %]
+ Show purchase suggestion #[% suggestionid %]
+ [% ELSE %]
+ Edit purchase suggestion #[% suggestionid %]
+ [% END %]
+ [% ELSE %]
+ Enter a new purchase suggestion
+ [% END %]
+ [% ELSE %]
+ Suggestions Management
+ [% END %]
+</title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'calendar.inc' %]
[% IF ( op_else ) %] <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
<body>
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › [% IF ( op_save ) %] <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> › [% IF ( suggestionid ) %]Suggestion edit #[% suggestionid %][% ELSE %]New purchase suggestion[% END %][% ELSE %]Suggestions Management[% END %] </div>
+<div id="breadcrumbs">
+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> ›
+ [% IF ( op_save ) %]
+ <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> ›
+ [% IF ( op == 'show' ) %]
+ Show suggestion #[% suggestionid %]
+ [% ELSE %]
+ Suggestion edit #[% suggestionid %]
+ [% END %]
+ [% ELSE %]
+ Suggestions Management
+ [% END %]
+</div>
+
+[% IF ( op == 'show' ) %]
+<div id="doc" class="yui-t7"> <!-- <div id="doc3" class="yui-t2"> -->
+<div id="bd">
+ <div id="yui-main">
+ <div class="yui-b">
+
+ <fieldset class="rows">
+ <legend>Bibliographic information</legend>
+ <ol>
+ <li><span class="label">Title:</span>[% title |html %]</li>
+ <li><span class="label">Author:</span>[% author %]</li>
+ <li><span class="label">Copyright date:</span>[% copyrightdate %]</li>
+ <li><span class="label">ISBN or ISSN or other standard number:</span>[% isbn %]</li>
+ <li><span class="label">Publisher:</span>[% publishercode %]</li>
+ <li><span class="label">Publication Place:</span>[% place %]</li>
+ <li><span class="label">Collection Title:</span>[% collectiontitle %]</li>
+ <li><span class="label">Document Type:</span>
+ [% FOREACH itemtypeloo IN itemtypeloop %]
+ [% IF ( itemtypeloo.selected ) %][% itemtypeloo.description %][% END %]
+ [% END %]
+ </li>
+ [% IF ( patron_reason_loop ) %]
+ <li><span class="label">Reason for suggestion: </span>
+ [% FOREACH patron_reason_loo IN patron_reason_loop %]
+ [% IF ( patron_reason_loo.selected ) %][% patron_reason_loo.lib %][% END %]
+ [% END %]
+ </li>
+ [% END %]
+ <li><span class="label">Notes:</span>[% note %]</li>
+ </ol>
+ </fieldset>
+ <fieldset class="rows"> <legend>Suggestion management</legend>
+ <ol>
+ <li>
+ <span class="label">Status:</span>
+ [% IF ( STATUS == 'ASKED' ) %]Pending
+ [% ELSIF ( STATUS == 'ACCEPTED' ) %]Accepted
+ [% ELSIF ( STATUS == 'CHECKED' ) %]Checked
+ [% ELSIF ( STATUS == 'REJECTED' ) %]Rejected
+ [% ELSE %]No Status
+ [% END %]
+ </li>
+ <li>
+ <table>
+ <thead><tr><th> </th><th>Date</th><th>By</th></tr></thead>
+ <tbody>
+ <tr>
+ <th><span class="label">Suggestion creation</span> </th>
+ <td>[% suggesteddate %]</td>
+ <td>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a> [% suggestedby_branchcode %] ([% suggestedby_description %])[% END %]
+ </td>
+ </tr>
+ <tr>
+ <th><span class="label">Suggestion management</span> </th>
+ <td>[% manageddate %]</td>
+ <td>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode %] ([% managedby_description %])[% END %]</td>
+ </tr>
+ <tr>
+ <th><span class="label">Suggestion Accepted</span> </th>
+ <td>[% accepteddate %]</td>
+ <td>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode %] ([% acceptedby_description %])[% END %]</td>
+ </tr>
+ </tbody>
+ </table></li></ol>
+ </fieldset>
+ <fieldset class="rows"> <legend>Acquisition information</legend>
+ <ol>
+ <li>
+ <span class="label">Library:</span> [% branchname %]
+ </li>
+ <li>
+ <span class="label">Budget:</span> [% budgetname %]
+ </li>
+ <li>
+ <span class="label">Copies:</span>[% quantity %]
+ </li>
+ <li>
+ <span class="label">Currency:</span>[% currency %]
+ </li>
+ <li>
+ <span class="label">Price:</span>[% price %]
+ </li>
+ <li>
+ <span class="label">Total</span>[% total %]
+ </li>
+ </ol>
+ </fieldset>
+
+ <a class="cancel" href="suggestion.pl"><<Back to the list</a>
+
+ </div>
+ </div>
+</div>
+[% ELSE %]
[% IF ( op_save ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
<div id="bd">
<input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total %]"/>
</li></ol>
</fieldset><input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby %][% ELSE %]noone[% END %]"/>
- <fieldset class="action"><input type="hidden" name="op" value="[% op %]" />[% IF ( suggestionid ) %]<input type="submit" value="Save" /> <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby %]#suggestions[% ELSE %]suggestion.pl?suggestionid=[% suggestionid %][% END %]">Cancel</a>[% ELSE %]<input type="submit" value="Submit Your Suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a>[% END %]
+ <fieldset class="action"><input type="hidden" name="op" value="[% op %]" />[% IF ( suggestionid ) %]<input type="submit" value="Save" /> <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby %]#suggestions[% ELSE %]suggestion.pl?suggestionid=[% suggestionid %]&op=show[% END %]">Cancel</a>[% ELSE %]<input type="submit" value="Submit Your Suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a>[% END %]
</fieldset>
</form>
[% END %]
<input type="checkbox" name="edit_field" value="[% suggestions_loo.suggestionid %]" />
</td>
<td>
- <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&op=edit" title="suggestion" >
- [% suggestions_loo.title |html %][% IF ( suggestions_loo.author ) %], by [% suggestions_loo.author %][% END %]
- </a>
+ <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&op=show" title="suggestion" >
+ [% suggestions_loo.title |html %][% IF ( suggestions_loo.author ) %], by [% suggestions_loo.author %][% END %]</a>
+ [<a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&op=edit" title="suggestion" >edit</a>]
<br />
[% IF ( suggestions_loo.copyrightdate ) %]© [% suggestions_loo.copyrightdate %] [% END %]
[% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc %]</i> [% END %]
</div>
</div>
- [% UNLESS ( op_save ) %] <div class="yui-b">
+ [% UNLESS ( op_save ) %] [% UNLESS ( op == 'show' ) %]<div class="yui-b">
<form name="suggestionfilter" action="suggestion.pl" method="get">
<fieldset class="brief"><ol style="display:block;"><li><label for="displayby">Organize by: </label>
<select name="displayby" id="displayby" style="width:auto;">
</fieldset>
</div>
</form>
- </div>[% END %]
+ </div>
+ [% END %]
+ [% END %]
</div>
+[% END %]
[% INCLUDE 'intranet-bottom.inc' %]
use strict;
sub kohaversion {
- our $VERSION = '3.07.00.023';
+ our $VERSION = '3.07.00.024';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
sub Init{
my $suggestion= shift @_;
- foreach my $date qw(suggesteddate manageddate){
+ foreach my $date ( qw(suggesteddate manageddate) ){
$suggestion->{$date}=(($suggestion->{$date} eq "0000-00-00" ||$suggestion->{$date} eq "")?
$suggestion->{$date}=C4::Dates->today:
format_date($suggestion->{$date})
);
}
- foreach my $date qw(rejecteddate accepteddate){
+ foreach my $date ( qw(rejecteddate accepteddate) ){
$suggestion->{$date}=(($suggestion->{$date} eq "0000-00-00" ||$suggestion->{$date} eq "")?
"":
format_date($suggestion->{$date})
}
$op = 'else';
}
+elsif ( $op eq 'show' ) {
+ $suggestion_ref=&GetSuggestion($$suggestion_ref{'suggestionid'});
+ $$suggestion_ref{branchname} = GetBranchName $$suggestion_ref{branchcode};
+ my $budget = GetBudget $$suggestion_ref{budgetid};
+ $$suggestion_ref{budgetname} = $$budget{budget_name};
+ Init($suggestion_ref);
+}
if ($op=~/else/) {
$op='else';
my $budget = GetBudget($suggestion->{budgetid});
$suggestion->{budget_name}=$budget->{budget_name} if $budget;
}
- foreach my $date qw(suggesteddate manageddate accepteddate){
+ foreach my $date ( qw(suggesteddate manageddate accepteddate) ){
if ($suggestion->{$date} ne "0000-00-00" && $suggestion->{$date} ne "" ){
$suggestion->{$date}=format_date($suggestion->{$date}) ;
} else {
);
}
-foreach my $element qw(managedby suggestedby acceptedby) {
+foreach my $element ( qw(managedby suggestedby acceptedby) ) {
# $debug || warn $$suggestion_ref{$element};
if ($$suggestion_ref{$element}){
my $member=GetMember(borrowernumber=>$$suggestion_ref{$element});
);
my %hashlists;
-foreach my $field qw(managedby acceptedby suggestedby budgetid) {
+foreach my $field ( qw(managedby acceptedby suggestedby budgetid) ) {
my $values_list;
$values_list=GetDistinctValues("suggestions.".$field) ;
my @codes_list = map{