2
0
forked from Wavyzz/dolibarr

Debug v21 - Fix set of focus on description after slection of type of

line
This commit is contained in:
Laurent Destailleur (aka Eldy)
2024-12-19 01:05:39 +01:00
parent ff2aa10145
commit 289b69bb24
6 changed files with 592 additions and 544 deletions

View File

@@ -1149,15 +1149,16 @@ class Form
* Return list of types of lines (product or service) * Return list of types of lines (product or service)
* Example: 0=product, 1=service, 9=other (for external module) * Example: 0=product, 1=service, 9=other (for external module)
* *
* @param string $selected Preselected type * @param string $selected Preselected type
* @param string $htmlname Name of field in html form * @param string $htmlname Name of field in html form
* @param int<0,1>|string $showempty Add an empty field * @param int<0,1>|string $showempty Add an empty field
* @param int $hidetext Do not show label 'Type' before combo box (used only if there is at least 2 choices to select) * @param int $hidetext Do not show label 'Type' before combo box (used only if there is at least 2 choices to select)
* @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, 2=Force to show only Products, 3=Force to show only services, -1=Force none (and set hidden field to 'service') * @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, 2=Force to show only Products, 3=Force to show only services, -1=Force none (and set hidden field to 'service')
* @param string $morecss More css * @param string $morecss More css
* @param int $useajaxcombo 1=Use ajaxcombo
* @return void * @return void
*/ */
public function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0, $morecss = "") public function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0, $morecss = "", $useajaxcombo = 1)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -1166,11 +1167,11 @@ class Form
if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service")) if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service"))
|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) { || (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) {
if (empty($hidetext)) { if (empty($hidetext)) {
print $langs->trans("Type") . ': '; print $langs->trans("Type").'...';
} }
print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">'; print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">';
if ($showempty) { if ($showempty) {
print '<option value="-1"'; print '<option value="-1" class="opacitymedium"'.($useajaxcombo ? '' : ' disabled="disabled"');
if ($selected == -1) { if ($selected == -1) {
print ' selected'; print ' selected';
} }
@@ -1196,7 +1197,10 @@ class Form
print '>' . $langs->trans("Service"); print '>' . $langs->trans("Service");
print '</select>'; print '</select>';
print ajax_combobox('select_' . $htmlname);
if ($useajaxcombo) {
print ajax_combobox('select_' . $htmlname);
}
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); //if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
} }
if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) {

View File

@@ -1557,11 +1557,13 @@ if (!getDolGlobalString('MAIN_DISABLE_SELECT2_FOCUS_PROTECTION') && !defined('DI
* TODO: Recheck with the select2 GH issue and remove once this is fixed on their side * TODO: Recheck with the select2 GH issue and remove once this is fixed on their side
*/ */
$(document).on('select2:open', (e) => { $(document).on('select2:open', (e) => {
console.log("Execute the focus (click on combo or use space when on component"); console.log("Execute the focus (click on combo or use space when on component)");
const target = $(e.target); const target = $(e.target);
if (target && target.length) { if (target && target.length) {
let id = target[0].id || target[0].name; let id = target[0].id || target[0].name;
if (id.substr(-2) == "[]") id = id.substr(0,id.length-2); if (id.substr(-2) == "[]") {
id = id.substr(0,id.length-2);
}
document.querySelector('input[aria-controls*='+id+']').focus(); document.querySelector('input[aria-controls*='+id+']').focus();
} }
}); });

File diff suppressed because it is too large Load Diff

View File

@@ -798,7 +798,7 @@ Notes=Notes
AddNewLine=Add new line AddNewLine=Add new line
AddFile=Add file AddFile=Add file
FreeZone=Free-text product FreeZone=Free-text product
FreeLineOfType=Free-text item, type: FreeLineOfType=Free-text item, type
CloneMainAttributes=Clone object with its main attributes CloneMainAttributes=Clone object with its main attributes
ReGeneratePDF=Re-generate PDF ReGeneratePDF=Re-generate PDF
PDFMerge=PDF Merge PDFMerge=PDF Merge

View File

@@ -748,8 +748,12 @@ input:-webkit-autofill {
/* CSS for placeholder */ /* CSS for placeholder */
.placeholder { color: #ccc; } .placeholder { color: #ccc; }
select.placeholder { color: #ccc; }
::-webkit-input-placeholder { color: #ccc; } ::-webkit-input-placeholder { color: #ccc; }
input:-moz-placeholder { color: #ccc; } input:-moz-placeholder { color: #ccc; }
select.placeholder option:not(.opacitymediumbycolor):not(.opacitymedium) {
color: var(--colortext);
}
input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; } input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; }
fieldset { fieldset {
@@ -766,6 +770,7 @@ input#onlinepaymenturl, input#directdownloadlink {
opacity: 0.7; opacity: 0.7;
} }
.formconsumeproduce { .formconsumeproduce {
background: #f3f3f3; background: #f3f3f3;
padding: 20px 0px 0px 0px; padding: 20px 0px 0px 0px;

View File

@@ -933,11 +933,15 @@ input[type=checkbox], input[type=radio] {
/* CSS for placeholder */ /* CSS for placeholder */
.placeholder { color: #ccc; } .placeholder { color: #ccc; }
select.placeholder { color: #ccc; }
::-webkit-input-placeholder { color:#ccc; } ::-webkit-input-placeholder { color:#ccc; }
:-moz-placeholder { color:#bbb; } /* firefox 18- */ :-moz-placeholder { color:#bbb; } /* firefox 18- */
::-moz-placeholder { color:#bbb; } /* firefox 19+ */ ::-moz-placeholder { color:#bbb; } /* firefox 19+ */
:-ms-input-placeholder { color:#ccc; } /* ie */ :-ms-input-placeholder { color:#ccc; } /* ie */
input:-moz-placeholder { color:#ccc; } input:-moz-placeholder { color:#ccc; }
select.placeholder option:not(.opacitymediumbycolor):not(.opacitymedium) {
color: var(--colortext);
}
input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; } input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; }
fieldset { fieldset {
@@ -4490,7 +4494,7 @@ tr.liste_titre_filter td.liste_titre {
padding-top: 4px; padding-top: 4px;
padding-bottom: 3px; padding-bottom: 3px;
} }
.liste_titre_create td, .liste_titre_create th, .liste_titre_create .tagtd .liste_titre_create td:not(.linecoldescription), .liste_titre_create th, .liste_titre_create .tagtd
{ {
border-top-width: 1px; border-top-width: 1px;
border-top-color: var(--colortopbordertitle1); border-top-color: var(--colortopbordertitle1);
@@ -4512,6 +4516,10 @@ tr#trlinefordates td {
border-top-style: solid; border-top-style: solid;
} }
td.linecoldescription {
padding: 6px 10px 6px 12px !important; /* t r b l */
}
table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.noborder tr.box_titre td { table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.noborder tr.box_titre td {
padding: 8px 8px 8px 10px; /* t r b l */ padding: 8px 8px 8px 10px; /* t r b l */
} }