From 00118610bbb5f2cb32dc1992b51b67d4ec80134f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jul 2016 15:29:46 +0200 Subject: [PATCH] A fix to make editinplace working better --- htdocs/comm/propal/card.php | 4 ++-- htdocs/core/class/html.form.class.php | 12 ++++++------ htdocs/core/js/editinplace.js | 13 +++++++++++++ htdocs/core/tpl/objectline_create.tpl.php | 13 +++++++++---- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 2f040b4610d..56e001b355b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1836,9 +1836,9 @@ if ($action == 'create') // Delivery date $langs->load('deliveries'); print ''; - print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer); + print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer, 'datepicker'); print ''; - print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer, 'day'); + print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer, 'datepicker'); print ''; print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 11da96beb60..6601912b404 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -74,10 +74,10 @@ class Form * * @param string $text Text of label or key to translate * @param string $htmlname Name of select field ('edit' prefix will be added) - * @param string $preselected Value to show/edit (not used in this function) + * @param string $preselected Value to show/edit (not used in this function) * @param object $object Object * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. - * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) + * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) * @param string $moreparam More param to add on a href URL* * @param int $fieldrequired 1 if we want to show field as mandatory using the fieldrequired CSS. * @return string HTML edit field @@ -129,7 +129,7 @@ class Form * @param string $value Value to show/edit * @param object $object Object * @param boolean $perm Permission to allow button to edit parameter - * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'dayhour' or 'datepickerhour', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...) + * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datepickerhour', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...) * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of value). Use '' to use same than $value * @param object $extObject External object * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') @@ -254,7 +254,7 @@ class Form * @param string $value Value to show/edit * @param string $htmlname DIV ID (field name) * @param int $condition Condition to edit - * @param string $inputType Type of input ('string', 'numeric', 'datepicker', 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:xxx') + * @param string $inputType Type of input ('string', 'numeric', 'datepicker' ('day' do not work, don't know why), 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:xxx') * @param string $editvalue When in edit mode, use this value as $value instead of value * @param object $extObject External object * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') @@ -269,7 +269,7 @@ class Form // Check parameters if ($inputType == 'textarea') $value = dol_nl2br($value); else if (preg_match('/^numeric/',$inputType)) $value = price($value); - else if ($inputType == 'datepicker') $value = dol_print_date($value, 'day'); + else if ($inputType == 'day' || $inputType == 'datepicker') $value = dol_print_date($value, 'day'); if ($condition) { @@ -302,7 +302,7 @@ class Form if (! empty($tmp[2])) $savemethod=$tmp[2]; $out.= ''."\n"; } - else if ((preg_match('/^datepicker/',$inputType)) || (preg_match('/^datehourpicker/',$inputType))) + else if ((preg_match('/^day$/',$inputType)) || (preg_match('/^datepicker/',$inputType)) || (preg_match('/^datehourpicker/',$inputType))) { $tmp=explode(':',$inputType); $inputType=$tmp[0]; diff --git a/htdocs/core/js/editinplace.js b/htdocs/core/js/editinplace.js index 7607ba6f885..830aec5cd13 100644 --- a/htdocs/core/js/editinplace.js +++ b/htdocs/core/js/editinplace.js @@ -53,9 +53,11 @@ $(document).ready(function() { }); $('.editkey_textarea').hover( function () { + console.log("We are hover (entry) an editkey_textarea"); $('#viewval_' + $(this).attr('id')).addClass("viewval_hover"); }, function () { + console.log("We are no more hover (exit) an editkey_textarea"); $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); } ); @@ -104,9 +106,11 @@ $(document).ready(function() { }); $('.editkey_ckeditor').hover( function () { + console.log("We are hover (entry) an editkey_ckeditor"); $('#viewval_' + $(this).attr('id')).addClass("viewval_hover"); }, function () { + console.log("We are no more hover (exit) an editkey_ckeditor"); $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); } ); @@ -145,9 +149,11 @@ $(document).ready(function() { }); $('.editkey_string').hover( function () { + console.log("We are hover (entry) an editkey_string"); $('#viewval_' + $(this).attr('id')).addClass("viewval_hover"); }, function () { + console.log("We are no more hover an editkey_string"); $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); } ); @@ -186,9 +192,11 @@ $(document).ready(function() { }); $('.editkey_numeric').hover( function () { + console.log("We are hover an editkey_numeric"); $( '#viewval_' + $(this).attr('id') ).addClass("viewval_hover"); }, function () { + console.log("We are no more hover (exit) an editkey_textarea"); $( '#viewval_' + $(this).attr('id') ).removeClass("viewval_hover"); } ); @@ -227,9 +235,11 @@ $(document).ready(function() { }); $('.editkey_datepicker').hover( function () { + console.log("We are hover (entry) editkey_datepicker"); $('#viewval_' + $(this).attr('id')).addClass("viewval_hover"); }, function () { + console.log("We are no more hover (exit) an editkey_datepicker"); $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); } ); @@ -270,9 +280,11 @@ $(document).ready(function() { }); $('.editkey_select').hover( function () { + console.log("We are hover (entry) an editkey_select"); $('#viewval_' + $(this).attr('id')).addClass("viewval_hover"); }, function () { + console.log("We are no more hover (exit) an editkey_select"); $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); } ); @@ -316,6 +328,7 @@ $(document).ready(function() { }); $('.editkey_autocomplete').hover( function () { + console.log("We are no more hover (exit) an editkey_autocomplete"); $('#viewval_' + $(this).attr('id')).addClass("viewval_hover"); }, function () { diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 7ed5770e4c9..323c07146fc 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -51,8 +51,11 @@ if (in_array($object->element,array('propal', 'supplier_proposal','facture','fac ?> -lines) == 0); ?> - +lines) == 0); +if ($nolinesbefore) { +?> + global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
trans('AddNewLine'); ?>trans("FreeZone"); ?> @@ -100,8 +103,10 @@ if (in_array($object->element,array('propal', 'supplier_proposal','facture','fac ?>   - -> + + global->MAIN_VIEW_LINE_NUMBER)) { $coldisplay=2; }