diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index de44d238726..09df7b7c758 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -40,6 +40,7 @@ class InfoBox if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2) { return array( 0 => 'Home', + 3 => 'thirdpartiesindex', 27 => 'AccountancyHome' ); } else { diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 0647a11d626..6729a984820 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -29,6 +29,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $hookmanager = new HookManager($db); @@ -47,6 +48,25 @@ $result = restrictedArea($user, 'societe', 0, '', '', '', ''); $thirdparty_static = new Societe($db); +if (!isset($form) || !is_object($form)) { + $form = new Form($db); +} +// Load $resultboxes +$resultboxes = FormOther::getBoxesArea($user, "3"); + +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 @@ -56,11 +76,8 @@ $transAreaType = $langs->trans("ThirdPartiesArea"); $helpurl = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Terceros'; llxHeader("", $langs->trans("ThirdParties"), $helpurl); -$linkback = ''; -print load_fiche_titre($transAreaType, $linkback, 'companies'); - -print '
'; +print load_fiche_titre($transAreaType, $resultboxes['selectboxlist'], 'companies'); /* @@ -115,11 +132,11 @@ if ($result) { dol_print_error($db); } -print '
'; -print ''."\n"; -print ''; +$thirdpartygraph = '
'; +$thirdpartygraph .= '
'.$langs->trans("Statistics").'
'."\n"; +$thirdpartygraph .= ''; if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + (round($third['customer']) ? 1 : 0) + (round($third['supplier']) ? 1 : 0) + (round($third['other']) ? 1 : 0) >= 2)) { - print ''."\n"; + $thirdpartygraph .= $dolgraph->show(); + $thirdpartygraph .= ''."\n"; } else { if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) { $statstring = ""; @@ -159,25 +176,23 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + $statstring2 .= ''; $statstring2 .= ""; } - print $statstring; - print $statstring2; + $thirdpartygraph .= $statstring; + $thirdpartygraph .= $statstring2; } -print ''; -print '
'.$langs->trans("Statistics").'
'; + $thirdpartygraph .= '
'; $dataseries = array(); if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) { $dataseries[] = array($langs->trans("Prospects"), round($third['prospect'])); @@ -141,8 +158,8 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + $dolgraph->SetType(array('pie')); $dolgraph->setHeight('200'); $dolgraph->draw('idgraphthirdparties'); - print $dolgraph->show(); - print '
'.$langs->trans("Suppliers").''.round($third['supplier']).'
'.$langs->trans("UniqueThirdParties").''; -print $total; -print '
'; -print '
'; +$thirdpartygraph .= ''.$langs->trans("UniqueThirdParties").''; +$thirdpartygraph .= $total; +$thirdpartygraph .= ''; +$thirdpartygraph .= ''; +$thirdpartygraph .= '
'; if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $elementtype = 'societe'; - print '
'; - - print '
'; - print ''; - print ''; - print ''; + $thirdpartycateggraph .= ''; + $thirdpartycateggraph .= '
'.$langs->trans("Categories").'
'; + $thirdpartycateggraph .= '
'; + $thirdpartycateggraph .= ''; + $thirdpartycateggraph .= ''; + $thirdpartycateggraph .= ''; + $thirdpartycateggraph .= ''; $total += $obj->nb; $i++; } } } - print ''; - print ''; - print '
'.$langs->trans("Categories").'
'; $sql = "SELECT c.label, count(*) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid"; @@ -218,27 +233,25 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA $dolgraph->SetType(array('pie')); $dolgraph->setHeight('200'); $dolgraph->draw('idgraphcateg'); - print $dolgraph->show(); + $thirdpartycateggraph .= $dolgraph->show(); } else { while ($i < $num) { $obj = $db->fetch_object($result); - print '
'.$obj->label.''.$obj->nb.'
'.$obj->label.''.$obj->nb.'
'.$langs->trans("Total").''; - print $total; - print '
'; - print '
'; + $thirdpartycateggraph .= '
'.$langs->trans("Total").''; + $thirdpartycateggraph .= $total; + $thirdpartycateggraph .= '
'; + $thirdpartycateggraph .= '
'; } -print '
'; - /* * Latest modified third parties @@ -279,14 +292,14 @@ if ($result) { if ($num > 0) { $transRecordedType = $langs->trans("LastModifiedThirdParties", $max); - print "\n\n"; - print '
'; - print ''; + $lastmodified = "\n\n"; + $lastmodified .= '
'; + $lastmodified .= '
'; - print ''; - print ''; - print ''; - print ''."\n"; + $lastmodified .= ''; + $lastmodified .= ''; + $lastmodified .= ''; + $lastmodified .= ''."\n"; while ($i < $num) { $objp = $db->fetch_object($result); @@ -306,37 +319,63 @@ if ($result) { $thirdparty_static->code_compta_fournisseur = $objp->code_compta_fournisseur; $thirdparty_static->code_compta = $objp->code_compta; - print ''; + $lastmodified .= ''; // Name - print '\n"; + $lastmodified .= '\n"; // Type - print ''; + $lastmodified .= ''; // Last modified date - print '"; - print '"; - print "\n"; + $lastmodified .= '"; + $lastmodified .= '"; + $lastmodified .= "\n"; $i++; } $db->free($result); - print "
'.$transRecordedType.' '.$langs->trans("FullList").'
'.$transRecordedType.' '.$langs->trans("FullList").'
'; - print $thirdparty_static->getNomUrl(1); - print "'; + $lastmodified .= $thirdparty_static->getNomUrl(1); + $lastmodified .= "'; - print $thirdparty_static->getTypeUrl(); - print ''; + $lastmodified .= $thirdparty_static->getTypeUrl(); + $lastmodified .= ''; - print dol_print_date($thirdparty_static->date_modification, 'day'); - print "'; - print $thirdparty_static->getLibStatut(3); - print "
'; + $lastmodified .= dol_print_date($thirdparty_static->date_modification, 'day'); + $lastmodified .= "'; + $lastmodified .= $thirdparty_static->getLibStatut(3); + $lastmodified .= "
\n"; - print '
'; - print "\n"; + $lastmodified .= "\n"; + $lastmodified .= '
'; + $lastmodified .= "\n"; } } else { dol_print_error($db); } -print '
'; +//print ''; + +// boxes +print '
'; +print '
'; + +$boxlist = '
'; + +$boxlist .= '
'; +$boxlist .= $thirdpartygraph; +$boxlist .= '
'; +$boxlist .= $thirdpartycateggraph; +$boxlist .= '
'; +$boxlist .= $resultboxes['boxlista']; +$boxlist .= '
'."\n"; + +$boxlist .= '
'; +$boxlist .= $lastmodified; +$boxlist .= '
'; +$boxlist .= $resultboxes['boxlistb']; +$boxlist .= '
'."\n"; + +$boxlist .= '
'; + +print $boxlist; + +print '
'; $parameters = array('user' => $user); $reshook = $hookmanager->executeHooks('dashboardThirdparties', $parameters, $object); // Note that $action and $object may have been modified by hook