diff --git a/htdocs/bookcal/bookcalindex.php b/htdocs/bookcal/bookcalindex.php index c54181584d0..8248ca44308 100644 --- a/htdocs/bookcal/bookcalindex.php +++ b/htdocs/bookcal/bookcalindex.php @@ -44,8 +44,9 @@ if (isset($user->socid) && $user->socid > 0) { $socid = $user->socid; } -$max = 5; $now = dol_now(); +$NBMAX = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT'); +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); /* @@ -137,9 +138,6 @@ if ($user->hasRight('bookcal', 'availabilities', 'read') && isModEnabled('bookca print '
'; -$NBMAX = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT'); -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); - /* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT // Last modified myobject if (isModEnabled('bookcal')) { diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 4b7aa0ca172..d5567fe9bc4 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -64,7 +64,7 @@ if (isset($user->socid) && $user->socid > 0) { } -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); $maxofloop = (!getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD); $now = dol_now(); @@ -479,6 +479,7 @@ if ((isModEnabled("fournisseur") && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMO $companystatic->name_alias = $obj->name_alias; $companystatic->code_client = $obj->code_client; $companystatic->code_compta = $obj->code_compta; + $companystatic->code_compta_client = $obj->code_compta; $companystatic->client = $obj->client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur; @@ -705,6 +706,189 @@ if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) { } +/* + * Last modified proposals + */ + +if (isModEnabled('proposal')) { + $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut as status, date_cloture as datec, c.tms as datem,"; + $sql .= " s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta"; + $sql .= " FROM ".MAIN_DB_PREFIX."propal as c,"; + $sql .= " ".MAIN_DB_PREFIX."societe as s"; + $sql .= " WHERE c.entity IN (".getEntity($propalstatic->element).")"; + $sql .= " AND c.fk_soc = s.rowid"; + // If the internal user must only see his customers, force searching by him + $search_sale = 0; + if (!$user->hasRight('societe', 'client', 'voir')) { + $search_sale = $user->id; + } + // Search on sale representative + if ($search_sale && $search_sale != '-1') { + if ($search_sale == -2) { + $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)"; + } elseif ($search_sale > 0) { + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + } + } + // Search on socid + if ($socid) { + $sql .= " AND c.fk_soc = ".((int) $socid); + } + $sql .= " ORDER BY c.tms DESC"; + + $sql .= $db->plimit($max, 0); + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + + startSimpleTable($langs->trans("LastModifiedProposals", $max), "comm/propal/list.php", "sortfield=p.tms&sortorder=DESC", 2, -1, 'propal'); + + if ($num) { + $i = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); + + $propalstatic->id = $obj->rowid; + $propalstatic->ref = $obj->ref; + + $companystatic->id = $obj->socid; + $companystatic->name = $obj->socname; + $companystatic->client = $obj->client; + $companystatic->canvas = $obj->canvas; + $companystatic->email = $obj->email; + $companystatic->code_compta = $obj->code_compta; + + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'.$propalstatic->getNomUrl(1).''.$formfile->getDocumentsLink($propalstatic->element, $filename, $filedir).'
'; + print ''; + + print ''.$companystatic->getNomUrl(1, 'customer').''; + + $datem = $db->jdate($obj->datem); + print ''; + print dol_print_date($datem, 'day', 'tzuserrel'); + print ''; + + print ''.$propalstatic->LibStatut($obj->status, 3).''; + + print ''; + + $i++; + } + } + + finishSimpleTable(true); + $db->free($resql); + } else { + dol_print_error($db); + } +} + + +/* + * Latest modified orders + */ + +if (isModEnabled('order')) { + $commandestatic = new Commande($db); + + $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut as status, c.facture, c.date_cloture as datec, c.tms as datem,"; + $sql .= " s.nom as name, s.rowid as socid"; + $sql .= ", s.client"; + $sql .= ", s.code_client"; + $sql .= ", s.canvas"; + $sql .= " FROM ".MAIN_DB_PREFIX."commande as c,"; + $sql .= " ".MAIN_DB_PREFIX."societe as s"; + if (!$user->hasRight('societe', 'client', 'voir')) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= " WHERE c.fk_soc = s.rowid"; + $sql .= " AND c.entity IN (".getEntity('commande').")"; + //$sql.= " AND c.fk_statut > 2"; + if ($socid) { + $sql .= " AND c.fk_soc = ".((int) $socid); + } + if (!$user->hasRight('societe', 'client', 'voir')) { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + $sql .= " ORDER BY c.tms DESC"; + $sql .= $db->plimit($max, 0); + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + + startSimpleTable($langs->trans("LastModifiedOrders", $max), "commande/list.php", "sortfield=c.tms&sortorder=DESC", 2, -1, 'order'); + + if ($num) { + $i = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); + + print ''; + print ''; + + $commandestatic->id = $obj->rowid; + $commandestatic->ref = $obj->ref; + + $companystatic->id = $obj->socid; + $companystatic->name = $obj->name; + $companystatic->client = $obj->client; + $companystatic->code_client = $obj->code_client; + $companystatic->canvas = $obj->canvas; + + print ''; + print ''; + + print ''; + + print '
'; + print $commandestatic->getNomUrl(1); + print ''; + print ' '; + print ''; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->commande->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); + print '
'; + + print ''; + + print ''; + print $companystatic->getNomUrl(1, 'company', 16); + print ''; + + $datem = $db->jdate($obj->datem); + print ''; + print dol_print_date($datem, 'day', 'tzuserrel'); + print ''; + + print ''.$commandestatic->LibStatut($obj->status, $obj->facture, 3).''; + print ''; + $i++; + } + } + finishSimpleTable(true); + } else { + dol_print_error($db); + } +} + + /* * Last suppliers */ diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 57be7253100..cc1ffc5486e 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -39,7 +39,7 @@ $hookmanager->initHooks(array('proposalindex')); $langs->loadLangs(array('propal', 'companies')); $now = dol_now(); -$max = 5; +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); // Security check $socid = GETPOSTINT('socid'); @@ -160,10 +160,10 @@ print '
'; * Last modified proposals */ -$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, date_cloture as datec"; -$sql .= ", s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta"; -$sql .= " FROM ".MAIN_DB_PREFIX."propal as c"; -$sql .= ", ".MAIN_DB_PREFIX."societe as s"; +$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut as status, date_cloture as datec, c.tms as datem,"; +$sql .= " s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta"; +$sql .= " FROM ".MAIN_DB_PREFIX."propal as c,"; +$sql .= " ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE c.entity IN (".getEntity($propalstatic->element).")"; $sql .= " AND c.fk_soc = s.rowid"; // If the internal user must only see his customers, force searching by him @@ -190,7 +190,8 @@ $sql .= $db->plimit($max, 0); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - startSimpleTable($langs->trans("LastModifiedProposals", $max), "", "", 3); + + startSimpleTable($langs->trans("LastModifiedProposals", $max), "comm/propal/list.php", "sortfield=p.tms&sortorder=DESC", 2, -1, 'propal'); if ($num) { $i = 0; @@ -213,7 +214,7 @@ if ($resql) { print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -224,8 +225,13 @@ if ($resql) { print ''; print ''; - print ''; - print ''; + + $datem = $db->jdate($obj->datem); + print ''; + + print ''; print ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 1769bafaaad..616838c156c 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1254,7 +1254,7 @@ if (!empty($arrayfields['country.code_iso']['checked'])) { // Company type if (!empty($arrayfields['typent.code']['checked'])) { print ''; } @@ -1525,27 +1525,27 @@ if (!empty($arrayfields['state.nom']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['country.code_iso']['checked'])) { - print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'class="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['typent.code']['checked'])) { - print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'class="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.date']['checked'])) { - print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'class="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.fin_validite']['checked'])) { - print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'class="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.date_livraison']['checked'])) { - print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'p.date_livraison', '', $param, 'class="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'p.date_livraison', '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.date_signature']['checked'])) { - print_liste_field_titre($arrayfields['p.date_signature']['label'], $_SERVER["PHP_SELF"], 'p.date_signature', '', $param, 'class="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.date_signature']['label'], $_SERVER["PHP_SELF"], 'p.date_signature', '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['ava.rowid']['checked'])) { diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 564cfcde895..c4c8daddf81 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -56,9 +56,8 @@ if ($user->socid > 0) { $socid = $user->socid; } -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); - // Maximum elements of the tables +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); $maxDraftCount = !getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD; $maxLatestEditCount = 5; $maxOpenCount = !getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD; @@ -154,13 +153,11 @@ if (isModEnabled('order')) { print '
'; -$max = 5; - /* * Latest modified orders */ -$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,"; +$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut as status, c.facture, c.date_cloture as datec, c.tms as datem,"; $sql .= " s.nom as name, s.rowid as socid"; $sql .= ", s.client"; $sql .= ", s.code_client"; @@ -184,12 +181,10 @@ $sql .= $db->plimit($max, 0); $resql = $db->query($sql); if ($resql) { - print '
'; - print '
'.$propalstatic->getNomUrl(1).''.$companystatic->getNomUrl(1, 'customer').''.dol_print_date($db->jdate($obj->datec), 'day').''.$propalstatic->LibStatut($obj->fk_statut, 3).''; + print dol_print_date($datem, 'day', 'tzuserrel'); + print ''.$propalstatic->LibStatut($obj->status, 3).'
'; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, getDolGlobalString('SOCIETE_SORT_ON_TYPEENT', 'ASC'), 'maxwidth100', 1); print ajax_combobox('search_type_thirdparty'); print '
'; - print ''; - print ''; - $num = $db->num_rows($resql); + + startSimpleTable($langs->trans("LastModifiedOrders", $max), "commande/list.php", "sortfield=c.tms&sortorder=DESC", 2, -1, 'order'); + if ($num) { $i = 0; while ($i < $num) { @@ -228,24 +223,28 @@ if ($resql) { print ''; - print ''; - print ''; + + $datem = $db->jdate($obj->datem); + print ''; + + print ''; print ''; $i++; } } - print "
'.$langs->trans("LastModifiedOrders", $max).'
'; print $companystatic->getNomUrl(1, 'company', 16); print ''.dol_print_date($db->jdate($obj->datem), 'day').''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).''; + print dol_print_date($datem, 'day', 'tzuserrel'); + print ''.$commandestatic->LibStatut($obj->status, $obj->facture, 3).'

