X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Frp.pl;h=da1a265acbd80c2ac2ca30d80345e0cb1b874b54;hb=d5c1e4fa391f26fc0acd568729a98493edf319d8;hp=8156df08d5d45f5470378ec66cf27d5f91f9a044;hpb=a63aaabd1fc1e72db9a746e81f62f3703d9985db;p=kivitendo-erp.git diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 8156df08d..da1a265ac 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -35,12 +35,13 @@ # #====================================================================== -require "$form->{path}/arap.pl"; +require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; use SL::PE; use SL::RP; use SL::USTVA; +use SL::Iconv; 1; @@ -110,9 +111,7 @@ sub report { $accrual = ($eur) ? "" : "checked"; $cash = ($eur) ? "checked" : ""; - ($null, $null, $null, $null, $null, $year, $null, $null, $null) = - localtime(); - $year += 1900; + $year = (localtime)[5] + 1900; # get departments $form->all_departments(\%myconfig); @@ -148,7 +147,7 @@ sub report { '-labels' => \%project_labels)); # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; + $form->{jsscript} = 1; $jsscript = ""; if ($form->{report} eq "ustva") { $department = ""; @@ -200,7 +199,7 @@ sub report { if ($name_1 eq "") { $button1 = qq| - |; + |; $button1_2 = qq| text('button') . qq|>|; @@ -210,12 +209,12 @@ sub report { Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2"); } else { $button1 = qq| - |; + |; $button1_2 = qq| text('button') . qq|>|; $button2 = qq| - |; + |; $button2_2 = qq| text('button') . qq|> @@ -231,19 +230,21 @@ sub report { # without JavaScript Calendar if ($name_1 eq "") { $button1 = - qq||; + qq||; } else { $button1 = - qq||; + qq||; $button2 = - qq||; + qq||; } } - + $form->{javascript} .= qq||; $form->header; - + $onload = qq|focus()|; + $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; + $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; print qq| - +
{script}> @@ -976,7 +977,6 @@ $jsscript
-{path}> {login}> {password}> @@ -1012,7 +1012,7 @@ $jsscript $lxdebug->leave_sub(); } -sub continue { &{ $form->{nextsub} } } +sub continue { call_sub($form->{"nextsub"}); } sub get_project { $lxdebug->enter_sub(); @@ -1354,7 +1354,7 @@ sub list_accounts { $description = $form->escape($ref->{description}); $href = - qq|ca.pl?path=$form->{path}&action=list_transactions&accounttype=$form->{accounttype}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&eur=$form->{eur}&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}&accno=$ref->{accno}&description=$description|; + qq|ca.pl?action=list_transactions&accounttype=$form->{accounttype}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&eur=$form->{eur}&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}&accno=$ref->{accno}&description=$description|; $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1; @@ -1522,7 +1522,7 @@ sub generate_ar_aging { $form->{arap} = "ar"; $form->{callback} = - qq|$form->{script}?path=$form->{path}&action=generate_ar_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&customer=$customer&title=$title|; + qq|$form->{script}?action=generate_ar_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&customer=$customer&title=$title|; RP->aging(\%myconfig, \%$form); &aging; @@ -1542,7 +1542,7 @@ sub generate_ap_aging { $form->{arap} = "ap"; $form->{callback} = - qq|$form->{script}?path=$form->{path}&action=generate_ap_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&vendor=$vendor&title=$title|; + qq|$form->{script}?action=generate_ap_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&vendor=$vendor&title=$title|; RP->aging(\%myconfig, \%$form); &aging; @@ -1707,7 +1707,7 @@ sub aging { $ref->{c90} = ($ref->{c90} != 0) ? $form->format_amount(\%myconfig, $ref->{c90}, 2, " ") : ""; $href = - qq|$ref->{module}.pl?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=| + qq|$ref->{module}.pl?action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=| . $form->escape($form->{callback}); $column_data{invnumber} = qq|$ref->{invnumber}|; @@ -1806,7 +1806,6 @@ sub aging { -{path}> {login}> {password}> @@ -1948,8 +1947,6 @@ sub e_mail { sub send_email { $lxdebug->enter_sub(); - $form->{OUT} = "$sendmail"; - $form->{subject} = $locale->text('Statement') . qq| - $form->{todate}| unless $form->{subject}; @@ -1957,10 +1954,10 @@ sub send_email { $form->{"statement_1"} = 1; - &print_form; + $form->{media} = 'email'; + print_form(); - $form->redirect( - $locale->text('Statement sent to') . " $form->{$form->{ct}}"); + $form->redirect($locale->text('Statement sent to') . " $form->{$form->{ct}}"); $lxdebug->leave_sub(); } @@ -1984,7 +1981,6 @@ sub print { $form->error($locale->text('Nothing selected!')) unless $selected; if ($form->{media} eq 'printer') { - $form->{OUT} = "| $myconfig{printer}"; $form->{"$form->{ct}_id"} = ""; } else { $form->{"statement_1"} = 1; @@ -1992,7 +1988,7 @@ sub print { RP->aging(\%myconfig, \%$form); - &print_form; + print_form(); $form->redirect($locale->text('Statements sent to printer!')) if ($form->{media} eq 'printer'); @@ -2003,21 +1999,40 @@ sub print { sub print_form { $lxdebug->enter_sub(); + my %replacements = + ( + "ä" => "ae", "ö" => "oe", "ü" => "ue", + "Ä" => "Ae", "Ö" => "Oe", "Ü" => "Ue", + "ß" => "ss", + " " => "_" + ); + + foreach my $key (keys %replacements) { + my $new_key = SL::Iconv::convert("ISO-8859-15", $dbcharset, $key); + $replacements{$new_key} = $replacements{$key} if $new_key ne $key; + } + $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1); $form->{templates} = "$myconfig{templates}"; - $form->{IN} = "$form->{type}.html"; - + my $suffix = "html"; + my $attachment_suffix = "html"; if ($form->{format} eq 'postscript') { $form->{postscript} = 1; - $form->{IN} =~ s/html$/tex/; - } - if ($form->{format} eq 'pdf') { + $suffix = "tex"; + $attachment_suffix = "ps"; + } elsif ($form->{format} eq 'pdf') { $form->{pdf} = 1; - $form->{IN} =~ s/html$/tex/; + $suffix = "tex"; + $attachment_suffix = "pdf"; } + $form->{IN} = "$form->{type}.$suffix"; + $form->{OUT} = + $form->{media} eq 'email' ? $sendmail : + $form->{media} eq 'printer' ? "| $myconfig{printer}" : ""; + # Save $form->{email} because it will be overwritten. $form->{EMAIL_RECIPIENT} = $form->{email}; @@ -2077,6 +2092,9 @@ sub print_form { $form->format_amount(\%myconfig, $form->{"${_}total"}, 2) } (c0, c30, c60, c90, ""); + $form->{attachment_filename} = $locale->text("Statement") . "_$form->{todate}.$attachment_suffix"; + map({ $form->{attachment_filename} =~ s/$_/$replacements{$_}/g; } keys(%replacements)); + $form->parse_template(\%myconfig, $userspath); } @@ -2084,6 +2102,7 @@ sub print_form { } # saving the history if(!exists $form->{addition} && $form->{id} ne "") { + $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; $form->{addition} = "PRINTED"; $form->{what_done} = $form->{type}; $form->save_history($form->dbconnect(\%myconfig)); @@ -2127,13 +2146,13 @@ sub generate_tax_report { # construct href $href = - "$form->{script}?path=$form->{path}&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}"; + "$form->{script}?&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}"; # construct callback $description = $form->escape($form->{$descvar}, 1); $department = $form->escape($form->{department}, 1); $callback = - "$form->{script}?path=$form->{path}&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}"; + "$form->{script}?&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}"; $title = $form->escape($form->{title}); $href .= "&title=$title"; @@ -2272,7 +2291,7 @@ sub generate_tax_report { $column_data{id} = qq|$ref->{id}|; $column_data{invnumber} = - qq|{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}|; + qq|{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}|; $column_data{transdate} = qq|$ref->{transdate}|; $column_data{name} = qq|$ref->{name} |; @@ -2392,7 +2411,7 @@ sub list_payments { $memo = $form->escape($form->{memo}); $href = - "$form->{script}?path=$form->{path}&action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo"; + "$form->{script}?action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo"; # construct callback $account = $form->escape($form->{account}, 1); @@ -2403,7 +2422,7 @@ sub list_payments { $memo = $form->escape($form->{memo}, 1); $form->{callback} = - "$form->{script}?path=$form->{path}&action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo&sort=$form->{sort}"; + "$form->{script}?action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo&sort=$form->{sort}"; $callback = $form->escape($form->{callback}); $column_header{name} = @@ -2487,7 +2506,7 @@ sub list_payments { $module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap'); $href = - qq|${module}.pl?path=$form->{path}&action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|; + qq|${module}.pl?action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|; $column_data{name} = "$payment->{name} "; $column_data{reference} =