Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b6a86ebd

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID b6a86ebd1232b0cb5402a18e0b2b356e09381efe
  • Vorgänger 77269871
  • Nachfolger c9f6c754

DB::Order: Persistenter Record-Type

Unterschiede anzeigen:

SL/DB/MetaSetup/Order.pm
expected_billing_date => { type => 'date' },
globalproject_id => { type => 'integer' },
id => { type => 'integer', not_null => 1, sequence => 'id' },
intake => { type => 'boolean', default => 'false', not_null => 1 },
intnotes => { type => 'text' },
itime => { type => 'timestamp', default => 'now()' },
language_id => { type => 'integer' },
......
payment_id => { type => 'integer' },
proforma => { type => 'boolean', default => 'false' },
quonumber => { type => 'text' },
quotation => { type => 'boolean', default => 'false' },
record_type => { type => 'enum', check_in => [ 'request_quotation', 'sales_quotation', 'purchase_quotation_intake', 'purchase_order', 'sales_order_intake', 'sales_order' ], db_type => 'order_types', not_null => 1 },
reqdate => { type => 'date' },
salesman_id => { type => 'integer' },
shippingpoint => { type => 'text' },
sql/Pg-upgrade2/order_type.sql
-- @tag: order_type
-- @description: Persistente Typen in Aufträgen
-- @depends: release_3_7_0 oe_sales_order_intake_type
CREATE TYPE order_types AS ENUM (
'request_quotation',
'sales_quotation',
'purchase_quotation_intake',
'purchase_order',
'sales_order_intake',
'sales_order'
);
ALTER TABLE oe ADD COLUMN record_type order_types;
UPDATE oe SET record_type = 'sales_order'
WHERE customer_id IS NOT NULL and (quotation = FALSE or quotation is null) and intake = FALSE;
UPDATE oe SET record_type = 'purchase_order'
WHERE vendor_id IS NOT NULL and (quotation = FALSE or quotation is null) and intake = FALSE;
UPDATE oe SET record_type = 'sales_quotation'
WHERE customer_id IS NOT NULL and quotation = TRUE and intake = FALSE;
UPDATE oe SET record_type = 'request_quotation'
WHERE vendor_id IS NOT NULL and quotation = TRUE and intake = FALSE;
UPDATE oe SET record_type = 'sales_order_intake'
WHERE customer_id IS NOT NULL and (quotation = FALSE or quotation is null) and intake = TRUE;
UPDATE oe SET record_type = 'purchase_quotation_intake'
WHERE vendor_id IS NOT NULL and quotation = TRUE and intake = TRUE;
ALTER TABLE oe ALTER COLUMN record_type SET NOT NULL;
ALTER TABLE oe DROP COLUMN quotation;
ALTER TABLE oe DROP COLUMN intake;

Auch abrufbar als: Unified diff