</links>
</class>
+ <class id="acqipm" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::invoice_payment_method" oils_persist:tablename="acq.invoice_payment_method" reporter:label="Invoice Payment Method">
+ <fields oils_persist:primary="code">
+ <field reporter:label="Code" name="code" reporter:datatype="id"/>
+ <field reporter:label="Name" name="name" reporter:datatype="text"/>
+ </fields>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ </permacrud>
+ </class>
+
<class id="acqinv" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::invoice" oils_persist:tablename="acq.invoice" reporter:label="Invoice">
<fields oils_persist:primary="id" oils_persist:sequence="acq.invoice_id_seq">
<field reporter:label="Internal Invoice ID" name="id" reporter:datatype="id"/>
<field reporter:label="Receive Method" name="recv_method" reporter:datatype="link" />
<field reporter:label="Invoice Type" name="inv_type" reporter:datatype="text" />
<field reporter:label="Vendor Invoice ID" name="inv_ident" reporter:datatype="text" />
+ <field reporter:label="Payment Auth" name="payment_auth" reporter:datatype="text" />
+ <field reporter:label="Payment Method" name="payment_method" reporter:datatype="link" />
+ <field reporter:label="Note" name="note" reporter:datatype="text" />
<field reporter:label="Invoice Entries" name="entries" reporter:datatype="link" oils_persist:virtual="true"/>
<field reporter:label="Invoice Items" name="items" reporter:datatype="link" oils_persist:virtual="true"/>
</fields>
<link field="provider" reltype="has_a" key="id" map="" class="acqpro"/>
<link field="shipper" reltype="has_a" key="id" map="" class="acqpro"/>
<link field="recv_method" reltype="has_a" key="code" map="" class="acqim"/>
+ <link field="payment_method" reltype="has_a" key="code" map="" class="acqipm"/>
<link field="entries" reltype="has_many" key="invoice" map="" class="acqie"/>
<link field="items" reltype="has_many" key="invoice" map="" class="acqii"/>
</links>
name TEXT NOT NULL -- i18n-ize
);
+CREATE TABLE acq.invoice_payment_method (
+ code TEXT PRIMARY KEY,
+ name TEXT NOT NULL -- i18n-ize
+);
+
CREATE TABLE acq.invoice (
id SERIAL PRIMARY KEY,
receiver INT NOT NULL REFERENCES actor.org_unit (id),
recv_date TIMESTAMPTZ NOT NULL DEFAULT NOW(),
recv_method TEXT NOT NULL REFERENCES acq.invoice_method (code) DEFAULT 'EDI',
inv_type TEXT, -- A "type" field is desired, but no idea what goes here
- inv_ident TEXT NOT NULL -- vendor-supplied invoice id/number
+ inv_ident TEXT NOT NULL, -- vendor-supplied invoice id/number
+ payment_auth TEXT,
+ payment_method TEXT REFERENCES acq.invoice_payment_method (code)
+ DEFERRABLE INITIALLY DEFERRED,
+ note TEXT
);
CREATE TABLE acq.invoice_entry (
--- /dev/null
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0230'); -- Scott McKellar
+
+CREATE TABLE acq.invoice_payment_method (
+ code TEXT PRIMARY KEY,
+ name TEXT NOT NULL
+);
+
+ALTER TABLE acq.invoice
+ ADD COLUMN payment_auth TEXT;
+
+ALTER TABLE acq.invoice
+ ADD COLUMN payment_method TEXT
+ REFERENCES acq.invoice_payment_method (code)
+ DEFERRABLE INITIALLY DEFERRED;
+
+ALTER TABLE acq.invoice
+ ADD COLUMN note TEXT;
+
+COMMIT;