X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fct.pl;h=767d0e87d5625f8b70c40d8ffdb9ef7b09ae92af;hb=db68b6fd72b9f0d7d8be953746c0e7d6154f5eaf;hp=33267a18babf263b6f1178e8a40f063727946533;hpb=3db6a6d9cb7e46bc2c1e88d01c55a07193208053;p=kivitendo-erp.git diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 33267a18b..767d0e87d 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -307,224 +307,6 @@ sub search_delivery { $lxdebug->leave_sub(); } -sub search_adr { - $lxdebug->enter_sub(); - - $form->{title} = $locale->text('ADR Report'); - - # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; - $jsscript = ""; - - if ($form->{jsscript}) { - - # with JavaScript Calendar - $button1 = qq| - {from}> - text('button') . qq|> - |; - $button2 = qq| - {to}> - text('button') . qq|> - |; - - - #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "2", - "from", "BL", - "trigger1", "to", - "BL", "trigger2"); - } else { - - # without JavaScript Calendar - $button1 = - qq|{from}>|; - $button2 = - qq|{to}>|; - } - - $form->header; - - print qq| - - -
{script}> - - - - - - - - - - - - - -
$form->{title}
- - - - - - - $button1 - - - - $button2 - - - - - -
| . $locale->text('Year') . qq|{year}>
| . $locale->text('From') . qq|
| . $locale->text('Bis') . qq|
 | - . $locale->text('HTML') . qq| -  | - . $locale->text('CSV') . qq|
-

-$jsscript - - -{path}> -{login}> -{password}> - -
- -
- - - -|; - $lxdebug->leave_sub(); -} -sub adr_report { - $lxdebug->enter_sub(); - - CT->adr(\%myconfig, \%$form); - - $form->{title} = $locale->text('ADR Report'); - if ($form->{from} || $form->{to}) { - $option = "Für den Zeitraum $form->{from} bis $form->{to}"; - } elsif ($form->{year}) { - $option = "Für das Jahr $form->{year}"; - } - - if ($form->{format} eq "html") { - $form->header(); - print qq| - - - - - - - - - - -
$form->{title}
$option
|; - - - @column_index = - $form->sort_columns(adr_code, - adr_description, - sum, - unit); - - - - $column_header{adr_code} = - qq|| . $locale->text('ADR Code') . qq||; - $column_header{adr_description} = - qq||. $locale->text('ADR Description'). qq||; - $column_header{sum} = - qq||. $locale->text('Quantity'). qq||; - $column_header{unit} = - qq|| . $locale->text('Unit') . qq||; - - print qq| - - - - - + |; foreach $item (split / /, $form->{taxaccounts}) { @@ -1081,6 +862,7 @@ sub form_header { # $locale->text('Customer Number') # $locale->text('Vendor Number') $form->{fokus} = "ct.greeting"; + $form->{jsscript} = 1; $form->header; print qq| @@ -1171,9 +953,9 @@ sub form_header { - - + + + @@ -1182,7 +964,7 @@ sub form_header { - + $customer @@ -1209,9 +991,6 @@ sub form_header { - - $taxzone
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - - foreach $ref (@{ $form->{ADR} }) { - - map { $column_data{$_} = "" } @column_index; - - - $i++; - $i %= 2; - print " - -"; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - - - } - - print qq| -
$ref->{$_} 
- - -|; - } else { - my $filename = "adr-report-$form->{from}-$form->{to}.csv"; - if ($form->{year}) { - $filename = "adr-report-$form->{year}.csv"; - } - @column_index = - $form->sort_columns(adr_code, - adr_description, - sum, - unit); - - $tmpfile = qq|ADR Code;ADR Beschreibung;Menge;Einheit\n|; - foreach $ref (@{ $form->{ADR} }) { - - map { $column_data{$_} = qq|"$ref->{$_}"| } @column_index; - - $line = ""; - map { $line .= "$column_data{$_};" } @column_index; - chomp($line); - $tmpfile .= qq|$line\n|;; - } - - my $size = length($tmpfile); - # launch application - print qq|Content-Type: application/csv -Content-Disposition: attachment; filename="$filename" -Content-Length: $size - -$tmpfile -|; - } - - $lxdebug->leave_sub(); -} - sub list_names { $lxdebug->enter_sub(); @@ -761,14 +543,8 @@ sub list_names { {password}> |; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } + . $locale->text('Add') . qq|"> - print qq| @@ -781,6 +557,10 @@ sub list_names { sub edit { $lxdebug->enter_sub(); + # show history button + $form->{javascript} = qq||; + #/show hhistory button + # $locale->text('Edit Customer') # $locale->text('Edit Vendor') @@ -893,6 +673,7 @@ sub form_header { 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}) { @@ -925,7 +706,7 @@ sub form_header { $delivery = qq|
| . $locale->text('Shipping Address') . qq|
| . $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('Obsolete') . qq| {obsolete}>| . $locale->text('Payment Terms') . qq|
@@ -1385,9 +1164,11 @@ $shipto $delivery | . $locale->text('From') . qq| - - | . $locale->text('Bis') . qq| - + + + | . $locale->text('To (time)') . qq| + + @@ -1400,7 +1181,8 @@ $shipto -|; +| . $form->write_trigger(\%myconfig, 2, "fromB", "BL", "trigger_from", + "toB", "BL", "trigger_to"); $lxdebug->leave_sub(); } @@ -1431,7 +1213,7 @@ sub form_footer { ## print qq| -{id}> +{id}> @@ -1441,7 +1223,7 @@ sub form_footer { {password}> -{db}> +{db}> @@ -1465,10 +1247,16 @@ $update_button . qq|">\n|; } - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; + # button for saving history + if($form->{id} ne "") { + print qq| + {id} + . qq|); name=history id=history value=| + . $locale->text('history') + . qq|>|; } + # /button for saving history print qq| @@ -1487,6 +1275,13 @@ initializetabcontent("maintab") sub add_transaction { $lxdebug->enter_sub(); +# # 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 ($vertreter && $form->{db} eq "customer") { $form->isblank("salesman_id", $locale->text("Salesman missing!")); @@ -1498,7 +1293,6 @@ sub add_transaction { $form->{callback} = "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&callback=$form->{callback}"; - $form->redirect; $lxdebug->leave_sub(); @@ -1508,8 +1302,13 @@ sub save_and_ap_transaction { $lxdebug->enter_sub(); $form->{script} = "ap.pl"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &add_transaction; - $lxdebug->leave_sub(); } @@ -1517,8 +1316,13 @@ sub save_and_ar_transaction { $lxdebug->enter_sub(); $form->{script} = "ar.pl"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &add_transaction; - $lxdebug->leave_sub(); } @@ -1527,8 +1331,13 @@ sub save_and_invoice { $form->{script} = ($form->{db} eq 'customer') ? "is.pl" : "ir.pl"; $form->{type} = "invoice"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &add_transaction; - $lxdebug->leave_sub(); } @@ -1537,8 +1346,13 @@ sub save_and_rfq { $form->{script} = "oe.pl"; $form->{type} = "request_quotation"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &add_transaction; - $lxdebug->leave_sub(); } @@ -1547,8 +1361,13 @@ sub save_and_quotation { $form->{script} = "oe.pl"; $form->{type} = "sales_quotation"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &add_transaction; - $lxdebug->leave_sub(); } @@ -1558,8 +1377,13 @@ sub save_and_order { $form->{script} = "oe.pl"; $form->{type} = ($form->{db} eq 'customer') ? "sales_order" : "purchase_order"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &add_transaction; - $lxdebug->leave_sub(); } @@ -1580,6 +1404,12 @@ sub save_and_close { if ($rc == 3) { $form->error($locale->text('customernumber not unique!')); } + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history $form->redirect($locale->text($msg)); $lxdebug->leave_sub(); @@ -1598,9 +1428,22 @@ 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); + my $res = &{"CT::save_$form->{db}"}("", \%myconfig, \%$form); + + if (3 == $res) { + if ($form->{"db"} eq "customer") { + $form->error($locale->text('This customer number is already in use.')); + } else { + $form->error($locale->text('This vendor number is already in use.')); + } + } + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &edit; exit; $lxdebug->leave_sub(); @@ -1618,6 +1461,12 @@ sub delete { $msg = ucfirst $form->{db}; $msg .= " deleted!"; + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "DELETED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history $form->redirect($locale->text($msg)); $msg = "Cannot delete $form->{db}"; @@ -1825,7 +1674,6 @@ sub get_contact { } - sub get_shipto { $lxdebug->enter_sub(); @@ -1843,7 +1691,7 @@ sub get_shipto { sub get_delivery { $lxdebug->enter_sub(); - CT->get_delivery(\%myconfig, \%$form); + CT->get_delivery(\%myconfig, \%$form ); @column_index = $form->sort_columns(shiptoname, @@ -1851,7 +1699,6 @@ sub get_delivery { ordnumber, transdate, description, - adr_code, qty, unit); @@ -1867,8 +1714,6 @@ sub get_delivery { qq|| . $locale->text('Invdate') . qq||; $column_header{description} = qq|| . $locale->text('Description') . qq||; - $column_header{adr_code} = - qq|| . $locale->text('ADR') . qq||; $column_header{qty} = qq|| . $locale->text('Qty') . qq||; $column_header{unit} =