diff --git a/htdocs/.htaccess b/htdocs/.htaccess new file mode 100644 index 00000000000..5a928f6da25 --- /dev/null +++ b/htdocs/.htaccess @@ -0,0 +1 @@ +Options -Indexes diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 07034c8389c..395c9587b7e 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -280,6 +280,7 @@ if (strlen(trim($search_pcgtype))) { $sql .= natural_search("aa.pcg_type", $search_pcgtype); } $sql .= $db->order($sortfield, $sortorder); +//print $sql; // Count total nb of records $nbtotalofrecords = ''; @@ -457,7 +458,7 @@ if ($resql) { $totalarray['nbfield']++; } if (!empty($arrayfields['aa.pcg_type']['checked'])) { - print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1); + 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); $totalarray['nbfield']++; } if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 7e77817ac5c..bee481bebd6 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -55,7 +55,7 @@ $accountingcategory = new AccountancyCategory($db); * Actions */ -// si ajout de comptes +// If we add account if (!empty($selectcpt)) { $cpts = array(); foreach ($selectcpt as $selectedoption) { @@ -72,6 +72,7 @@ if (!empty($selectcpt)) { setEventMessages($langs->trans('RecordModifiedSuccessfully'), null, 'mesgs'); } } + if ($action == 'delete') { if ($cpt_id) { if ($accountingcategory->deleteCptCat($cpt_id)) { @@ -93,8 +94,9 @@ $formaccounting = new FormAccounting($db); llxheader('', $langs->trans('AccountingCategory')); $linkback = ''.$langs->trans("BackToList").''; +$titlepicto = 'setup'; -print load_fiche_titre($langs->trans('AccountingCategory'), $linkback); +print load_fiche_titre($langs->trans('AccountingCategory'), $linkback, $titlepicto); print '
'."\n"; print ''; diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index cb987055cea..549bd942524 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php'; // Load translation files required by the page $langs->loadLangs(array("errors", "admin", "companies", "resource", "holiday", "accountancy", "hrm")); @@ -52,7 +53,6 @@ $actl[1] = img_picto($langs->trans("Activated"), 'switch_on'); $listoffset = GETPOST('listoffset', 'alpha'); $listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000; -$active = 1; $sortfield = GETPOST("sortfield", 'aZ09comma'); $sortorder = GETPOST("sortorder", 'aZ09comma'); @@ -124,11 +124,7 @@ $tabfieldcheck[32] = array(); // Complete all arrays with entries found into modules complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck); - -// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact") -$elementList = array(); -$sourceList = array(); - +$accountingcategory = new AccountancyCategory($db); /* @@ -428,7 +424,7 @@ llxHeader('', $langs->trans('DictionaryAccountancyCategory')); $titre = $langs->trans($tablib[$id]); $linkback = ''; -$titlepicto = 'title_accountancy'; +$titlepicto = 'setup'; print load_fiche_titre($titre, $linkback, $titlepicto); @@ -438,427 +434,432 @@ print ''.$langs->trans("AccountingAccountGroupsDesc" if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id.($search_country_id > 0 ? '&search_country_id='.$search_country_id : ''), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); } -//var_dump($elementList); -/* - * Show a dictionary - */ -if ($id) { - // Complete requete recherche valeurs avec critere de tri - $sql = $tabsql[$id]; +// Complete requete recherche valeurs avec critere de tri +$sql = $tabsql[$id]; - if ($search_country_id > 0) { - if (preg_match('/ WHERE /', $sql)) { - $sql .= " AND "; - } else { - $sql .= " WHERE "; - } - $sql .= " (a.fk_country = ".$search_country_id." OR a.fk_country = 0)"; +if ($search_country_id > 0) { + if (preg_match('/ WHERE /', $sql)) { + $sql .= " AND "; + } else { + $sql .= " WHERE "; } + $sql .= " (a.fk_country = ".$search_country_id." OR a.fk_country = 0)"; +} - // If sort order is "country", we use country_code instead - if ($sortfield == 'country') { - $sortfield = 'country_code'; - } - $sql .= $db->order($sortfield, $sortorder); - $sql .= $db->plimit($listlimit + 1, $offset); - //print $sql; +// If sort order is "country", we use country_code instead +if ($sortfield == 'country') { + $sortfield = 'country_code'; +} +$sql .= $db->order($sortfield, $sortorder); +$sql .= $db->plimit($listlimit + 1, $offset); +//print $sql; +$fieldlist = explode(',', $tabfield[$id]); + +print ''; +print ''; +print ''; + +print '
'; +print ''; + +// Form to add a new line +if ($tabname[$id]) { $fieldlist = explode(',', $tabfield[$id]); - 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"); + } + } + 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"); + } - print '
'; - print '
'; + if ($valuetoshow != '') { + print ''; + } + } - // Form to add a new line - if ($tabname[$id]) { - $fieldlist = explode(',', $tabfield[$id]); + 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 ""; + + $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 ''; + } + + // 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 ''; + $filterfound++; + } else { + print ''; + } + } + } + print ''; + print ''; + print ''; + 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 ''; + 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 ''; + } + } + } + + // 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 '"; + + // Modify link + if ($canbemodified) { + print ''; + } else { + print ''; + } + + // Delete link + if ($iserasable) { + print ''; + } else { + print ''; + } + + // Link to setup the group + print ''; } + print "\n"; + $i++; } - - 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 ""; - - $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 ''; - } - - // 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 ''; - $filterfound++; - } else { - print ''; - } - } - } - print ''; - print ''; - print ''; - 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 ''; - } 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 ''; - } - } - } - - // 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 '"; - - // Modify link - if ($canbemodified) { - print ''; - } else { - print ''; - } - - // Delete link - if ($iserasable) { - print ''; - } else { - print ''; - } - - // Link to setup the group - print ''; - } - print "\n"; - $i++; - } - } - } else { - dol_print_error($db); - } - - 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 ''; + print ''; + print '
'; + print ''; + print '
 
'; + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); + print '
'; + print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); + print ''; + if ($filterfound) { + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + } + 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 '
'.dol_escape_htmltag($valuetoshow).''; + if ($canbedisabled) { + print ''.$actl[$obj->active].''; } else { - print $valuetoshow; + print $langs->trans("AlwaysActive"); + } + print "'.img_edit().' '; + if ($user->admin) { + print ''.img_delete().''; + } + //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin + 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 ''; - print '
'; - print ''; - print '
 
'; - print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); - print '
'; - print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); - print ''; - if ($filterfound) { - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - } - print '
'; - print ''; - print ''; - print ''; - print '
'; - print ''; - print '
'.dol_escape_htmltag($valuetoshow).''; - if ($canbedisabled) { - print ''.$actl[$obj->active].''; - } else { - print $langs->trans("AlwaysActive"); - } - print "'.img_edit().' '; - if ($user->admin) { - print ''.img_delete().''; - } - //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin - print ' '; - if (empty($obj->formula)) { - print ''; - print $langs->trans("ListOfAccounts"); - print ''; - } - print '
'; - print '
'; - - print ''; +} else { + dol_print_error($db); } +print ''; +print ''; + +print ''; + print '
'; // End of page @@ -879,9 +880,6 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co { global $conf, $langs, $db; global $form, $mysoc; - global $region_id; - global $elementList, $sourceList, $localtax_typeList; - global $bc; $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 3e171110c8b..9550933f2d8 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -418,10 +418,10 @@ class AccountancyCategory // extends CommonObject /** - * Function to select all accounting accounts from an accounting category + * Function to select into ->lines_display all accounting accounts for a given custom accounting group * - * @param int $id Id - * @return int <0 if KO, 0 if not found, >0 if OK + * @param int $id Id + * @return int <0 if KO, 0 if not found, >0 if OK */ public function display($id) { @@ -453,23 +453,23 @@ class AccountancyCategory // extends CommonObject } /** - * Function to select accounting category of an accounting account present in chart of accounts + * Function to fill ->lines_cptbk with accounting account used (into bookkeeping) and not yet into a custom group * - * @param int $id Id category - * - * @return int <0 if KO, 0 if not found, >0 if OK + * @param int $id Id of custom group + * @return int <0 if KO, 0 if not found, >0 if OK */ + /* public function getCptBK($id) { global $conf; - $sql = "SELECT t.numero_compte, t.label_operation, t.doc_ref"; + $sql = "SELECT DISTINCT t.numero_compte, t.label_operation, t.doc_ref"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t"; - $sql .= " WHERE t.numero_compte NOT IN ("; + $sql .= " WHERE t.numero_compte NOT IN ("; // account not into a custom group $sql .= " SELECT t.account_number"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t"; - $sql .= " WHERE t.fk_accounting_category = ".$id." AND t.entity = ".$conf->entity.")"; - $sql .= " AND t.numero_compte IN ("; + $sql .= " WHERE t.fk_accounting_category = ".((int) $id)." AND t.entity = ".$conf->entity.")"; + $sql .= " AND t.numero_compte IN ("; // account into current chart of account $sql .= " SELECT DISTINCT aa.account_number"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; @@ -479,7 +479,7 @@ class AccountancyCategory // extends CommonObject $sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref"; $sql .= " ORDER BY t.numero_compte"; - $this->lines_CptBk = array(); + $this->lines_cptbk = array(); dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); @@ -500,13 +500,13 @@ class AccountancyCategory // extends CommonObject return -1; } } + */ /** - * Function to select accounting category of an accounting account present in chart of accounts + * Function to fill ->lines_cptbk with accounting account (defined in chart of account) and not yet into a custom group * - * @param int $id Id of category to know which account to exclude - * - * @return int <0 if KO, 0 if not found, >0 if OK + * @param int $id Id of category to know which account to exclude + * @return int <0 if KO, 0 if not found, >0 if OK */ public function getAccountsWithNoCategory($id) { @@ -515,14 +515,14 @@ class AccountancyCategory // extends CommonObject $sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; - $sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)"; - $sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS; + $sql .= " WHERE (aa.fk_accounting_category <> ".((int) $id)." OR aa.fk_accounting_category IS NULL)"; + $sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS); $sql .= " AND aa.active = 1"; $sql .= " AND aa.entity = ".$conf->entity; $sql .= " GROUP BY aa.account_number, aa.label"; $sql .= " ORDER BY aa.account_number, aa.label"; - $this->lines_CptBk = array(); + $this->lines_cptbk = array(); dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); @@ -656,7 +656,7 @@ class AccountancyCategory // extends CommonObject } /** - * Function to know all category from accounting account + * Function to know all custom groupd from an accounting account * * @return array|integer Result in table (array), -1 if KO */ @@ -785,7 +785,7 @@ class AccountancyCategory // extends CommonObject } /** - * Return list of personalized groups that are active + * Return list of custom groups that are active * * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups * @return array|int Array of groups or -1 if error @@ -843,11 +843,11 @@ class AccountancyCategory // extends CommonObject /** - * Get all accounting account of a group. + * Get all accounting account of a custom group (or a list of custom groups). * You must choose between first parameter (personalized group) or the second (free criteria filter) * * @param int $cat_id Id if personalized accounting group/category - * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts + * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts. This value must not come from an input of a user. * @return array|int Array of accounting accounts or -1 if error */ public function getCptsCat($cat_id, $predefinedgroupwhere = '') diff --git a/htdocs/adherents/admin/member_emails.php b/htdocs/adherents/admin/member_emails.php index cdda83b4714..c55d44d391f 100644 --- a/htdocs/adherents/admin/member_emails.php +++ b/htdocs/adherents/admin/member_emails.php @@ -50,15 +50,15 @@ $error = 0; // Editing global variables not related to a specific theme $constantes = array( 'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))), - 'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member', - 'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */ - 'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */ - 'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */ - 'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */ - 'ADHERENT_EMAIL_TEMPLATE_EXCLUSION' =>'emailtemplate:member', - 'ADHERENT_MAIL_FROM'=>'string', - 'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'=>'string', - 'ADHERENT_AUTOREGISTER_NOTIF_MAIL'=>'html', + 'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member', + 'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', // until Dolibarr 7 it was ADHERENT_AUTOREGISTER_MAIL + 'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', // until Dolibarr 7 it was ADHERENT_MAIL_VALID + 'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', // until Dolibarr 7 it was ADHERENT_MAIL_COTIS + 'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', // until Dolibarr 7 it was ADHERENT_MAIL_RESIL + 'ADHERENT_EMAIL_TEMPLATE_EXCLUSION' =>'emailtemplate:member', + 'ADHERENT_MAIL_FROM' =>'string', + 'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT' =>'string', + 'ADHERENT_AUTOREGISTER_NOTIF_MAIL' =>'html', ); @@ -128,7 +128,7 @@ if ($action == 'update' || $action == 'add') { $form = new Form($db); -$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; +$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder'; llxHeader('', $langs->trans("MembersSetup"), $help_url); diff --git a/htdocs/adherents/admin/member_type_extrafields.php b/htdocs/adherents/admin/member_type_extrafields.php index 91a9233e5d0..68916df624f 100644 --- a/htdocs/adherents/admin/member_type_extrafields.php +++ b/htdocs/adherents/admin/member_type_extrafields.php @@ -67,7 +67,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; $textobject = $langs->transnoentitiesnoconv("MembersTypes"); -$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; +$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder'; llxHeader('', $langs->trans("MembersSetup"), $help_url); diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index eaea02cda3a..37ec67e1ba3 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -239,7 +239,10 @@ if (empty($reshook)) { $form = new Form($db); $formfile = new FormFile($db); -llxHeader('', $langs->trans("BOM"), ''); + +$title = $langs->trans('BOM'); + +llxHeader('', $title, ''); // Example : Adding jquery code print '