my $self = shift;
my $action = shift;
my $e = $self->editor;
-
+ my $url;
my @hold_ids = $self->cgi->param('hold_id'); # for non-_all actions
@hold_ids = @{$self->fetch_user_holds(undef, 1)} if $action =~ /_all/;
'open-ils.circ.hold.cancel', $e->authtoken, $hold_id, 6 )->gather(1); # 6 == patron-cancelled-via-opac
}
- } else {
+ } elsif ($action =~ /activate|suspend/) {
my $vlist = [];
for my $hold_id (@hold_ids) {
}
$circ->request('open-ils.circ.hold.update.batch.atomic', $e->authtoken, undef, $vlist)->gather(1);
+ } elsif ($action eq 'edit') {
+
+ my @vals = map {
+ my $val = {"id" => $_};
+ $val->{"frozen"} = $self->cgi->param("frozen");
+ $val->{"pickup_lib"} = $self->cgi->param("pickup_lib");
+
+ for my $field (qw/expire_time thaw_date/) {
+ # XXX TODO make this support other date formats, not just
+ # MM/DD/YYYY.
+ next unless $self->cgi->param($field) =~
+ m:^(\d{2})/(\d{2})/(\d{4})$:;
+ $val->{$field} = "$3-$1-$2";
+ }
+ $val;
+ } @hold_ids;
+
+ $circ->request(
+ 'open-ils.circ.hold.update.batch.atomic',
+ $e->authtoken, undef, \@vals
+ )->gather(1); # LFW XXX test for failure
+ $url = 'https://' . $self->apache->hostname . $self->ctx->{opac_root} . '/myopac/holds';
}
$circ->kill_me;
- return undef;
+ return defined($url) ? $self->generic_redirect($url) : undef;
}
sub load_myopac_holds {
my $action = $self->cgi->param('action') || '';
my $available = int($self->cgi->param('available') || 0);
- $self->handle_hold_update($action) if $action;
+ my $hold_handle_result;
+ $hold_handle_result = $self->handle_hold_update($action) if $action;
$ctx->{holds} = $self->fetch_user_holds(undef, 0, 1, $available, $limit, $offset);
- return Apache2::Const::OK;
+ return defined($hold_handle_result) ? $hold_handle_result : Apache2::Const::OK;
}
sub load_place_hold {
#hold_editor h1 { font-size: 120%; font-weight: bold; }
#hold_editor h2 { font-size: 111%; font-weight: normal; text-indent: 2em; font-style: italic; }
#hold_editor h1, #hold_editor h2 { margin: 2px 0; }
+#hold_editor_table { background-color: #ddd; padding: 0.5em; }
#hold_editor_table th { text-align: right; padding-right: 1em; }
+#hold_editor_table td { padding: 0.25em 0; }
+.fmt-note { vertical-align: middle; padding-left: 1em !important; }
+.hold-editor-controls { text-align: center; padding-top: 1em !important; }
+.hold-editor-controls a { padding-left: 2em; }
<div class="pad-bottom-five">
<div class="header_middle">
<span id="acct_holds_header float-left">[% l('Editing Hold') %]</span>
+
+ <a href="[% ctx.opac_root %]/myopac/holds">[% l('List all holds') %]</a>
</div>
<div id="hold_editor">
[% IF hold %]
<p>
<strong>[% l('Status') %]</strong>: [% hold.human_status %]
</p>
- <form>
+ <form method="POST">
<table id="hold_editor_table">
<tr>
<th>
- <input type="hidden" name="hold"
+ <input type="hidden" name="action" value="edit" />
+ <input type="hidden" name="hold_id"
value="[% ahr.id %]" />
[% l('Pickup library') %]
</th>
<input type="text" name="expire_time"
value="[% expire_time | html %]" />
</td>
+ <td class="fmt-note">
+ <em>[% l('Enter date in MM/DD/YYYY format') %]</em>
+ <!-- XXX TODO pick out a minimal, simple, reliable
+ calendar widget that's not part of some giant,
+ bloated framework and doesn't do anything at onload.
+ -->
+ </td>
</tr>
<tr>
<th>
- [% l('Activate on') %]
+ [% l('Active?') %]
+ </th>
+ <td>
+ <select name="frozen">
+ <option value="f"[% ahr.frozen == 't' ? '' :' selected="selected"' %]>
+ [% l('Yes, this hold is active now') %]
+ </option>
+ <option value="t"[% ahr.frozen == 't' ? ' selected="selected"' : '' %]>
+ [% l('No, this hold is suspended') %]
+ </option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th>
+ [% l('If suspended, activate on') %]
</th>
<td>
<input type="text" name="thaw_date"
value="[% thaw_date | html %]" />
</td>
+ <td class="fmt-note">
+ <em>[% l('Enter date in MM/DD/YYYY format') %]</em>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="hold-editor-controls">
+ <input type="image"
+ src="[% ctx.media_prefix %]/images/btnSubmit.png"
+ alt="[% l('Submit') %]"
+ title="[% l('Submit') %]" />
+ <a href="[% ctx.opac_root %]/myopac/holds"><img
+ src="[% ctx.media_prefix %]/images/btnCancel.png"
+ alt="[% l('Cancel') %]"
+ title="[% l('Cancel') %]" /></a>
+ </td>
</tr>
</table>
</form>
ELSE;
cls_which = "off";
END -%]
- <a href="[% page.url %]"
+ <a href="[% ctx.opac_root _ '/myopac/' _ page.url %]"
class="acct-[% page.url; '-'; cls_which %] acct-tab"></a>
[% END %]
</div>