can add box on member index page
This commit is contained in:
parent
46a5fa52da
commit
6fad38db57
@ -29,6 +29,7 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
$hookmanager = new HookManager($db);
|
||||
|
||||
@ -40,7 +41,24 @@ $langs->loadLangs(array("companies", "members"));
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent');
|
||||
if (!isset($form) || !is_object($form)) {
|
||||
$form = new Form($db);
|
||||
}
|
||||
// Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
|
||||
$resultboxes = FormOther::getBoxesArea($user, "2");
|
||||
|
||||
if (GETPOST('addbox')) {
|
||||
// Add box (when submit is done from a form when ajax disabled)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||
$zone = GETPOST('areacode', 'aZ09');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$boxorder = GETPOST('boxorder', 'aZ09');
|
||||
$boxorder .= GETPOST('boxcombo', 'aZ09');
|
||||
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans("BoxAdded"), null);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -52,7 +70,7 @@ $staticmember = new Adherent($db);
|
||||
$statictype = new AdherentType($db);
|
||||
$subscriptionstatic = new Subscription($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("MembersArea"), '', 'members');
|
||||
print load_fiche_titre($langs->trans("MembersArea"), $resultboxes['selectboxlist'], 'members');
|
||||
|
||||
$Adherents = array();
|
||||
$AdherentsAValider = array();
|
||||
@ -85,9 +103,15 @@ if ($result) {
|
||||
$adhtype->label = $objp->label;
|
||||
$AdherentType[$objp->rowid] = $adhtype;
|
||||
|
||||
if ($objp->statut == -1) { $MemberToValidate[$objp->rowid] = $objp->somme; }
|
||||
if ($objp->statut == 1) { $MembersValidated[$objp->rowid] = $objp->somme; }
|
||||
if ($objp->statut == 0) { $MembersResiliated[$objp->rowid] = $objp->somme; }
|
||||
if ($objp->statut == -1) {
|
||||
$MemberToValidate[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
if ($objp->statut == 1) {
|
||||
$MembersValidated[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
if ($objp->statut == 0) {
|
||||
$MembersResiliated[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -136,10 +160,14 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
$i = 0;
|
||||
foreach ($listofsearchfields as $key => $value) {
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
if ($i == 0) {
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
}
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
if ($i == 0) {
|
||||
print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
@ -247,7 +275,7 @@ print "</tr>\n";
|
||||
|
||||
krsort($Total);
|
||||
$i = 0;
|
||||
foreach ($Total as $key=>$value) {
|
||||
foreach ($Total as $key => $value) {
|
||||
if ($i >= 8) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>...</td>";
|
||||
@ -449,6 +477,42 @@ print "</div>";
|
||||
|
||||
print '</div></div></div>';
|
||||
|
||||
// boxes
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
print '<div class="fichecenter fichecenterbis">';
|
||||
|
||||
|
||||
/*
|
||||
* Show widgets (boxes)
|
||||
*/
|
||||
|
||||
$boxlist .= '<div class="twocolumns">';
|
||||
|
||||
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
|
||||
if (!empty($nbworkboardcount)) {
|
||||
$boxlist .= $boxwork;
|
||||
}
|
||||
|
||||
$boxlist .= $resultboxes['boxlista'];
|
||||
|
||||
$boxlist .= '</div>';
|
||||
|
||||
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
|
||||
|
||||
$boxlist .= $boxstat;
|
||||
$boxlist .= $resultboxes['boxlistb'];
|
||||
|
||||
$boxlist .= '</div>';
|
||||
$boxlist .= "\n";
|
||||
|
||||
$boxlist .= '</div>';
|
||||
|
||||
|
||||
print $boxlist;
|
||||
|
||||
print '</div>';
|
||||
|
||||
$parameters = array('user' => $user);
|
||||
$reshook = $hookmanager->executeHooks('dashboardMembers', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
|
||||
|
||||
@ -37,10 +37,10 @@ class InfoBox
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2)
|
||||
{
|
||||
if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
return array(
|
||||
0 => 'Home',
|
||||
2 => 'membersindex',
|
||||
27 => 'AccountancyHome'
|
||||
);
|
||||
} else {
|
||||
@ -95,16 +95,20 @@ class InfoBox
|
||||
$boxes = array();
|
||||
|
||||
$confuserzone = 'MAIN_BOXES_'.$zone;
|
||||
if ($mode == 'activated') // activated
|
||||
{
|
||||
if ($mode == 'activated') { // activated
|
||||
$sql = "SELECT b.rowid, b.position, b.box_order, b.fk_user,";
|
||||
$sql .= " d.rowid as box_id, d.file, d.note, d.tms";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
|
||||
$sql .= " WHERE b.box_id = d.rowid";
|
||||
$sql .= " AND b.entity IN (0,".$conf->entity.")";
|
||||
if ($zone >= 0) $sql .= " AND b.position = ".$zone;
|
||||
if (is_object($user)) $sql .= " AND b.fk_user IN (0,".$user->id.")";
|
||||
else $sql .= " AND b.fk_user = 0";
|
||||
if ($zone >= 0) {
|
||||
$sql .= " AND b.position = ".$zone;
|
||||
}
|
||||
if (is_object($user)) {
|
||||
$sql .= " AND b.fk_user IN (0,".$user->id.")";
|
||||
} else {
|
||||
$sql .= " AND b.fk_user = 0";
|
||||
}
|
||||
$sql .= " ORDER BY b.box_order";
|
||||
} else // available
|
||||
{
|
||||
@ -115,19 +119,15 @@ class InfoBox
|
||||
|
||||
dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user) ? $user->id : '')."", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$j = 0;
|
||||
while ($j < $num)
|
||||
{
|
||||
while ($j < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if (!in_array($obj->box_id, $excludelist))
|
||||
{
|
||||
if (!in_array($obj->box_id, $excludelist)) {
|
||||
$regs = array();
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $obj->file, $regs))
|
||||
{
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $obj->file, $regs)) {
|
||||
$boxname = preg_replace('/\.php$/i', '', $regs[1]);
|
||||
$module = $regs[2];
|
||||
$relsourcefile = "/".$module."/core/boxes/".$boxname.".php";
|
||||
@ -142,8 +142,7 @@ class InfoBox
|
||||
// the "enabled" condition for modules forbidden for external users and the depends condition can be done.
|
||||
// Goal is to avoid making a "new" done for each boxes returned by select.
|
||||
dol_include_once($relsourcefile);
|
||||
if (class_exists($boxname))
|
||||
{
|
||||
if (class_exists($boxname)) {
|
||||
$box = new $boxname($db, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params.
|
||||
//$box=new stdClass();
|
||||
|
||||
@ -154,14 +153,15 @@ class InfoBox
|
||||
$box->box_order = (empty($obj->box_order) ? '' : $obj->box_order);
|
||||
$box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user);
|
||||
$box->sourcefile = $relsourcefile;
|
||||
$box->class = $boxname;
|
||||
$box->class = $boxname;
|
||||
|
||||
if ($mode == 'activated' && !is_object($user)) // List of activated box was not yet personalized into database
|
||||
{
|
||||
if (is_numeric($box->box_order))
|
||||
{
|
||||
if ($box->box_order % 2 == 1) $box->box_order = 'A'.$box->box_order;
|
||||
elseif ($box->box_order % 2 == 0) $box->box_order = 'B'.$box->box_order;
|
||||
if ($mode == 'activated' && !is_object($user)) { // List of activated box was not yet personalized into database
|
||||
if (is_numeric($box->box_order)) {
|
||||
if ($box->box_order % 2 == 1) {
|
||||
$box->box_order = 'A'.$box->box_order;
|
||||
} elseif ($box->box_order % 2 == 0) {
|
||||
$box->box_order = 'B'.$box->box_order;
|
||||
}
|
||||
}
|
||||
}
|
||||
// box_def properties
|
||||
@ -171,20 +171,18 @@ class InfoBox
|
||||
// Filter on box->enabled (used for example by box_comptes)
|
||||
// Filter also on box->depends. Example: array("product|service") or array("contrat", "service")
|
||||
$enabled = $box->enabled;
|
||||
if (isset($box->depends) && count($box->depends) > 0)
|
||||
{
|
||||
foreach ($box->depends as $moduleelem)
|
||||
{
|
||||
if (isset($box->depends) && count($box->depends) > 0) {
|
||||
foreach ($box->depends as $moduleelem) {
|
||||
$arrayelem = explode('|', $moduleelem);
|
||||
$tmpenabled = 0; // $tmpenabled is used for the '|' test (OR)
|
||||
foreach ($arrayelem as $module)
|
||||
{
|
||||
foreach ($arrayelem as $module) {
|
||||
$tmpmodule = preg_replace('/@[^@]+/', '', $module);
|
||||
if (!empty($conf->$tmpmodule->enabled)) $tmpenabled = 1;
|
||||
if (!empty($conf->$tmpmodule->enabled)) {
|
||||
$tmpenabled = 1;
|
||||
}
|
||||
//print $boxname.'-'.$module.'-module enabled='.(empty($conf->$tmpmodule->enabled)?0:1).'<br>';
|
||||
}
|
||||
if (empty($tmpenabled)) // We found at least one module required that is disabled
|
||||
{
|
||||
if (empty($tmpenabled)) { // We found at least one module required that is disabled
|
||||
$enabled = 0;
|
||||
break;
|
||||
}
|
||||
@ -193,8 +191,11 @@ class InfoBox
|
||||
//print '=>'.$boxname.'-enabled='.$enabled.'<br>';
|
||||
|
||||
//print 'xx module='.$module.' enabled='.$enabled;
|
||||
if ($enabled && ($includehidden || empty($box->hidden))) $boxes[] = $box;
|
||||
else unset($box);
|
||||
if ($enabled && ($includehidden || empty($box->hidden))) {
|
||||
$boxes[] = $box;
|
||||
} else {
|
||||
unset($box);
|
||||
}
|
||||
} else {
|
||||
dol_syslog("Failed to load box '".$boxname."' into file '".$relsourcefile."'", LOG_WARNING);
|
||||
}
|
||||
@ -229,7 +230,9 @@ class InfoBox
|
||||
|
||||
dol_syslog(get_class()."::saveboxorder zone=".$zone." userid=".$userid);
|
||||
|
||||
if (!$userid || $userid == 0) return 0;
|
||||
if (!$userid || $userid == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$user = new User($db);
|
||||
$user->id = $userid;
|
||||
@ -240,8 +243,7 @@ class InfoBox
|
||||
$tab = array();
|
||||
$confuserzone = 'MAIN_BOXES_'.$zone;
|
||||
$tab[$confuserzone] = 1;
|
||||
if (dol_set_user_param($db, $conf, $user, $tab) < 0)
|
||||
{
|
||||
if (dol_set_user_param($db, $conf, $user, $tab) < 0) {
|
||||
$error = $db->lasterror();
|
||||
$db->rollback();
|
||||
return -3;
|
||||
@ -255,11 +257,9 @@ class InfoBox
|
||||
|
||||
dol_syslog(get_class()."::saveboxorder", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$colonnes = explode('-', $boxorder);
|
||||
foreach ($colonnes as $collist)
|
||||
{
|
||||
foreach ($colonnes as $collist) {
|
||||
$part = explode(':', $collist);
|
||||
$colonne = $part[0];
|
||||
$list = $part[1];
|
||||
@ -267,10 +267,8 @@ class InfoBox
|
||||
|
||||
$i = 0;
|
||||
$listarray = explode(',', $list);
|
||||
foreach ($listarray as $id)
|
||||
{
|
||||
if (is_numeric($id))
|
||||
{
|
||||
foreach ($listarray as $id) {
|
||||
if (is_numeric($id)) {
|
||||
//dol_syslog("aaaaa".count($listarray));
|
||||
$i++;
|
||||
$ii = sprintf('%02d', $i);
|
||||
@ -287,8 +285,7 @@ class InfoBox
|
||||
|
||||
dol_syslog(get_class()."::saveboxorder", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
@ -299,8 +296,7 @@ class InfoBox
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error)
|
||||
{
|
||||
if ($error) {
|
||||
$db->rollback();
|
||||
return -2;
|
||||
} else {
|
||||
|
||||
142
htdocs/index.php
142
htdocs/index.php
@ -30,7 +30,7 @@ require 'main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
// If not defined, we select menu "home"
|
||||
$_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ?GETPOST('mainmenu', 'aZ09') : 'home';
|
||||
$_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ? GETPOST('mainmenu', 'aZ09') : 'home';
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$hookmanager->initHooks(array('index'));
|
||||
@ -41,18 +41,15 @@ $hookmanager->initHooks(array('index'));
|
||||
*/
|
||||
|
||||
// Check if company name is defined (first install)
|
||||
if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_NOM))
|
||||
{
|
||||
if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_NOM)) {
|
||||
header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
|
||||
exit;
|
||||
}
|
||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
||||
{
|
||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only user module enabled
|
||||
header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
|
||||
exit;
|
||||
}
|
||||
if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax disabled)
|
||||
{
|
||||
if (GETPOST('addbox')) { // Add box (when submit is done from a form when ajax disabled)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||
$zone = GETPOST('areacode', 'aZ09');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
@ -60,7 +57,9 @@ if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax dis
|
||||
$boxorder .= GETPOST('boxcombo', 'aZ09');
|
||||
|
||||
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
|
||||
if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans("BoxAdded"), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -68,11 +67,15 @@ if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax dis
|
||||
* View
|
||||
*/
|
||||
|
||||
if (!isset($form) || !is_object($form)) $form = new Form($db);
|
||||
if (!isset($form) || !is_object($form)) {
|
||||
$form = new Form($db);
|
||||
}
|
||||
|
||||
// Title
|
||||
$title = $langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION;
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = $langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$title = $langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;
|
||||
}
|
||||
|
||||
llxHeader('', $title);
|
||||
|
||||
@ -82,11 +85,9 @@ $resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (select
|
||||
|
||||
print load_fiche_titre(' ', $resultboxes['selectboxlist'], '', 0, '', 'titleforhome');
|
||||
|
||||
if (!empty($conf->global->MAIN_MOTD))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_MOTD)) {
|
||||
$conf->global->MAIN_MOTD = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD);
|
||||
if (!empty($conf->global->MAIN_MOTD))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_MOTD)) {
|
||||
$substitutionarray = getCommonSubstitutionArray($langs);
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
$texttoshow = make_substitutions($conf->global->MAIN_MOTD, $substitutionarray, $langs);
|
||||
@ -113,16 +114,14 @@ $boxstatFromHook = '';
|
||||
$langs->loadLangs(array('commercial', 'bills', 'orders', 'contracts'));
|
||||
|
||||
// Load global statistics of objects
|
||||
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
{
|
||||
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) {
|
||||
$object = new stdClass();
|
||||
$parameters = array();
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$boxstatFromHook = $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Cle array returned by the method load_state_board for each line
|
||||
$keys = array(
|
||||
'users',
|
||||
@ -285,18 +284,17 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
|
||||
// Loop and displays each line of table
|
||||
$boardloaded = array();
|
||||
foreach ($keys as $val)
|
||||
{
|
||||
if ($conditions[$val])
|
||||
{
|
||||
foreach ($keys as $val) {
|
||||
if ($conditions[$val]) {
|
||||
$boxstatItem = '';
|
||||
$class = $classes[$val];
|
||||
// Search in cache if load_state_board is already realized
|
||||
$classkeyforcache = $class;
|
||||
if ($classkeyforcache == 'ProductService') $classkeyforcache = 'Product'; // ProductService use same load_state_board than Product
|
||||
if ($classkeyforcache == 'ProductService') {
|
||||
$classkeyforcache = 'Product'; // ProductService use same load_state_board than Product
|
||||
}
|
||||
|
||||
if (!isset($boardloaded[$classkeyforcache]) || !is_object($boardloaded[$classkeyforcache]))
|
||||
{
|
||||
if (!isset($boardloaded[$classkeyforcache]) || !is_object($boardloaded[$classkeyforcache])) {
|
||||
include_once $includes[$val]; // Loading a class cost around 1Mb
|
||||
|
||||
$board = new $class($db);
|
||||
@ -471,8 +469,12 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$object = new stdClass();
|
||||
$parameters = array();
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object,
|
||||
$action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks(
|
||||
'addOpenElementsDashboardLine',
|
||||
$parameters,
|
||||
$object,
|
||||
$action
|
||||
); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook == 0) {
|
||||
$dashboardlines = array_merge($dashboardlines, $hookmanager->resArray);
|
||||
}
|
||||
@ -627,8 +629,10 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$boxwork .= '<th class="liste_titre"><div class="inline-block valignmiddle">'.$langs->trans("DolibarrWorkBoard").'</div>';
|
||||
if ($showweather) {
|
||||
if ($totallate > 0) {
|
||||
$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",
|
||||
$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
|
||||
$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv(
|
||||
"NActionsLate",
|
||||
$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')
|
||||
).')';
|
||||
} else {
|
||||
$text = $langs->transnoentitiesnoconv("NoItemLate");
|
||||
}
|
||||
@ -670,17 +674,17 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$globalStatsKey = $groupElement['globalStatsKey'];
|
||||
$groupElement['globalStats'] = array();
|
||||
|
||||
if (is_array($keys) && in_array($globalStatsKey, $keys))
|
||||
{
|
||||
if (is_array($keys) && in_array($globalStatsKey, $keys)) {
|
||||
// get key index of stats used in $includes, $classes, $keys, $icons, $titres, $links
|
||||
$keyIndex = array_search($globalStatsKey, $keys);
|
||||
|
||||
$classe = $classes[$keyIndex];
|
||||
if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe]))
|
||||
{
|
||||
if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe])) {
|
||||
$groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey] ? $boardloaded[$classe]->nb[$globalStatsKey] : 0;
|
||||
$nbTotal = doubleval($groupElement['globalStats']['total']);
|
||||
if ($nbTotal >= 10000) { $nbTotal = round($nbTotal / 1000, 2).'k'; }
|
||||
if ($nbTotal >= 10000) {
|
||||
$nbTotal = round($nbTotal / 1000, 2).'k';
|
||||
}
|
||||
$groupElement['globalStats']['text'] = $langs->trans('Total').' : '.$langs->trans($titres[$keyIndex]).' ('.$groupElement['globalStats']['total'].')';
|
||||
$groupElement['globalStats']['total'] = $nbTotal;
|
||||
$groupElement['globalStats']['link'] = $links[$keyIndex];
|
||||
@ -767,8 +771,10 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
|
||||
$text = '';
|
||||
if ($totallate > 0) {
|
||||
$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",
|
||||
$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
|
||||
$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv(
|
||||
"NActionsLate",
|
||||
$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')
|
||||
).')';
|
||||
} else {
|
||||
$text = $langs->transnoentitiesnoconv("NoItemLate");
|
||||
}
|
||||
@ -783,16 +789,24 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$weatherDashBoard .= ' <div class="info-box-title">'.$langs->trans('GlobalOpenedElemView').'</div>'."\n";
|
||||
|
||||
if ($totallatePercentage > 0 && !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
|
||||
$weatherDashBoard .= ' <span class="info-box-number">'.$langs->transnoentitiesnoconv("NActionsLate",
|
||||
price($totallatePercentage).'%').'</span>'."\n";
|
||||
$weatherDashBoard .= ' <span class="progress-description">'.$langs->trans('NActionsLate',
|
||||
$totalLateNumber).'</span>'."\n";
|
||||
$weatherDashBoard .= ' <span class="info-box-number">'.$langs->transnoentitiesnoconv(
|
||||
"NActionsLate",
|
||||
price($totallatePercentage).'%'
|
||||
).'</span>'."\n";
|
||||
$weatherDashBoard .= ' <span class="progress-description">'.$langs->trans(
|
||||
'NActionsLate',
|
||||
$totalLateNumber
|
||||
).'</span>'."\n";
|
||||
} else {
|
||||
$weatherDashBoard .= ' <span class="info-box-number">'.$langs->transnoentitiesnoconv("NActionsLate",
|
||||
$totalLateNumber).'</span>'."\n";
|
||||
$weatherDashBoard .= ' <span class="info-box-number">'.$langs->transnoentitiesnoconv(
|
||||
"NActionsLate",
|
||||
$totalLateNumber
|
||||
).'</span>'."\n";
|
||||
if ($totallatePercentage > 0) {
|
||||
$weatherDashBoard .= ' <span class="progress-description">'.$langs->trans('NActionsLate',
|
||||
price($totallatePercentage).'%').'</span>'."\n";
|
||||
$weatherDashBoard .= ' <span class="progress-description">'.$langs->trans(
|
||||
'NActionsLate',
|
||||
price($totallatePercentage).'%'
|
||||
).'</span>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -840,8 +854,11 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$boxwork .= '<div class="dashboardlinelatecoin nowrap">';
|
||||
$boxwork .= '<a title="'.dol_escape_htmltag($textlate).'" class="valignmiddle dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late).'">';
|
||||
//$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').'';
|
||||
$boxwork .= img_picto($textlate, "warning_white",
|
||||
'class="inline-block hideonsmartphone valigntextbottom"').'';
|
||||
$boxwork .= img_picto(
|
||||
$textlate,
|
||||
"warning_white",
|
||||
'class="inline-block hideonsmartphone valigntextbottom"'
|
||||
).'';
|
||||
$boxwork .= '<span class="dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'">';
|
||||
$boxwork .= $board->nbtodolate;
|
||||
$boxwork .= '</span>';
|
||||
@ -892,8 +909,7 @@ print '<div class="fichecenter fichecenterbis">';
|
||||
$boxlist .= '<div class="twocolumns">';
|
||||
|
||||
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
|
||||
if (!empty($nbworkboardcount))
|
||||
{
|
||||
if (!empty($nbworkboardcount)) {
|
||||
$boxlist .= $boxwork;
|
||||
}
|
||||
|
||||
@ -902,8 +918,7 @@ $boxlist .= $resultboxes['boxlista'];
|
||||
$boxlist .= '</div>';
|
||||
|
||||
|
||||
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
{
|
||||
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) {
|
||||
// Remove allready present info in new dash board
|
||||
if (!empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD) && is_array($boxstatItems) && count($boxstatItems) > 0) {
|
||||
foreach ($boxstatItems as $boxstatItemKey => $boxstatItemHtml) {
|
||||
@ -926,8 +941,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
|
||||
$boxstat .= $boxstatFromHook;
|
||||
|
||||
if (is_array($boxstatItems) && count($boxstatItems) > 0)
|
||||
{
|
||||
if (is_array($boxstatItems) && count($boxstatItems) > 0) {
|
||||
$boxstat .= implode('', $boxstatItems);
|
||||
}
|
||||
|
||||
@ -967,30 +981,26 @@ print '</div>';
|
||||
*/
|
||||
|
||||
// Security warning repertoire install existe (si utilisateur admin)
|
||||
if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING))
|
||||
{
|
||||
if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING)) {
|
||||
$message = '';
|
||||
|
||||
// Check if install lock file is present
|
||||
$lockfile = DOL_DATA_ROOT.'/install.lock';
|
||||
if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install"))
|
||||
{
|
||||
if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install")) {
|
||||
$langs->load("errors");
|
||||
//if (! empty($message)) $message.='<br>';
|
||||
$message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
|
||||
}
|
||||
|
||||
// Conf files must be in read only mode
|
||||
if (is_writable($conffile))
|
||||
{
|
||||
if (is_writable($conffile)) {
|
||||
$langs->load("errors");
|
||||
//$langs->load("other");
|
||||
//if (! empty($message)) $message.='<br>';
|
||||
$message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
|
||||
}
|
||||
|
||||
if ($message)
|
||||
{
|
||||
if ($message) {
|
||||
print $message;
|
||||
//$message.='<br>';
|
||||
//print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install"));
|
||||
@ -1063,20 +1073,16 @@ function getWeatherStatus($totallate)
|
||||
if ($totallate <= $level0) {
|
||||
$weather->picto = 'weather-clear.png';
|
||||
$weather->level = 0;
|
||||
}
|
||||
elseif ($totallate <= $level1) {
|
||||
} elseif ($totallate <= $level1) {
|
||||
$weather->picto = 'weather-few-clouds.png';
|
||||
$weather->level = 1;
|
||||
}
|
||||
elseif ($totallate <= $level2) {
|
||||
} elseif ($totallate <= $level2) {
|
||||
$weather->picto = 'weather-clouds.png';
|
||||
$weather->level = 2;
|
||||
}
|
||||
elseif ($totallate <= $level3) {
|
||||
} elseif ($totallate <= $level3) {
|
||||
$weather->picto = 'weather-many-clouds.png';
|
||||
$weather->level = 3;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$weather->picto = 'weather-storm.png';
|
||||
$weather->level = 4;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user