X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fct.pl;h=a1bfc255d6f3606892cf269d606e4e911a9b8e3d;hb=6277aefffea29c8aa6f684bd86c55cdc6366f32f;hp=0e1df522a0b0ba12d3903b13d1b948cf28f2d6fc;hpb=bb1c185dd07e69b46ad26efa74d8eef99307daf8;p=kivitendo-erp.git diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 0e1df522a..a1bfc255d 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -38,6 +38,9 @@ # $locale->text('Add Vendor') use SL::CT; +use CGI::Ajax; +use CGI; +use Data::Dumper; 1; @@ -69,8 +72,7 @@ sub search { if ($form->{db} eq 'vendor') { $gifi = qq| | - . $locale->text('GIFI') - . qq| + . $locale->text('GIFI') . qq| |; } @@ -112,8 +114,7 @@ sub search {  | . $locale->text('All') . qq|  | - . $locale->text('Orphaned') - . qq| + . $locale->text('Orphaned') . qq| | . $locale->text('Include in Report') . qq| @@ -121,54 +122,162 @@ sub search { + . $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| $gifi + . $locale->text('SIC') . qq| + . $locale->text('Type of Business') . 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| | - . $locale->text('Type of Business') - . 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"); + + if ($form->{db} eq 'vendor') { + $gifi = qq| + | + . $locale->text('GIFI') . qq| +|; + } + + $form->header; + + print qq| + + +
{script}> + +{db}> + + + + + + + + - - - - +
$form->{title}
+ + + + + + + + + + + + + + + + + + + + + + + + @@ -434,14 +543,8 @@ sub list_names { {password}> |; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } + . $locale->text('Add') . qq|"> - print qq| @@ -479,6 +582,7 @@ sub form_header { $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| @@ -489,16 +593,118 @@ 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||; + $lang .= qq||; } } + $payment = qq||; + foreach $item (@{ $form->{payment_terms} }) { + if ($form->{payment_id} eq $item->{id}) { + $payment .= qq||; + } else { + $payment .= qq||; + } + } + + if (!$form->{id}) { + if ($form->{db} eq "customer") { + $form->{taxzone_id} = 0; + } else { + $form->{taxzone_id} = 0; + } + } + + if (@{ $form->{TAXZONE} }) { + foreach $item (@{ $form->{TAXZONE} }) { + if ($item->{id} == $form->{taxzone_id}) { + $form->{selecttaxzone} .= + " + + + + |; + + $get_contact_url = + "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_contact"; + + my $pjx = new CGI::Ajax( 'get_contact' => $get_contact_url ); + $form->{selectcontact} = ""; + 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| + + + + + |; + $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} .= + " + + + + |; + + + $get_delivery_url = + "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_delivery"; + + my $pjz = new CGI::Ajax( 'get_delivery' => $get_delivery_url ); + + push(@ { $form->{AJAX} }, $pjz); + + $delivery = qq| + + + + |; + foreach $item (split / /, $form->{taxaccounts}) { if (($form->{tax}{$item}{taxable}) || !($form->{id})) { $taxable .= @@ -528,10 +734,10 @@ sub form_header { |; } - $form->{selectbusiness} = qq|
| . $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('Include in Report') . qq| + + + + + + + + + + + + + + + + $gifi + + + . $locale->text('Invoices') . qq| + . $locale->text('Orders') . qq| + . $locale->text('Quotations') . 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| | + . $locale->text('Type of Business') . qq|
| - . $locale->text('Invoices') - . qq| | - . $locale->text('Orders') - . qq| | - . $locale->text('Quotations') - . qq|
| . $locale->text('Steuersatz') . qq|
| . $locale->text('Ansprechpartner') . qq|
| . $locale->text('Shipping Address') . qq|
| . $locale->text('Shipping Address') . qq|
- -
$form->{title}
+
+ + +{script} onKeyUp="highlight(event)" onClick="highlight(event)"> + + + + + +
+ +
+ - - - - $business_salesman + + + + - - + - - + - - + - - + . $locale->text('Zipcode') . "/" . $locale->text('City') . qq| + - - + - - + - - + - - + - - + - + - - |; -##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| + + |; + } print qq| + $taxzone
| . $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(); } @@ -822,7 +1209,7 @@ sub form_footer { ## print qq| -{id}> +{id}> @@ -832,12 +1219,16 @@ sub form_footer { {password}> -{db}> +{db}> + +
$update_button + @@ -852,15 +1243,13 @@ $update_button . qq|">\n|; } - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - print qq| - + |; @@ -872,6 +1261,9 @@ sub add_transaction { $lxdebug->enter_sub(); $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->{callback} = $form->escape($form->{callback}, 1); @@ -944,6 +1336,28 @@ sub save_and_order { $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 ($vertreter && $form->{db} eq "customer") { + $form->isblank("salesman_id", $locale->text("Salesman missing!")); + } + $rc = &{"CT::save_$form->{db}"}("", \%myconfig, \%$form); + if ($rc == 3) { + $form->error($locale->text('customernumber not unique!')); + } + $form->redirect($locale->text($msg)); + + $lxdebug->leave_sub(); +} + sub save { $lxdebug->enter_sub(); @@ -957,10 +1371,11 @@ sub save { if ($vertreter && $form->{db} eq "customer") { $form->isblank("salesman_id", $locale->text("Salesman missing!")); } + print(STDERR "SHIPTO in sub save $form->{shipto_id}\n"); &{"CT::save_$form->{db}"}("", \%myconfig, \%$form); - $form->redirect($locale->text($msg)); - + &edit; + exit; $lxdebug->leave_sub(); } @@ -1169,4 +1584,116 @@ sub salesman_selected { $lxdebug->leave_sub(); } +sub get_contact { + $lxdebug->enter_sub(); + + CT->get_contact(\%myconfig, \%$form); + + 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(); + +} + + +sub get_shipto { + $lxdebug->enter_sub(); + + 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(); + +} + +sub get_delivery { + $lxdebug->enter_sub(); + + CT->get_delivery(\%myconfig, \%$form ); + + @column_index = + $form->sort_columns(shiptoname, + invnumber, + ordnumber, + transdate, + description, + qty, + unit); + + + + $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| + + + +
+ + +|; + + map { $result .= "$column_header{$_}\n" } @column_index; + + $result .= qq| + +|; + + + foreach $ref (@{ $form->{DELIVERY} }) { + + if ($ref->{shiptoname} eq $sameshiptoname) { + map { $column_data{$_} = "" } @column_index; + $column_data{shiptoname} = ""; + } else { + map { $column_data{$_} = "" } @column_index; + } + + $i++; + $i %= 2; + $result .= " + +"; + + map { $result .= "$column_data{$_}\n" } @column_index; + + $result .= qq| + +|; + + $sameshiptoname = $ref->{shiptoname}; + + } + + $result .= qq| +
$ref->{$_}  $ref->{$_} 
+|; + + + my $q = new CGI; + print $q->header(); + print $result; + $lxdebug->leave_sub(); + +} + sub continue { &{ $form->{nextsub} } }