X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fir.pl;h=6c9c8a87eb67e70ee1470326b3dc6fdbada67df1;hb=96d3ef850a6170a3cbada36eb7f375ef99efe373;hp=7e610f3e5bf2ef9bfbe7b1c3edce8f2d7dda7572;hpb=3138b5c71a57c5cf7ce31a96432563f663063c22;p=kivitendo-erp.git
diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl
index 7e610f3e5..6c9c8a87e 100644
--- a/bin/mozilla/ir.pl
+++ b/bin/mozilla/ir.pl
@@ -31,11 +31,14 @@
#
#======================================================================
+use SL::FU;
use SL::IR;
use SL::IS;
use SL::PE;
+use List::Util qw(max sum);
require "bin/mozilla/io.pl";
+require "bin/mozilla/invoice_io.pl";
require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
require "bin/mozilla/drafts.pl";
@@ -46,7 +49,8 @@ require "bin/mozilla/drafts.pl";
sub add {
$lxdebug->enter_sub();
- $form->{"Watchdog::invdate,duedate,vendor,vendor_id"} = 1;
+
+ $auth->assert('vendor_invoice_edit');
return $lxdebug->leave_sub() if (load_draft_maybe());
@@ -61,11 +65,13 @@ sub add {
sub edit {
$lxdebug->enter_sub();
-
+
+ $auth->assert('vendor_invoice_edit');
+
# show history button
$form->{javascript} = qq||;
#/show hhistory button
-
+
$form->{title} = $locale->text('Edit Vendor Invoice');
&invoice_links;
@@ -78,6 +84,8 @@ sub edit {
sub invoice_links {
$lxdebug->enter_sub();
+ $auth->assert('vendor_invoice_edit');
+
# create links
$form->{webdav} = $webdav;
$form->{jsscript} = 1;
@@ -108,7 +116,7 @@ sub invoice_links {
IR->get_vendor(\%myconfig, \%$form);
IR->retrieve_invoice(\%myconfig, \%$form);
$form->{cp_id} = $cp_id;
-
+
if ($payment_id) {
$form->{payment_id} = $payment_id;
}
@@ -181,6 +189,8 @@ sub invoice_links {
sub prepare_invoice {
$lxdebug->enter_sub();
+ $auth->assert('vendor_invoice_edit');
+
if ($form->{id}) {
map { $form->{$_} =~ s/\"/"/g } qw(invnumber ordnumber quonumber);
@@ -214,73 +224,54 @@ sub prepare_invoice {
sub form_header {
$lxdebug->enter_sub();
+ $auth->assert('vendor_invoice_edit');
+
+ push @{ $form->{AJAX} }, CGI::Ajax->new('set_duedate_vendor' => "$form->{script}?action=set_duedate_vendor");
+
# set option selected
foreach $item (qw(AP vendor currency department)) {
$form->{"select$item"} =~ s/ selected//;
- $form->{"select$item"} =~
- s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
- }
-
- if ($form->{old_employee_id}) {
- $form->{employee_id} = $form->{old_employee_id};
- }
- if ($form->{old_salesman_id}) {
- $form->{salesman_id} = $form->{old_salesman_id};
+ $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
}
+ $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
+ $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
-
-
- $form->{radier} =
- ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
-
- $form->{exchangerate} =
- $form->format_amount(\%myconfig, $form->{exchangerate});
-
- $form->{creditlimit} =
- $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
- $form->{creditremaining} =
- $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
+ $form->{radier} = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
+ $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate});
+ $form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
+ $form->{creditremaining} = $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
$exchangerate = "";
if ($form->{currency} ne $form->{defaultcurrency}) {
if ($form->{forex}) {
- $exchangerate .= qq|
-
|
- . $locale->text('Exchangerate') . qq| |
- $form->{exchangerate}{exchangerate}> |
-|;
+ $exchangerate .= qq| | . $locale->text('Exchangerate') . qq| |
+ $form->{exchangerate}{exchangerate}> | \n|;
} else {
- $exchangerate .= qq|
- |
- . $locale->text('Exchangerate') . qq| |
- {exchangerate}> |
-|;
+ $exchangerate .= qq| | . $locale->text('Exchangerate') . qq| |
+ {exchangerate}> | \n|;
}
}
- $exchangerate .= qq|
-{forex}>
-|;
+ $exchangerate .= qq| {forex}>\n|;
my @old_project_ids = ($form->{"globalproject_id"});
- map({ push(@old_project_ids, $form->{"project_id_$_"})
- if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
-
- $form->get_lists("contacts" => "ALL_CONTACTS",
- "projects" => { "key" => "ALL_PROJECTS",
- "all" => 0,
- "old_id" => \@old_project_ids },
- "taxzones" => "ALL_TAXZONES",
- "employees" => "ALL_SALESMEN",
- "currencies" => "ALL_CURRENCIES",
- "vendors" => "ALL_VENDORS");
+ map { push @old_project_ids, $form->{"project_id_$_"} if $form->{"project_id_$_"}; } 1..$form->{"rowcount"};
+
+ $form->get_lists("contacts" => "ALL_CONTACTS",
+ "projects" => { "key" => "ALL_PROJECTS",
+ "all" => 0,
+ "old_id" => \@old_project_ids },
+ "taxzones" => "ALL_TAXZONES",
+ "employees" => "ALL_SALESMEN",
+ "currencies" => "ALL_CURRENCIES",
+ "vendors" => "ALL_VENDORS",
+ "price_factors" => "ALL_PRICE_FACTORS");
my %labels;
my @values = (undef);
foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
push(@values, $item->{"cp_id"});
- $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
- ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
+ $labels{$item->{"cp_id"}} = $item->{"cp_name"} . ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
}
my $contact;
@@ -288,10 +279,8 @@ sub form_header {
$contact = qq|
| . $locale->text('Contact Person') . qq| |
- | .
- NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px',
- '-labels' => \%labels, '-default' => $form->{"cp_id"}))
- . qq|
+ | | . NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px',
+ '-labels' => \%labels, '-default' => $form->{"cp_id"})) . qq|
|
|;
}
@@ -302,11 +291,9 @@ sub form_header {
push(@values, $item->{"id"});
$labels{$item->{"id"}} = $item->{"projectnumber"};
}
- my $globalprojectnumber =
- NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
- '-labels' => \%labels,
- '-default' => $form->{"globalproject_id"}));
-
+ my $globalprojectnumber = NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values, '-labels' => \%labels,
+ '-default' => $form->{"globalproject_id"}));
+
%labels = ();
@values = ();
my $i = 0;
@@ -314,16 +301,15 @@ sub form_header {
push(@values, $item);
$labels{$item} = $item;
}
-
+
$form->{currency} = $form->{defaultcurrency} unless $form->{currency};
my $currencies;
if (scalar @values) {
$currencies = qq|
| . $locale->text('Currency') . qq| |
- | .
- NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
- '-values' => \@values, '-labels' => \%labels)) . qq|
+ | | . NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
|
|;
}
@@ -336,13 +322,12 @@ sub form_header {
$labels{$item->{"id"}} = $item->{"name"};
}
my $employees = qq|
-
+
| . $locale->text('Employee') . qq| |
- | .
- NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"},
- '-values' => \@values, '-labels' => \%labels)) . qq|
+ | | . NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
|
-
|;
+ |;
%labels = ();
@values = ();
@@ -360,9 +345,9 @@ sub form_header {
(($myconfig{vclimit} <= scalar(@values))
? qq||
: (NTI($cgi->popup_menu('-name' => 'vendor', '-default' => $form->{oldvendor},
- '-onChange' => 'document.getElementById(\'update_button\').click();',
- '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq|
-
+ '-onChange' => 'document.getElementById(\'update_button\').click();',
+ '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq|
+
|;
%labels = ();
@@ -376,12 +361,10 @@ sub form_header {
$taxzone = qq|
| . $locale->text('Steuersatz') . qq| |
- | .
- NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
- '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')) . qq|
+ | | . NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
+ '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')) . qq|
|
|;
-
} else {
$taxzone = qq|
@@ -394,13 +377,12 @@ sub form_header {
}
$department = qq|
-
+
| . $locale->text('Department') . qq| |
|
-
-| if $form->{selectdepartment};
+ \n| if $form->{selectdepartment};
$n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
@@ -409,43 +391,51 @@ sub form_header {
$jsscript = "";
$button1 = qq|
-
- text('button') . qq|> |
- |;
+
+
+
+ | \n|;
+
+#, 'old_duedate__'' + document.getElementsByName('duedate')[0].value, 'vendor_id__' + document.getElementsByName('vendor_id')[0].value],['duedate'])">
$button2 = qq|
-
- text('button') . qq|> |
- |;
+
+
+ text('button') . qq|>
+ | \n|;
#write Trigger
$jsscript =
- Form->write_trigger(\%myconfig, "2", "invdate", "BL", "trigger1",
+ Form->write_trigger(\%myconfig, "2",
+ "invdate", "BL", "trigger1",
"duedate", "BL", "trigger2");
- $form->{"javascript"} .= qq||;
- $form->{"javascript"} .= qq||;
- $form->{javascript} .= qq||;
+ my $follow_up_vc = $form->{vendor};
+ $follow_up_vc =~ s/--.*?//;
+ my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)";
+
+ $form->{javascript} .= qq||;
+ $form->{javascript} .= qq||;
+ $form->{javascript} .= qq||;
+ $form->{javascript} .= qq||;
- $jsscript .=
- $form->write_trigger(\%myconfig, 2,
- "orddate", "BL", "trigger_orddate",
- "quodate", "BL", "trigger_quodate");
+ $jsscript .= $form->write_trigger(\%myconfig, 2, "orddate", "BL", "trigger_orddate", "quodate", "BL", "trigger_quodate");
$form->header;
- $onload = qq|focus()|;
+ $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|
-
-