"; + finishSimpleTable(true); } else { dol_print_error($db); } -$max = 10; /* * Orders to process */ if (isModEnabled('order')) { - $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; + $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut as status, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; $sql .= ", s.client"; $sql .= ", s.code_client"; $sql .= ", s.canvas"; @@ -314,7 +313,7 @@ if (isModEnabled('order')) { print ''.dol_print_date($db->jdate($obj->date), 'day').''."\n"; - print ''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).''; + print ''.$commandestatic->LibStatut($obj->status, $obj->facture, 3).''; print ''; $i++; @@ -334,7 +333,7 @@ if (isModEnabled('order')) { * Orders that are in process */ if (isModEnabled('order')) { - $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; + $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut as status, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; $sql .= ", s.client"; $sql .= ", s.code_client"; $sql .= ", s.canvas"; @@ -403,7 +402,7 @@ if (isModEnabled('order')) { print ''.dol_print_date($db->jdate($obj->date), 'day').''."\n"; - print ''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).''; + print ''.$commandestatic->LibStatut($obj->status, $obj->facture, 3).''; print ''; $i++; diff --git a/htdocs/compta/facture/index.php b/htdocs/compta/facture/index.php index ea2543aeb90..795e54bbc6c 100644 --- a/htdocs/compta/facture/index.php +++ b/htdocs/compta/facture/index.php @@ -41,9 +41,8 @@ if (isset($user->socid) && $user->socid > 0) { $socid = $user->socid; } -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); - // Maximum elements of the tables +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); $maxDraftCount = !getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? $max : $conf->global->MAIN_MAXLIST_OVERLOAD; $maxOpenCount = !getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? $max : $conf->global->MAIN_MAXLIST_OVERLOAD; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 0d20375bcb5..1294ad99e78 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -67,9 +67,8 @@ if ($user->socid > 0) { $socid = $user->socid; } -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); - // Maximum elements of the tables +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); $maxDraftCount = !getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD; $maxLatestEditCount = 5; $maxOpenCount = !getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD; diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 9f7089afc5f..90bfa1362bd 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -44,6 +44,8 @@ $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTI $statut = GETPOST('statut') ? GETPOST('statut') : 1; +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); + // Security check $socid = 0; $id = GETPOSTINT('id'); @@ -58,6 +60,7 @@ $staticcontratligne = new ContratLigne($db); $productstatic = new Product($db); + /* * Action */ @@ -315,7 +318,6 @@ print '
'; // Last modified contracts -$max = 5; $sql = 'SELECT '; $sql .= " sum(".$db->ifsql("cd.statut=0", 1, 0).') as nb_initial,'; $sql .= " sum(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')", 1, 0).') as nb_running,'; @@ -353,7 +355,7 @@ if ($result) { print '
'; print ''; - print ''; + print ''; print ''; //print ''; print ''; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 5ade23faf61..711a0bb499d 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -158,7 +158,7 @@ class Conf extends stdClass // TODO Remove this part. /** - * @var stdClass Supplier + * @var stdClass Supplier */ public $fournisseur; @@ -582,10 +582,6 @@ class Conf extends stdClass } elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) { // If this is a module constant (must be at end) $modulename = strtolower($reg[1]); - $mapping = $this->deprecatedProperties(); - if (array_key_exists($modulename, $mapping)) { - $modulename = $mapping[$modulename]; - } $this->modules[$modulename] = $modulename; // Add this module in list of enabled modules // deprecated in php 8.2 @@ -594,7 +590,18 @@ class Conf extends stdClass $this->$modulename = new stdClass(); // We need this to use the ->enabled and the ->multidir, ->dir... } $this->$modulename->enabled = true; // TODO Remove this - //} + + // Duplicate entry with the new name + $mapping = $this->deprecatedProperties(); + if (array_key_exists($modulename, $mapping)) { + $newmodulename = $mapping[$modulename]; + $this->modules[$newmodulename] = $newmodulename; + + if (!isset($this->$newmodulename) || !is_object($this->$newmodulename)) { + $this->$newmodulename = new stdClass(); // We need this to use the ->enabled and the ->multidir, ->dir... + } + $this->$newmodulename->enabled = true; // TODO Remove this + } } } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d697c7595f3..323262c3727 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12641,14 +12641,14 @@ function getNonce() * @param string $header The first left header of the table (automatic translated) * @param string $link (optional) The link to a internal dolibarr page, when click on the number (without the first "/") * @param string $arguments (optional) Additional arguments for the link (e.g. "search_status=0") - * @param integer $emptyRows (optional) The count of empty columns after the first column + * @param integer $emptyColumns (optional) Number of empty columns to add after the first column * @param integer $number (optional) The number that is shown right after the first header, when not set the link is shown on the right side of the header as "FullList" * @param string $pictofulllist (optional) The picto to use for the full list link * @return void * * @see finishSimpleTable() */ -function startSimpleTable($header, $link = "", $arguments = "", $emptyRows = 0, $number = -1, $pictofulllist = '') +function startSimpleTable($header, $link = "", $arguments = "", $emptyColumns = 0, $number = -1, $pictofulllist = '') { global $langs; @@ -12656,7 +12656,7 @@ function startSimpleTable($header, $link = "", $arguments = "", $emptyRows = 0, print '
'.$langs->trans("LastContracts", 5).'
'.$langs->trans("LastContracts", $max).''.$langs->trans("DateModification").''.$langs->trans("Status").''.$langs->trans("Services").'
'; print ''; - print $emptyRows < 1 ? '
' : ''; + print ($emptyColumns < 1) ? '' : ''; print $langs->trans($header); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d41472c6528..f8f53593bdc 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1346,7 +1346,7 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le */ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) { - global $user, $conf, $langs; + global $user, $langs; if ($mainmenu == 'commercial') { $langs->load("companies"); diff --git a/htdocs/eventorganization/eventorganizationindex.php b/htdocs/eventorganization/eventorganizationindex.php index 538782131d1..fe1e16ba5a0 100644 --- a/htdocs/eventorganization/eventorganizationindex.php +++ b/htdocs/eventorganization/eventorganizationindex.php @@ -33,7 +33,8 @@ $langs->loadLangs(array("eventorganization")); $action = GETPOST('action', 'aZ09'); -$max = 5; +$NBMAX = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT', 5); +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); $now = dol_now(); // Security check @@ -147,9 +148,6 @@ END MODULEBUILDER DRAFT MYOBJECT */ print '
'; -$NBMAX = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT'); -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); - /* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT // Last modified myobject if (isModEnabled('eventorganization') && $user->rights->eventorganization->read) diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index ab95b3a5e0b..dfd0ec7a099 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -41,13 +41,6 @@ $hookmanager->initHooks(array('expensereportindex')); // Load translation files required by the page $langs->loadLangs(array('companies', 'users', 'trips')); -// Security check -$socid = GETPOSTINT('socid'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'expensereport', '', ''); - $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -66,7 +59,14 @@ if (!$sortfield) { } $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); + +// Security check +$socid = GETPOSTINT('socid'); +if ($user->socid) { + $socid = $user->socid; +} +$result = restrictedArea($user, 'expensereport', '', ''); /* diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index cfb5ab3577d..ca8b9349c9e 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -50,6 +50,7 @@ if ($user->socid > 0) { $socid = $user->socid; } +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); /* @@ -68,9 +69,7 @@ print load_fiche_titre($langs->trans("InterventionsArea"), '', 'intervention'); print '
'; -/* - * Statistics - */ +// Statistics $sql = "SELECT count(f.rowid), f.fk_statut"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -217,8 +216,6 @@ if (isModEnabled('intervention')) { print '
'; -$max = 5; - /* * Last modified interventions */ diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 46fa4f15166..dbf343a0824 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -37,6 +37,12 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // Load translation files required by the page $langs->loadLangs(array("suppliers", "orders")); +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('orderssuppliersindex')); + +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); // Security check $orderid = GETPOST('orderid'); @@ -45,12 +51,6 @@ if ($user->socid) { } $result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande'); -$hookmanager = new HookManager($db); - -// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager->initHooks(array('orderssuppliersindex')); - - /* * View @@ -285,7 +285,6 @@ print '
'; /* * Last modified orders */ -$max = 5; $sql = "SELECT c.rowid, c.ref, c.fk_statut as status, c.tms, c.billed, s.nom as name, s.rowid as socid"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index 16629f0febd..68f4a06dacc 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -38,9 +38,8 @@ if (isset($user->socid) && $user->socid > 0) { $socid = $user->socid; } -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); - // Maximum elements of the tables +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); $maxDraftCount = getDolGlobalInt('MAIN_MAXLIST_OVERLOAD', 500); $maxLatestEditCount = 5; $maxOpenCount = getDolGlobalInt('MAIN_MAXLIST_OVERLOAD', 500); diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 6790b12942c..cb75f8849e0 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -72,7 +72,7 @@ if (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') || !getDolGlobalString('MAIN_IN $setupcompanynotcomplete = 1; } -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); /* diff --git a/htdocs/modulebuilder/template/mymoduleindex.php b/htdocs/modulebuilder/template/mymoduleindex.php index 9597abbd11f..6405f5c67d9 100644 --- a/htdocs/modulebuilder/template/mymoduleindex.php +++ b/htdocs/modulebuilder/template/mymoduleindex.php @@ -64,8 +64,7 @@ $langs->loadLangs(array("mymodule@mymodule")); $action = GETPOST('action', 'aZ09'); $now = dol_now(); - -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); // Security check - Protection if external user $socid = GETPOST('socid', 'int'); diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index 409f1847a8b..5f4d49d0263 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -42,7 +42,7 @@ $langs->loadLangs(array("companies", "mrp")); // Security check $result = restrictedArea($user, 'bom|mrp'); -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); /* diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 02ffb3632f2..51e10cb7d39 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -78,7 +78,7 @@ if (GETPOST('addbox')) { } } -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); /* diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 4712a0b1b92..a7eecde9ef4 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -50,6 +50,11 @@ if ($search_project_user == $user->id) { $mine = 1; } +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); + +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); + // Security check $socid = 0; //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignment. @@ -57,11 +62,6 @@ if (!$user->hasRight('projet', 'lire')) { accessforbidden(); } -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); - -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); - /* * Actions diff --git a/htdocs/recruitment/index.php b/htdocs/recruitment/index.php index c8d525403bf..6be0d7af944 100644 --- a/htdocs/recruitment/index.php +++ b/htdocs/recruitment/index.php @@ -35,7 +35,8 @@ $langs->loadLangs(array("recruitment", "boxes")); $action = GETPOST('action', 'aZ09'); -$max = 5; +$NBMAX = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT', 5); +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); $now = dol_now(); $socid = GETPOSTINT('socid'); @@ -329,9 +330,6 @@ END MODULEBUILDER DRAFT MYOBJECT */ print '
'; -$NBMAX = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT'); -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); - // Last modified job position if (isModEnabled('recruitment') && $user->hasRight('recruitment', 'recruitmentjobposition', 'read')) { $sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status, COUNT(rc.rowid) as nbapplications"; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index f2b5fd2b824..0472e85afe0 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -74,7 +74,7 @@ if (GETPOST('addbox')) { } } -$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); /*