X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fis.pl;h=e94bb386e11dc1f8fd65baf04aeb870b6910a8ab;hb=599030d5e26bcef0f9850ddbbedba106ded70ebb;hp=ce9e76081375800c8100fca2f6bfb00b4a4a88d0;hpb=54451a50c048a22fa02bb7862424a4a5a38983fd;p=kivitendo-erp.git diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index ce9e76081..e94bb386e 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -35,8 +35,8 @@ use SL::IS; use SL::PE; use Data::Dumper; -require "$form->{path}/io.pl"; -require "$form->{path}/arap.pl"; +require "bin/mozilla/io.pl"; +require "bin/mozilla/arap.pl"; require "bin/mozilla/drafts.pl"; 1; @@ -61,7 +61,7 @@ sub add { $form->{callback} = - "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&path=$form->{path}&password=$form->{password}" + "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; $form{jsscript} = "date"; @@ -167,19 +167,11 @@ sub invoice_links { $form->{shipto_id} = $shipto_id; } - # currencies - @curr = split(/:/, $form->{currencies}); - chomp $curr[0]; - $form->{defaultcurrency} = $curr[0]; - - map { $form->{selectcurrency} .= "\n" } @curr; - $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}"; if (@{ $form->{all_customer} }) { - $form->{customer} = "$form->{customer}--$form->{customer_id}"; - map { $form->{selectcustomer} .= "\n" } - (@{ $form->{all_customer} }); + $form->{customer} = "$form->{customer}--$form->{customer_id}"; + $form->{selectcustomer} = "$form->{customer}--$form->{customer_id}"; } # departments @@ -195,13 +187,6 @@ sub invoice_links { $form->{employee} = "$form->{employee}--$form->{employee_id}"; - # sales staff - if ($form->{all_employees}) { - $form->{selectemployee} = ""; - map { $form->{selectemployee} .= "\n" } - (@{ $form->{all_employees} }); - } - # forex $form->{forex} = $form->{exchangerate}; $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1; @@ -329,38 +314,11 @@ sub form_header { } my $set_duedate_url = - "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=set_duedate"; + "$form->{script}?login=$form->{login}&password=$form->{password}&action=set_duedate"; my $pjx = new CGI::Ajax( 'set_duedate' => $set_duedate_url ); push(@ { $form->{AJAX} }, $pjx); - if (@{ $form->{TAXZONE} }) { - $form->{selecttaxzone} = ""; - foreach $item (@{ $form->{TAXZONE} }) { - if ($item->{id} == $form->{taxzone_id}) { - $form->{selecttaxzone} .= - ""; - } else { - $form->{selecttaxzone} .= - ""; - } - - } - } else { - $form->{selecttaxzone} =~ s/ selected//g; - if ($form->{taxzone_id} ne "") { - $form->{selecttaxzone} =~ s/value=\"$form->{taxzone_id}\"/value=\"$form->{taxzone_id}\" selected/; - } - } - - $taxzone = qq| - - | . $locale->text('Steuersatz') . qq| - - - |; - my @old_project_ids = ($form->{"globalproject_id"}); map({ push(@old_project_ids, $form->{"project_id_$_"}) if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"})); @@ -370,7 +328,10 @@ sub form_header { "projects" => { "key" => "ALL_PROJECTS", "all" => 0, "old_id" => \@old_project_ids }, - "employees" => "ALL_SALESMEN"); + "employees" => "ALL_SALESMEN", + "taxzones" => "ALL_TAXZONES", + "currencies" => "ALL_CURRENCIES", + "customers" => "ALL_CUSTOMERS"); my %labels; my @values = (undef); @@ -383,6 +344,40 @@ sub form_header { NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-labels' => \%labels, '-default' => $form->{"cp_id"})); + %labels = (); + @values = (); + foreach my $item (@{ $form->{"ALL_SALESMEN"} }) { + push(@values, $item->{"id"}); + $labels{$item->{"id"}} = $item->{"name"}; + } + + my $employees = qq| + + | . $locale->text('Employee') . qq| + | . + NTI($cgi->popup_menu('-name' => 'employee', '-default' => $form->{"employee_id"}, + '-values' => \@values, '-labels' => \%labels)) . qq| + + |; + + + %labels = (); + @values = (); + foreach my $item (@{ $form->{"ALL_CUSTOMERS"} }) { + push(@values, $item->{name}.qq|--|.$item->{"id"}); + $labels{$item->{"id"}} = $item->{name}.qq|--|.$item->{"id"}; + } + + my $customers = qq| + | . $locale->text('Customer') . qq| + | . + (($myconfig{vclimit} == 1 ) + ? qq|| + : (NTI($cgi->popup_menu('-name' => 'customer', '-default' => $form->{oldcustomer}, + '-onChange' => 'document.getElementById(\'update_button\').click();', + '-values' => \@values, '-labels' => \%labels)))) . qq| + |; + %labels = (); @values = (""); foreach my $item (@{ $form->{"ALL_SHIPTO"} }) { @@ -398,6 +393,23 @@ sub form_header { '-labels' => \%labels, '-default' => $form->{"shipto_id"})) . qq||; + %labels = (); + @values = (); + foreach my $item (@{ $form->{"ALL_CURRENCIES"} }) { + push(@values, $item); + $labels{$item} = $item; + } + + $form->{currency} = $form->{defaultcurrency} unless $form->{currency}; + my $currencies = qq| + + | . $locale->text('Currency') . qq| + | . + NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"}, + '-values' => \@values, '-labels' => \%labels)) . qq| + + |; + %labels = (); @values = (""); foreach my $item (@{ $form->{"ALL_PROJECTS"} }) { @@ -425,6 +437,34 @@ sub form_header { . qq| |; + %labels = (); + @values = (); + foreach my $item (@{ $form->{"ALL_TAXZONES"} }) { + push(@values, $item->{"id"}); + $labels{$item->{"id"}} = $item->{"description"}; + } + + if (!$form->{"id"}) { + $taxzone = qq| + + | . $locale->text('Steuersatz') . qq| + | . + NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"}, + '-values' => \@values, '-labels' => \%labels)) . qq| + + |; + + } else { + $taxzone = qq| + + | . $locale->text('Steuersatz') . qq| + + + | . H($labels{$form->{"taxzone_id"}}) . qq| + + |; + } + # set option selected foreach $item (qw(AR customer currency department employee)) { $form->{"select$item"} =~ s/ selected//; @@ -470,11 +510,6 @@ sub form_header { |; - $customer = - ($form->{selectcustomer}) - ? qq|\n| - : qq||; - $department = qq| | . $locale->text('Department') . qq| @@ -528,7 +563,7 @@ sub form_header { # with JavaScript Calendar $button1 = qq| - + |; @@ -541,7 +576,7 @@ sub form_header { # without JavaScript Calendar $button1 = - qq||; + qq||; $button2 = qq||; } @@ -550,17 +585,17 @@ sub form_header { # with JavaScript Calendar $button1 = qq| - + |; $button2 = qq| - + |; $button3 = qq| - + |; @@ -577,9 +612,9 @@ sub form_header { # without JavaScript Calendar $button1 = - qq||; + qq||; $button2 = - qq|{duedate}>|; + qq|{duedate} onBlur=\"check_right_date_format(this)\">|; } } if ($form->{resubmit} && ($form->{format} eq "html")) { @@ -588,9 +623,10 @@ sub form_header { } elsif ($form->{resubmit}) { $onload = qq|document.invoice.submit()|; } else { - $onload = "fokus()"; + $onload = "focus()"; } - + $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; + $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; $credittext = $locale->text('Credit Limit exceeded!!!'); if ($creditwarning) { $onload = qq|alert('$credittext')|; @@ -636,11 +672,11 @@ print qq| - - + $customers - + + @@ -670,10 +706,7 @@ print qq| $taxzone $department - - - - + $currencies $exchangerate @@ -686,7 +719,11 @@ print qq| - |; + + + + + |; # #
| . $locale->text('Customer') . qq|$customer | . $locale->text('Contact Person') . qq| $contact
| . $locale->text('Currency') . qq|
| . $locale->text('Ship via') . qq|
| . $locale->text('Transaction description') . qq|| . $cgi->textfield("-name" => "transaction_description", "-size" => 35, "-value" => $form->{transaction_description}) . qq|
# @@ -711,12 +748,7 @@ print qq|
- - - - - - + $employees $salesman |; if ($form->{type} eq "credit_note") { @@ -752,7 +784,7 @@ print qq| - + @@ -761,7 +793,7 @@ print qq| - + @@ -817,13 +849,13 @@ sub form_footer { qq||; $intnotes = qq||; - - $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; + + $form->{taxincluded} = ($form->{taxincluded} ? "checked" : ""); $taxincluded = ""; if ($form->{taxaccounts}) { $taxincluded = qq| - {taxincluded}> | + {taxincluded}> | . $locale->text('Tax Included') . qq|

|; } @@ -1038,12 +1070,12 @@ if ($form->{type} eq "credit_note") { $exchangerate .= qq||; $column_data{"paid_$i"} = - qq|
|; + qq||; $column_data{"exchangerate_$i"} = qq||; $column_data{"AR_paid_$i"} = qq||; $column_data{"datepaid_$i"} = - qq||; $column_data{"source_$i"} = qq||; @@ -1068,7 +1100,7 @@ if ($form->{type} eq "credit_note") { @@ -1159,7 +1191,7 @@ if ($form->{type} eq "credit_note") { $cgi->hidden("-name" => "callback", "-value" => $form->{callback}) . $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}]) . $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]); -map({ print $cgi->hidden("-name" => $_ , "-value" => $form->{$_});} qw(path login password)); +map({ print $cgi->hidden("-name" => $_ , "-value" => $form->{$_});} qw(login password)); print qq| @@ -1180,10 +1212,19 @@ sub update { $form->{print_and_post} = 0; } + + if($form->{taxincluded}) { + $taxincluded = "checked"; + } $form->{update} = 1; &check_name(customer); + if(!$form->{taxincluded}) { + $form->{taxincluded} = $taxincluded; + } + + $form->{exchangerate} = $exchangerate if ( $form->{forex} = ( @@ -1431,6 +1472,7 @@ sub post { remove_draft() if $form->{remove_draft}; if(!exists $form->{addition}) { + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = $print_post ? "PRINTED AND POSTED" : $form->{storno} ? "STORNO" : "POSTED"; @@ -1480,7 +1522,7 @@ sub storno { } map({ my $key = $_; delete($form->{$key}) - unless (grep({ $key eq $_ } qw(path login password id type))); } + unless (grep({ $key eq $_ } qw(login password id type))); } keys(%{ $form })); &invoice_links; @@ -1607,6 +1649,7 @@ sub yes { if (IS->delete_invoice(\%myconfig, \%$form, $spool)) { # saving the history if(!exists $form->{addition}) { + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "DELETED"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -1621,11 +1664,20 @@ sub yes { sub e_mail { $lxdebug->enter_sub(); - $print_post = 1; + if (!$form->{id}) { + $print_post = 1; - &post; + my $saved_form = save_form(); + + post(); + + my %saved_vars; + map({ $saved_vars{$_} = $form->{$_}; } qw(id invnumber)); + restore_form($saved_form); + map({ $form->{$_} = $saved_vars{$_}; } qw(id invnumber)); + } - &edit_e_mail; + edit_e_mail(); $lxdebug->leave_sub(); }
| . $locale->text('Employee') . qq|
| . $locale->text('Order Date') . qq|
| . $locale->text('Quotation Date') . qq|
$exchangerate{"datepaid_$i"}> + qq| |; - &print_options; + print_options(); print qq|