Revision 9cb9a448
Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
1692 | 1692 |
: $::form->{type} eq sales_order_type() ? purchase_order_type() |
1693 | 1693 |
: ''; |
1694 | 1694 |
|
1695 |
# check for direct delivery |
|
1696 |
# copy shipto in custom shipto (custom shipto will be copied by new_from() in case) |
|
1697 |
my $custom_shipto; |
|
1698 |
if ( $::form->{type} eq sales_order_type() && $destination_type eq purchase_order_type() |
|
1699 |
&& $::form->{use_shipto} && $self->order->shipto) { |
|
1700 |
$custom_shipto = $self->order->shipto->clone('SL::DB::Order'); |
|
1701 |
} |
|
1702 |
|
|
1695 | 1703 |
$self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type)); |
1696 | 1704 |
$self->{converted_from_oe_id} = delete $::form->{id}; |
1697 | 1705 |
|
... | ... | |
1700 | 1708 |
$item->{new_fake_id} = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000); |
1701 | 1709 |
} |
1702 | 1710 |
|
1711 |
if ($::form->{type} eq sales_order_type() && $destination_type eq purchase_order_type()) { |
|
1712 |
if ($::form->{use_shipto}) { |
|
1713 |
$self->order->custom_shipto($custom_shipto) if $custom_shipto; |
|
1714 |
} else { |
|
1715 |
# remove any custom shipto if not wanted |
|
1716 |
$self->order->custom_shipto(SL::DB::Shipto->new(module => 'OE', custom_variables => [])); |
|
1717 |
} |
|
1718 |
} |
|
1719 |
|
|
1703 | 1720 |
# change form type |
1704 | 1721 |
$::form->{type} = $destination_type; |
1705 | 1722 |
$self->type($self->init_type); |
... | ... | |
1825 | 1842 |
], |
1826 | 1843 |
action => [ |
1827 | 1844 |
t8('Save and Purchase Order'), |
1828 |
submit => [ '#order_form', { action => "Order/purchase_order" } ],
|
|
1829 |
only_if => (any { $self->type eq $_ } (sales_order_type(), request_quotation_type())), |
|
1845 |
call => [ 'kivi.Order.purchase_order_check_for_direct_delivery' ],
|
|
1846 |
only_if => (any { $self->type eq $_ } (sales_order_type(), request_quotation_type())),
|
|
1830 | 1847 |
], |
1831 | 1848 |
action => [ |
1832 | 1849 |
t8('Save and Delivery Order'), |
js/kivi.Order.js | ||
---|---|---|
852 | 852 |
kivi.SalesPurchase.edit_custom_shipto(); |
853 | 853 |
}; |
854 | 854 |
|
855 |
ns.purchase_order_check_for_direct_delivery = function() { |
|
856 |
if ($('#type').val() != 'sales_order') { |
|
857 |
kivi.submit_form_with_action($('#order_form'), 'Order/purchase_order'); |
|
858 |
} |
|
859 |
|
|
860 |
var empty = true; |
|
861 |
var shipto; |
|
862 |
if ($('#order_shipto_id').val() !== '') { |
|
863 |
empty = false; |
|
864 |
shipto = $('#order_shipto_id option:selected').text(); |
|
865 |
} else { |
|
866 |
$('#shipto_inputs [id^="shipto"]').each(function(idx, elt) { |
|
867 |
if (!empty) return true; |
|
868 |
if (/^shipto_to_copy/.test($(elt).prop('id'))) return true; |
|
869 |
if (/^shiptocp_gender/.test($(elt).prop('id'))) return true; |
|
870 |
if (/^shiptocvar_/.test($(elt).prop('id'))) return true; |
|
871 |
if ($(elt).val() !== '') { |
|
872 |
empty = false; |
|
873 |
return false; |
|
874 |
} |
|
875 |
}); |
|
876 |
var shipto_elements = []; |
|
877 |
$([$('#shiptoname').val(), $('#shiptostreet').val(), $('#shiptozipcode').val(), $('#shiptocity').val()]).each(function(idx, elt) { |
|
878 |
if (elt !== '') shipto_elements.push(elt); |
|
879 |
}); |
|
880 |
shipto = shipto_elements.join('; '); |
|
881 |
} |
|
882 |
|
|
883 |
var use_it = false; |
|
884 |
if (!empty) { |
|
885 |
ns.direct_delivery_dialog(shipto); |
|
886 |
} else { |
|
887 |
kivi.submit_form_with_action($('#order_form'), 'Order/purchase_order'); |
|
888 |
} |
|
889 |
}; |
|
890 |
|
|
891 |
ns.direct_delivery_callback = function(accepted) { |
|
892 |
$('#direct-delivery-dialog').dialog('close'); |
|
893 |
|
|
894 |
if (accepted) { |
|
895 |
$('<input type="hidden" name="use_shipto">').appendTo('#order_form').val('1'); |
|
896 |
} |
|
897 |
|
|
898 |
kivi.submit_form_with_action($('#order_form'), 'Order/purchase_order'); |
|
899 |
}; |
|
900 |
|
|
901 |
ns.direct_delivery_dialog = function(shipto) { |
|
902 |
$('#direct-delivery-dialog').remove(); |
|
903 |
|
|
904 |
var text1 = kivi.t8('You have entered or selected the following shipping address for this customer:'); |
|
905 |
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?'); |
|
906 |
var html = '<div id="direct-delivery-dialog"><p>' + text1 + '</p><p>' + shipto + '</p><p>' + text2 + '</p>'; |
|
907 |
html = html + '<hr><p>'; |
|
908 |
html = html + '<input type="button" value="' + kivi.t8('Yes') + '" size="30" onclick="kivi.Order.direct_delivery_callback(true)">'; |
|
909 |
html = html + ' '; |
|
910 |
html = html + '<input type="button" value="' + kivi.t8('No') + '" size="30" onclick="kivi.Order.direct_delivery_callback(false)">'; |
|
911 |
html = html + '</p></div>'; |
|
912 |
$(html).hide().appendTo('#order_form'); |
|
913 |
|
|
914 |
kivi.popup_dialog({id: 'direct-delivery-dialog', |
|
915 |
dialog: {title: kivi.t8('Carry over shipping address'), |
|
916 |
height: 300, |
|
917 |
width: 500 }}); |
|
918 |
}; |
|
919 |
|
|
855 | 920 |
}); |
856 | 921 |
|
857 | 922 |
$(function() { |
js/locale/de.js | ||
---|---|---|
16 | 16 |
"Assign invoice":"Rechnung zuweisen", |
17 | 17 |
"Basic settings actions":"Aktionen zu Grundeinstellungen", |
18 | 18 |
"Cancel":"Abbrechen", |
19 |
"Carry over shipping address":"Lieferadresse übernehmen", |
|
19 | 20 |
"Chart picker":"Kontenauswahl", |
20 | 21 |
"Copy":"Kopieren", |
21 | 22 |
"Copy requirement spec":"Pflichtenheft kopieren", |
... | ... | |
48 | 49 |
"Do you really want to save?":"Möchten Sie wirklich speichern?", |
49 | 50 |
"Do you really want to send by mail?":"Wollen Sie den Beleg wirklich per Mail verschicken?", |
50 | 51 |
"Do you really want to unimport the selected documents?":"Möchten Sie wirklich diese Dateien an die Quelle zurückgeben?", |
52 |
"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?", |
|
51 | 53 |
"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?", |
52 | 54 |
"Download picture":"Bild herunterladen", |
53 | 55 |
"Due Date missing!":"Fälligkeitsdatum fehlt!", |
... | ... | |
144 | 146 |
"Wrong time format (#1)":"Falsches Zeitformat (#1)", |
145 | 147 |
"Yes":"Ja", |
146 | 148 |
"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.", |
149 |
"You have entered or selected the following shipping address for this customer:":"Sie haben die folgende Lieferadresse eingegeben oder ausgewählt:", |
|
147 | 150 |
"filename has not uploadable characters ":"Bitte Dateinamen ändern. Er hat für den Upload nicht verwendbare Sonderzeichen ", |
148 | 151 |
"filesize too big: ":"Datei zu groß: ", |
149 | 152 |
"flat-rate position":"Pauschalposition", |
js/locale/en.js | ||
---|---|---|
16 | 16 |
"Assign invoice":"", |
17 | 17 |
"Basic settings actions":"", |
18 | 18 |
"Cancel":"", |
19 |
"Carry over shipping address":"", |
|
19 | 20 |
"Chart picker":"", |
20 | 21 |
"Copy":"", |
21 | 22 |
"Copy requirement spec":"", |
... | ... | |
48 | 49 |
"Do you really want to save?":"", |
49 | 50 |
"Do you really want to send by mail?":"", |
50 | 51 |
"Do you really want to unimport the selected documents?":"", |
52 |
"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?":"", |
|
51 | 53 |
"Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?":"", |
52 | 54 |
"Download picture":"", |
53 | 55 |
"Due Date missing!":"", |
... | ... | |
144 | 146 |
"Wrong time format (#1)":"", |
145 | 147 |
"Yes":"", |
146 | 148 |
"You have changed the currency or exchange rate. Please check prices.":"", |
149 |
"You have entered or selected the following shipping address for this customer:":"", |
|
147 | 150 |
"filename has not uploadable characters ":"", |
148 | 151 |
"filesize too big: ":"", |
149 | 152 |
"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.