ModReserveFill($borr_res);
}
- if ($cancelreserve) { # cancel reserves on this item
+ if ( $cancelreserve eq 'revert' ) { ## Revert waiting reserve to priority 1
+ RevertWaitingStatus({ itemnumber => $itemnumber });
+ }
+ elsif ( $cancelreserve eq 'cancel' || $cancelreserve ) { # cancel reserves on this item
CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
CancelReserve($res->{'biblionumber'}, 0, $res->{'borrowernumber'});
}
}
}
+=head2 RevertWaitingStatus
+
+ $success = RevertWaitingStatus({ itemnumber => $itemnumber });
+
+ Reverts a 'waiting' hold back to a regular hold with a priority of 1.
+
+ Caveat: Any waiting hold fixed with RevertWaitingStatus will be an
+ item level hold, even if it was only a bibliolevel hold to
+ begin with. This is because we can no longer know if a hold
+ was item-level or bib-level after a hold has been set to
+ waiting status.
+
+=cut
+
+sub RevertWaitingStatus {
+ my ( $params ) = @_;
+ my $itemnumber = $params->{'itemnumber'};
+
+ return unless ( $itemnumber );
+
+ my $dbh = C4::Context->dbh;
+
+ ## Get the waiting reserve we want to revert
+ my $query = "
+ SELECT * FROM reserves
+ WHERE itemnumber = ?
+ AND found IS NOT NULL
+ ";
+ my $sth = $dbh->prepare( $query );
+ $sth->execute( $itemnumber );
+ my $reserve = $sth->fetchrow_hashref();
+
+ ## Increment the priority of all other non-waiting
+ ## reserves for this bib record
+ $query = "
+ UPDATE reserves
+ SET
+ priority = priority + 1
+ WHERE
+ biblionumber = ?
+ AND
+ priority > 0
+ ";
+ $sth = $dbh->prepare( $query );
+ $sth->execute( $reserve->{'biblionumber'} );
+
+ ## Fix up the currently waiting reserve
+ $query = "
+ UPDATE reserves
+ SET
+ priority = 1,
+ found = NULL,
+ waitingdate = NULL
+ WHERE
+ reserve_id = ?
+ ";
+ $sth = $dbh->prepare( $query );
+ return $sth->execute( $reserve->{'reserve_id'} );
+}
+
=head2 ReserveSlip
ReserveSlip($branchcode, $borrowernumber, $biblionumber)
</div>
</div><div class="yui-g"><fieldset class="action">
- <input type="submit" value="Save" />
+ <input type="submit" onclick="return false;" style="display: none;" id="phony_submit" value="phony_submit" name="phony_submit" />
+ <input type="submit" value="Save" class="button" accesskey="w" />
<a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Cancel</a>
</fieldset></div> </form>
[% ELSE %]
<fieldset class="rows"><ol>
<li>
[% IF ( action_add_category ) %]<label for="category">Category</label>
- <input type="text" name="category" id="category" size="10" maxlength="10" />
+ <input type="text" name="category" id="category" size="10" maxlength="10" class="focus" />
[% ELSE %]<span class="label">Category</span>
<input type="hidden" name="category" value="[% category %]" /> [% category %]
[% END %]
<li>
<label for="authorised_value">Authorized value</label>
[% IF ( action_modify ) %]<input type="hidden" id="id" name="id" value="[% id %]" />[% END %]
+ [% IF ( action_add_category ) %]
<input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" />
+ [% ELSE %]
+ <input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" class="focus" />
+ [% END %]
</li>
<li>
<label for="lib">Description</label>
</li>
[% ELSE %]
<li>
- <label for="itemtype">Item type</label> <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" onblur="toUC(this)" />
+ <label for="itemtype">Item type</label> <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" onblur="toUC(this)" class="focus" />
</li>
[% END %]
<li>
- <label for="description">Description</label><input type="text" id="description" name="description" size="48" value="[% description |html %]" /> </li>
+ [% IF ( itemtype ) %]
+ <label for="description">Description</label><input type="text" id="description" name="description" size="48" value="[% description |html %]" class="focus" /></li>
+ [% ELSE %]
+ <label for="description">Description</label><input type="text" id="description" name="description" size="48" value="[% description |html %]" /></li>
+ [% END %]
[% IF ( noItemTypeImages ) %]
<li><span class="label">Image: </span>Item type images are disabled. To enable them, turn off the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=noItemTypeImages">noItemTypeImages system preference</a></li></ol>
[% ELSE %]</ol>
[% IF ( RESERVED ) %]
<p>
- <input type="checkbox" id="cancelreserve" name="cancelreserve" value="1" />
+ <input type="checkbox" id="cancelreserve" name="cancelreserve" value="cancel" />
<label for="cancelreserve">Cancel hold</label>
</p>
[% END %]
[% IF ( RESERVE_WAITING ) %]
- <p>
- <input type="checkbox" id="cancelreserve" name="cancelreserve" value="1" />
+<p>
<label for="cancelreserve">Cancel hold</label>
- </p>
+ <input type="radio" value="cancel" name="cancelreserve" id="cancelreserve" /><br />
+ <label for="revertreserve">Revert waiting status</label>
+ <input type="radio" value="revert" name="cancelreserve" id="revertreserve" checked="checked"/>
+</p>
[% END %]
<input type="hidden" name="barcode" value="[% barcode %]" />
[% END %]
</table>
- <fieldset class="action"><input type="submit" value="Save" class="button" accesskey="w" />
- [% UNLESS ( serialsadditems ) %] <input type="button" onclick="javascript:generateReceive()" value="Multi receiving">[% END %]
+ <fieldset class="action">
+ <input type="submit" onclick="return false;" style="display: none;" id="phony_submit" value="phony_submit" name="phony_submit" />
+ <input type="submit" value="Save" class="button" accesskey="w" />
+ [% UNLESS ( serialsadditems ) %] <input type="button" onclick="javascript:generateReceive()" value="Multi receiving">[% END %]
+ </fieldset>
</form>
</div>