Revert "NEW : accoutancy : subleger label input automatic filling when selecting subleger account in select2 list"
This commit is contained in:
parent
1b72b27f75
commit
be95662ece
@ -659,7 +659,7 @@ if ($action == 'create') {
|
|||||||
// Also, it is not possible to use a value that is not in the list.
|
// Also, it is not possible to use a value that is not in the list.
|
||||||
// Also, the label is not automatically filled when a value is selected.
|
// Also, the label is not automatically filled when a value is selected.
|
||||||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
|
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
|
||||||
print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label');
|
print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1);
|
||||||
} else {
|
} else {
|
||||||
print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">';
|
print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">';
|
||||||
}
|
}
|
||||||
@ -728,7 +728,7 @@ if ($action == 'create') {
|
|||||||
// Also, it is not possible to use a value that is not in the list.
|
// Also, it is not possible to use a value that is not in the list.
|
||||||
// Also, the label is not automatically filled when a value is selected.
|
// Also, the label is not automatically filled when a value is selected.
|
||||||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
|
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
|
||||||
print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label');
|
print $formaccounting->select_auxaccount('', 'subledger_account', 1);
|
||||||
} else {
|
} else {
|
||||||
print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '">';
|
print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '">';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -441,7 +441,7 @@ class FormAccounting extends Form
|
|||||||
* @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
|
* @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
|
||||||
* @return string String with HTML select
|
* @return string String with HTML select
|
||||||
*/
|
*/
|
||||||
public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'maxwidth250', $usecache = '', $labelhtmlname = '')
|
public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'maxwidth250', $usecache = '')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
|
|
||||||
@ -505,19 +505,6 @@ class FormAccounting extends Form
|
|||||||
|
|
||||||
// Build select
|
// Build select
|
||||||
$out .= Form::selectarray($htmlname, $aux_account, $selectid, ($showempty ? (is_numeric($showempty) ? 1 : $showempty): 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
$out .= Form::selectarray($htmlname, $aux_account, $selectid, ($showempty ? (is_numeric($showempty) ? 1 : $showempty): 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||||
//automatic filling if we give the name of the subledger_label input
|
|
||||||
if (!empty($labelhtmlname)) {
|
|
||||||
$out .= '<script>
|
|
||||||
jQuery(document).ready(() => {
|
|
||||||
$("#'.$htmlname.'").on("select2:select", function(e) {
|
|
||||||
var regExp = /\(([^)]+)\)/;
|
|
||||||
const match = regExp.exec(e.params.data.text);
|
|
||||||
$(\'input[name="'.$labelhtmlname.'"]\').val(match[1]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user