targetVol.isdeleted(true);
this.context.volsToDelete.push(targetVol);
- volNode.children.forEach(copyNode => {
- const copy = copyNode.target;
- if (copy.isnew()) {
- // New copies can simply be discarded.
- } else {
- copy.isdeleted(true);
- this.context.copiesToDelete.push(copy);
- }
- });
+ // When deleting vols, no need to delete the linked
+ // copies. They'll be force deleted via the API.
}
if (deleteVolIdx !== null) { break; }
this.context.volsToDelete.forEach(vol => {
const cloneVol = this.idl.clone(vol);
- // If a deleted volume also has deleted copies, they will
- // be appended below.
+ // No need to flesh copies -- they'll be force deleted.
cloneVol.copies([]);
volumes.push(cloneVol);
});
let vol = volumes.filter(v => v.id() === copyVol.id())[0];
if (vol) {
+ console.log('Adding deleted copy to vol deleted=' + vol.isdeleted());
vol.copies().push(cloneCopy);
} else {
vol = this.idl.clone(copyVol);
let method = 'open-ils.cat.asset.volume.fleshed.batch.update';
if (override) { method += '.override'; }
- this.net.request('open-ils.cat', method, this.auth.token(), volumes, true,
- {auto_merge_vols: true, create_parts: true, return_copy_ids: true})
+ this.net.request('open-ils.cat',
+ method, this.auth.token(), volumes, true,
+ { auto_merge_vols: true,
+ create_parts: true,
+ return_copy_ids: true,
+ force_delete_copies: true
+ }
- .toPromise().then(copyIds => {
+ ).toPromise().then(copyIds => {
const evt = this.evt.parse(copyIds);