FIX debug report expense/income

This commit is contained in:
Laurent Destailleur
2020-12-23 22:17:05 +01:00
parent 8e839a34e2
commit 940f0484ee
5 changed files with 189 additions and 147 deletions

View File

@@ -3939,13 +3939,16 @@ class Form
* @param string $moreattrib To add more attribute on select
* @param int $showcurrency Show currency in label
* @param string $morecss More CSS
* @param int $nooutput 1=Return string, do not send to output
* @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...)
*/
public function select_comptes($selected = '', $htmlname = 'accountid', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '')
public function select_comptes($selected = '', $htmlname = 'accountid', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '', $nooutput = 0)
{
// phpcs:enable
global $langs, $conf;
$out = '';
$langs->load("admin");
$num = 0;
@@ -3964,10 +3967,10 @@ class Form
$i = 0;
if ($num)
{
print '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
if ($useempty == 1 || ($useempty == 2 && $num > 1))
{
print '<option value="-1">&nbsp;</option>';
$out .= '<option value="-1">&nbsp;</option>';
}
while ($i < $num)
@@ -3975,26 +3978,30 @@ class Form
$obj = $this->db->fetch_object($result);
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected)))
{
print '<option value="'.$obj->rowid.'" selected>';
$out .= '<option value="'.$obj->rowid.'" selected>';
} else {
print '<option value="'.$obj->rowid.'">';
$out .= '<option value="'.$obj->rowid.'">';
}
print trim($obj->label);
if ($showcurrency) print ' ('.$obj->currency_code.')';
if ($status == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
print '</option>';
$out .= trim($obj->label);
if ($showcurrency) $out .= ' ('.$obj->currency_code.')';
if ($status == 2 && $obj->status == 1) $out .= ' ('.$langs->trans("Closed").')';
$out .= '</option>';
$i++;
}
print "</select>";
print ajax_combobox('select'.$htmlname);
$out .= "</select>";
$out .= ajax_combobox('select'.$htmlname);
} else {
if ($status == 0) print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
else print '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>';
if ($status == 0) $out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
else $out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>';
}
} else {
dol_print_error($this->db);
}
// Output or return
if (empty($nooutput)) print $out;
else return $out;
return $num;
}