diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index ed3ee851709..9bb31534dca 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -90,8 +90,8 @@ $arrayfields = array( '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) + 'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1), + 'aa.active'=>array('label'=>"Activated", 'checked'=>1) ); if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -448,7 +448,7 @@ if ($resql) { print '
'; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields + $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); $moreforfilter = ''; @@ -581,8 +581,9 @@ if ($resql) { print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } + // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); $totalarray['nbfield']++; } print "\n"; @@ -601,15 +602,25 @@ if ($resql) { // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + print ''; + if ($user->hasRight('accounting', 'chartofaccount')) { + print ''; + print img_edit(); + print ''; + print ' '; + print ''; + print img_delete(); + print ''; + print ' '; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; } - print ''; + print ''."\n"; if (!$i) { $totalarray['nbfield']++; } @@ -627,7 +638,7 @@ if ($resql) { // Account label if (!empty($arrayfields['aa.label']['checked'])) { - print ""; + print ''; print dol_escape_htmltag($obj->label); print "\n"; if (!$i) { @@ -747,15 +758,25 @@ if ($resql) { // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + print ''; + if ($user->hasRight('accounting', 'chartofaccount')) { + print ''; + print img_edit(); + print ''; + print ' '; + print ''; + print img_delete(); + print ''; + print ' '; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; } - print ''; + print ''."\n"; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 26287a5bbb8..7f2bf439c09 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -381,7 +381,7 @@ if ($action == 'create') { print '
'; print '
'; - print ''; + print '
'; // Label print ''; diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 7b660419daf..4ef7fe78726 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -131,8 +131,12 @@ print '
'.$langs->trans("Label").'
'; // Select the category print ''; print ''; print '
'.$langs->trans("AccountingCategory").''; -print $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0); -print ''; +$s = $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0); +if ($formaccounting->nbaccounts_category <= 0) { + print ''.$s.''; +} else { + print ''; +} print '
'; diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 7b7148f89ce..59d9f219ee4 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -58,9 +58,10 @@ $listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000 $sortfield = GETPOST("sortfield", 'aZ09comma'); $sortorder = GETPOST("sortorder", 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $listlimit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -450,7 +451,7 @@ if (empty($sortfield)) { $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($listlimit + 1, $offset); -//print $sql; + $fieldlist = explode(',', $tabfield[$id]); @@ -468,7 +469,9 @@ if ($sortfield) { if (GETPOST('from', 'alpha')) { $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha')); } - +if ($listlimit) { + $paramwithsearch .= '&listlimit='.urlencode(GETPOST('listlimit', 'int')); +} print '
'; print ''; print ''; @@ -476,7 +479,7 @@ print ''; -print '
'; +print '
'; print ''; // Form to add a new line @@ -485,6 +488,10 @@ if ($tabname[$id]) { // Line for title print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } foreach ($fieldlist as $field => $value) { // Determine le nom du champ par rapport aux noms possibles // dans les dictionnaires de donnees @@ -524,6 +531,7 @@ if ($tabname[$id]) { } if ($fieldlist[$field] == 'range_account') { $valuetoshow = $langs->trans("Comment"); + $class = 'width75'; } if ($fieldlist[$field] == 'category_type') { $valuetoshow = $langs->trans("Calculated"); @@ -546,13 +554,20 @@ if ($tabname[$id]) { print ''; print ''; print ''; - print ''; - print ''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ''; // Line to enter new values print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + $obj = new stdClass(); // If data was already input, we define them in obj to populate input fields. if (GETPOST('actionadd', 'alpha')) { @@ -572,19 +587,29 @@ if ($tabname[$id]) { fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'add'); } - print ''; + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print ""; $colspan = count($fieldlist) + 3; if ($id == 32) { $colspan++; } - - print ''; // Keep   to have a line with enough height } +print '
'; + print ''; print ''; print '
 
