1 namespace('kivi.SalesPurchase', function(ns) {
2 this.edit_longdescription = function(row) {
3 var $edit = $('#popup_edit_longdescription_input');
4 var $element = $('#longdescription_' + row);
6 if (!$element.length) {
7 console.error("kivi.SalesPurchase.edit_longdescription: Element #longdescription_" + row + " not found");
11 $edit.data('element', $element);
12 $edit.val($element.val());
14 $('#popup_edit_longdescription_runningnumber').html(row);
15 $('#popup_edit_longdescription_partnumber').html($('#partnumber_' + row).val() || '');
17 var description = ($('#description_' + row).val() || '').replace(/[\n\r]+/, '');
18 if (description.length >= 50)
19 description = description.substring(0, 50) + "…";
20 $('#popup_edit_longdescription_description').html(description);
23 id: 'edit_longdescription_dialog',
25 title: kivi.t8('Enter longdescription'),
26 open: function() { kivi.set_focus('#popup_edit_longdescription_input'); }
31 this.set_longdescription = function() {
32 var $edit = $('#popup_edit_longdescription_input');
33 var $element = $edit.data('element');
35 $element.val($edit.val());
36 $('#edit_longdescription_dialog').dialog('close');
39 this.delivery_order_check_transfer_qty = function() {
41 var rowcount = $('input[name=rowcount]').val();
42 for (var i = 1; i < rowcount; i++)
43 if ($('#stock_in_out_qty_matches_' + i).val() != 1)
49 return confirm(kivi.t8('There are still transfers not matching the qty of the delivery order. Stock operations can not be changed later. Do you really want to proceed?'));
52 this.on_submit_checks = function() {
53 var $button = $(this);
54 if (($button.data('check-transfer-qty') == 1) && !kivi.SalesPurchase.delivery_order_check_transfer_qty())
60 this.init_on_submit_checks = function() {
61 $('input[type=submit]').click(kivi.SalesPurchase.on_submit_checks);