tslittle / tiffanymaster

0 stars 0 forks source link

Auto-deletion of bibs does not check active/pending Acq orders #10

Open tslittle opened 3 years ago

tslittle commented 3 years ago

https://bugs.launchpad.net/evergreen/+bug/1904768

tslittle commented 3 years ago

The pertinent sub is in OpenILS/Application/Cat/AssetCommon.pm, sub remove_empty_objects

tslittle commented 3 years ago

I had a brainstorm this morning. If this is implemented to where it just doesn't delete the bib, then that means if later on you don't activate that pending purchase order (or you delete it) then the auto-deletion of bibs cleanup is useless. You just have empty bibs hanging out for no reason that you need to clean up.

What if instead we edit the creation of items function for acq copies to where "if bib deleted='t', then set bib deleted='f'" and then create the copies? Would that be desirable to undelete bibs where the lineitems have attached? That way the only time the bib delete flag comes into play is if items are intended to be created there, and only at that point.

tslittle commented 3 years ago

The pertinent part (I think) would be in Order.pm, around line 1256 in the sub create_lineitem_assets

tslittle commented 3 years ago

I think what I might need to do is to reference in Cat.pm, and then right before it's going to create the call numbers, do something like

if ($li->eg_bib_id) { my $bib = $e->retrieve_acq_cancel_reason($lid->cancel_reason);

    if (!$U->is_true($bib->isdeleted)) {
        undelete_biblio_record_entry(
            $mgr, $lid->lineitem, $lid) or return 0;
    }
    $lid->clear_cancel_reason;
}
tslittle commented 3 years ago

Obviously the above is Frankenstein'd between another sub that seemed pertinent and what might be necessary.

tslittle commented 3 years ago

Related bug: https://bugs.launchpad.net/evergreen/+bug/1815238