X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fir.pl;h=d72ca7ed852868aa8f7bbb34edbfeeab35a04d57;hb=644c68bae03521cec693800af0a19b9ab4e0ed9c;hp=de2625f96a5409e02501e515d9b8925867b6c06b;hpb=ea274593a0c4b6ffbeb88882cd53fd22c9e480e0;p=kivitendo-erp.git
diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl
index de2625f96..d72ca7ed8 100644
--- a/bin/mozilla/ir.pl
+++ b/bin/mozilla/ir.pl
@@ -32,11 +32,13 @@
#======================================================================
use SL::IR;
+use SL::IS;
use SL::PE;
require "$form->{path}/io.pl";
require "$form->{path}/arap.pl";
require "$form->{path}/common.pl";
+require "bin/mozilla/drafts.pl";
1;
@@ -45,6 +47,8 @@ require "$form->{path}/common.pl";
sub add {
$lxdebug->enter_sub();
+ return $lxdebug->leave_sub() if (load_draft_maybe());
+
$form->{title} = $locale->text('Add Vendor Invoice');
&invoice_links;
@@ -399,6 +403,8 @@ sub form_header {
{storno}>
{storno_id}>
+| . ($form->{saved_message} ? qq|
$form->{saved_message}
| : "") . qq|
+
$form->{title} |
@@ -554,7 +560,7 @@ sub form_footer {
$tax .= qq|
$form->{"${item}_description"} |
- . $form->{"${item}_rate"} * 100 .qq|% |
+ . $form->{"${item}_rate"} * 100 .qq|%
$form->{"${item}_total"} |
|;
@@ -596,7 +602,7 @@ sub form_footer {
$tax .= qq|
Enthaltene $form->{"${item}_description"} |
- . $form->{"${item}_rate"} * 100 .qq|% |
+ . $form->{"${item}_rate"} * 100 .qq|%
$form->{"${item}_total"} |
@@ -780,12 +786,14 @@ sub form_footer {
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
if ($form->{id}) {
+ my $show_storno = !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ap");
+
print qq|
|;
print qq|
-| unless ($form->{storno});
+| if ($show_storno);
if ($form->{radier}) {
print qq|
text('Post') . qq|">|;
+ . $locale->text('Post') . qq|"> | .
+ NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'),
+ '-class' => 'submit'));
}
print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
@@ -816,15 +826,18 @@ sub form_footer {
{path}>
{login}>
{password}>
-|;
+|
+ . $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}])
+ . $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]);
+
# button for saving history
if($form->{id} ne "") {
print qq|
- {id}
- . qq|); name=history id=history value=|
- . $locale->text('history')
- . qq|>|;
+ |;
}
# /button for saving history
@@ -871,7 +884,7 @@ sub update {
}
$i = $form->{rowcount};
- $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
+ $exchangerate = ($form->{exchangerate} * 1) ? $form->{exchangerate} * 1 : 1;
if ( ($form->{"partnumber_$i"} eq "")
&& ($form->{"description_$i"} eq "")
@@ -962,6 +975,14 @@ sub storno {
$form->error($locale->text('Cannot storno storno invoice!'));
}
+ if (IS->has_storno(\%myconfig, $form, "ap")) {
+ $form->error($locale->text("Invoice has already been storno'd!"));
+ }
+
+ invoice_links();
+ prepare_invoice();
+ relink_accounts();
+
$form->{storno_id} = $form->{id};
$form->{storno} = 1;
$form->{id} = "";
@@ -1070,7 +1091,7 @@ sub post {
relink_accounts();
- if (IR->post_invoice(\%myconfig, \%$form)){
+ if (IR->post_invoice(\%myconfig, \%$form)){
# saving the history
if(!exists $form->{addition} && $form->{id} ne "") {
$form->{addition} = "POSTED";
@@ -1078,6 +1099,7 @@ sub post {
$form->save_history($form->dbconnect(\%myconfig));
}
# /saving the history
+ remove_draft() if $form->{remove_draft};
$form->redirect( $locale->text('Invoice')
. " $form->{invnumber} "
. $locale->text('posted!'));