$template = $e->retrieve_biblio_record_entry( $titem->target_biblio_record_entry )->marc;
}
- my $responses = [];
- my $some_failed = 0;
+ my $num_failed = 0;
+ my $num_succeeded = 0;
$conn->respond_complete(
- $actor->request('open-ils.actor.anon_cache.set_value', $auth, res_list => $responses)->gather(1)
+ $actor->request('open-ils.actor.anon_cache.set_value', $auth, batch_edit_progress => {})->gather(1)
) if ($actor);
for my $item ( @$items ) {
)->[0]->{'vandelay.template_overlay_bib_record'};
}
- $some_failed++ if ($success eq 'f');
+ if ($success eq 'f') {
+ $num_failed++;
+ } else {
+ $num_succeeded++;
+ }
if ($actor) {
- push @$responses, { record => $rec->id, success => $success };
- $actor->request('open-ils.actor.anon_cache.set_value', $auth, res_list => $responses);
+ $actor->request(
+ 'open-ils.actor.anon_cache.set_value', $auth,
+ batch_edit_progress => {
+ succeeded => $num_succeeded,
+ failed => $num_failed
+ },
+ );
} else {
$conn->respond({ record => $rec->id, success => $success });
}
unless ($e->delete_container_biblio_record_entry_bucket_item($item)) {
$e->rollback;
if ($actor) {
- push @$responses, { complete => 1, success => 'f' };
- $actor->request('open-ils.actor.anon_cache.set_value', $auth, res_list => $responses);
+ $actor->request(
+ 'open-ils.actor.anon_cache.set_value', $auth,
+ batch_edit_progress => {
+ complete => 1,
+ success => 'f',
+ succeeded => $num_succeeded,
+ failed => $num_failed,
+ }
+ );
return undef;
} else {
return { complete => 1, success => 'f' };
}
}
- if ($titem && !$some_failed) {
+ if ($titem && !$num_failed) {
return $e->die_event unless ($e->delete_container_biblio_record_entry_bucket_item($titem));
}
if ($e->commit) {
if ($actor) {
- push @$responses, { complete => 1, success => 't' };
- $actor->request('open-ils.actor.anon_cache.set_value', $auth, res_list => $responses);
+ $actor->request(
+ 'open-ils.actor.anon_cache.set_value', $auth,
+ batch_edit_progress => {
+ complete => 1,
+ success => 't',
+ succeeded => $num_succeeded,
+ failed => $num_failed,
+ }
+ );
} else {
return { complete => 1, success => 't' };
}
} else {
if ($actor) {
- push @$responses, { complete => 1, success => 'f' };
- $actor->request('open-ils.actor.anon_cache.set_value', $auth, res_list => $responses);
+ $actor->request(
+ 'open-ils.actor.anon_cache.set_value', $auth,
+ batch_edit_progress => {
+ complete => 1,
+ success => 'f',
+ succeeded => $num_succeeded,
+ failed => $num_failed,
+ }
+ );
} else {
return { complete => 1, success => 'f' };
}
fieldmapper.standardRequest(
['open-ils.actor','open-ils.actor.anon_cache.get_value'],
{ async : false,
- params: [ u.authtoken, 'res_list' ],
+ params: [ u.authtoken, 'batch_edit_progress' ],
onerror : function (r) { progress_dialog.hide(); },
onresponse : function (r) {
var counter = { success : 0, fail : 0, total : 0 };
- dojo.forEach( openils.Util.readResponse(r), function(x) {
+ if (x = openils.Util.readResponse(r)) {
+ counter.success = x.succeeded;
+ counter.fail = x.failed;
+ counter.total = counter.success + counter.fail;
if (x.complete) {
clearInterval(interval);
progress_dialog.hide();
if (x.success == 't') dojo.byId('complete_msg').innerHTML = 'Overlay completed successfully';
else dojo.byId('complete_msg').innerHTML = 'Overlay did not complet successfully';
- } else {
- counter.total++;
- switch (x.success) {
- case 't':
- counter.success++;
- break;
- default:
- counter.fail++;
- break;
- }
}
- });
+ };
// update the progress dialog
progress_dialog.update({progress:counter.total});