Revision 9cb9a448
Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
: $::form->{type} eq sales_order_type() ? purchase_order_type()
|
||
: '';
|
||
|
||
# check for direct delivery
|
||
# copy shipto in custom shipto (custom shipto will be copied by new_from() in case)
|
||
my $custom_shipto;
|
||
if ( $::form->{type} eq sales_order_type() && $destination_type eq purchase_order_type()
|
||
&& $::form->{use_shipto} && $self->order->shipto) {
|
||
$custom_shipto = $self->order->shipto->clone('SL::DB::Order');
|
||
}
|
||
|
||
$self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type));
|
||
$self->{converted_from_oe_id} = delete $::form->{id};
|
||
|
||
... | ... | |
$item->{new_fake_id} = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
|
||
}
|
||
|
||
if ($::form->{type} eq sales_order_type() && $destination_type eq purchase_order_type()) {
|
||
if ($::form->{use_shipto}) {
|
||
$self->order->custom_shipto($custom_shipto) if $custom_shipto;
|
||
} else {
|
||
# remove any custom shipto if not wanted
|
||
$self->order->custom_shipto(SL::DB::Shipto->new(module => 'OE', custom_variables => []));
|
||
}
|
||
}
|
||
|
||
# change form type
|
||
$::form->{type} = $destination_type;
|
||
$self->type($self->init_type);
|
||
... | ... | |
],
|
||
action => [
|
||
t8('Save and Purchase Order'),
|
||
submit => [ '#order_form', { action => "Order/purchase_order" } ],
|
||
only_if => (any { $self->type eq $_ } (sales_order_type(), request_quotation_type())),
|
||
call => [ 'kivi.Order.purchase_order_check_for_direct_delivery' ],
|
||
only_if => (any { $self->type eq $_ } (sales_order_type(), request_quotation_type())),
|
||
],
|
||
action => [
|
||
t8('Save and Delivery Order'),
|
js/kivi.Order.js | ||
---|---|---|
kivi.SalesPurchase.edit_custom_shipto();
|
||
};
|
||
|
||
ns.purchase_order_check_for_direct_delivery = function() {
|
||
if ($('#type').val() != 'sales_order') {
|
||
kivi.submit_form_with_action($('#order_form'), 'Order/purchase_order');
|
||
}
|
||
|
||
var empty = true;
|
||
var shipto;
|
||
if ($('#order_shipto_id').val() !== '') {
|
||
empty = false;
|
||
shipto = $('#order_shipto_id option:selected').text();
|
||
} else {
|
||
$('#shipto_inputs [id^="shipto"]').each(function(idx, elt) {
|
||
if (!empty) return true;
|
||
if (/^shipto_to_copy/.test($(elt).prop('id'))) return true;
|
||
if (/^shiptocp_gender/.test($(elt).prop('id'))) return true;
|
||
if (/^shiptocvar_/.test($(elt).prop('id'))) return true;
|
||
if ($(elt).val() !== '') {
|
||
empty = false;
|
||
return false;
|
||
}
|
||
});
|
||
var shipto_elements = [];
|
||
$([$('#shiptoname').val(), $('#shiptostreet').val(), $('#shiptozipcode').val(), $('#shiptocity').val()]).each(function(idx, elt) {
|
||
if (elt !== '') shipto_elements.push(elt);
|
||
});
|
||
shipto = shipto_elements.join('; ');
|
||
}
|
||
|
||
var use_it = false;
|
||
if (!empty) {
|
||
ns.direct_delivery_dialog(shipto);
|
||
} else {
|
||
kivi.submit_form_with_action($('#order_form'), 'Order/purchase_order');
|
||
}
|
||
};
|
||
|
||
ns.direct_delivery_callback = function(accepted) {
|
||
$('#direct-delivery-dialog').dialog('close');
|
||
|
||
if (accepted) {
|
||
$('<input type="hidden" name="use_shipto">').appendTo('#order_form').val('1');
|
||
}
|
||
|
||
kivi.submit_form_with_action($('#order_form'), 'Order/purchase_order');
|
||
};
|
||
|
||
ns.direct_delivery_dialog = function(shipto) {
|
||
$('#direct-delivery-dialog').remove();
|
||
|
||
var text1 = kivi.t8('You have entered or selected the following shipping address for this customer:');
|
||
var text2 = kivi.t8('Do you want to carry this shipping address over to the new purchase order so that the vendor can deliver the goods directly to your customer?');
|
||
var html = '<div id="direct-delivery-dialog"><p>' + text1 + '</p><p>' + shipto + '</p><p>' + text2 + '</p>';
|
||
html = html + '<hr><p>';
|
||
html = html + '<input type="button" value="' + kivi.t8('Yes') + '" size="30" onclick="kivi.Order.direct_delivery_callback(true)">';
|
||
html = html + ' ';
|
||
html = html + '<input type="button" value="' + kivi.t8('No') + '" size="30" onclick="kivi.Order.direct_delivery_callback(false)">';
|
||
html = html + '</p></div>';
|
||
$(html).hide().appendTo('#order_form');
|
||
|
||
kivi.popup_dialog({id: 'direct-delivery-dialog',
|
||
dialog: {title: kivi.t8('Carry over shipping address'),
|
||
height: 300,
|
||
width: 500 }});
|
||
};
|
||
|
||
});
|
||
|
||
$(function() {
|
js/locale/de.js | ||
---|---|---|
"Assign invoice":"Rechnung zuweisen",
|
||
"Basic settings actions":"Aktionen zu Grundeinstellungen",
|
||
"Cancel":"Abbrechen",
|
||
"Carry over shipping address":"Lieferadresse übernehmen",
|
||
"Chart picker":"Kontenauswahl",
|
||
"Copy":"Kopieren",
|
||
"Copy requirement spec":"Pflichtenheft kopieren",
|
||
... | ... | |
"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 carry this shipping address over to the new purchase order so that the vendor can deliver the goods directly to your customer?":"Möchten Sie diese Lieferadresse in den neuen Lieferantenauftrag übernehmen, damit der Händler die Waren direkt an Ihren Kunden liefern kann?",
|
||
"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",
|
||
"Due Date missing!":"Fälligkeitsdatum fehlt!",
|
||
... | ... | |
"Wrong time format (#1)":"Falsches Zeitformat (#1)",
|
||
"Yes":"Ja",
|
||
"You have changed the currency or exchange rate. Please check prices.":"Die Währung oder der Wechselkurs hat sich geändert. Bitte überprüfen Sie die Preise.",
|
||
"You have entered or selected the following shipping address for this customer:":"Sie haben die folgende Lieferadresse eingegeben oder ausgewählt:",
|
||
"filename has not uploadable characters ":"Bitte Dateinamen ändern. Er hat für den Upload nicht verwendbare Sonderzeichen ",
|
||
"filesize too big: ":"Datei zu groß: ",
|
||
"flat-rate position":"Pauschalposition",
|
js/locale/en.js | ||
---|---|---|
"Assign invoice":"",
|
||
"Basic settings actions":"",
|
||
"Cancel":"",
|
||
"Carry over shipping address":"",
|
||
"Chart picker":"",
|
||
"Copy":"",
|
||
"Copy requirement spec":"",
|
||
... | ... | |
"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 carry this shipping address over to the new purchase order so that the vendor can deliver the goods directly to your customer?":"",
|
||
"Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?":"",
|
||
"Download picture":"",
|
||
"Due Date missing!":"",
|
||
... | ... | |
"Wrong time format (#1)":"",
|
||
"Yes":"",
|
||
"You have changed the currency or exchange rate. Please check prices.":"",
|
||
"You have entered or selected the following shipping address for this customer:":"",
|
||
"filename has not uploadable characters ":"",
|
||
"filesize too big: ":"",
|
||
"flat-rate position":"",
|
Auch abrufbar als: Unified diff
Auftrags-Controller: Workflow VK->EK: Lieferadresse für direkte Lieferung
Falls beim Workflow Kundenauftrag->Lieferantenauftrag eine Lieferadresse
ausgewählt oder eine indiv. Lieferadresse eingetragen ist, wir gefragt,
ob diese Lieferadresse als (indiv.) Lieferadresse in den Lieferantenauftrag
übernommen werden soll.