[open-ils-commits] [GIT] Evergreen ILS branch rel_2_8 updated. ec852021bad593cd100b5a2d7cc53afc4dbc4b66
Evergreen Git
git at git.evergreen-ils.org
Fri Nov 6 09:52:47 EST 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_8 has been updated
via ec852021bad593cd100b5a2d7cc53afc4dbc4b66 (commit)
via 59ca73acbdb9510bfa77bd09acb6299e0132cba4 (commit)
via 521e0b6a9e06fba67d4acf50ef102deb6ec310e5 (commit)
via 03abdcd69f83e71a8a269b1b67da463381b6d74b (commit)
from 7969b7c06ac6dc4c89f264ff9d664165af1f5e28 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ec852021bad593cd100b5a2d7cc53afc4dbc4b66
Author: Ben Shum <bshum at biblio.org>
Date: Thu Nov 5 18:12:35 2015 -0500
LP#937789: Stamping upgrade script for part deletion
Signed-off-by: Ben Shum <bshum at biblio.org>
Conflicts:
Open-ILS/src/sql/Pg/002.schema.config.sql
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 5b2cb1c..e7f6804 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -91,7 +91,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0941', :eg_version); -- yboston/dyrcona
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0948', :eg_version); -- miker/gmcharlt/remington/bshum
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fake-delete-parts.sql b/Open-ILS/src/sql/Pg/upgrade/0948.schema.fake-delete-parts.sql
similarity index 99%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fake-delete-parts.sql
rename to Open-ILS/src/sql/Pg/upgrade/0948.schema.fake-delete-parts.sql
index 554e876..297a34c 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fake-delete-parts.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0948.schema.fake-delete-parts.sql
@@ -1,5 +1,7 @@
BEGIN;
+SELECT evergreen.upgrade_deps_block_check('0948', :eg_version);
+
ALTER TABLE biblio.monograph_part ADD COLUMN deleted BOOL NOT NULL DEFAULT FALSE;
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;
commit 59ca73acbdb9510bfa77bd09acb6299e0132cba4
Author: Remington Steed <rjs7 at calvin.edu>
Date: Thu Nov 5 08:45:23 2015 -0500
LP#937789: Hide 'deleted' from parts table & editor
This commit hides the new parts 'deleted' field from the Manage Parts
dojo table and popup editor.
Signed-off-by: Remington Steed <rjs7 at calvin.edu>
Signed-off-by: Ben Shum <bshum at biblio.org>
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 c1f246a..d0d0dac 100644
--- a/Open-ILS/src/templates/conify/global/biblio/monograph_part.tt2
+++ b/Open-ILS/src/templates/conify/global/biblio/monograph_part.tt2
@@ -18,8 +18,8 @@
autoHeight='true'
fieldOrder="['label']"
displayLimit=0
- suppressFields="['id','record','label_sortkey']"
- suppressEditFields="['id','label_sortkey']"
+ suppressFields="['id','record','label_sortkey','deleted']"
+ suppressEditFields="['id','label_sortkey','deleted']"
query="{id: null}"
fmClass='bmp'
editOnEnter='true'/>
commit 521e0b6a9e06fba67d4acf50ef102deb6ec310e5
Author: Galen Charlton <gmc at esilibrary.com>
Date: Thu Oct 29 15:39:16 2015 +0000
LP#937789: various improvements to logical deletion of parts
This patch ensures that when a monograph part is marked as
deleted, that mappings between it and its copies are also
removed, similar to the previous behavior of the cascade
on delete.
This patch also adds some pgTAP tests and ensures that
unapi.bmp() and unapi.holdings_xml() get updated during upgrade.
To test the fix for this bug:
[1] Apply the patches.
[2] Create a monograph part on a record, then delete it. Verify that
it no longer shows up in the parts maintenance interface, but that
a row in the biblio.monograph_parts table still exists with the
deleted flag set to true.
[3] Create another monograph part on the same record.
[4] Create a new volume/copy and assign the part created in step
3 to it. Verify that the part shown in step 2 is *not*
included in the XUL part selector.
[5] Place a part-level hold. Verify that the hold request
is displayed correct in both the public catalog and the staff
interface.
[6] Delete the part created in step 3.
[7] Verify that viewing the list of the patron's holds in the XUL staff
client doesn't result in any 'network errors'. Also verify that
the hold request is still displayed in patron's view in the public
catalog.
[8] Using SQL or some other means, set the expire_time and
prev_check_time of the test hold request to a couple days in the
past, then run the hold targeter. Verify that the hold gets
cancelled for lack of a suitable copy to fill it.
Signed-off-by: Galen Charlton <gmc at esilibrary.com>
Signed-off-by: Remington Steed <rjs7 at calvin.edu>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/sql/Pg/800.fkeys.sql b/Open-ILS/src/sql/Pg/800.fkeys.sql
index 5ad8d3f..54d2f59 100644
--- a/Open-ILS/src/sql/Pg/800.fkeys.sql
+++ b/Open-ILS/src/sql/Pg/800.fkeys.sql
@@ -39,7 +39,9 @@ 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
+ WHERE OLD.id = biblio.monograph_part.id;
+ DELETE FROM asset.copy_part_map
+ WHERE part = OLD.id
);
ALTER TABLE actor.usr ADD CONSTRAINT actor_usr_mailing_address_fkey FOREIGN KEY (mailing_address) REFERENCES actor.usr_address (id) DEFERRABLE INITIALLY DEFERRED;
diff --git a/Open-ILS/src/sql/Pg/t/regress/lp937789_fake_bmp_delete.sql b/Open-ILS/src/sql/Pg/t/regress/lp937789_fake_bmp_delete.sql
new file mode 100644
index 0000000..882ab01
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/t/regress/lp937789_fake_bmp_delete.sql
@@ -0,0 +1,73 @@
+BEGIN;
+
+SELECT plan(6);
+
+INSERT INTO biblio.record_entry (id, last_xact_id, marc)
+VALUES (999999998, 'pgtap', '<record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" xmlns="http://www.loc.gov/MARC21/slim">
+ <leader>00531nam a2200157 a 4500</leader>
+ <controlfield tag="005">20080729170300.0</controlfield>
+ <controlfield tag="008"> t19981999enka 0 eng </controlfield>
+ <datafield tag="245" ind1="1" ind2="4">
+ <subfield code="a">test-value</subfield>
+ </datafield>
+</record>');
+
+INSERT INTO biblio.monograph_part(record, label) VALUES (999999998, 'Part 1');
+
+SELECT is(
+ label,
+ 'Part 1',
+ 'LP#937789: new monograph parts start out active'
+)
+FROM biblio.monograph_part
+WHERE record = 999999998
+AND NOT deleted;
+
+SELECT is(
+ (XPATH(
+ '//ns:monograph_parts/ns:monograph_part/@label',
+ unapi.holdings_xml(999999998, 1, 'CONS', 0, '{bmp}'),
+ '{{ns,http://open-ils.org/spec/holdings/v1}}'
+ ))[1]::TEXT,
+ 'Part 1',
+ 'LP#937789: unapi.holdings_xml returns monograph part'
+);
+
+SELECT is(
+ (XPATH(
+ '/ns:monograph_part/@label',
+ unapi.bmp(CURRVAL('biblio.monograph_part_id_seq'), '', '', '{}', 'CONS'),
+ '{{ns,http://open-ils.org/spec/holdings/v1}}'
+ ))[1]::TEXT,
+ 'Part 1',
+ 'LP#937789: unapi.bmp returns monograph part'
+);
+
+DELETE FROM biblio.monograph_part WHERE record = 999999998;
+
+SELECT is(
+ deleted,
+ TRUE,
+ 'LP#937789: deleting monograph part sets deleted flag'
+)
+FROM biblio.monograph_part
+WHERE record = 999999998
+AND label = 'Part 1';
+
+SELECT is(
+ (XPATH(
+ '//ns:monograph_parts/ns:monograph_part/@label',
+ unapi.holdings_xml(999999998, 1, 'CONS', 0, '{bmp}'),
+ '{{ns,http://open-ils.org/spec/holdings/v1}}'
+ ))[1]::TEXT,
+ NULL,
+ 'LP#937789: unapi.holdings_xml does not return deleted monograph part'
+);
+
+SELECT is(
+ unapi.bmp(CURRVAL('biblio.monograph_part_id_seq'), '', '', '{}', 'CONS')::TEXT,
+ NULL,
+ 'LP#937789: unapi.bmp does not return deleted monograph part'
+);
+
+ROLLBACK;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fake-delete-parts.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fake-delete-parts.sql
index ada71d2..554e876 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fake-delete-parts.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fake-delete-parts.sql
@@ -1,7 +1,137 @@
BEGIN;
ALTER TABLE biblio.monograph_part ADD COLUMN deleted BOOL NOT NULL DEFAULT FALSE;
-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);
+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;
+ DELETE FROM asset.copy_part_map WHERE part = OLD.id
+);
+
+CREATE OR REPLACE FUNCTION unapi.holdings_xml (
+ bid BIGINT,
+ ouid INT,
+ org TEXT,
+ depth INT DEFAULT NULL,
+ includes TEXT[] DEFAULT NULL::TEXT[],
+ slimit HSTORE DEFAULT NULL,
+ soffset HSTORE DEFAULT NULL,
+ include_xmlns BOOL DEFAULT TRUE,
+ pref_lib INT DEFAULT NULL
+)
+RETURNS XML AS $F$
+ SELECT XMLELEMENT(
+ name holdings,
+ XMLATTRIBUTES(
+ CASE WHEN $8 THEN 'http://open-ils.org/spec/holdings/v1' ELSE NULL END AS xmlns,
+ CASE WHEN ('bre' = ANY ($5)) THEN 'tag:open-ils.org:U2 at bre/' || $1 || '/' || $3 ELSE NULL END AS id,
+ (SELECT record_has_holdable_copy FROM asset.record_has_holdable_copy($1)) AS has_holdable
+ ),
+ XMLELEMENT(
+ name counts,
+ (SELECT XMLAGG(XMLELEMENT::XML) FROM (
+ SELECT XMLELEMENT(
+ name count,
+ XMLATTRIBUTES('public' as type, depth, org_unit, coalesce(transcendant,0) as transcendant, available, visible as count, unshadow)
+ )::text
+ FROM asset.opac_ou_record_copy_count($2, $1)
+ UNION
+ SELECT XMLELEMENT(
+ name count,
+ XMLATTRIBUTES('staff' as type, depth, org_unit, coalesce(transcendant,0) as transcendant, available, visible as count, unshadow)
+ )::text
+ FROM asset.staff_ou_record_copy_count($2, $1)
+ UNION
+ SELECT XMLELEMENT(
+ name count,
+ XMLATTRIBUTES('pref_lib' as type, depth, org_unit, coalesce(transcendant,0) as transcendant, available, visible as count, unshadow)
+ )::text
+ FROM asset.opac_ou_record_copy_count($9, $1)
+ ORDER BY 1
+ )x)
+ ),
+ CASE
+ WHEN ('bmp' = ANY ($5)) THEN
+ XMLELEMENT(
+ name monograph_parts,
+ (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 NOT deleted AND record = $1
+ )x)
+ )
+ ELSE NULL
+ END,
+ XMLELEMENT(
+ name volumes,
+ (SELECT XMLAGG(acn ORDER BY rank, name, label_sortkey) FROM (
+ -- Physical copies
+ SELECT unapi.acn(y.id,'xml','volume',evergreen.array_remove_item_by_value( evergreen.array_remove_item_by_value($5,'holdings_xml'),'bre'), $3, $4, $6, $7, FALSE), y.rank, name, label_sortkey
+ FROM evergreen.ranked_volumes($1, $2, $4, $6, $7, $9, $5) AS y
+ UNION ALL
+ -- Located URIs
+ SELECT unapi.acn(uris.id,'xml','volume',evergreen.array_remove_item_by_value( evergreen.array_remove_item_by_value($5,'holdings_xml'),'bre'), $3, $4, $6, $7, FALSE), uris.rank, name, label_sortkey
+ FROM evergreen.located_uris($1, $2, $9) AS uris
+ )x)
+ ),
+ CASE WHEN ('ssub' = ANY ($5)) THEN
+ XMLELEMENT(
+ name subscriptions,
+ (SELECT XMLAGG(ssub) FROM (
+ SELECT unapi.ssub(id,'xml','subscription','{}'::TEXT[], $3, $4, $6, $7, FALSE)
+ FROM serial.subscription
+ WHERE record_entry = $1
+ )x)
+ )
+ ELSE NULL END,
+ CASE WHEN ('acp' = ANY ($5)) THEN
+ XMLELEMENT(
+ name foreign_copies,
+ (SELECT XMLAGG(acp) FROM (
+ SELECT unapi.acp(p.target_copy,'xml','copy',evergreen.array_remove_item_by_value($5,'acp'), $3, $4, $6, $7, FALSE)
+ FROM biblio.peer_bib_copy_map p
+ JOIN asset.copy c ON (p.target_copy = c.id)
+ WHERE NOT c.deleted AND p.peer_record = $1
+ LIMIT ($6 -> 'acp')::INT
+ OFFSET ($7 -> 'acp')::INT
+ )x)
+ )
+ ELSE NULL END
+ );
+$F$ LANGUAGE SQL STABLE;
+
+CREATE OR REPLACE FUNCTION unapi.bmp ( obj_id BIGINT, format TEXT, ename TEXT, includes TEXT[], org TEXT, depth INT DEFAULT NULL, slimit HSTORE DEFAULT NULL, soffset HSTORE DEFAULT NULL, include_xmlns BOOL DEFAULT TRUE ) RETURNS XML AS $F$
+ SELECT XMLELEMENT(
+ name monograph_part,
+ XMLATTRIBUTES(
+ CASE WHEN $9 THEN 'http://open-ils.org/spec/holdings/v1' ELSE NULL END AS xmlns,
+ 'tag:open-ils.org:U2 at bmp/' || id AS id,
+ id AS ident,
+ label,
+ label_sortkey,
+ 'tag:open-ils.org:U2 at bre/' || record AS record
+ ),
+ CASE
+ WHEN ('acp' = ANY ($4)) THEN
+ XMLELEMENT( name copies,
+ (SELECT XMLAGG(acp) FROM (
+ SELECT unapi.acp( cp.id, 'xml', 'copy', evergreen.array_remove_item_by_value($4,'bmp'), $5, $6, $7, $8, FALSE)
+ FROM asset.copy cp
+ JOIN asset.copy_part_map cpm ON (cpm.target_copy = cp.id)
+ WHERE cpm.part = $1
+ AND cp.deleted IS FALSE
+ ORDER BY COALESCE(cp.copy_number,0), cp.barcode
+ LIMIT ($7 -> 'acp')::INT
+ OFFSET ($8 -> 'acp')::INT
+
+ )x)
+ )
+ ELSE NULL
+ END,
+ 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 NOT deleted AND id = $1
+ GROUP BY id, label, label_sortkey, record;
+$F$ LANGUAGE SQL STABLE;
COMMIT;
commit 03abdcd69f83e71a8a269b1b67da463381b6d74b
Author: Ben Shum <bshum at biblio.org>
Date: Fri Nov 6 09:47:16 2015 -0500
LP#937789: fake-delete support for monograph parts
Unlike copies, call numbers, and bibs, parts can be directly removed from the
database. This has a negative impact on holds, in that the holds become not
just orphaned, but broken entirely. With this commit we bring part holds to
parity with other hold types such that they can be system-canceled when their
target goes away. This will avoid spurious UI-level errors to staff.
Conflicts: rel_2_8 does not contain the cataloging module for webstaff, commit
amended.
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Galen Charlton <gmc at esilibrary.com>
Signed-off-by: Remington Steed <rjs7 at calvin.edu>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index ea46dfb..98b435c 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -2979,6 +2979,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
<field name="record" reporter:datatype="link"/>
<field name="label" reporter:datatype="text"/>
<field name="label_sortkey" reporter:datatype="text"/>
+ <field name="deleted" reporter:datatype="bool"/>
</fields>
<links>
<link field="record" reltype="has_a" key="id" map="" class="bre"/>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
index 2a4e184..22b346d 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
@@ -2033,7 +2033,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 5c84493..8de593b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
@@ -2637,7 +2637,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 732dd9a..fde1a04 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 7f53b53..7252920 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
@@ -3735,6 +3735,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;
@@ -3762,6 +3765,7 @@ sub as_xml {
$xml .= " <monograph_parts>\n";
if (ref($self->obj->parts) && $self->obj->parts) {
for my $part ( @{$self->obj->parts} ) {
+ next if $U->is_true($part->deleted);
$xml .= sprintf(' <monograph_part record="%s" sortkey="%s">%s</monograph_part>',$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 4ce54ae..ff0542d 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 009b915..5ad8d3f 100644
--- a/Open-ILS/src/sql/Pg/800.fkeys.sql
+++ b/Open-ILS/src/sql/Pg/800.fkeys.sql
@@ -35,6 +35,13 @@ CREATE RULE protect_copy_location_delete AS
DELETE FROM config.circ_limit_set_copy_loc_map WHERE copy_loc = 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 751ec12..886c778 100644
--- a/Open-ILS/src/sql/Pg/990.schema.unapi.sql
+++ b/Open-ILS/src/sql/Pg/990.schema.unapi.sql
@@ -564,7 +564,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
@@ -945,7 +945,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/sql/Pg/upgrade/XXXX.schema.fake-delete-parts.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fake-delete-parts.sql
new file mode 100644
index 0000000..ada71d2
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fake-delete-parts.sql
@@ -0,0 +1,7 @@
+BEGIN;
+
+ALTER TABLE biblio.monograph_part ADD COLUMN deleted BOOL NOT NULL DEFAULT FALSE;
+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);
+
+COMMIT;
+
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 dfc89cc..c1f246a 100644
--- a/Open-ILS/src/templates/conify/global/biblio/monograph_part.tt2
+++ b/Open-ILS/src/templates/conify/global/biblio/monograph_part.tt2
@@ -37,7 +37,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 : [{class : 'bmp', field : 'label_sortkey'}]}, {record : cgi.param('r')});
+ monoPartGrid.loadAll({order_by : [{class : 'bmp', field : 'label_sortkey'}]}, {deleted : 'f', record : cgi.param('r')});
});
</script>
[% 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 0b16308..950488f 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
@@ -205,7 +205,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 );
/***********************************************************************************************************/
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/examples/fm_IDL.xml | 1 +
.../perlmods/lib/OpenILS/Application/AppUtils.pm | 2 +-
.../lib/OpenILS/Application/Search/Biblio.pm | 3 +-
.../lib/OpenILS/Application/Storage/CDBI/biblio.pm | 2 +-
.../perlmods/lib/OpenILS/Application/SuperCat.pm | 4 +
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/010.schema.biblio.sql | 1 +
Open-ILS/src/sql/Pg/800.fkeys.sql | 9 ++
Open-ILS/src/sql/Pg/990.schema.unapi.sql | 4 +-
.../sql/Pg/t/regress/lp937789_fake_bmp_delete.sql | 73 +++++++++++++++
...e_acn.sql => 0948.schema.fake-delete-parts.sql} | 94 +++++++++-----------
.../conify/global/biblio/monograph_part.tt2 | 6 +-
.../staff_client/server/cat/volume_copy_creator.js | 2 +-
13 files changed, 143 insertions(+), 60 deletions(-)
create mode 100644 Open-ILS/src/sql/Pg/t/regress/lp937789_fake_bmp_delete.sql
copy Open-ILS/src/sql/Pg/upgrade/{0769.schema.unapi_exclude_invisible_acn.sql => 0948.schema.fake-delete-parts.sql} (65%)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list