[open-ils-commits] r10094 - in branches/acq-experiment/Open-ILS:
examples src/sql/Pg
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jul 23 10:52:45 EDT 2008
Author: miker
Date: 2008-07-23 10:52:40 -0400 (Wed, 23 Jul 2008)
New Revision: 10094
Modified:
branches/acq-experiment/Open-ILS/examples/fm_IDL.xml
branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql
Log:
rearranging some columns for better layout; removing xpath requirement from usr attrs; adding unowned attr table
Modified: branches/acq-experiment/Open-ILS/examples/fm_IDL.xml
===================================================================
--- branches/acq-experiment/Open-ILS/examples/fm_IDL.xml 2008-07-23 02:45:47 UTC (rev 10093)
+++ branches/acq-experiment/Open-ILS/examples/fm_IDL.xml 2008-07-23 14:52:40 UTC (rev 10094)
@@ -3701,7 +3701,6 @@
<field reporter:label="Definition ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
<field reporter:label="Code" name="code" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="text" />
<field reporter:label="Description" name="description" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text" oils_persist:i18n="true" />
- <field reporter:label="XPath" name="xpath" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="text" />
</fields>
<links/>
</class>
@@ -3756,14 +3755,25 @@
<field reporter:label="Definition ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
<field reporter:label="Code" name="code" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="text" />
<field reporter:label="Description" name="description" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text" oils_persist:i18n="true" />
- <field reporter:label="XPath" name="xpath" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="text" />
- <field reporter:label="User" name="usr" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="User" name="usr" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="link" />
</fields>
<links>
<link field="usr" reltype="has_a" key="id" map="" class="au"/>
</links>
</class>
+ <class id="acqlilad" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::lineitem_local_attr_definition" oils_persist:tablename="acq.lineitem_local_attr_definition">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.lineitem_attr_definition_id_seq">
+ <field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
+ <field name="ischanged" oils_obj:array_position="1" oils_persist:virtual="true" />
+ <field name="isdeleted" oils_obj:array_position="2" oils_persist:virtual="true" />
+ <field reporter:label="Definition ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
+ <field reporter:label="Code" name="code" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="text" />
+ <field reporter:label="Description" name="description" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text" oils_persist:i18n="true" />
+ </fields>
+ <links/>
+ </class>
+
<class id="rof" controller="open-ils.reporter-store" oils_obj:fieldmapper="reporter::output_folder" oils_persist:tablename="reporter.output_folder">
<fields oils_persist:primary="id" oils_persist:sequence="reporter.output_folder_id_seq">
<field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
Modified: branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql
===================================================================
--- branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql 2008-07-23 02:45:47 UTC (rev 10093)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql 2008-07-23 14:52:40 UTC (rev 10094)
@@ -180,21 +180,23 @@
id BIGSERIAL PRIMARY KEY,
code TEXT NOT NULL,
description TEXT NOT NULL,
- xpath TEXT NOT NULL,
remove TEXT NOT NULL DEFAULT ''
);
CREATE TABLE acq.lineitem_marc_attr_definition (
- id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq')
+ id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq'),
+ xpath TEXT NOT NULL
) INHERITS (acq.lineitem_attr_definition);
CREATE TABLE acq.lineitem_provider_attr_definition (
id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq'),
+ xpath TEXT NOT NULL,
provider INT NOT NULL REFERENCES acq.provider (id)
) INHERITS (acq.lineitem_attr_definition);
CREATE TABLE acq.lineitem_generated_attr_definition (
- id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq')
+ id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq'),
+ xpath TEXT NOT NULL
) INHERITS (acq.lineitem_attr_definition);
CREATE TABLE acq.lineitem_usr_attr_definition (
@@ -202,7 +204,11 @@
usr INT NOT NULL REFERENCES actor.usr (id)
) INHERITS (acq.lineitem_attr_definition);
+CREATE TABLE acq.lineitem_local_attr_definition (
+ id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq')
+) INHERITS (acq.lineitem_attr_definition);
+
-- Seed data
@@ -260,12 +266,15 @@
IF (atype = 'lineitem_provider_attr_definition') THEN
SELECT provider INTO prov FROM acq.lineitem_provider_attr_definition WHERE id = adef.id;
CONTINUE WHEN NEW.provider IS NULL OR prov <> NEW.provider;
+ ELSIF (atype NOT IN ('lineitem_usr_attr_definition','lineitem_local_attr_definition')) THEN
+
+ SELECT extract_acq_marc_field(id, adef.xpath, adef.remove) INTO value FROM acq.lineitem WHERE id = NEW.id;
+ IF (value IS NOT NULL AND value <> '') THEN
+ INSERT INTO acq.lineitem_attr (lineitem, attr_type, attr_name, attr_value) VALUES (NEW.id, atype, adef.code, value);
+ END IF;
+
END IF;
- SELECT extract_acq_marc_field(id, adef.xpath, adef.remove) INTO value FROM acq.lineitem WHERE id = NEW.id;
- IF (value IS NOT NULL AND value <> '') THEN
- INSERT INTO acq.lineitem_attr (lineitem, attr_type, attr_name, attr_value) VALUES (NEW.id, atype, adef.code, value);
- END IF;
END LOOP;
RETURN NULL;
More information about the open-ils-commits
mailing list