X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fir.pl;h=c9624ccb3035b25ea14f1f0406e0195a006a8f68;hb=f5ab83507b71d551147835d84ec8317afd2842e9;hp=faaa3cc6461a07fc9ba66d0a35f2f28ce6094e71;hpb=83d48a07af73da318458780e40814cf89579cb94;p=kivitendo-erp.git diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index faaa3cc64..c9624ccb3 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -78,10 +78,8 @@ sub invoice_links { $lxdebug->enter_sub(); # create links - $form->{webdav} = $webdav; - - # set jscalendar - $form->{jscalendar} = $jscalendar; + $form->{webdav} = $webdav; + $form->{jsscript} = 1; $form->create_links("AP", \%myconfig, "vendor"); @@ -275,7 +273,9 @@ sub form_header { "all" => 0, "old_id" => \@old_project_ids }, "taxzones" => "ALL_TAXZONES", - "currencies" => "ALL_CURRENCIES"); + "employees" => "ALL_SALESMEN", + "currencies" => "ALL_CURRENCIES", + "vendors" => "ALL_VENDORS"); my %labels; my @values = (undef); @@ -284,9 +284,19 @@ sub form_header { $labels{$item->{"cp_id"}} = $item->{"cp_name"} . ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : ""); } - my $contact = - NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, - '-labels' => \%labels, '-default' => $form->{"cp_id"})); + + my $contact; + if (scalar @values > 1) { + $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| + + |; + } %labels = (); @values = (""); @@ -301,13 +311,16 @@ sub form_header { %labels = (); @values = (); + my $i = 0; foreach my $item (@{ $form->{"ALL_CURRENCIES"} }) { - push(@values, $item->{"currency"}); - $labels{$item->{"currency"}} = $item->{"currency"}; + push(@values, $item); + $labels{$item} = $item; } - $form->{currency} = $form->{defaultcurrency} unless $form->{currency}; - my $currencies = qq| + $form->{currency} = $form->{defaultcurrency} unless $form->{currency}; + my $currencies; + if (scalar @values) { + $currencies = qq| | . $locale->text('Currency') . qq| | . @@ -315,7 +328,40 @@ sub form_header { '-values' => \@values, '-labels' => \%labels)) . qq| |; - + } + + %labels = (); + @values = (); + my $i = 0; + 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_id', '-default' => $form->{"employee_id"}, + '-values' => \@values, '-labels' => \%labels)) . qq| + + |; + + %labels = (); + @values = (); + my $i = 0; + foreach my $item (@{ $form->{"ALL_VENDORS"} }) { + push(@values, $item->{name}.qq|--|.$item->{"id"}); + $labels{$item->{"id"}} = $item->{"name"}.qq|--|.$item->{"id"}; + } + my $vendors = qq| + | . $locale->text('Vendor') . qq| + | . + NTI($cgi->popup_menu('-name' => 'vendor', '-default' => $form->{"vendor"}, + '-onChange' => 'document.getElementById(\'update_button\').click();', + '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')) . qq| + + |; + %labels = (); @values = (); foreach my $item (@{ $form->{"ALL_TAXZONES"} }) { @@ -329,7 +375,7 @@ sub form_header { | . $locale->text('Steuersatz') . qq| | . NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"}, - '-values' => \@values, '-labels' => \%labels)) . qq| + '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')) . qq| |; @@ -344,19 +390,11 @@ sub form_header { |; } - $vendor = - ($form->{selectvendor}) - ? qq|\n| - : qq||; - $department = qq| | . $locale->text('Department') . qq| - - + + | if $form->{selectdepartment}; @@ -364,37 +402,28 @@ onchange="document.getElementById('update_button').click();">| . $n = ($form->{creditremaining} =~ /-/) ? "0" : "1"; # use JavaScript Calendar or not - $form->{jsscript} = $form->{jscalendar}; + $form->{jsscript} = 1; $jsscript = ""; - if ($form->{jsscript}) { - - # with JavaScript Calendar - $button1 = qq| - - text('button') . qq|> - |; - $button2 = qq| - - text('button') . qq|> - |; - #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "2", "invdate", "BL", "trigger1", - "duedate", "BL", "trigger2"); - } else { + $button1 = qq| + + text('button') . qq|> + |; + $button2 = qq| + + text('button') . qq|> + |; - # without JavaScript Calendar - $button1 = - qq||; - $button2 = - qq||; - } + #write Trigger + $jsscript = + Form->write_trigger(\%myconfig, "2", "invdate", "BL", "trigger1", + "duedate", "BL", "trigger2"); $form->{"javascript"} .= qq||; $form->{"javascript"} .= qq||; + $form->{javascript} .= qq||; $jsscript .= $form->write_trigger(\%myconfig, 2, @@ -409,65 +438,35 @@ onchange="document.getElementById('update_button').click();">| .
{script}> +|; -{id}> - - -{type}> -{level}> - -{creditlimit}> -{creditremaining}> + $form->hide_form(qw(id title vc type level creditlimit creditremaining + closedto locked shippted storno storno_id + max_dunning_level dunning_amount)); -{closedto}> -{locked}> + print qq|

$form->{saved_message}

| if $form->{saved_message}; -{shipped}> -{storno}> -{storno_id}> + print qq| -| . ($form->{saved_message} ? qq|

$form->{saved_message}

| : "") . qq| +
$form->{title}
- - - - -
$form->{title}
- - -
+ + $vendors + + + + $contact + + + + - - - - - - - {vendor_id}> - - - - - - - - - - + + + $taxzone $department @@ -479,7 +478,8 @@ onchange="document.getElementById('update_button').click();">| .
| . $locale->text('Credit Limit') . qq|$form->{creditlimit}; | . $locale->text('Remaining') . qq| $form->{creditremaining}
| . $locale->text('Vendor') . qq|$vendor| - . $locale->text('Contact Person') . qq|$contact
- - - - - - - - -
| . $locale->text('Credit Limit') . qq|$form->{creditlimit}| . $locale->text('Remaining') . qq|$form->{creditremaining}
-
| . $locale->text('Record in') . qq|| . $locale->text('Record in') . qq|
- + $employees + @@ -498,13 +498,13 @@ onchange="document.getElementById('update_button').click();">| . - - + - - + @@ -662,7 +662,7 @@ sub form_footer {
| . $locale->text('Invoice Number') . qq|
| . $locale->text('Order Date') . qq| +
| . $locale->text('Quotation Date') . qq| +
| . $locale->text('Project Number') . qq|
$subtotal $tax - 0 + @@ -701,9 +701,6 @@ sub form_footer { print $webdav_list; } print qq| -{jscalendar}> -|; - print qq|
| . $locale->text('Total') . qq| $form->{invtotal}
@@ -805,6 +802,10 @@ sub form_footer { $invdate = $form->datetonum($form->{invdate}, \%myconfig); $closedto = $form->datetonum($form->{closedto}, \%myconfig); + print qq| +|; + if ($form->{id}) { my $show_storno = !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ap"); @@ -826,9 +827,6 @@ sub form_footer { } - print qq||; - if (!$form->{id} && ($invdate > $closedto)) { print qq| | . @@ -988,9 +986,14 @@ sub storno { $form->error($locale->text("Invoice has already been storno'd!")); } + my $employee_id = $form->{employee_id}; invoice_links(); prepare_invoice(); relink_accounts(); + + # Payments must not be recorded for the new storno invoice. + $form->{paidaccounts} = 0; + map { my $key = $_; delete $form->{$key} if grep { $key =~ /^$_/ } qw(datepaid_ source_ memo_ paid_ exchangerate_ AR_paid_) } keys %{ $form }; # saving the history if(!exists $form->{addition} && $form->{id} ne "") { @@ -1005,7 +1008,8 @@ sub storno { $form->{id} = ""; $form->{invnumber} = "Storno zu " . $form->{invnumber}; $form->{rowcount}++; - &post(); + $form->{employee_id} = $employee_id; + post(); $lxdebug->leave_sub(); } @@ -1068,6 +1072,9 @@ sub post { $form->isblank("invdate", $locale->text('Invoice Date missing!')); $form->isblank("vendor", $locale->text('Vendor missing!')); + $form->{invnumber} =~ s/^\s*//g; + $form->{invnumber} =~ s/\s*$//g; + # if the vendor changed get new values if (&check_name(vendor)) { &update;