[set page_banner]Owner[/set] [set fm_class]Admin[/set] [set help_name]owner[/set] [set page_title]Owner[/set] [set icon_name]icon_people.gif[/set] @_FM_STD_HEAD_@ [seti sqlSentence] BEGIN TRANSACTION; [perl] my $trans; my $action = $Values->{"mv_action"}; my $contact_id = $Scratch->{"contact_id"}; $trans = "UPDATE sy_ownercompany SET periodfrom = '[value periodfrom]', periodto = '[value periodto]'; UPDATE co_address SET address1 = '[value addr1]', address2 = '[value addr2]', address3 = '[value addr3]', postalcode = '[value postalcode]', city = '[value city]', updated='now' WHERE contact_id = $contact_id; UPDATE co_company SET name = '[value compname]', attention='[value attention]', updated='now' WHERE contact_id = $contact_id;"; if (!$Values->{"phonenr"} and $Scratch->{"phonenr"}) { $trans .= "DELETE FROM co_telephone WHERE contact_id = $contact_id AND type=90001;"; } elsif ($Scratch->{"phonenr"}) { $trans .= "UPDATE co_telephone SET phonenr = '[value phonenr]', updated='now' WHERE contact_id = $contact_id AND type=90001;"; } elsif ($Values->{"phonenr"}) { $trans .= "INSERT INTO co_telephone (contact_id,type,phonenr,updated) VALUES ($contact_id,90001,'[value phonenr]','now');"; } if (!$Values->{"mobilenr"} and $Scratch->{"mobilenr"}) { $trans .= "DELETE FROM co_telephone WHERE contact_id = $contact_id AND type=90002;"; } elsif ($Scratch->{"mobilenr"}) { $trans .= "UPDATE co_telephone SET phonenr = '[value mobilenr]', updated='now' WHERE contact_id = $contact_id AND type=90002;"; } elsif ($Values->{"phonenr"}) { $trans .= "INSERT INTO co_telephone (contact_id,type,phonenr,updated) VALUES ($contact_id,90002,'[value mobilenr]','now');"; } if (!$Values->{"faxnr"} and $Scratch->{"faxnr"}) { $trans .= "DELETE FROM co_telephone WHERE contact_id = $contact_id AND type=90003;"; } elsif ($Scratch->{"faxnr"}) { $trans .= "UPDATE co_telephone SET phonenr = '[value faxnr]', updated='now' WHERE contact_id = $contact_id AND type=90003;"; } elsif ($Values->{"faxnr"}) { $trans .= "INSERT INTO co_telephone (contact_id,type,phonenr,updated) VALUES ($contact_id,90003,'[value faxnr]','now');"; } if (!$Values->{"emailaddr"} and $Scratch->{"emailaddr"}) { $trans .= "DELETE FROM co_url WHERE contact_id = $contact_id AND type=80001;"; } elsif ($Scratch->{"emailaddr"}) { $trans .= "UPDATE co_url SET url = '[value emailaddr]', updated='now' WHERE contact_id = $contact_id AND type=80001;"; } elsif ($Values->{"emailaddr"}) { $trans .= "INSERT INTO co_url (contact_id,type,url,updated) VALUES ($contact_id,80001,'[value emailaddr]','now');"; } if (!$Values->{"webaddr"} and $Scratch->{"webaddr"}) { $trans .= "DELETE FROM co_url WHERE contact_id = $contact_id AND type=80002;"; } elsif ($Scratch->{"webaddr"}) { $trans .= "UPDATE co_url SET url = '[value webaddr]', updated='now' WHERE contact_id = $contact_id AND type=80002;"; } elsif ($Values->{"webaddr"}) { $trans .= "INSERT INTO co_url (contact_id,type,url,updated) VALUES ($contact_id,80002,'[value webaddr]','now');"; }; if ($Values->{periodto} ne $Scratch->{periodto}) { $trans .= "INSERT INTO gl_balance (ag_id, periodnr, begindr, begincr) SELECT ag_id, '[value periodto]', perioddr, periodcr FROM gl_balance WHERE periodnr = '[scratch periodto]';" }; $trans; [/perl] COMMIT; [/seti] [set returnpage]freemoney/owner[/set] [set leadtext]The owner entry has been added[/set] [value name=mv_action set=""] [try][sql interpolate=1][scratch sqlSentence][/sql][/try]
[L][scratch leadtext][/L]

[catch] [L]There was an error updating the owner entry. Please check your data.[/L]

[/catch] [L]BACK[/L] @_FM_STD_FOOTER_@