X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fct.pl;h=6c119be5d3916836e9534f5e9e902234410503a2;hb=40782548cf82ac1e4c0fe417113a4cb3072e9390;hp=09068dce4ad72353d2ddc1f5d1abda7615778ce1;hpb=5b9f9bd6fc967ee0978be32dbe50414af0e55bb1;p=kivitendo-erp.git diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 09068dce4..6c119be5d 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -38,6 +38,11 @@ # $locale->text('Add Vendor') use SL::CT; +use CGI::Ajax; +use CGI; +use Data::Dumper; + +require "bin/mozilla/common.pl"; 1; @@ -52,7 +57,7 @@ sub add { "$form->{script}?action=add&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; - CT->taxaccounts(\%myconfig, \%$form); + CT->populate_drop_down_boxes(\%myconfig, \%$form); &form_header; &form_footer; @@ -63,15 +68,157 @@ sub add { sub search { $lxdebug->enter_sub(); + my $vc_business_type = $form->{db} eq "customer" ? + $locale->text("Customer type") : $locale->text("Vendor type"); + + $form->get_lists("business_types" => "ALL_BUSINESS_TYPES"); + my (%labels, @values); + + my $business_types; + if (scalar(@{ $form->{ALL_BUSINESS_TYPES} }) != 0) { + push(@values, undef); + foreach my $item (@{ $form->{ALL_BUSINESS_TYPES} }) { + push(@values, $item->{id}); + $labels{$item->{id}} = $item->{description}; + } + + $business_types = + qq| + ${vc_business_type} + | + . NTI($cgi->popup_menu('-name' => 'business_id', '-values' => \@values, + '-labels' => \%labels)) + . qq| + +|; + } + $label = ucfirst $form->{db}; $form->{title} = $locale->text($label . "s"); - if ($form->{db} eq 'vendor') { - $gifi = qq| - | - . $locale->text('GIFI') . qq| + $form->header; + + print qq| + + +
{script}> + +{db}> + + + + + + + + + + + + +
$form->{title}
+ + + + + + + + + + + + + + + + + + $business_types + + + + + + + + + + + + +
| . $locale->text($label . ' Number') . qq|{db}number size=35>
| . $locale->text('Company Name') . qq|
| . $locale->text('Contact') . qq|
| . $locale->text('E-mail') . qq|
 | + . $locale->text('All') . qq| +  | + . $locale->text('Orphaned') . qq|
 | + . $locale->text('All') . qq| +  | + . $locale->text('Obsolete') . qq| +  | + . $locale->text('Not obsolete') . qq|
| . $locale->text('Include in Report') . qq| + + + + + + + + + + + + + + + + + + + + + + + +
| + . $locale->text('ID') . qq| | + . $locale->text($label . ' Number') . qq| | + . $locale->text('Company Name') . qq| | + . $locale->text('Address') . qq|
| + . $locale->text('Contact') . qq| | + . $locale->text('Phone') . qq| | + . $locale->text('Fax') . qq| | + . $locale->text('E-mail') . qq|
| + . $locale->text('Tax Number') . qq| | + . $locale->text('SIC') . qq| | + . $vc_business_type . qq|
| + . $locale->text('Invoices') . qq| | + . $locale->text('Orders') . qq| | + . $locale->text('Quotations') . qq|
+
+

