sub action_print {
my ($self) = @_;
+ my $errors = $self->save();
+
+ if (scalar @{ $errors }) {
+ $self->js->flash('error', $_) foreach @{ $errors };
+ return $self->js->render();
+ }
+
+ $self->js->val('#id', $self->order->id)
+ ->val('#order_' . $self->nr_key(), $self->order->number);
+
my $format = $::form->{print_options}->{format};
my $media = $::form->{print_options}->{media};
my $formname = $::form->{print_options}->{formname};
sub action_send_email {
my ($self) = @_;
+ my $errors = $self->save();
+
+ if (scalar @{ $errors }) {
+ $self->js->run('kivi.Order.close_email_dialog');
+ $self->js->flash('error', $_) foreach @{ $errors };
+ return $self->js->render();
+ }
+
+ $self->js->val('#id', $self->order->id)
+ ->val('#order_' . $self->nr_key(), $self->order->number);
+
my $email_form = delete $::form->{email_form};
my %field_names = (to => 'email');
$intnotes .= t8('Subject') . ": " . $::form->{subject} . "\n\n";
$intnotes .= t8('Message') . ": " . $::form->{message};
+ $self->order->update_attributes(intnotes => $intnotes);
+
$self->js
->val('#order_intnotes', $intnotes)
->run('kivi.Order.close_email_dialog')
t8('Export'),
],
action => [
- t8('Print'),
- call => [ 'kivi.Order.show_print_options' ],
+ t8('Save and print'),
+ call => [ 'kivi.Order.show_print_options', $::instance_conf->get_order_warn_duplicate_parts ],
],
action => [
- t8('E-mail'),
- call => [ 'kivi.Order.email' ],
+ t8('Save and E-mail'),
+ call => [ 'kivi.Order.email', $::instance_conf->get_order_warn_duplicate_parts ],
],
action => [
t8('Download attachments of all parts'),
=item *
-Save order only on "save" (and "save and delivery order"-workflow). No
-hidden save on "print" or "email".
-
-=item *
-
Item list in a scrollable area, so that the workflow buttons stay at
the bottom.
return true;
};
- ns.check_save_duplicate_parts = function() {
+ ns.check_duplicate_parts = function(question) {
var id_arr = $('[name="order.orderitems[].parts_id"]').map(function() { return this.value; }).get();
var i, obj = {}, pos = [];
}
if (pos.length > 0) {
+ question = question || kivi.t8("Do you really want to save?");
return confirm(kivi.t8("There are duplicate parts at positions") + "\n"
+ pos.join(', ') + "\n"
- + kivi.t8("Do you really want to save?"));
+ + question);
}
return true;
};
ns.save = function(action, warn_on_duplicates, warn_on_reqdate) {
if (!ns.check_cv()) return;
- if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return;
- if (warn_on_reqdate && !ns.check_valid_reqdate()) return;
+ if (warn_on_duplicates && !ns.check_duplicate_parts()) return;
+ if (warn_on_reqdate && !ns.check_valid_reqdate()) return;
var data = $('#order_form').serializeArray();
data.push({ name: 'action', value: 'Order/' + action });
$.post("controller.pl", data, kivi.eval_json_result);
};
- ns.show_print_options = function() {
+ ns.show_print_options = function(warn_on_duplicates) {
if (!ns.check_cv()) return;
+ if (warn_on_duplicates && !ns.check_duplicate_parts(kivi.t8("Do you really want to print?"))) return;
kivi.popup_dialog({
id: 'print_options',
$.download("controller.pl", data);
};
- ns.email = function() {
+ ns.email = function(warn_on_duplicates) {
+ if (warn_on_duplicates && !ns.check_duplicate_parts(kivi.t8("Do you really want to send by mail?"))) return;
if (!ns.check_cv()) return;
+
var data = $('#order_form').serializeArray();
data.push({ name: 'action', value: 'Order/show_email_dialog' });
"Do you really want to delete the selected documents?":"Möchten Sie wirklich diese Dateien löschen?",
"Do you really want to delete this draft?":"Möchten Sie diesen Entwurf wirklich löschen?",
"Do you really want to delete this record template?":"Möchten Sie diese Belegvorlage wirklich löschen?",
+"Do you really want to print?":"Wollen Sie wirklich drucken?",
"Do you really want to revert to this version?":"Möchten Sie wirklich auf diese Version zurücksetzen?",
"Do you really want to save?":"Möchten Sie wirklich speichern?",
+"Do you really want to send by mail?":"Wollen Sie den Beleg wirklich per Mail verschicken?",
"Do you really want to unimport the selected documents?":"Möchten Sie wirklich diese Dateien an die Quelle zurückgeben?",
"Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?":"Soll die Kontonummer \"#1\" zu \"#2\" und den Name \"#3\" zu \"#4\" geändert werden?",
"Download picture":"Bild herunterladen",
"Do you really want to delete the selected documents?":"",
"Do you really want to delete this draft?":"",
"Do you really want to delete this record template?":"",
+"Do you really want to print?":"",
"Do you really want to revert to this version?":"",
"Do you really want to save?":"",
+"Do you really want to send by mail?":"",
"Do you really want to unimport the selected documents?":"",
"Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?":"",
"Download picture":"",
'Do you really want to delete this draft?' => 'Möchten Sie diesen Entwurf wirklich löschen?',
'Do you really want to delete this object?' => 'Möchten Sie dieses Objekt wirklich löschen?',
'Do you really want to delete this record template?' => 'Möchten Sie diese Belegvorlage wirklich löschen?',
+ 'Do you really want to print?' => 'Wollen Sie wirklich drucken?',
'Do you really want to revert to this version?' => 'Möchten Sie wirklich auf diese Version zurücksetzen?',
'Do you really want to save?' => 'Möchten Sie wirklich speichern?',
+ 'Do you really want to send by mail?' => 'Wollen Sie den Beleg wirklich per Mail verschicken?',
'Do you really want to undo the selected SEPA exports? You have to reassign the export again.' => 'Möchten Sie wirklich die ausgewählten SEPA-Exports rückgängig machen? Der Export muss anschließend neu erzeugt werden.',
'Do you really want to unimport the selected documents?' => 'Möchten Sie wirklich diese Dateien an die Quelle zurückgeben?',
'Do you want to <b>limit</b> your search?' => 'Möchten Sie Ihre Suche <b>spezialisieren</b>?',
'Save and AR Transaction' => 'Speichern und Debitorenbuchung erfassen',
'Save and Close' => 'Speichern und schließen',
'Save and Delivery Order' => 'Speichern und Lieferschein',
+ 'Save and E-mail' => 'Speichern und E-Mail',
'Save and Invoice' => 'Speichern und Rechnung erfassen',
'Save and Order' => 'Speichern und Auftrag erfassen',
'Save and Quotation' => 'Speichern und Angebot',
'Save and close' => 'Speichern und schließen',
'Save and execute' => 'Speichern und ausführen',
'Save and keep open' => 'Speichern und geöffnet lassen',
+ 'Save and print' => 'Speichern und drucken',
'Save as a new draft.' => 'Als neuen Entwurf speichern',
'Save as new' => 'Als neu speichern',
'Save document in WebDAV repository' => 'Dokument in WebDAV-Ablage speichern',
'Do you really want to delete this draft?' => '',
'Do you really want to delete this object?' => '',
'Do you really want to delete this record template?' => '',
+ 'Do you really want to print?' => '',
'Do you really want to revert to this version?' => '',
'Do you really want to save?' => '',
+ 'Do you really want to send by mail?' => '',
'Do you really want to undo the selected SEPA exports? You have to reassign the export again.' => '',
'Do you really want to unimport the selected documents?' => '',
'Do you want to <b>limit</b> your search?' => '',
'Save and AR Transaction' => '',
'Save and Close' => '',
'Save and Delivery Order' => '',
+ 'Save and E-mail' => '',
'Save and Invoice' => '',
'Save and Order' => '',
'Save and Quotation' => '',
'Save and close' => '',
'Save and execute' => '',
'Save and keep open' => '',
+ 'Save and print' => '',
'Save as a new draft.' => '',
'Save as new' => '',
'Save document in WebDAV repository' => '',