Skip to content

Commit

Permalink
FIX #11460 FIX #11492 FIX #11576 FIX #11590
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 30, 2019
1 parent 5b1a89b commit a871aa8
Showing 1 changed file with 36 additions and 14 deletions.
50 changes: 36 additions & 14 deletions htdocs/core/tpl/objectline_create.tpl.php
Expand Up @@ -255,6 +255,25 @@
{
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, '', GETPOST('combinations', 'array'));
}

if (empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_CUSTOMER_PRODUCTS))
{
?>
<script type="text/javascript">
$(document).ready(function(){
// On first focus on a select2 combo, auto open the menu (this allow to use the keyboard only)
$(document).on('focus', '.select2-selection.select2-selection--single', function (e) {
console.log('focus on a select2');
if ($(this).attr('aria-labelledby') == 'select2-idprod-container')
{
console.log('open combo');
$('#idprod').select2('open');
}
});
});
</script>
<?php
}
}
else
{
Expand All @@ -277,21 +296,24 @@
}

$form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice, 'maxwidth300');
?>
<script type="text/javascript">

$(document).ready(function(){

$(document).on('keypress',function(e) {
if ($('input:focus').length == 0) {
$('#idprodfournprice').select2('open');
}
});


});
</script>
<?php
if (empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_SUPPLIER_PRODUCTS))
{
?>
<script type="text/javascript">
$(document).ready(function(){
// On first focus on a select2 combo, auto open the menu (this allow to use the keyboard only)
$(document).on('focus', '.select2-selection.select2-selection--single', function (e) {
//console.log('focus on a select2');
if ($(this).attr('aria-labelledby') == 'select2-idprodfournprice-container')
{
$('#idprodfournprice').select2('open');
}
});
});
</script>
<?php
}
}
echo '<input type="hidden" name="pbq" id="pbq" value="">';
echo '</span>';
Expand Down

0 comments on commit a871aa8

Please sign in to comment.