'; +print '
'; + +print '
'; +print ''; + // List of available record in database dol_syslog("htdocs/accountancy/admin/categories_list.php", LOG_DEBUG); @@ -595,13 +620,37 @@ if ($resql) { // There is several pages if ($num > $listlimit) { - 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') { + $filterfound++; + } + } + } + // Title line with search boxes print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + $filterfound = 0; foreach ($fieldlist as $field => $value) { $showfield = 1; // By defaut @@ -623,17 +672,23 @@ if ($resql) { } print ''; print ''; - print ''; - print ''; } - print ''; print ''; // Title of lines print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(''); + } foreach ($fieldlist as $field => $value) { // Determines the name of the field in relation to the possible names // in data dictionaries @@ -707,16 +762,22 @@ if ($resql) { print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "", $sortfield, $sortorder, $class.' '); } } + print getTitleFieldOfList($langs->trans("ListOfAccounts"), 0, $_SERVER["PHP_SELF"], "", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, ''); print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center '); - print getTitleFieldOfList(''); - print getTitleFieldOfList(''); - print getTitleFieldOfList(''); + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(''); + } print ''; + if ($num) { + $imaxinloop = ($listlimit ? min($num, $listlimit) : $num); + // Lines with values - while ($i < $num) { + while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); + //print_r($obj); print ''; if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { @@ -725,12 +786,16 @@ if ($resql) { $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; + // Actions + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + // Show fields if (empty($reshook)) { fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'edit'); } - print ''; print ''; print ''; - print ''; + // Actions + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } } else { + // 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; + } + } + $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 .= '&'; + + $canbemodified = $iserasable; + $tmpaction = 'view'; $parameters = array('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; + // Actions + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + if (empty($reshook)) { foreach ($fieldlist as $field => $value) { $showfield = 1; - $class = "left"; + $title = ''; + $class = 'tddict'; + $tmpvar = $fieldlist[$field]; $valuetoshow = $obj->$tmpvar; if ($value == 'category_type') { @@ -764,43 +863,35 @@ if ($resql) { $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 (in_array($fieldlist[$field], array('label', 'range_account', 'formula'))) { + $class = "tdoverflowmax250"; + $title = $valuetoshow; } elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') { $showfield = 0; } - $class = 'tddict'; // Show value for field if ($showfield) { - print ''; + 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; - } - } + // Link to setup the group + print ''; // Active print '"; - // Modify link - if ($canbemodified) { - print ''; - } else { - print ''; - } - - // Delete link - if ($iserasable) { + // Actions + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; - } else { - print ''; } - - // Link to setup the group - print ''; } print "\n"; $i++; } } else { - $colspan = 11; + $colspan = 10; print ''; } } else { @@ -920,20 +987,14 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co print ''; } else { print ''; } } diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 18797312ad8..0b172c4e36e 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -356,7 +356,7 @@ if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''."\n"; print ''."\n"; print ''."\n"; } @@ -386,7 +386,7 @@ if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { // We use an option here because it adds bugs when used on agenda page "peruser" and "list" $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE)); } -$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1, $multiselect); +$formactions->select_type_actions(getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE'), "AGENDA_DEFAULT_FILTER_TYPE", '', (getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? -1 : 1), 1, $multiselect); print ''."\n"; // AGENDA_DEFAULT_FILTER_STATUS diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 7dac8f9d440..91b7c3a00d0 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -216,8 +216,8 @@ $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as $tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; $tabsql[10] = "SELECT t.rowid, t.entity, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays = c.rowid AND t.entity = ".getEntity($tabname[10]); $tabsql[11] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; -$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = ".getEntity($tabname[12]); -$tabsql[13] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = ".getEntity($tabname[13]); +$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity IN (".getEntity($tabname[12]).")"; +$tabsql[13] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity IN (".getEntity($tabname[13]).")"; $tabsql[14] = "SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1"; $tabsql[15] = "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format"; $tabsql[16] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel"; @@ -229,7 +229,7 @@ $tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.type_duration, c.qty, $tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason"; $tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource"; -$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]); +$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity($tabname[25]).")"; //$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units"; $tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm"; $tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; @@ -242,7 +242,7 @@ $tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PR $tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c"; $tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r"; $tabsql[37] = "SELECT r.rowid, r.code, r.sortorder, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r"; -$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity = ".getEntity($tabname[38]); +$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity IN (".getEntity($tabname[38]).")"; $tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel"; $tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact"; $tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode"; @@ -310,8 +310,8 @@ $tabfield[8] = "code,libelle,country_id,country".(!empty($conf->global->SOCIETE_ $tabfield[9] = "code,label,unicode"; $tabfield[10] = "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[11] = "element,source,code,libelle,position"; -$tabfield[12] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity"; -$tabfield[13] = "code,libelle,type,entity"; +$tabfield[12] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder"; +$tabfield[13] = "code,libelle,type"; $tabfield[14] = "code,label,price,organization,country"; $tabfield[15] = "code,libelle,width,height,unit"; $tabfield[16] = "code,libelle,sortorder"; @@ -336,7 +336,7 @@ $tabfield[34] = "code,label"; $tabfield[35] = "label"; $tabfield[36] = "range_ik,fk_c_exp_tax_cat"; $tabfield[37] = "code,label,short_label,unit_type,scale,sortorder"; -$tabfield[38] = "code,label,url,icon,entity"; +$tabfield[38] = "code,label,url,icon"; $tabfield[39] = "code,libelle,sortorder"; $tabfield[40] = "code,libelle,picto"; $tabfield[41] = "code,label"; @@ -391,7 +391,7 @@ $tabfieldvalue[42] = "code,label"; $tabfieldvalue[43] = "code,label"; $tabfieldvalue[44] = "code,label"; -// Field names in the table for inserting a record +// Field names in the table for inserting a record (add field "entity" only here when dictionary is ready to personalized by entity) $tabfieldinsert = array(); $tabfieldinsert[1] = "code,libelle,fk_pays"; $tabfieldinsert[2] = "code_departement,nom,fk_region"; @@ -417,7 +417,7 @@ $tabfieldinsert[21] = "code,label,qty,type_duration,position"; $tabfieldinsert[22] = "code,label"; $tabfieldinsert[23] = "fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[24] = "code,label"; -$tabfieldinsert[25] = "code,label"; +$tabfieldinsert[25] = "code,label,entity"; //$tabfieldinsert[26]= "code,label,short_label"; $tabfieldinsert[27] = "code,libelle,picto"; $tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder"; @@ -890,7 +890,7 @@ if (empty($reshook)) { } $i = 0; foreach ($listfieldinsert as $f => $value) { - $keycode = $listfieldvalue[$i]; + $keycode = (isset($listfieldvalue[$i]) ? $listfieldvalue[$i] : ''); if (empty($keycode)) { $keycode = $value; } diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index ddc48e264c4..a340d7ef7c3 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -270,7 +270,7 @@ if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) { if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { $colspan++; } - print ''; + print ''; } print '
'; + print '
'; print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); print '
'; + if ($filterfound) { + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + } + print ''; - if ($filterfound) { - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($filterfound) { + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + } + print '
'; print '
'; @@ -739,18 +804,52 @@ if ($resql) { print ''; print ''; print '
'; + if ($canbemodified) { + print ''.img_edit().''; + } + if ($iserasable) { + if ($user->admin) { + print ''.img_delete().''; + } + } + print ''.dol_escape_htmltag($valuetoshow).''.dol_escape_htmltag($valuetoshow).''; + if (empty($obj->formula)) { + // Count number of accounts into group + $nbofaccountintogroup = 0; + $listofaccountintogroup = $accountingcategory->getCptsCat($obj->rowid); + $nbofaccountintogroup = count($listofaccountintogroup); - $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; + print ''; + print $langs->trans("NAccounts", $nbofaccountintogroup); + print ''; + } else { + print ''.$langs->trans("Formula").''; } - $url .= '&'; + print ''; @@ -811,49 +902,25 @@ if ($resql) { } print "'.img_edit().' '; - if ($user->admin) { - print ''.img_delete().''; + if ($canbemodified) { + print ''.img_edit().''; + } + if ($iserasable) { + 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 '
'.$langs->trans("None").'
'; - $size = ''; $class = ''; - if ($fieldlist[$field] == 'code') { + $class = ''; + if (in_array($fieldlist[$field], array('code', 'range_account', 'label', 'formula'))) { $class = 'maxwidth100'; } if ($fieldlist[$field] == 'position') { $class = 'maxwidth50'; } - if ($fieldlist[$field] == 'libelle') { - $class = 'quatrevingtpercent'; - } - if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'category_type') { - $size = 'size="2" '; - } - print ''; + print ''; print ''.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").' '."\n"; - $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1); + $formactions->select_type_actions(getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT'), "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1); print '
'.$langs->trans("NoInvoice").'
'.$langs->trans("NoInvoice").'

'; $db->free($resql); @@ -397,7 +397,7 @@ if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { $colspan++; } - print ''.$langs->trans("NoInvoice").''; + print ''.$langs->trans("NoInvoice").''; } print '

'; } else { @@ -488,7 +488,7 @@ if (isModEnabled('don') && $user->hasRight('don', 'lire')) { print "\n"; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print '

'; } else { @@ -578,7 +578,7 @@ if (isModEnabled('tax') && !empty($user->rights->tax->charges->lire)) { print ' '; print ''; } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print "
"; $db->free($resql); diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 9c72c98721c..b1917f42ee8 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -48,6 +48,10 @@ class FormAccounting extends Form * @var int Nb of accounts found */ public $nbaccounts; + /** + * @var int Nb of accounts category found + */ + public $nbaccounts_category; /** @@ -235,7 +239,7 @@ class FormAccounting extends Form public function select_accounting_category($selected = '', $htmlname = 'account_category', $useempty = 0, $maxlen = 0, $help = 1, $allcountries = 0) { // phpcs:enable - global $db, $langs, $mysoc; + global $langs, $mysoc; if (empty($mysoc->country_id) && empty($mysoc->country_code) && empty($allcountries)) { dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); @@ -263,11 +267,15 @@ class FormAccounting extends Form $sql .= " ORDER BY c.label ASC"; } + $this->nbaccounts_category = 0; + dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); if ($num) { + $this->nbaccounts_category = $num; + $out = ''; + print ''.$langs->trans("ProductRef").''; if ($refalreadyexists) { print $langs->trans("RefAlreadyExists"); } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 0f99d58720e..b804f786c6a 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -220,7 +220,7 @@ $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? // Definition of array of fields for columns $arrayfields = array( 'p.rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'), - 'p.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>10), + 'p.ref'=>array('label'=>'ProductRef', 'checked'=>1, 'position'=>10), //'pfp.ref_fourn'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1, 'enabled'=>(isModEnabled('barcode'))), 'thumbnail'=>array('label'=>'Photo', 'checked'=>0, 'position'=>10), 'p.label'=>array('label'=>"Label", 'checked'=>1, 'position'=>10), @@ -852,16 +852,15 @@ if ($type === "") { if ($type === "") { $params['forcenohideoftext'] = 1; } -if ($type === "") { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', $perm, $params); - $type = Product::TYPE_SERVICE; -} - $label = 'NewProduct'; -if ($type == Product::TYPE_SERVICE) { - $label = 'NewService'; -} - $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type='.$type, '', $perm, $params); +if ($type === "" || $type == Product::TYPE_PRODUCT) { + $label = 'NewProduct'; + $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', $perm, $params); +} +if ($type === "" || $type == Product::TYPE_SERVICE) { + $label = 'NewService'; + $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=1', '', $perm, $params); +} print ''; if ($optioncss != '') { diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 9447187e16c..275e08373e2 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -773,7 +773,7 @@ print ''; // Lines of title print ''; print_liste_field_titre('', $_SERVER["PHP_SELF"], ''); -print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); +print_liste_field_titre('ProductRef', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); if (isModEnabled("service") && $type == 1) { print_liste_field_titre('Duration', $_SERVER["PHP_SELF"], 'p.duration', $param, '', '', $sortfield, $sortorder, 'center '); diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 0e16bf8d68b..1f57ad3a934 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -487,7 +487,7 @@ if (!empty($search_fk_warehouse)) { // Lines of title print ''; -print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); +print_liste_field_titre('ProductRef', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); if ($mode == 'future') { @@ -502,13 +502,14 @@ if ($mode == 'future') { print_liste_field_titre('', $_SERVER["PHP_SELF"]); print_liste_field_titre('CurrentStock', $_SERVER["PHP_SELF"], $fieldtosortcurrentstock, $param, '', '', $sortfield, $sortorder, 'right '); } -print_liste_field_titre('', $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right '); // Hook fields $parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; +print_liste_field_titre('', $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right '); + print "\n"; $totalbuyingprice = 0; @@ -643,14 +644,14 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $totalcurrentstock += $currentstock; } - // Action - print ''; - // Fields from hook $parameters = array('objp'=>$objp); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + // Action + print ''; + print ''."\n"; } $i++; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 45c7c12f487..b8e449f0748 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1598,8 +1598,8 @@ class Task extends CommonObjectLine if ($timespent->id > 0) { $this->timespent_id = $timespent->id; $this->id = $timespent->fk_element; - $this->timespent_date = $this->db->jdate($timespent->element_date); - $this->timespent_datehour = $this->db->jdate($timespent->element_datehour); + $this->timespent_date = $timespent->element_date; + $this->timespent_datehour = $timespent->element_datehour; $this->timespent_withhour = $timespent->element_date_withhour; $this->timespent_duration = $timespent->element_duration; $this->timespent_fk_user = $timespent->fk_user; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index d1b87656588..676e91857f4 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -5349,7 +5349,7 @@ class Societe extends CommonObject if ($code) { $sql .= " AND tc.code = '".$this->db->escape($code)."'"; } - $sql .= " AND sc.entity = ".getEntity($this->element); + $sql .= " AND sc.entity IN (".getEntity($this->element).")"; $sql .= " AND tc.source = 'external'"; $sql .= " AND tc.active=1"; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 08334b5efea..b5367108f7c 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1276,7 +1276,8 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_type"; - $sql .= " WHERE active > 0"; + $sql .= " WHERE entity IN (".getEntity('c_ticket_type').")"; + $sql .= " AND active > 0"; $sql .= " ORDER BY pos"; dol_syslog(get_class($this)."::load_cache_type_tickets", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1316,7 +1317,8 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description, public, active, force_severity, fk_parent"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category"; - $sql .= " WHERE active > 0 AND entity = ".((int) $conf->entity); + $sql .= " WHERE entity IN (".getEntity('c_ticket_category').")"; + $sql .= " WHERE active > 0"; if ($publicgroup > -1) { $sql .= " AND public = ".((int) $publicgroup); } @@ -1368,7 +1370,8 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_severity"; - $sql .= " WHERE active > 0"; + $sql .= " WHERE entity IN (".getEntity('c_ticket_severity').")"; + $sql .= " AND active > 0"; $sql .= " ORDER BY pos"; dol_syslog(get_class($this)."::loadCacheSeveritiesTickets", LOG_DEBUG); $resql = $this->db->query($sql);