X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fct.pl;h=a1bfc255d6f3606892cf269d606e4e911a9b8e3d;hb=6277aefffea29c8aa6f684bd86c55cdc6366f32f;hp=fc260c6da819dd0c7c68b184f2fe978d00e8c101;hpb=8e58d69a5a65f4887c7722dfae72a658b883eeec;p=kivitendo-erp.git diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index fc260c6da..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; @@ -182,6 +185,128 @@ sub search { $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}
+ + + + + + + + + + + + + + + + + + + + + + + + + +
| . $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('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 list_names { $lxdebug->enter_sub(); @@ -418,14 +543,8 @@ sub list_names { {password}> |; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } + . $locale->text('Add') . qq|"> - print qq| @@ -474,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||; + } + } + + $payment = qq||; + foreach $item (@{ $form->{payment_terms} }) { + if ($form->{payment_id} eq $item->{id}) { + $payment .= qq||; } else { - $lang .= qq||; + $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} .= + ""; + 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') { @@ -620,169 +857,124 @@ sub form_header { # $locale->text('Customer Number') # $locale->text('Vendor Number') - $form->{fokus} = "ct.name"; + $form->{fokus} = "ct.greeting"; + $form->{jsscript} = 1; $form->header; print 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') { @@ -796,20 +988,197 @@ sub form_header { + $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('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(); } @@ -840,7 +1209,7 @@ sub form_footer { ## print qq| -{id}> +{id}> @@ -850,7 +1219,7 @@ sub form_footer { {password}> -{db}> +{db}> @@ -858,6 +1227,8 @@ sub form_footer { $update_button + @@ -872,15 +1243,13 @@ $update_button . qq|">\n|; } - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - print qq|
- + |; @@ -892,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); @@ -964,7 +1336,7 @@ sub save_and_order { $lxdebug->leave_sub(); } -sub save { +sub save_and_close { $lxdebug->enter_sub(); # $locale->text('Customer saved!') @@ -986,6 +1358,27 @@ sub save { $lxdebug->leave_sub(); } +sub save { + $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!")); + } + print(STDERR "SHIPTO in sub save $form->{shipto_id}\n"); + &{"CT::save_$form->{db}"}("", \%myconfig, \%$form); + + &edit; + exit; + $lxdebug->leave_sub(); +} + sub delete { $lxdebug->enter_sub(); @@ -1191,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} } }