Debug v17

This commit is contained in:
Laurent Destailleur 2023-01-03 02:29:49 +01:00
parent d62fb2af64
commit 496cff0167
4 changed files with 80 additions and 19 deletions

View File

@ -47,6 +47,7 @@ $search_label = GETPOST('search_label', 'alpha');
$search_labelshort = GETPOST('search_labelshort', 'alpha');
$search_accountparent = GETPOST('search_accountparent', 'alpha');
$search_pcgtype = GETPOST('search_pcgtype', 'alpha');
$search_import_key = GETPOST('search_import_key', 'alpha');
$toselect = GETPOST('toselect', 'array');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$confirm = GETPOST('confirm', 'alpha');
@ -83,16 +84,19 @@ if (!$sortorder) {
}
$arrayfields = array(
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1),
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
'aa.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1),
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
'aa.account_number'=>array('label'=>"AccountNumber", 'checked'=>1),
'aa.label'=>array('label'=>"Label", 'checked'=>1),
'aa.labelshort'=>array('label'=>"LabelToShow", 'checked'=>1),
'aa.account_parent'=>array('label'=>"Accountparent", 'checked'=>1),
'aa.pcg_type'=>array('label'=>"Pcgtype", 'checked'=>1, 'help'=>'PcgtypeDesc'),
'categories'=>array('label'=>"AccountingCategories", 'checked'=>-1, 'help'=>'AccountingCategoriesDesc'),
'aa.reconcilable'=>array('label'=>"Reconcilable", 'checked'=>1),
'aa.active'=>array('label'=>"Activated", 'checked'=>1),
'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1)
);
if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
unset($arrayfields['categories']);
unset($arrayfields['aa.reconcilable']);
}
@ -226,15 +230,12 @@ if ($action == 'delete') {
$pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.reconcilable, aa.active, ";
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent, aa.label, aa.labelshort, aa.fk_accounting_category,";
$sql .= " aa.reconcilable, aa.active, aa.import_key,";
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity;
if ($db->type == 'pgsql') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity;
} else {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity;
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".((int) $conf->entity);
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".((int) $conf->entity);
$sql .= " WHERE asy.rowid = ".((int) $pcgver);
//print $sql;
if (strlen(trim($search_account))) {
@ -337,6 +338,9 @@ if ($resql) {
if ($search_pcgtype) {
$param .= '&search_pcgtype='.urlencode($search_pcgtype);
}
if ($optioncss != '') {
$param .= '&search_import_key='.urlencode($search_import_key);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
@ -439,8 +443,17 @@ if ($resql) {
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2, array(), 0, 0, 'maxwidth150');
print '</td>';
}
// Predefined group
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
print '<td class="liste_titre"><input type="text" class="flat width100" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
print '<td class="liste_titre"><input type="text" class="flat width75" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
}
// Custom groups
if (!empty($arrayfields['categories']['checked'])) {
print '<td class="liste_titre"></td>';
}
// Import key
if (!empty($arrayfields['aa.import_key']['checked'])) {
print '<td class="liste_titre"><input type="text" class="flat width75" name="search_import_key" value="'.$search_import_key.'"></td>';
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
@ -471,6 +484,12 @@ if ($resql) {
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1);
}
if (!empty($arrayfields['categories']['checked'])) {
print_liste_field_titre($arrayfields['categories']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '', $arrayfields['categories']['help'], 1);
}
if (!empty($arrayfields['aa.import_key']['checked'])) {
print_liste_field_titre($arrayfields['aa.import_key']['label'], $_SERVER["PHP_SELF"], 'aa.import_key', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.import_key']['help'], 1);
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder);
@ -505,7 +524,7 @@ if ($resql) {
// Account label
if (!empty($arrayfields['aa.label']['checked'])) {
print "<td>";
print $obj->label;
print dol_escape_htmltag($obj->label);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
@ -515,7 +534,7 @@ if ($resql) {
// Account label to show (label short)
if (!empty($arrayfields['aa.labelshort']['checked'])) {
print "<td>";
print $obj->labelshort;
print dol_escape_htmltag($obj->labelshort);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
@ -549,10 +568,30 @@ if ($resql) {
}
}
// Chart of accounts type
// Predefined group (deprecated)
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
print "<td>";
print $obj->pcg_type;
print dol_escape_htmltag($obj->pcg_type);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Custom accounts
if (!empty($arrayfields['categories']['checked'])) {
print "<td>";
// TODO Get all custom groups labels the account is in
print dol_escape_htmltag($obj->fk_accounting_category);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Import id
if (!empty($arrayfields['aa.import_key']['checked'])) {
print "<td>";
print dol_escape_htmltag($obj->import_key);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;

View File

@ -1511,6 +1511,16 @@ while ($i < min($num, $limit)) {
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

View File

@ -1232,6 +1232,16 @@ if ($num > 0 && $colspan > 0) {
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

View File

@ -218,6 +218,7 @@ JournalLabel=Journal label
NumPiece=Piece number
TransactionNumShort=Num. transaction
AccountingCategory=Custom group
AccountingCategories=Custom groups
GroupByAccountAccounting=Group by general ledger account
GroupBySubAccountAccounting=Group by subledger account
AccountingAccountGroupsDesc=You can define here some groups of accounting account. They will be used for personalized accounting reports.
@ -265,6 +266,7 @@ ShowSubtotalByGroup=Show subtotal by level
Pcgtype=Group of account
PcgtypeDesc=Group of account are used as predefined 'filter' and 'grouping' criteria for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as groups for accounting accounts of products to build the expense/income report.
AccountingCategoriesDesc=Custom group of accounts can be used to group accounting accounts into one name to ease filter use or building of custom reports.
Reconcilable=Reconcilable