- push @{ $form->{AJAX} }, map {
- new CGI::Ajax( "get_$_" => "$form->{script}?action=get_$_" )
- } qw(shipto contact delivery);
-
- $form->{title} = $form->{title_save}
- || $locale->text("$form->{title} " . ucfirst $form->{db}) . ($form->{title} eq "Edit" ? " $form->{name}" : '');
-
-## LINET: Create a drop-down box with all prior titles and greetings.
- CT->query_titles_and_greetings(\%myconfig, \%$form);
- map { $form->{"MB_$_"} = [ map +{ id => $_, description => $_ }, @{ $form->{$_} } ] } qw(TITLES GREETINGS COMPANY_GREETINGS DEPARTMENT);
-## /LINET
-
- $form->{CUSTOM_VARIABLES} = CVar->get_custom_variables('module' => 'CT', 'trans_id' => $form->{id});
-
- CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}) if (scalar @{ $form->{CUSTOM_VARIABLES} });
-
- $main::lxdebug->dump(0, "cvar", $form->{CUSTOM_VARIABLES});
-
- $form->header;
- print $form->parse_html_template('ct/form_header');
-
- $lxdebug->leave_sub();
-}
-
-sub form_footer {
- $lxdebug->enter_sub();
-
- $auth->assert('customer_vendor_edit');
-
- print $form->parse_html_template('ct/form_footer', { is_orphaned => $form->{status} eq 'orphaned',
- is_customer => $form->{db} eq 'customer' });
- $lxdebug->leave_sub();
-}
-
-sub add_transaction {
- $lxdebug->enter_sub();
-
- $auth->assert('customer_vendor_edit & general_ledger');
-
-# # 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!"));
- 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}?action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&callback=$form->{callback}";
- $form->redirect;
-
- $lxdebug->leave_sub();
-}
-
-sub save_and_ap_transaction {
- $lxdebug->enter_sub();
-
- $auth->assert('customer_vendor_edit & general_ledger');
-
- $form->{script} = "ap.pl";
- # saving the history
- if(!exists $form->{addition}) {
- $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
- $form->{addition} = "SAVED";
- $form->save_history($form->dbconnect(\%myconfig));
- }
- # /saving the history
- &add_transaction;
- $lxdebug->leave_sub();
-}