<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"/>
acpm => {
type => 'left',
join => {
- bmp => { type => 'left' }
+ bmp => { type => 'left', filter => { deleted => 'f' } }
}
}
}
},
distinct => 1,
}
- }
+ },
+ deleted => 'f'
},
order_by =>[{class=>'bmp', field=>'label_sortkey'}]
};
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;
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;
$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";
}
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)
);
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;
(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
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;
--- /dev/null
+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;
+
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 %]
return $q.when(service.bmp_parts[rec]);
return egCore.pcrud.search('bmp',
- {record : rec},
+ {record : rec, deleted : 'f'},
null, {atomic : true}
).then(function(list) {
service.bmp_parts[rec] = list;
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 );
/***********************************************************************************************************/