Revision 6b6a2ddf
Von Jan Büren vor fast 10 Jahren hinzugefügt
SL/OE.pm | ||
---|---|---|
578 | 578 |
name_prefix => 'ic_', |
579 | 579 |
name_postfix => "_$i", |
580 | 580 |
dbh => $dbh); |
581 |
# link quotation items with order items |
|
582 |
if ($form->{"converted_from_quotation_orderitems_id_$i"}) { |
|
583 |
RecordLinks->create_links('dbh' => $dbh, |
|
584 |
'mode' => 'ids', |
|
585 |
'from_table' => 'orderitems', |
|
586 |
'from_ids' => $form->{"converted_from_quotation_orderitems_id_$i"}, |
|
587 |
'to_table' => 'orderitems', |
|
588 |
'to_id' => $orderitems_id, |
|
589 |
); |
|
590 |
} |
|
581 | 591 |
} |
582 | 592 |
} |
583 | 593 |
# search for orphaned ids |
bin/mozilla/oe.pl | ||
---|---|---|
1820 | 1820 |
|
1821 | 1821 |
# reset |
1822 | 1822 |
map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal delivered ordnumber); |
1823 |
$form->{"converted_from_quotation_orderitems_id_$_"} = $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; # always reset orderitems_id |
|
1823 | 1824 |
delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; # always reset orderitems_id |
1824 | 1825 |
|
1825 | 1826 |
# if purchase_order was generated from sales_order, use lastcost_$i as sellprice_$i |
... | ... | |
1896 | 1897 |
|
1897 | 1898 |
for my $i (1 .. $form->{rowcount}) { |
1898 | 1899 |
map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice lastcost basefactor discount); |
1900 |
$form->{"converted_from_order_orderitems_id_$_"} = $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; |
|
1899 | 1901 |
} |
1900 | 1902 |
|
1901 | 1903 |
my %old_values = map { $_ => $form->{$_} } qw(customer_id oldcustomer customer vendor_id oldvendor vendor shipto_id); |
sql/Pg-upgrade2/record_links_orderitems_delete_triggers.sql | ||
---|---|---|
1 |
-- @tag: record_links_orderitems_delete_triggers |
|
2 |
-- @description: delete trigger für verknüpfte invoice(items), orderitems und delivery_order_items |
|
3 |
-- @depends: record_links_post_delete_triggers2 |
|
4 |
CREATE OR REPLACE FUNCTION clean_up_record_links_before_orderitems_delete() RETURNS trigger AS $$ |
|
5 |
BEGIN |
|
6 |
DELETE FROM record_links |
|
7 |
WHERE (from_table = 'orderitems' AND from_id = OLD.id) |
|
8 |
OR (to_table = 'orderitems' AND to_id = OLD.id); |
|
9 |
RETURN OLD; |
|
10 |
END; |
|
11 |
$$ LANGUAGE plpgsql; |
|
12 |
|
|
13 |
CREATE OR REPLACE FUNCTION clean_up_record_links_before_delivery_order_items_delete() RETURNS trigger AS $$ |
|
14 |
BEGIN |
|
15 |
DELETE FROM record_links |
|
16 |
WHERE (from_table = 'delivery_order_items' AND from_id = OLD.id) |
|
17 |
OR (to_table = 'delivery_order_items' AND to_id = OLD.id); |
|
18 |
RETURN OLD; |
|
19 |
END; |
|
20 |
$$ LANGUAGE plpgsql; |
|
21 |
|
|
22 |
CREATE OR REPLACE FUNCTION clean_up_record_links_before_invoice_delete() RETURNS trigger AS $$ |
|
23 |
BEGIN |
|
24 |
DELETE FROM record_links |
|
25 |
WHERE (from_table = 'invoice' AND from_id = OLD.id) |
|
26 |
OR (to_table = 'invoice' AND to_id = OLD.id); |
|
27 |
RETURN OLD; |
|
28 |
END; |
|
29 |
$$ LANGUAGE plpgsql; |
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
CREATE TRIGGER before_delete_orderitems_trigger |
|
34 |
BEFORE DELETE ON orderitems FOR EACH ROW EXECUTE |
|
35 |
PROCEDURE clean_up_record_links_before_orderitems_delete(); |
|
36 |
|
|
37 |
CREATE TRIGGER before_delete_delivery_order_items_trigger |
|
38 |
BEFORE DELETE ON delivery_order_items FOR EACH ROW EXECUTE |
|
39 |
PROCEDURE clean_up_record_links_before_delivery_order_items_delete(); |
|
40 |
|
|
41 |
CREATE TRIGGER before_delete_invoice_trigger |
|
42 |
BEFORE DELETE ON invoice FOR EACH ROW EXECUTE |
|
43 |
PROCEDURE clean_up_record_links_before_invoice_delete(); |
|
44 |
|
|
45 |
|
|
46 |
|
Auch abrufbar als: Unified diff
Angebots-Position mit Auftragsposition verknüpft (orderitems -> orderitems)
Angebot -> Workflow Auftrag