+ + + +{path}> +{login}> +{password}> + +
+ +
+ + + |; - } + $lxdebug->leave_sub(); +} + +sub search_delivery { + $lxdebug->enter_sub(); + + $label = ucfirst $form->{db}; + $form->{title} = $locale->text($label . "s"); $form->header; @@ -140,7 +287,6 @@ sub search { | . $locale->text('Tax Number') . qq| - $gifi | . $locale->text('SIC') . qq| | @@ -188,7 +334,7 @@ sub list_names { CT->search(\%myconfig, \%$form); $callback = - "$form->{script}?action=list_names&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}"; + "$form->{script}?action=list_names&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}&obsolete=$form->{obsolete}"; $href = $callback; @columns = @@ -196,7 +342,7 @@ sub list_names { "$form->{db}number", address, contact, phone, fax, email, - taxnumber, gifi_accno, + taxnumber, sic_code, business, invnumber, ordnumber, quonumber); @@ -285,10 +431,6 @@ sub list_names { qq|| . $locale->text('Tax Number') . qq||; - $column_header{gifi_accno} = - qq|| - . $locale->text('GIFI') - . qq||; $column_header{sic_code} = qq|| . $locale->text('SIC') @@ -418,14 +560,8 @@ sub list_names { {password}> |; + . $locale->text('Add') . qq|"> - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| @@ -438,10 +574,15 @@ sub list_names { sub edit { $lxdebug->enter_sub(); + # show history button + $form->{javascript} = qq||; + #/show hhistory button + # $locale->text('Edit Customer') # $locale->text('Edit Vendor') CT->get_tuple(\%myconfig, \%$form); + CT->populate_drop_down_boxes(\%myconfig, \%$form); # format " into " map { $form->{$_} =~ s/\"/"/g } keys %$form; @@ -460,9 +601,12 @@ sub edit { sub form_header { $lxdebug->enter_sub(); + $form->get_lists("employees" => "ALL_SALESMEN"); + $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; $form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0); + $form->{discount} = $form->format_amount(\%myconfig, $form->{discount}); if ($myconfig{role} eq 'admin') { $bcc = qq| @@ -473,45 +617,117 @@ sub form_header { |; } $form->{obsolete} = "checked" if $form->{obsolete}; - %langs = (de => "deutsch", en => "englisch", fr => "französisch"); + $lang = qq||; - foreach $item (keys %langs) { - if ($form->{language} eq $item) { - $lang .= qq||; + foreach $item (@{ $form->{languages} }) { + if ($form->{language_id} eq $item->{id}) { + $lang .= qq||; + } else { + $lang .= qq||; + } + } + + $payment = qq||; + foreach $item (@{ $form->{payment_terms} }) { + if ($form->{payment_id} eq $item->{id}) { + $payment .= qq||; } else { - $lang .= qq||; + $payment .= qq||; } } - foreach $item (split / /, $form->{taxaccounts}) { - if (($form->{tax}{$item}{taxable}) || !($form->{id})) { - $taxable .= - qq|  $form->{tax}{$item}{description}|; + if (!$form->{id}) { + if ($form->{db} eq "customer") { + $form->{taxzone_id} = 0; } else { - $taxable .= - qq|  $form->{tax}{$item}{description}|; + $form->{taxzone_id} = 0; } } -##LINET - $taxable = ""; + if (@{ $form->{TAXZONE} }) { + foreach $item (@{ $form->{TAXZONE} }) { + if ($item->{id} == $form->{taxzone_id}) { + $form->{selecttaxzone} .= + ""; + if (@{ $form->{CONTACTS} }) { + foreach $item (@{ $form->{CONTACTS} }) { + if ($item->{cp_id} == $form->{cp_id}) { + $form->{selectcontact} .= + qq|\n|; + } else { + $form->{selectcontact} .= + qq|\n|; + } + + } + } + push(@ { $form->{AJAX} }, $pjx); + $ansprechpartner = qq| + + | . $locale->text('Ansprechpartner') . qq| + + + |; + $get_shipto_url = + "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_shipto"; + + my $pjy = new CGI::Ajax( 'get_shipto' => $get_shipto_url ); + $form->{selectshipto} = ""; + $form->{selectshipto} .= ""; + if (@{ $form->{SHIPTO} }) { + foreach $item (@{ $form->{SHIPTO} }) { + if ($item->{shipto_id} == $form->{shipto_id}) { + $form->{selectshipto} .= + "|; } @{ $form->{GREETINGS} }); $select_greeting .= qq||; + + $select_company_greeting = + qq| |; + + $select_department = + qq| |; ## /LINET if ($form->{db} eq 'customer') { - #get pricegroup and form it - $form->get_pricegroup(\%myconfig, { all => 1 }); - $form->{pricegroup} = "$form->{klass}"; - $form->{pricegroup_id} = "$form->{klass}"; + #get pricegroup and form it + $form->get_pricegroup(\%myconfig, { all => 1 }); - if (@{ $form->{all_pricegroup} }) { + $form->{pricegroup} = "$form->{klass}"; + $form->{pricegroup_id} = "$form->{klass}"; - $form->{selectpricegroup} = qq|
{script}> - - -
$form->{title}
+
+ + +{script} onKeyUp="highlight(event)" onClick="highlight(event)"> + + + +
+ +
+ +
+ - - - - - $business_salesman + + + + - - + - - + - - + - - + - - + - - + - - + - - + - - + - + - - |; -##LINET - added fields for contact person - print qq| - - - |; -##/LINET - print qq| $bcc - $tax -
| - . $locale->text('Billing Address') . qq|| - . $locale->text('Shipping Address') . qq|
| . $locale->text($label . ' Number') . qq| {db}number"}">
| . $locale->text('Greeting') . qq|  + $select_company_greeting
| . $locale->text('Company Name') . qq|
| . $locale->text('Abteilung') . qq| - - +
| . $locale->text('Street') . qq|
| . $locale->text('Zipcode') . "/" . $locale->text('City') . qq| - - +
| . $locale->text('Country') . qq|
| . $locale->text('Contact') . qq|
| . $locale->text('Phone') . qq|
| . $locale->text('Fax') . qq|
| . $locale->text('E-mail') . qq|
| . $locale->text('Homepage') . qq|
- {cp_id}> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| - . $locale->text('Contact Person') . qq|
| . $locale->text('Greeting') . qq|  - $select_greeting| . $locale->text('Title') . qq|  - $select_title
| - . $locale->text('Given Name') . qq|| . $locale->text('Name') . qq|
| . $locale->text('Phone1') . qq|| . $locale->text('Phone2') . qq|
| . $locale->text('E-mail') . qq|
-
- - - - - +
+ - - - + + + + - - + - + $customer - + - + - + $business - |; -if ($form->{db} eq 'customer'){ -print qq| + if ($form->{db} eq 'customer') { + + print qq| |; -} + } print qq| + + $taxzone + $salesman +
| . $locale->text('Credit Limit') . qq|| . $locale->text('Terms: Net') . qq|| - . $locale->text('days') . qq|| . $locale->text('Payment Terms') . qq| | . $locale->text('Discount') . qq| + %
| . $locale->text('Tax Number / SSN') . qq| | . $locale->text('USt-IdNr.') . qq|
| . $locale->text('Account Number') . qq| | . $locale->text('Bank Code Number') . qq| | . $locale->text('Bank') . qq|
| . $locale->text('Language') . qq|| . $locale->text('Preisklasse') . qq| $pricegroup
| . $locale->text('Obsolete') . qq| {obsolete}>
- - + - - - + +
| . $locale->text('Notes') . qq|

+ + -|; +
|; + +print qq| +
+ + +$shipto + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
| . $locale->text('Company Name') . qq|
| . $locale->text('Abteilung') . qq| +
| . $locale->text('Street') . qq|
| + . $locale->text('Zipcode') . "/" . $locale->text('City') . qq| +
| . $locale->text('Country') . qq|
| . $locale->text('Contact') . qq|
| . $locale->text('Phone') . qq|
| . $locale->text('Fax') . qq|
| . $locale->text('E-mail') . qq|
 
 
+
|; + + +##LINET - added fields for contact person + print qq| +
+ + + + + |; +##/LINET + print qq| $bcc + $tax +
+ {cp_id}> + + $ansprechpartner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
| . $locale->text('Greeting') . qq|  + $select_greeting
| . $locale->text('Title') . qq|  + $select_title
| . $locale->text('Department') . qq|  + $select_department
| + . $locale->text('Given Name') . qq|
| . $locale->text('Name') . qq|
| . $locale->text('Phone1') . qq|
| . $locale->text('Phone2') . qq|
| . $locale->text('Fax') . qq|
| . $locale->text('Mobile1') . qq|
| . $locale->text('Mobile2') . qq|
| . $locale->text('Sat. Phone') . qq|
| . $locale->text('Sat. Fax') . qq|
| . $locale->text('Project') . qq|
| . $locale->text('E-mail') . qq|
| . $locale->text('Private Phone') . qq|
| . $locale->text('Private E-mail') . qq|
| . $locale->text('Birthday') . qq|
+
+ + + + + +
+
+ + $delivery + + + + + + + + + +
| . $locale->text('From') . qq| + | . $locale->text('To (time)') . qq| +
+
+
+
+
+ +
+ +| . $form->write_trigger(\%myconfig, 2, "fromB", "BL", "trigger_from", + "toB", "BL", "trigger_to"); $lxdebug->leave_sub(); } @@ -821,13 +1187,6 @@ sub form_footer { ($form->{db} eq 'customer') ? $locale->text('Save and AR Transaction') : $locale->text('Save and AP Transaction'); - if ($vertreter) { - $update_button = - qq||; - } else { - $update_button = ""; - } ## ## @@ -835,8 +1194,7 @@ sub form_footer { ## print qq| -{id}> - +{id}> @@ -845,14 +1203,15 @@ sub form_footer { {password}> -{db}> +{db}>
-$update_button + @@ -867,15 +1226,24 @@ $update_button . qq|">\n|; } - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; + # button for saving history + if($form->{id} ne "") { + print qq| + {id} + . qq|); name=history id=history value=| + . $locale->text('history') + . qq|>|; } + # /button for saving history print qq|
- + |; @@ -886,15 +1254,25 @@ $update_button sub add_transaction { $lxdebug->enter_sub(); +# # saving the history +# if(!exists $form->{addition}) { +# $form->{addition} = "ADD TRANSACTION"; +# $form->save_history($form->dbconnect(\%myconfig)); +# } +# # /saving the history + $form->isblank("name", $locale->text("Name missing!")); - &{"CT::save_$form->{db}"}("", \%myconfig, \%$form); + if ($form->{"db"} eq "customer") { + CT->save_customer(\%myconfig, \%$form); + } else { + CT->save_vendor(\%myconfig, \%$form); + } $form->{callback} = $form->escape($form->{callback}, 1); $name = $form->escape("$form->{name}", 1); $form->{callback} = "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&callback=$form->{callback}"; - $form->redirect; $lxdebug->leave_sub(); @@ -904,8 +1282,13 @@ sub save_and_ap_transaction { $lxdebug->enter_sub(); $form->{script} = "ap.pl"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &add_transaction; - $lxdebug->leave_sub(); } @@ -913,8 +1296,13 @@ sub save_and_ar_transaction { $lxdebug->enter_sub(); $form->{script} = "ar.pl"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &add_transaction; - $lxdebug->leave_sub(); } @@ -923,8 +1311,13 @@ sub save_and_invoice { $form->{script} = ($form->{db} eq 'customer') ? "is.pl" : "ir.pl"; $form->{type} = "invoice"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &add_transaction; - $lxdebug->leave_sub(); } @@ -933,8 +1326,13 @@ sub save_and_rfq { $form->{script} = "oe.pl"; $form->{type} = "request_quotation"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &add_transaction; - $lxdebug->leave_sub(); } @@ -943,8 +1341,13 @@ sub save_and_quotation { $form->{script} = "oe.pl"; $form->{type} = "sales_quotation"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &add_transaction; - $lxdebug->leave_sub(); } @@ -954,7 +1357,41 @@ sub save_and_order { $form->{script} = "oe.pl"; $form->{type} = ($form->{db} eq 'customer') ? "sales_order" : "purchase_order"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &add_transaction; + $lxdebug->leave_sub(); +} + +sub save_and_close { + $lxdebug->enter_sub(); + + # $locale->text('Customer saved!') + # $locale->text('Vendor saved!') + + $msg = ucfirst $form->{db}; + $imsg .= " saved!"; + + $form->isblank("name", $locale->text("Name missing!")); + if ($form->{"db"} eq "customer") { + $rc = CT->save_customer(\%myconfig, \%$form); + } else { + $rc = CT->save_vendor(\%myconfig, \%$form); + } + if ($rc == 3) { + $form->error($locale->text('customernumber not unique!')); + } + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + $form->redirect($locale->text($msg)); $lxdebug->leave_sub(); } @@ -969,13 +1406,29 @@ sub save { $imsg .= " saved!"; $form->isblank("name", $locale->text("Name missing!")); - if ($vertreter && $form->{db} eq "customer") { - $form->isblank("salesman_id", $locale->text("Salesman missing!")); - } - &{"CT::save_$form->{db}"}("", \%myconfig, \%$form); - $form->redirect($locale->text($msg)); + my $res; + if ($form->{"db"} eq "customer") { + $res = CT->save_customer(\%myconfig, \%$form); + } else { + $res = CT->save_customer(\%myconfig, \%$form); + } + if (3 == $res) { + if ($form->{"db"} eq "customer") { + $form->error($locale->text('This customer number is already in use.')); + } else { + $form->error($locale->text('This vendor number is already in use.')); + } + } + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + &edit; + exit; $lxdebug->leave_sub(); } @@ -991,6 +1444,12 @@ sub delete { $msg = ucfirst $form->{db}; $msg .= " deleted!"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "DELETED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history $form->redirect($locale->text($msg)); $msg = "Cannot delete $form->{db}"; @@ -1011,177 +1470,119 @@ sub display { sub update { $lxdebug->enter_sub(); - &check_salesman($form->{salesman}); - - # $form->get_salesman(\%myconfig, $form->{salesman}); &display(); $lxdebug->leave_sub(); } -sub check_salesman { +sub get_contact { $lxdebug->enter_sub(); - my ($name) = @_; + CT->get_contact(\%myconfig, \%$form); - my ($new_name, $new_id) = split /--/, $form->{$name}; - my $i = 0; - - # check name, combine name and id - if ($form->{"oldsalesman"} ne $form->{"salesman"}) { - - # return one name or a list of names in $form->{name_list} - if (($i = $form->get_salesman(\%myconfig, $name)) > 1) { - &select_salesman($name); - exit; - } - - if ($i == 1) { + my $q = new CGI; + $result = "$form->{cp_name}"; + map { $result .= "__pjx__" . $form->{$_} } qw(cp_greeting cp_title cp_givenname cp_phone1 cp_phone2 cp_email cp_abteilung cp_fax cp_mobile1 cp_mobile2 cp_satphone cp_satfax cp_project cp_privatphone cp_privatemail cp_birthday); + print $q->header(); + print $result; + $lxdebug->leave_sub(); - # we got one name - $form->{"salesman_id"} = $form->{salesman_list}[0]->{id}; - $form->{salesman} = $form->{salesman_list}[0]->{name}; - $form->{"oldsalesman"} = $form->{salesman}; +} - } else { +sub get_shipto { + $lxdebug->enter_sub(); - # name is not on file - # $locale->text('Customer not on file!') - # $locale->text('Vendor not on file!') - $msg = ucfirst $name . " not on file or locked!"; - $form->error($locale->text($msg)); - } - } + CT->get_shipto(\%myconfig, \%$form); + my $q = new CGI; + $result = "$form->{shiptoname}"; + map { $result .= "__pjx__" . $form->{$_} } qw(shiptodepartment_1 shiptodepartment_2 shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail); + print $q->header(); + print $result; $lxdebug->leave_sub(); - return $i; } -sub select_salesman { +sub get_delivery { $lxdebug->enter_sub(); - my ($table) = @_; + CT->get_delivery(\%myconfig, \%$form ); - @column_index = qw(ndx name); + @column_index = + $form->sort_columns(shiptoname, + invnumber, + ordnumber, + transdate, + description, + qty, + unit); - $label = ucfirst $table; - $column_data{ndx} = qq| |; - $column_data{name} = - qq|| . $locale->text($label) . qq||; - # list items with radio button on a form - $form->header; - - $title = $locale->text('Select from one of the names below'); - - print qq| - -
{script}> + $column_header{shiptoname} = + qq|| . $locale->text('Shipping Address') . qq||; + $column_header{invnumber} = + qq||. $locale->text('Invoice'). qq||; + $column_header{ordnumber} = + qq||. $locale->text('Order'). qq||; + $column_header{transdate} = + qq|| . $locale->text('Invdate') . qq||; + $column_header{description} = + qq|| . $locale->text('Description') . qq||; + $column_header{qty} = + qq|| . $locale->text('Qty') . qq||; + $column_header{unit} = + qq|| . $locale->text('Unit') . qq||; + $result .= qq| - - - - - - - - -
$title
- |; - - map { print "\n$column_data{$_}" } @column_index; - - print qq| - + |; - my $i = 0; - foreach $ref (@{ $form->{salesman_list} }) { - $checked = ($i++) ? "" : "checked"; + map { $result .= "$column_header{$_}\n" } @column_index; - $ref->{name} =~ s/\"/"/g; + $result .= qq| + +|; - $column_data{ndx} = - qq||; - $column_data{name} = - qq||; - $j++; - $j %= 2; - print qq| - |; + foreach $ref (@{ $form->{DELIVERY} }) { - map { print "\n$column_data{$_}" } @column_index; + if ($ref->{shiptoname} eq $sameshiptoname) { + map { $column_data{$_} = "" } @column_index; + $column_data{shiptoname} = ""; + } else { + map { $column_data{$_} = "" } @column_index; + } - print qq| - + $i++; + $i %= 2; + $result .= " + +"; -{id}> + map { $result .= "$column_data{$_}\n" } @column_index; + $result .= qq| + |; + $sameshiptoname = $ref->{shiptoname}; + } - print qq| + $result .= qq|
$ref->{name}
$ref->{$_}  $ref->{$_} 
-

- - - |; - # delete variables - map { delete $form->{$_} } qw(action name_list header); - - # save all other form variables - foreach $key (keys %${form}) { - $form->{$key} =~ s/\"/"/g; - print qq|\n|; - } - - print qq| - - - -
- -
- - - -|; + my $q = new CGI; + print $q->header(); + print $result; $lxdebug->leave_sub(); -} - -sub salesman_selected { - $lxdebug->enter_sub(); - - # replace the variable with the one checked - # index for new item - $i = $form->{ndx}; - - $form->{salesman} = $form->{"new_name_$i"}; - $form->{"salesman_id"} = $form->{"new_id_$i"}; - $form->{"oldsalesman"} = $form->{salesman}; - - # delete all the new_ variables - for $i (1 .. $form->{lastndx}) { - map { delete $form->{"new_${_}_$i"} } (id, name); - } - - map { delete $form->{$_} } qw(ndx lastndx nextsub); - - &update(1); - - $lxdebug->leave_sub(); } -sub continue { &{ $form->{nextsub} } } +sub continue { call_sub($form->{nextsub}); }