if ($taxzone_id) {
$form->{taxzone_id} = $taxzone_id;
}
- $form->{intnotes} = $intnotes;
+ $form->{intnotes} = $intnotes if $intnotes;
($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
$form->{"old$form->{vc}"} =
qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
}
$form->{"javascript"} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
-
+ # show history button js
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+ #/show history button js
$form->header;
print qq|
$tax .= qq|
<tr>
<th align=right>$form->{"${item}_description"} |
- . $form->{"${item}_rate"} * 100 .qq|%</th>
+ . $form->{"${item}_rate"} * 100 .qq|%</th>
<td align=right>$form->{"${item}_total"}</td>
</tr>
|;
$tax .= qq|
<tr>
<th align=right>Enthaltene $form->{"${item}_description"} |
- . $form->{"${item}_rate"} * 100 .qq|%</th>
+ . $form->{"${item}_rate"} * 100 .qq|%</th>
<td align=right>$form->{"${item}_total"}</td>
</tr>
<tr>
if (($form->{id})) {
print qq|
+ <input type="button" class="submit" onclick="set_history_window(|
+ . Q($form->{id})
+ . qq|);" name="history" id="history" value="|
+ . $locale->text('history')
+ . qq|">
+
<br>| . $locale->text("Workflow $form->{type}") . qq|<br>
<input class=submit type=submit name=action value="|
. $locale->text('Save as new') . qq|">
|;
}
+ $form->hide_form("saved_xyznumber");
+
print qq|
<input type=hidden name=rowcount value=$form->{rowcount}>
<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
-|;
-# button for saving history
-print qq|
- <input type=button class=submit onclick=set_history_window(|
- . $form->{id}
- . qq|); name=history id=history value=|
- . $locale->text('history')
- . qq|>|;
-# /button for saving history
-
-qq|
+
</form>
</body>
}
relink_accounts();
+
+ $form->error($err) if (!OE->save(\%myconfig, \%$form));
+
# saving the history
if(!exists $form->{addition}) {
$form->{addition} = "SAVED";
$form->save_history($form->dbconnect(\%myconfig));
}
- # /saving the history
+ # /saving the history
- $form->redirect(
- $form->{label} . " $form->{$ordnumber} " . $locale->text('saved!'))
- if (OE->save(\%myconfig, \%$form));
- $form->error($err);
+ $form->redirect($form->{label} . " $form->{$ordnumber} " .
+ $locale->text('saved!'));
$lxdebug->leave_sub();
}
unless $form->{$ordnumber};
relink_accounts();
+
+ OE->save(\%myconfig, \%$form);
+
# saving the history
if(!exists $form->{addition}) {
$form->{addition} = "SAVED";
}
# /saving the history
- OE->save(\%myconfig, \%$form);
$form->{simple_save} = 1;
if(!$form->{print_and_save}) {
set_headings("edit");
# these checks only apply if the items don't bring their own ordnumbers/transdates.
# The if clause ensures that by searching for empty ordnumber_#/transdate_# fields.
$form->isblank("ordnumber", $locale->text('Order Number missing!'))
- if (+{ map { $form->{"ordnumber_$_"}, 1 } (1 .. $form->{rowcount} - 1) }
- ->{''});
+ if (+{ map { $form->{"ordnumber_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''});
$form->isblank("transdate", $locale->text('Order Date missing!'))
- if (+{ map { $form->{"transdate_$_"}, 1 } (1 .. $form->{rowcount} - 1) }
- ->{''});
+ if (+{ map { $form->{"transdate_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''});
# also copy deliverydate from the order
$form->{deliverydate} = $form->{reqdate} if $form->{reqdate};
$form->{saveasnew} = 1;
$form->{closed} = 0;
- map { delete $form->{$_} } qw(printed emailed queued ordnumber quonumber);
+ map { delete $form->{$_} } qw(printed emailed queued);
+
+ # Let Lx-Office assign a new order number if the user hasn't changed the
+ # previous one. If it has been changed manually then use it as-is.
+ my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber";
+ if ($form->{saved_xyznumber} &&
+ ($form->{saved_xyznumber} eq $form->{$idx})) {
+ delete($form->{$idx});
+ }
&save;
$lxdebug->leave_sub();
}
+sub e_mail {
+ $lxdebug->enter_sub();
+
+ $form->{saveasnew} = 1;
+ $form->{closed} = 0;
+ $form->{print_and_save} = 1;
+ map { delete $form->{$_} } qw(printed emailed queued);
+
+ # Let Lx-Office assign a new order number if the user hasn't changed the
+ # previous one. If it has been changed manually then use it as-is.
+ my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber";
+ if ($form->{saved_xyznumber} &&
+ ($form->{saved_xyznumber} eq $form->{$idx})) {
+ delete($form->{$idx});
+ }
+
+ &save;
+
+ &edit_e_mail;
+
+ $lxdebug->leave_sub();
+}
+