on the hold, the requestor must have UPDATE_HOLDS permissions.
NOTE
-sub update_hold {
- my($self, $client, $auth, $hold) = @_;
+__PACKAGE__->register_method(
+ method => "batch_update_hold",
+ api_name => "open-ils.circ.hold.update.batch",
+ notes => <<" NOTE");
+ Updates the specified hold. The login session
+ is the requestor and if the requestor is different from the usr field
+ on the hold, the requestor must have UPDATE_HOLDS permissions.
+ NOTE
+sub update_hold {
+ my($self, $client, $auth, $hold, $values) = @_;
my $e = new_editor(authtoken=>$auth, xact=>1);
return $e->die_event unless $e->checkauth;
+ my $resp = update_hold_impl($self, $e, $hold, $values);
+ return $resp if $U->event_code($resp);
+ $e->commit;
+ return $resp;
+}
+
+sub batch_update_hold {
+ my($self, $client, $auth, $hold_list, $values_list) = @_;
+ my $e = new_editor(authtoken=>$auth, xact => 1);
+ return $e->die_event unless $e->checkauth;
+
+ my $count = ($hold_list) ? scalar(@$hold_list) : scalar(@$values_list);
+ $hold_list ||= [];
+ $values_list ||= [];
+ for my $idx (0..$count-1) {
+ my $resp = update_hold_impl($self, $e, $hold_list->[$idx], $values_list->[$idx]);
+ return $resp if $U->event_code($resp);
+ }
+
+ $e->commit;
+ return 1;
+}
+
+sub update_hold_impl {
+ my($self, $e, $hold, $values) = @_;
+
+ unless($hold) {
+ $hold = $e->retrieve_action_hold_request($values->{id})
+ or return $e->die_event;
+ $hold->$_($values->{$_}) for keys %$values;
+ }
my $orig_hold = $e->retrieve_action_hold_request($hold->id)
or return $e->die_event;