';
+ if ($valuetoshow != '') {
+ print '| ';
+ if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
+ print ''.$valuetoshow.' '.img_help(1, $valuetoshow).'';
+ } elseif (!empty($tabhelp[$id][$value])) {
+ print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
+ } else {
+ print $valuetoshow;
+ }
+ print ' | ';
+ }
+ }
- // Form to add a new line
- if ($tabname[$id]) {
- $fieldlist = explode(',', $tabfield[$id]);
+ print '';
+ print '';
+ print ' | ';
+ print ' | ';
+ print ' | ';
+ print ' | ';
+ print '';
- // Line for title
- print '';
- foreach ($fieldlist as $field => $value) {
- // Determine le nom du champ par rapport aux noms possibles
- // dans les dictionnaires de donnees
- $valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
- $valuetoshow = $langs->trans($valuetoshow); // try to translate
- $class = "left";
- if ($fieldlist[$field] == 'type') {
- if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
- $valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
- } else {
- $valuetoshow = $langs->trans("Type");
+ // Line to enter new values
+ print '
';
+
+ $obj = new stdClass();
+ // If data was already input, we define them in obj to populate input fields.
+ if (GETPOST('actionadd', 'alpha')) {
+ foreach ($fieldlist as $key => $val) {
+ if (GETPOST($val) != '') {
+ $obj->$val = GETPOST($val);
+ }
+ }
+ }
+
+ $tmpaction = 'create';
+ $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
+ $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
+ $error = $hookmanager->error; $errors = $hookmanager->errors;
+
+ if (empty($reshook)) {
+ fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'add');
+ }
+
+ print '| ';
+ print '';
+ print ' | ';
+ print "
";
+
+ $colspan = count($fieldlist) + 3;
+ if ($id == 32) {
+ $colspan++;
+ }
+
+ print '| |
'; // Keep to have a line with enough height
+}
+
+// List of available record in database
+dol_syslog("htdocs/accountancy/admin/categories_list.php", LOG_DEBUG);
+
+$resql = $db->query($sql);
+if ($resql) {
+ $num = $db->num_rows($resql);
+ $i = 0;
+
+ $param = '&id='.$id;
+ if ($search_country_id > 0) {
+ $param .= '&search_country_id='.$search_country_id;
+ }
+ $paramwithsearch = $param;
+ if ($sortorder) {
+ $paramwithsearch .= '&sortorder='.$sortorder;
+ }
+ if ($sortfield) {
+ $paramwithsearch .= '&sortfield='.$sortfield;
+ }
+ if (GETPOST('from', 'alpha')) {
+ $paramwithsearch .= '&from='.GETPOST('from', 'alpha');
+ }
+ // There is several pages
+ if ($num > $listlimit) {
+ print '| ';
+ print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '');
+ print ' |
';
+ }
+
+ // Title line with search boxes
+ print '';
+ $filterfound = 0;
+ foreach ($fieldlist as $field => $value) {
+ $showfield = 1; // By defaut
+
+ if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
+ $showfield = 0;
+ }
+
+ if ($showfield) {
+ if ($value == 'country') {
+ print '| ';
+ print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
+ print ' | ';
+ $filterfound++;
+ } else {
+ print ' | ';
+ }
+ }
+ }
+ print ' | ';
+ print ' | ';
+ print ' | ';
+ print '';
+ if ($filterfound) {
+ $searchpicto = $form->showFilterAndCheckAddButtons(0);
+ print $searchpicto;
+ }
+ print ' | ';
+ print '
';
+
+ // Title of lines
+ print '';
+ foreach ($fieldlist as $field => $value) {
+ // Determine le nom du champ par rapport aux noms possibles
+ // dans les dictionnaires de donnees
+ $showfield = 1; // By defaut
+ $class = "left";
+ $sortable = 1;
+ $valuetoshow = '';
+
+ $valuetoshow = ucfirst($fieldlist[$field]); // By defaut
+ $valuetoshow = $langs->trans($valuetoshow); // try to translate
+ if ($fieldlist[$field] == 'source') {
+ $valuetoshow = $langs->trans("Contact");
+ }
+ if ($fieldlist[$field] == 'price') {
+ $valuetoshow = $langs->trans("PriceUHT");
+ }
+ if ($fieldlist[$field] == 'taux') {
+ if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") {
+ $valuetoshow = $langs->trans("Rate");
+ } else {
+ $valuetoshow = $langs->trans("Amount");
+ }
+ $class = 'center';
+ }
+ if ($fieldlist[$field] == 'type') {
+ $valuetoshow = $langs->trans("Type");
+ }
+ if ($fieldlist[$field] == 'code') {
+ $valuetoshow = $langs->trans("Code");
+ }
+ if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
+ $valuetoshow = $langs->trans("Label");
+ }
+ if ($fieldlist[$field] == 'country') {
+ $valuetoshow = $langs->trans("Country");
+ }
+ if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
+ $showfield = 0;
+ }
+ if ($fieldlist[$field] == 'accountancy_code') {
+ $valuetoshow = $langs->trans("AccountancyCode");
+ }
+ if ($fieldlist[$field] == 'accountancy_code_sell') {
+ $valuetoshow = $langs->trans("AccountancyCodeSell");
+ $sortable = 0;
+ }
+ if ($fieldlist[$field] == 'accountancy_code_buy') {
+ $valuetoshow = $langs->trans("AccountancyCodeBuy");
+ $sortable = 0;
+ }
+ if ($fieldlist[$field] == 'fk_pcg_version') {
+ $valuetoshow = $langs->trans("Pcg_version");
+ }
+ if ($fieldlist[$field] == 'account_parent') {
+ $valuetoshow = $langs->trans("Accountsparent");
+ }
+ if ($fieldlist[$field] == 'pcg_type') {
+ $valuetoshow = $langs->trans("Pcg_type");
+ }
+ if ($fieldlist[$field] == 'type_template') {
+ $valuetoshow = $langs->trans("TypeOfTemplate");
+ }
+ if ($fieldlist[$field] == 'range_account') {
+ $valuetoshow = $langs->trans("Comment");
+ }
+ if ($fieldlist[$field] == 'category_type') {
+ $valuetoshow = $langs->trans("Calculated");
+ }
+ // Affiche nom du champ
+ if ($showfield) {
+ print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "", $sortfield, $sortorder, $class.' ');
+ }
+ }
+ print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
+ print getTitleFieldOfList('');
+ print getTitleFieldOfList('');
+ print getTitleFieldOfList('');
+ print '
';
+
+ if ($num) {
+ // Lines with values
+ while ($i < $num) {
+ $obj = $db->fetch_object($resql);
+ //print_r($obj);
+ print '';
+ if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
+ $tmpaction = 'edit';
+ $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
+ $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
+ $error = $hookmanager->error; $errors = $hookmanager->errors;
+
+ // Show fields
+ if (empty($reshook)) {
+ fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'edit');
}
- }
- if ($fieldlist[$field] == 'code') {
- $valuetoshow = $langs->trans("Code");
- }
- if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
- $valuetoshow = $langs->trans("Label");
- }
- if ($fieldlist[$field] == 'libelle_facture') {
- $valuetoshow = $langs->trans("LabelOnDocuments");
- }
- if ($fieldlist[$field] == 'country') {
- $valuetoshow = $langs->trans("Country");
- }
- if ($fieldlist[$field] == 'accountancy_code') {
- $valuetoshow = $langs->trans("AccountancyCode");
- }
- if ($fieldlist[$field] == 'accountancy_code_sell') {
- $valuetoshow = $langs->trans("AccountancyCodeSell");
- }
- if ($fieldlist[$field] == 'accountancy_code_buy') {
- $valuetoshow = $langs->trans("AccountancyCodeBuy");
- }
- if ($fieldlist[$field] == 'pcg_version' || $fieldlist[$field] == 'fk_pcg_version') {
- $valuetoshow = $langs->trans("Pcg_version");
- }
- if ($fieldlist[$field] == 'range_account') {
- $valuetoshow = $langs->trans("Comment");
- }
- if ($fieldlist[$field] == 'category_type') {
- $valuetoshow = $langs->trans("Calculated");
- }
- if ($valuetoshow != '') {
- print '| ';
- if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
- print ''.$valuetoshow.' '.img_help(1, $valuetoshow).'';
- } elseif (!empty($tabhelp[$id][$value])) {
- print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
+ print ' | | ';
+ print ' | ';
+ print '';
+ print '';
+ print '';
+ print '';
+ print '';
+ print '';
+ print ' | ';
+ print ' | ';
+ } else {
+ $tmpaction = 'view';
+ $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
+ $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
+
+ $error = $hookmanager->error; $errors = $hookmanager->errors;
+
+ if (empty($reshook)) {
+ foreach ($fieldlist as $field => $value) {
+ $showfield = 1;
+ $class = "left";
+ $valuetoshow = $obj->{$fieldlist[$field]};
+ if ($value == 'category_type') {
+ $valuetoshow = yn($valuetoshow);
+ } elseif ($valuetoshow == 'all') {
+ $valuetoshow = $langs->trans('All');
+ } elseif ($fieldlist[$field] == 'country') {
+ if (empty($obj->country_code)) {
+ $valuetoshow = '-';
+ } else {
+ $key = $langs->trans("Country".strtoupper($obj->country_code));
+ $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
+ }
+ } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
+ $key = $langs->trans("Country".strtoupper($obj->code));
+ $valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
+ } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
+ $langs->loadLangs(array("propal"));
+ $key = $langs->trans("AvailabilityType".strtoupper($obj->code));
+ $valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
+ } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
+ $key = $langs->trans("Action".strtoupper($obj->code));
+ $valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
+ } elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
+ $showfield = 0;
+ }
+
+ $class = 'tddict';
+ // Show value for field
+ if ($showfield) {
+ print ''.dol_escape_htmltag($valuetoshow).' | ';
+ }
+ }
+ }
+
+ // Can an entry be erased or disabled ?
+ $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
+ if (isset($obj->code)) {
+ if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
+ $iserasable = 0; $canbedisabled = 0;
+ }
+ }
+
+ $canbemodified = $iserasable;
+
+ $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
+ if ($param) {
+ $url .= '&'.$param;
+ }
+ $url .= '&';
+
+ // Active
+ print '';
+ if ($canbedisabled) {
+ print ''.$actl[$obj->active].'';
} else {
- print $valuetoshow;
+ print $langs->trans("AlwaysActive");
+ }
+ print " | ";
+
+ // Modify link
+ if ($canbemodified) {
+ print ''.img_edit().' | ';
+ } else {
+ print ' | ';
+ }
+
+ // Delete link
+ if ($iserasable) {
+ print '';
+ if ($user->admin) {
+ print ''.img_delete().'';
+ }
+ //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin
+ print ' | ';
+ } else {
+ print ' | ';
+ }
+
+ // Link to setup the group
+ print '';
+ if (empty($obj->formula)) {
+ print '';
+ print $langs->trans("ListOfAccounts");
+ print '';
+
+ // Count number of accounts into group
+ $nbofaccountintogroup = 0;
+ $listofaccountintogroup = $accountingcategory->getCptsCat($obj->rowid);
+ $nbofaccountintogroup = count($listofaccountintogroup);
+ //if ($nbofaccountintogroup > 0) {
+ print ' ('.$langs->trans("NAccounts", $nbofaccountintogroup).')';
+ //} else {
+ // print ' (0)';
+ //}
}
print ' | ';
}
+ print "
\n";
+ $i++;
}
-
- print '';
- print '';
- print ' | ';
- print ' | ';
- print ' | ';
- print ' | ';
- print '';
-
- // Line to enter new values
- print '';
-
- $obj = new stdClass();
- // If data was already input, we define them in obj to populate input fields.
- if (GETPOST('actionadd', 'alpha')) {
- foreach ($fieldlist as $key => $val) {
- if (GETPOST($val) != '') {
- $obj->$val = GETPOST($val);
- }
- }
- }
-
- $tmpaction = 'create';
- $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
- $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
- $error = $hookmanager->error; $errors = $hookmanager->errors;
-
- if (empty($reshook)) {
- fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'add');
- }
-
- print '| ';
- print '';
- print ' | ';
- print "
";
-
- $colspan = count($fieldlist) + 3;
- if ($id == 32) {
- $colspan++;
- }
-
- print '| |
'; // Keep to have a line with enough height
}
-
- // List of available record in database
- dol_syslog("htdocs/admin/dict", LOG_DEBUG);
- $resql = $db->query($sql);
- if ($resql) {
- $num = $db->num_rows($resql);
- $i = 0;
-
- $param = '&id='.$id;
- if ($search_country_id > 0) {
- $param .= '&search_country_id='.$search_country_id;
- }
- $paramwithsearch = $param;
- if ($sortorder) {
- $paramwithsearch .= '&sortorder='.$sortorder;
- }
- if ($sortfield) {
- $paramwithsearch .= '&sortfield='.$sortfield;
- }
- if (GETPOST('from', 'alpha')) {
- $paramwithsearch .= '&from='.GETPOST('from', 'alpha');
- }
- // There is several pages
- if ($num > $listlimit) {
- print '| ';
- print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '');
- print ' |
';
- }
-
- // Title line with search boxes
- print '';
- $filterfound = 0;
- foreach ($fieldlist as $field => $value) {
- $showfield = 1; // By defaut
-
- if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
- $showfield = 0;
- }
-
- if ($showfield) {
- if ($value == 'country') {
- print '| ';
- print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
- print ' | ';
- $filterfound++;
- } else {
- print ' | ';
- }
- }
- }
- print ' | ';
- print ' | ';
- print ' | ';
- print '';
- if ($filterfound) {
- $searchpicto = $form->showFilterAndCheckAddButtons(0);
- print $searchpicto;
- }
- print ' | ';
- print '
';
-
- // Title of lines
- print '';
- foreach ($fieldlist as $field => $value) {
- // Determine le nom du champ par rapport aux noms possibles
- // dans les dictionnaires de donnees
- $showfield = 1; // By defaut
- $class = "left";
- $sortable = 1;
- $valuetoshow = '';
-
- $valuetoshow = ucfirst($fieldlist[$field]); // By defaut
- $valuetoshow = $langs->trans($valuetoshow); // try to translate
- if ($fieldlist[$field] == 'source') {
- $valuetoshow = $langs->trans("Contact");
- }
- if ($fieldlist[$field] == 'price') {
- $valuetoshow = $langs->trans("PriceUHT");
- }
- if ($fieldlist[$field] == 'taux') {
- if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") {
- $valuetoshow = $langs->trans("Rate");
- } else {
- $valuetoshow = $langs->trans("Amount");
- }
- $class = 'center';
- }
- if ($fieldlist[$field] == 'type') {
- $valuetoshow = $langs->trans("Type");
- }
- if ($fieldlist[$field] == 'code') {
- $valuetoshow = $langs->trans("Code");
- }
- if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
- $valuetoshow = $langs->trans("Label");
- }
- if ($fieldlist[$field] == 'country') {
- $valuetoshow = $langs->trans("Country");
- }
- if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
- $showfield = 0;
- }
- if ($fieldlist[$field] == 'accountancy_code') {
- $valuetoshow = $langs->trans("AccountancyCode");
- }
- if ($fieldlist[$field] == 'accountancy_code_sell') {
- $valuetoshow = $langs->trans("AccountancyCodeSell");
- $sortable = 0;
- }
- if ($fieldlist[$field] == 'accountancy_code_buy') {
- $valuetoshow = $langs->trans("AccountancyCodeBuy");
- $sortable = 0;
- }
- if ($fieldlist[$field] == 'fk_pcg_version') {
- $valuetoshow = $langs->trans("Pcg_version");
- }
- if ($fieldlist[$field] == 'account_parent') {
- $valuetoshow = $langs->trans("Accountsparent");
- }
- if ($fieldlist[$field] == 'pcg_type') {
- $valuetoshow = $langs->trans("Pcg_type");
- }
- if ($fieldlist[$field] == 'type_template') {
- $valuetoshow = $langs->trans("TypeOfTemplate");
- }
- if ($fieldlist[$field] == 'range_account') {
- $valuetoshow = $langs->trans("Comment");
- }
- if ($fieldlist[$field] == 'category_type') {
- $valuetoshow = $langs->trans("Calculated");
- }
- // Affiche nom du champ
- if ($showfield) {
- print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "", $sortfield, $sortorder, $class.' ');
- }
- }
- print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
- print getTitleFieldOfList('');
- print getTitleFieldOfList('');
- print getTitleFieldOfList('');
- print '
';
-
- if ($num) {
- // Lines with values
- while ($i < $num) {
- $obj = $db->fetch_object($resql);
- //print_r($obj);
- print '';
- if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
- $tmpaction = 'edit';
- $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
- $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
- $error = $hookmanager->error; $errors = $hookmanager->errors;
-
- // Show fields
- if (empty($reshook)) {
- fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'edit');
- }
-
- print ' | ';
- print ' | ';
- print '';
- print '';
- print '';
- print '';
- print '';
- print '';
- print ' | ';
- print ' | ';
- } else {
- $tmpaction = 'view';
- $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
- $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
-
- $error = $hookmanager->error; $errors = $hookmanager->errors;
-
- if (empty($reshook)) {
- foreach ($fieldlist as $field => $value) {
- $showfield = 1;
- $class = "left";
- $valuetoshow = $obj->{$fieldlist[$field]};
- if ($value == 'category_type') {
- $valuetoshow = yn($valuetoshow);
- } elseif ($valuetoshow == 'all') {
- $valuetoshow = $langs->trans('All');
- } elseif ($fieldlist[$field] == 'country') {
- if (empty($obj->country_code)) {
- $valuetoshow = '-';
- } else {
- $key = $langs->trans("Country".strtoupper($obj->country_code));
- $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
- }
- } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
- $key = $langs->trans("Country".strtoupper($obj->code));
- $valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
- } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
- $langs->loadLangs(array("propal"));
- $key = $langs->trans("AvailabilityType".strtoupper($obj->code));
- $valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
- } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
- $key = $langs->trans("Action".strtoupper($obj->code));
- $valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
- } elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
- $showfield = 0;
- }
-
- $class = 'tddict';
- // Show value for field
- if ($showfield) {
- print ''.dol_escape_htmltag($valuetoshow).' | ';
- }
- }
- }
-
- // Can an entry be erased or disabled ?
- $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
- if (isset($obj->code)) {
- if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
- $iserasable = 0; $canbedisabled = 0;
- }
- }
-
- $canbemodified = $iserasable;
-
- $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
- if ($param) {
- $url .= '&'.$param;
- }
- $url .= '&';
-
- // Active
- print '';
- if ($canbedisabled) {
- print ''.$actl[$obj->active].'';
- } else {
- print $langs->trans("AlwaysActive");
- }
- print " | ";
-
- // Modify link
- if ($canbemodified) {
- print ''.img_edit().' | ';
- } else {
- print ' | ';
- }
-
- // Delete link
- if ($iserasable) {
- print '';
- if ($user->admin) {
- print ''.img_delete().'';
- }
- //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin
- print ' | ';
- } else {
- print ' | ';
- }
-
- // Link to setup the group
- print '';
- if (empty($obj->formula)) {
- print '';
- print $langs->trans("ListOfAccounts");
- print '';
- }
- print ' | ';
- }
- print "
\n";
- $i++;
- }
- }
- } else {
- dol_print_error($db);
- }
-
- print '