X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fct.pl;h=10b138e62e94cff123b101eff50239d3f4502d45;hb=0e6197ea79295e1a1232617ee4ed4ae99d8a0640;hp=10ff70675c38e89ff7e58405168decfa233f7c0b;hpb=57bf9c89a037036fcf433de39643778854defe51;p=kivitendo-erp.git diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 10ff70675..10b138e62 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -156,7 +156,7 @@ sub list_names { my %column_defs = ( 'id' => { 'text' => $locale->text('ID'), }, "$form->{db}number" => { 'text' => $locale->text('Number'), }, - 'name' => { 'text' => $locale->text('Name'), }, + 'name' => { 'text' => $form->{IS_CUSTOMER} ? $::locale->text('Customer Name') : $::locale->text('Vendor Name'), }, 'contact' => { 'text' => $locale->text('Contact'), }, 'phone' => { 'text' => $locale->text('Phone'), }, 'fax' => { 'text' => $locale->text('Fax'), }, @@ -285,10 +285,12 @@ sub form_header { my %myconfig = %main::myconfig; my $locale = $main::locale; - $form->get_lists("employees" => "ALL_EMPLOYEES", - "taxzones" => "ALL_TAXZONES"); + $form->get_lists(employees => "ALL_EMPLOYEES", + taxzones => "ALL_TAXZONES"); $form->get_pricegroup(\%myconfig, { all => 1 }); + $form->get_lists(customers => { key => "ALL_SALESMAN_CUSTOMERS", business_is_salesman => 1 }) if $::vertreter; + $form->{ALL_SALESMEN} = $form->{ALL_EMPLOYEES}; $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; $form->{is_admin} = $myconfig{role} eq 'admin'; @@ -347,8 +349,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 +383,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 +403,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 +428,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 +449,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 +470,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 +496,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 +530,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,13 +569,14 @@ 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; - exit; + $main::lxdebug->leave_sub(); + ::end_of_request(); } sub delete { @@ -592,8 +595,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)); @@ -652,26 +655,25 @@ sub get_shipto { my %myconfig = %main::myconfig; CT->get_shipto(\%myconfig, \%$form); - print $form->ajax_response_header(), join '__pjx__', map $form->{"shipto$_"}, - qw(name department_1 department_2 street zipcode city country contact phone fax email used); + print $form->ajax_response_header(), join('__pjx__', map($form->{"shipto$_"}, qw(name department_1 department_2 street zipcode city country contact phone fax email used))); $main::lxdebug->leave_sub(); } sub get_delivery { - $main::lxdebug->enter_sub(); + $::lxdebug->enter_sub; - $main::auth->assert('customer_vendor_edit'); + $::auth->assert('customer_vendor_edit'); + $::auth->assert('sales_all_edit'); - my $form = $main::form; - my %myconfig = %main::myconfig; + CT->get_delivery(\%::myconfig, $::form ); - CT->get_delivery(\%myconfig, \%$form ); - $form->{IS_CUSTOMER} = $form->{db} eq 'customer'; + print $::form->ajax_response_header, + $::form->parse_html_template('ct/get_delivery', { + is_customer => $::form->{db} eq 'customer', + }); - print $form->ajax_response_header(), $form->parse_html_template('ct/get_delivery'); - - $main::lxdebug->leave_sub(); + $::lxdebug->leave_sub; } sub delete_shipto { @@ -714,4 +716,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}); }