From 8614c414d30f81033ef1e0ac43c674bc017ed061 Mon Sep 17 00:00:00 2001 From: senator Date: Wed, 30 Mar 2011 17:41:17 -0400 Subject: [PATCH] essentially functioning hold editor Still needs a way to report failures to the user --- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 33 ++++++++++++-- Open-ILS/web/css/skin/default/opac/style.css | 5 ++ .../templates/default/opac/myopac/holds/edit.tt2 | 46 ++++++++++++++++++- .../templates/default/opac/parts/myopac/base.tt2 | 2 +- 4 files changed, 77 insertions(+), 9 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index bed70d4..67920e3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -125,7 +125,7 @@ sub handle_hold_update { 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/; @@ -139,7 +139,7 @@ sub handle_hold_update { '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) { @@ -157,10 +157,32 @@ sub handle_hold_update { } $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 { @@ -174,11 +196,12 @@ 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 { diff --git a/Open-ILS/web/css/skin/default/opac/style.css b/Open-ILS/web/css/skin/default/opac/style.css index 6b40404..32a3c82 100644 --- a/Open-ILS/web/css/skin/default/opac/style.css +++ b/Open-ILS/web/css/skin/default/opac/style.css @@ -971,4 +971,9 @@ a.dash-link:hover { text-decoration: underline !important; } #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; } diff --git a/Open-ILS/web/templates/default/opac/myopac/holds/edit.tt2 b/Open-ILS/web/templates/default/opac/myopac/holds/edit.tt2 index bf30913..53e12c9 100644 --- a/Open-ILS/web/templates/default/opac/myopac/holds/edit.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/holds/edit.tt2 @@ -24,6 +24,8 @@
[% l('Editing Hold') %] +         + [% l('List all holds') %]
[% IF hold %] @@ -36,11 +38,12 @@

[% l('Status') %]: [% hold.human_status %]

-
+ @@ -57,15 +60,52 @@ + + + + + + + + +
- + [% l('Pickup library') %] + [% l('Enter date in MM/DD/YYYY format') %] + +
- [% l('Activate on') %] + [% l('Active?') %] + + +
+ [% l('If suspended, activate on') %] + [% l('Enter date in MM/DD/YYYY format') %] +
+ + [% l('Cancel') %] +
diff --git a/Open-ILS/web/templates/default/opac/parts/myopac/base.tt2 b/Open-ILS/web/templates/default/opac/parts/myopac/base.tt2 index d41caa1..f374db2 100644 --- a/Open-ILS/web/templates/default/opac/parts/myopac/base.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/myopac/base.tt2 @@ -22,7 +22,7 @@ ELSE; cls_which = "off"; END -%] - [% END %]
-- 1.7.2.5