X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fir.pl;h=701c91bb4e45ba6d53640eb17c4b2dc9e4e0a973;hb=d6bf475aee947e7451eb9b797ed0ad5ab5bcf6f8;hp=159dc45e8941d0896c74b8453c3e777648f649ae;hpb=47916a374217afc8d84bd147f0fada5086970bae;p=kivitendo-erp.git diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 159dc45e8..701c91bb4 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"); @@ -124,13 +122,6 @@ sub invoice_links { $form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}"; - # vendors - if (@{ $form->{all_vendor} }) { - $form->{vendor} = "$form->{vendor}--$form->{vendor_id}"; - map { $form->{selectvendor} .= "$_->{name}--$_->{id}\n" } - (@{ $form->{all_vendor} }); - } - # departments if ($form->{all_departments}) { $form->{selectdepartment} = "\n"; @@ -229,15 +220,16 @@ sub form_header { 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->{radier} = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0; - #quote selectvendor Bug 133 - $form->{"selectvendor"} = $form->quote($form->{"selectvendor"}); - - #substitute \n and \r to \s (bug 543) - $form->{"selectvendor"} =~ s/[\n\r]/ /g; - $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate}); @@ -293,7 +285,7 @@ sub form_header { | . $locale->text('Contact Person') . qq| | . - NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, + NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px', '-labels' => \%labels, '-default' => $form->{"cp_id"})) . qq| @@ -347,20 +339,26 @@ sub form_header { '-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"}; + $labels{$item->{name}.qq|--|.$item->{"id"}} = $item->{"name"}; } + + $form->{selectvendor} = ($myconfig{vclimit} > scalar(@values)); + my $vendors = qq| | . $locale->text('Vendor') . qq| | . - NTI($cgi->popup_menu('-name' => 'vendor', '-default' => $form->{"vendor"}, + (($myconfig{vclimit} <= scalar(@values)) + ? qq|| + : (NTI($cgi->popup_menu('-name' => 'vendor', '-default' => $form->{oldvendor}, '-onChange' => 'document.getElementById(\'update_button\').click();', - '-values' => \@values, '-labels' => \%labels)) . qq| + '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq| + |; %labels = (); @@ -376,7 +374,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| |; @@ -394,7 +392,7 @@ sub form_header { $department = qq| | . $locale->text('Department') . qq| - $form->{selectdepartment} + $form->{selectdepartment} @@ -403,37 +401,28 @@ sub form_header { $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, @@ -448,24 +437,15 @@ sub form_header { {script}> +|; -{id}> - - -{type}> -{level}> - -{creditlimit}> -{creditremaining}> - -{closedto}> -{locked}> + $form->hide_form(qw(id title vc type level creditlimit creditremaining + closedto locked shippted storno storno_id + max_dunning_level dunning_amount)); -{shipped}> -{storno}> -{storno_id}> + print qq|$form->{saved_message}| if $form->{saved_message}; -| . ($form->{saved_message} ? qq|$form->{saved_message}| : "") . qq| + print qq| $form->{title} @@ -476,7 +456,7 @@ sub form_header { $vendors - + $contact | . $locale->text('Credit Limit') . qq| @@ -484,7 +464,7 @@ sub form_header { | . $locale->text('Record in') . qq| - $form->{selectAP} + $form->{selectAP} $taxzone @@ -720,9 +700,6 @@ sub form_footer { print $webdav_list; } print qq| -{jscalendar}> -|; - print qq| @@ -752,7 +729,9 @@ sub form_footer { |; - my @triggers = (); + my @triggers = (); + my $totalpaid = 0; + $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); for $i (1 .. $form->{paidaccounts}) { @@ -764,6 +743,8 @@ sub form_footer { $form->{"selectAP_paid_$i"} =~ s/option>\Q$form->{"AP_paid_$i"}\E/option selected>$form->{"AP_paid_$i"}/; + $totalpaid += $form->{"paid_$i"}; + # format amounts if ($form->{"paid_$i"}) { $form->{"paid_$i"} = @@ -807,7 +788,22 @@ sub form_footer { push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); } + my $paid_missing = $form->{oldinvtotal} - $totalpaid; + print qq| + + + + | . $locale->text('Total') . qq| + | . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq| + + + + + | . $locale->text('Missing amount') . qq| + | . H($form->format_amount(\%myconfig, $paid_missing, 2)) . qq| + + {oldinvtotal}> {paidaccounts}> @@ -869,7 +865,12 @@ sub form_footer { . qq|">|; } # /button for saving history - + # mark_as_paid button + if($form->{id} ne "") { + print qq||; + } + # /mark_as_paid button print qq| @@ -879,6 +880,12 @@ print qq| $lxdebug->leave_sub(); } +sub mark_as_paid { + $lxdebug->enter_sub(); + &mark_as_paid_common(\%myconfig,"ap"); + $lxdebug->leave_sub(); +} + sub update { $lxdebug->enter_sub(); @@ -1071,19 +1078,19 @@ sub post_payment { ($form->{AP}) = split /--/, $form->{AP}; ($form->{AP_paid}) = split /--/, $form->{AP_paid}; if (IR->post_payment(\%myconfig, \%$form)){ - - if(!exists $form->{addition} && $form->{id} ne "") { + if (!exists $form->{addition} && $form->{id} ne "") { # saving the history - $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "PAYMENT POSTED"; $form->{what_done} = $form->{currency} . qq| | . $form->{paid} . qq| | . $locale->text("POSTED"); $form->save_history($form->dbconnect(\%myconfig)); - # /saving the history - $form->redirect($locale->text(' Payment posted!')); + # /saving the history } + + $form->redirect($locale->text('Payment posted!')); } - $form->error($locale->text('Cannot post payment!')); + $form->error($locale->text('Cannot post payment!')); $lxdebug->leave_sub(); }
$form->{saved_message}