X-Git-Url: http://wagnertech.de/git?p=kivitendo-erp.git;a=blobdiff_plain;f=sql%2FPg-upgrade2%2Fpayment_terms_for_invoices.sql;fp=sql%2FPg-upgrade2%2Fpayment_terms_for_invoices.sql;h=6b6653d41200e25199ab60d9946bc87ef4eca733;hp=0000000000000000000000000000000000000000;hb=53593baa211863fbf66540cf1bcc36c8fb37257f;hpb=deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44 diff --git a/sql/Pg-upgrade2/payment_terms_for_invoices.sql b/sql/Pg-upgrade2/payment_terms_for_invoices.sql new file mode 100644 index 000000000..6b6653d41 --- /dev/null +++ b/sql/Pg-upgrade2/payment_terms_for_invoices.sql @@ -0,0 +1,20 @@ +-- @tag: payment_terms_for_invoices +-- @description: Unterscheidung in Zahlungsbedingungen für Angebote/Aufträge und Rechnungen +-- @depends: release_3_4_0 +ALTER TABLE payment_terms ADD COLUMN description_long_invoice TEXT; +UPDATE payment_terms SET description_long_invoice = description_long; + +INSERT INTO generic_translations (translation_type, language_id, translation_id, translation) +SELECT translation_type || '_invoice', language_id, translation_id, translation +FROM generic_translations +WHERE translation_type = 'SL::DB::PaymentTerm/description_long'; + +CREATE OR REPLACE FUNCTION generic_translations_delete_on_payment_terms_delete_trigger() +RETURNS TRIGGER AS $$ + BEGIN + DELETE FROM generic_translations + WHERE (translation_id = OLD.id) + AND (translation_type IN ('SL::DB::PaymentTerm/description_long', 'SL::DB::PaymentTerm/description_long_invoice')); + RETURN OLD; + END; +$$ LANGUAGE plpgsql;