projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Form->show_generic_error: Parameter action, back_button entfernt
[kivitendo-erp.git]
/
js
/
autocomplete_part.js
diff --git
a/js/autocomplete_part.js
b/js/autocomplete_part.js
index
cbce72c
..
cae7f01
100644
(file)
--- a/
js/autocomplete_part.js
+++ b/
js/autocomplete_part.js
@@
-1,4
+1,6
@@
namespace('kivi', function(k){
namespace('kivi', function(k){
+ "use strict";
+
k.PartPicker = function($real, options) {
// short circuit in case someone double inits us
if ($real.data("part_picker"))
k.PartPicker = function($real, options) {
// short circuit in case someone double inits us
if ($real.data("part_picker"))
@@
-12,6
+14,9
@@
namespace('kivi', function(k){
RIGHT: 39,
PAGE_UP: 33,
PAGE_DOWN: 34,
RIGHT: 39,
PAGE_UP: 33,
PAGE_DOWN: 34,
+ SHIFT: 16,
+ CTRL: 17,
+ ALT: 18,
};
var CLASSES = {
PICKED: 'partpicker-picked',
};
var CLASSES = {
PICKED: 'partpicker-picked',
@@
-88,7
+93,6
@@
namespace('kivi', function(k){
state = STATES.PICKED;
last_real = $real.val();
last_dummy = $dummy.val();
state = STATES.PICKED;
last_real = $real.val();
last_dummy = $dummy.val();
- last_unverified_dummy = $dummy.val();
$real.trigger('change');
if (o.fat_set_item && item.id) {
$real.trigger('change');
if (o.fat_set_item && item.id) {
@@
-109,10
+113,9
@@
namespace('kivi', function(k){
if (state == STATES.PICKED) {
annotate_state();
return true
if (state == STATES.PICKED) {
annotate_state();
return true
- } else if (state == STATES.UNDEFINED && $dummy.val() == '')
+ } else if (state == STATES.UNDEFINED && $dummy.val() ==
=
'')
set_item({})
else {
set_item({})
else {
- last_unverified_dummy = $dummy.val();
set_item({ id: last_real, name: last_dummy })
}
annotate_state();
set_item({ id: last_real, name: last_dummy })
}
annotate_state();
@@
-121,10
+124,9
@@
namespace('kivi', function(k){
function annotate_state () {
if (state == STATES.PICKED)
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED);
function annotate_state () {
if (state == STATES.PICKED)
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED);
- else if (state == STATES.UNDEFINED && $dummy.val() == '')
+ else if (state == STATES.UNDEFINED && $dummy.val() ==
=
'')
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED);
else {
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED);
else {
- last_unverified_dummy = $dummy.val();
$dummy.addClass(STATES.UNDEFINED).removeClass(STATES.PICKED);
}
}
$dummy.addClass(STATES.UNDEFINED).removeClass(STATES.PICKED);
}
}
@@
-137,7
+139,7
@@
namespace('kivi', function(k){
}, ajax_data(function(){ var val = $('#part_picker_filter').val(); return val === undefined ? '' : val })),
success: function(data){ $('#part_picker_result').html(data) }
});
}, ajax_data(function(){ var val = $('#part_picker_filter').val(); return val === undefined ? '' : val })),
success: function(data){ $('#part_picker_result').html(data) }
});
- }
;
+ }
function result_timer (event) {
if (!$('no_paginate').prop('checked')) {
function result_timer (event) {
if (!$('no_paginate').prop('checked')) {
@@
-156,7
+158,7
@@
namespace('kivi', function(k){
function close_popup() {
$('#part_selection').dialog('close');
function close_popup() {
$('#part_selection').dialog('close');
- }
;
+ }
function handle_changed_text(callbacks) {
$.ajax({
function handle_changed_text(callbacks) {
$.ajax({
@@
-177,7
+179,7
@@
namespace('kivi', function(k){
annotate_state();
}
});
annotate_state();
}
});
- }
;
+ }
$dummy.autocomplete({
source: function(req, rsp) {
$dummy.autocomplete({
source: function(req, rsp) {
@@
-191,6
+193,10
@@
namespace('kivi', function(k){
select: function(event, ui) {
set_item(ui.item);
},
select: function(event, ui) {
set_item(ui.item);
},
+ search: function(event, ui) {
+ if ((event.which == KEY.SHIFT) || (event.which == KEY.CTRL) || (event.which == KEY.ALT))
+ event.preventDefault();
+ }
});
/* In case users are impatient and want to skip ahead:
* Capture <enter> key events and check if it's a unique hit.
});
/* In case users are impatient and want to skip ahead:
* Capture <enter> key events and check if it's a unique hit.
@@
-207,7
+213,7
@@
namespace('kivi', function(k){
$dummy.keydown(function(event){
if (event.which == KEY.ENTER || event.which == KEY.TAB) {
// if string is empty assume they want to delete
$dummy.keydown(function(event){
if (event.which == KEY.ENTER || event.which == KEY.TAB) {
// if string is empty assume they want to delete
- if ($dummy.val() == '') {
+ if ($dummy.val() ==
=
'') {
set_item({});
return true;
} else if (state == STATES.PICKED) {
set_item({});
return true;
} else if (state == STATES.PICKED) {
@@
-224,7
+230,7
@@
namespace('kivi', function(k){
});
return false;
}
});
return false;
}
- } else {
+ } else
if ((event.which != KEY.SHIFT) && (event.which != KEY.CTRL) && (event.which != KEY.ALT))
{
state = STATES.UNDEFINED;
}
});
state = STATES.UNDEFINED;
}
});