X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fct.pl;h=b0f72b43a9d9b876f925ebc25b3d4f12b0d02363;hb=0459dded82ee2c88499f4e46a9f3facba519f4f6;hp=10ff70675c38e89ff7e58405168decfa233f7c0b;hpb=3ae0915da839e710ea997a984e6825466aafb411;p=kivitendo-erp.git diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 10ff70675..b0f72b43a 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -347,8 +347,8 @@ sub add_transaction { # # saving the history # if(!exists $form->{addition}) { -# $form->{addition} = "ADD TRANSACTION"; -# $form->save_history($form->dbconnect(\%myconfig)); +# $form->{addition} = "ADD TRANSACTION"; +# $form->save_history($form->dbconnect(\%myconfig)); # } # # /saving the history @@ -381,8 +381,8 @@ sub save_and_ap_transaction { # saving the history if(!exists $form->{addition}) { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; - $form->{addition} = "SAVED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history &add_transaction; @@ -401,8 +401,8 @@ sub save_and_ar_transaction { # saving the history if(!exists $form->{addition}) { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; - $form->{addition} = "SAVED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history &add_transaction; @@ -426,8 +426,8 @@ sub save_and_invoice { # saving the history if(!exists $form->{addition}) { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; - $form->{addition} = "SAVED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history &add_transaction; @@ -447,8 +447,8 @@ sub save_and_rfq { # saving the history if(!exists $form->{addition}) { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; - $form->{addition} = "SAVED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history &add_transaction; @@ -468,8 +468,8 @@ sub save_and_quotation { # saving the history if(!exists $form->{addition}) { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; - $form->{addition} = "SAVED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history &add_transaction; @@ -494,8 +494,8 @@ sub save_and_order { # saving the history if(!exists $form->{addition}) { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; - $form->{addition} = "SAVED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history &add_transaction; @@ -528,7 +528,7 @@ sub save_and_close { if(!exists $form->{addition}) { $form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber}); $form->{addition} = "SAVED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history $form->redirect($locale->text($msg)); @@ -567,8 +567,8 @@ sub save { # saving the history if(!exists $form->{addition}) { $form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber}); - $form->{addition} = "SAVED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history &edit; @@ -592,8 +592,8 @@ sub delete { # saving the history if(!exists $form->{addition}) { $form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber}); - $form->{addition} = "DELETED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{addition} = "DELETED"; + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history $form->redirect($locale->text($msg)); @@ -659,19 +659,19 @@ sub get_shipto { } sub get_delivery { - $main::lxdebug->enter_sub(); - - $main::auth->assert('customer_vendor_edit'); + $::lxdebug->enter_sub; - my $form = $main::form; - my %myconfig = %main::myconfig; + $::auth->assert('customer_vendor_edit'); + $::auth->assert('sales_all_edit'); - CT->get_delivery(\%myconfig, \%$form ); - $form->{IS_CUSTOMER} = $form->{db} eq 'customer'; + CT->get_delivery(\%::myconfig, $::form ); - print $form->ajax_response_header(), $form->parse_html_template('ct/get_delivery'); + print $::form->ajax_response_header, + $::form->parse_html_template('ct/get_delivery', { + is_customer => $::form->{db} eq 'customer', + }); - $main::lxdebug->leave_sub(); + $::lxdebug->leave_sub; } sub delete_shipto { @@ -714,4 +714,25 @@ sub delete_contact { $main::lxdebug->leave_sub(); } +sub ajax_autocomplete { + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + + $form->{column} = 'name' unless $form->{column} =~ /^name$/; + $form->{vc} = 'customer' unless $form->{vc} =~ /^customer|vendor$/; + $form->{db} = $form->{vc}; # CT expects this + $form->{$form->{column}} = $form->{q} || ''; + $form->{limit} = ($form->{limit} * 1) || 10; + $form->{searchitems} ||= ''; + + CT->search(\%myconfig, $form); + + print $form->ajax_response_header(), + $form->parse_html_template('ct/ajax_autocomplete'); + + $main::lxdebug->leave_sub(); +} + sub continue { call_sub($main::form->{nextsub}); }