Revision e0412b7e
Von Bernd Bleßmann vor fast 11 Jahren hinzugefügt
sql/Pg-upgrade2/delete_translations_on_payment_term_delete.sql | ||
---|---|---|
1 |
-- @tag: delete_translations_on_payment_term_delete |
|
2 |
-- @description: Übersetzungen löschen, wenn Lieferbedingung gelöscht wird |
|
3 |
-- @depends: payment_terms_translation2 |
|
4 |
-- @encoding: utf-8 |
|
5 |
|
|
6 |
CREATE OR REPLACE FUNCTION generic_translations_delete_on_payment_terms_delete_trigger() |
|
7 |
RETURNS TRIGGER AS $$ |
|
8 |
BEGIN |
|
9 |
DELETE FROM generic_translations |
|
10 |
WHERE translation_id = OLD.id AND translation_type LIKE 'SL::DB::PaymentTerm/description_long'; |
|
11 |
RETURN OLD; |
|
12 |
END; |
|
13 |
$$ LANGUAGE plpgsql; |
|
14 |
|
|
15 |
DROP TRIGGER IF EXISTS after_delete_payment_term_trigger ON payment_terms; |
|
16 |
|
|
17 |
CREATE TRIGGER after_delete_payment_term_trigger |
|
18 |
AFTER DELETE ON payment_terms |
|
19 |
FOR EACH ROW EXECUTE PROCEDURE generic_translations_delete_on_payment_terms_delete_trigger(); |
|
20 |
|
|
21 |
-- delete orphaned translations |
|
22 |
DELETE FROM generic_translations |
|
23 |
WHERE translation_type LIKE 'SL::DB::PaymentTerm/description_long' |
|
24 |
AND translation_id NOT IN (SELECT id FROM payment_terms); |
Auch abrufbar als: Unified diff
Übersetzungen von Zahlungsbedingungen löschen, wenn Zahlungsbed. gelöscht wird.
Via Trigger. Außerdem löscht das Update-Skript alle verweisten Übersetzungen
der Zahlungsbedingungen.
Behebt #2390.