FIX Load chart of account only if we click or select button "Load chart"
This commit is contained in:
parent
52c06c1815
commit
80c1a92872
@ -36,6 +36,7 @@ $action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$massaction = GETPOST('massaction', 'aZ09');
|
||||
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'accountingaccountlist'; // To manage different context of search
|
||||
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
@ -100,7 +101,7 @@ if (empty($reshook))
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
if (GETPOST('change_chart', 'alpha'))
|
||||
if (GETPOST('change_chart', 'alpha') && GETPOST('valid_change_chart', 'int'))
|
||||
{
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
|
||||
@ -236,6 +237,21 @@ if ($resql)
|
||||
if ($search_pcgsubtype) $param.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print '<!-- Add javascript to update a flag when we select "Change plan" -->
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("#searchFormList").on("submit", function (e) {
|
||||
console.log("chartofaccounts focus = "+$("#chartofaccounts").is(":focus"));
|
||||
console.log("change_chart focus = "+$("#change_chart").is(":focus"));
|
||||
if ($("#change_chart").is(":focus"))
|
||||
{
|
||||
console.log("We set valid_change_chart to 1");
|
||||
$("#valid_change_chart").val(1);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -278,7 +294,8 @@ if ($resql)
|
||||
else dol_print_error($db);
|
||||
print "</select>";
|
||||
print ajax_combobox("chartofaccounts");
|
||||
print '<input type="submit" class="button" name="change_chart" tabindex="-1" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||
print '<input type="submit" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||
print '<input type="hidden" name="valid_change_chart" id="valid_change_chart" value="0">';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
@ -286,6 +303,9 @@ if ($resql)
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
$moreforfilter = '';
|
||||
$massactionbutton = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
|
||||
@ -7450,11 +7450,7 @@ class Form
|
||||
*/
|
||||
public function showFilterButtons()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$out='<div class="nowrap">';
|
||||
//$out.='<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
//$out.='<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
$out.='<button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||
$out.='<button type="submit" class="liste_titre button_removefilter" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>';
|
||||
$out.='</div>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user