From: Mike Rylander Date: Thu, 7 Jun 2012 18:54:24 +0000 (-0400) Subject: Basic fake-delete support for mono parts X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fmiker%2Ffake-delete-parts;p=working%2FEvergreen.git Basic fake-delete support for mono parts Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 88b1b71310..e414900d50 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -2504,6 +2504,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm index 792f53bb6f..1168b21d4b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm @@ -2103,7 +2103,7 @@ sub basic_opac_copy_query { acpm => { type => 'left', join => { - bmp => { type => 'left' } + bmp => { type => 'left', filter => { deleted => 'f' } } } } } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm index 82ad1af73a..8da498d3a8 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -2564,7 +2564,8 @@ sub rec_hold_parts { }, distinct => 1, } - } + }, + deleted => 'f' }, order_by =>[{class=>'bmp', field=>'label_sortkey'}] }; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/biblio.pm index 24e484c231..0a5c5e389e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/biblio.pm @@ -43,7 +43,7 @@ package biblio::monograph_part; use base qw/biblio/; biblio::monograph_part->table( 'biblio_monograph_part' ); -biblio::monograph_part->columns( Essential => qw/id record label label_sortkey/ ); +biblio::monograph_part->columns( Essential => qw/id record label label_sortkey deleted/ ); #------------------------------------------------------------------------------- 1; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm index d98bb3db6e..e736123146 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm @@ -3674,6 +3674,9 @@ sub as_xml { package OpenILS::Application::SuperCat::unAPI::acp; use base qw/OpenILS::Application::SuperCat::unAPI/; +use OpenILS::Application::AppUtils; +my $U = "OpenILS::Application::AppUtils"; + sub as_xml { my $self = shift; my $args = shift; @@ -3701,6 +3704,7 @@ sub as_xml { $xml .= " \n"; if (ref($self->obj->parts) && $self->obj->parts) { for my $part ( @{$self->obj->parts} ) { + next if $U->is_true($part->deleted); $xml .= sprintf(' %s',$part->record, $self->escape($part->label_sortkey), $self->escape($part->label)); $xml .= "\n"; } diff --git a/Open-ILS/src/sql/Pg/010.schema.biblio.sql b/Open-ILS/src/sql/Pg/010.schema.biblio.sql index 4ce54ae96b..ff0542d21d 100644 --- a/Open-ILS/src/sql/Pg/010.schema.biblio.sql +++ b/Open-ILS/src/sql/Pg/010.schema.biblio.sql @@ -98,6 +98,7 @@ CREATE TABLE biblio.monograph_part ( record BIGINT NOT NULL REFERENCES biblio.record_entry (id), label TEXT NOT NULL, label_sortkey TEXT NOT NULL, + deleted BOOL NOT NULL DEFAULT FALSE, CONSTRAINT record_label_unique UNIQUE (record,label) ); diff --git a/Open-ILS/src/sql/Pg/800.fkeys.sql b/Open-ILS/src/sql/Pg/800.fkeys.sql index 53be2e1a9e..8102f2f70f 100644 --- a/Open-ILS/src/sql/Pg/800.fkeys.sql +++ b/Open-ILS/src/sql/Pg/800.fkeys.sql @@ -21,6 +21,8 @@ BEGIN; CREATE RULE protect_bib_rec_delete AS ON DELETE TO biblio.record_entry DO INSTEAD (UPDATE biblio.record_entry SET deleted = TRUE WHERE OLD.id = biblio.record_entry.id; DELETE FROM metabib.metarecord_source_map WHERE source = OLD.id); +CREATE RULE protect_mono_part_delete AS ON DELETE TO biblio.monograph_part DO INSTEAD (UPDATE biblio.monograph_part SET deleted = TRUE WHERE OLD.id = biblio.monograph_part.id); + ALTER TABLE actor.usr ADD CONSTRAINT actor_usr_mailing_address_fkey FOREIGN KEY (mailing_address) REFERENCES actor.usr_address (id) DEFERRABLE INITIALLY DEFERRED; ALTER TABLE actor.usr ADD CONSTRAINT actor_usr_billing_address_fkey FOREIGN KEY (billing_address) REFERENCES actor.usr_address (id) DEFERRABLE INITIALLY DEFERRED; ALTER TABLE actor.usr ADD CONSTRAINT actor_usr_home_ou_fkey FOREIGN KEY (home_ou) REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED; diff --git a/Open-ILS/src/sql/Pg/990.schema.unapi.sql b/Open-ILS/src/sql/Pg/990.schema.unapi.sql index ac33c667fa..4b6a05b2fc 100644 --- a/Open-ILS/src/sql/Pg/990.schema.unapi.sql +++ b/Open-ILS/src/sql/Pg/990.schema.unapi.sql @@ -430,7 +430,7 @@ RETURNS XML AS $F$ (SELECT XMLAGG(bmp) FROM ( SELECT unapi.bmp( id, 'xml', 'monograph_part', evergreen.array_remove_item_by_value( evergreen.array_remove_item_by_value($5,'bre'), 'holdings_xml'), $3, $4, $6, $7, FALSE) FROM biblio.monograph_part - WHERE record = $1 + WHERE NOT deleted AND record = $1 )x) ) ELSE NULL @@ -811,7 +811,7 @@ CREATE OR REPLACE FUNCTION unapi.bmp ( obj_id BIGINT, format TEXT, ename TEXT, CASE WHEN ('bre' = ANY ($4)) THEN unapi.bre( record, 'marcxml', 'record', evergreen.array_remove_item_by_value($4,'bmp'), $5, $6, $7, $8, FALSE) ELSE NULL END ) FROM biblio.monograph_part - WHERE id = $1 + WHERE NOT deleted AND id = $1 GROUP BY id, label, label_sortkey, record; $F$ LANGUAGE SQL STABLE; diff --git a/Open-ILS/src/templates/conify/global/biblio/monograph_part.tt2 b/Open-ILS/src/templates/conify/global/biblio/monograph_part.tt2 index 08fc5c04ce..6676c6ab26 100644 --- a/Open-ILS/src/templates/conify/global/biblio/monograph_part.tt2 +++ b/Open-ILS/src/templates/conify/global/biblio/monograph_part.tt2 @@ -29,7 +29,7 @@ openils.Util.addOnLoad( function() { monoPartGrid.overrideEditWidgets.record = new dijit.form.TextBox({"disabled": true}); monoPartGrid.overrideEditWidgets.record.shove = { create : cgi.param('r') }; - monoPartGrid.loadAll({order_by : {bmp : 'label'}}, {record : cgi.param('r')}); + monoPartGrid.loadAll({order_by : {bmp : 'label'}}, {deleted : 'f', record : cgi.param('r')}); }); [% END %] diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js index 913fef64ba..da82f1831e 100644 --- a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js +++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js @@ -206,7 +206,7 @@ function my_init() { dojo.require('openils.PermaCrud'); g.pcrud = new openils.PermaCrud({'authtoken':ses()}); - g.parts = g.pcrud.search('bmp',{'record':g.doc_id},{'order_by': { 'bmp' : 'label_sortkey' } }); + g.parts = g.pcrud.search('bmp',{'deleted':'f', 'record':g.doc_id},{'order_by': { 'bmp' : 'label_sortkey' } }); g.parts_hash = util.functional.convert_object_list_to_hash( g.parts ); /***********************************************************************************************************/