Revision 9cb9a448
Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt
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() { |
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.