72 global $user, $langs, $conf;
73 $langs->load(
"boxes");
76 $this->info_box_head = array(
'text' => $langs->trans(
"DolibarrStateBoard"));
78 if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) {
80 $hookmanager->initHooks(array(
'index'));
81 $object =
new stdClass();
84 $hookmanager->executeHooks(
'addStatisticLine', $parameters, $object, $action);
85 $boxstatItems = array();
86 $boxstatFromHook =
'';
87 $boxstatFromHook = $hookmanager->resPrint;
106 'supplier_proposals',
115 'users' => $user->hasRight(
'user',
'user',
'lire'),
116 'members' => isModEnabled(
'adherent') && $user->hasRight(
'adherent',
'lire'),
117 'customers' => isModEnabled(
'societe') && $user->hasRight(
'societe',
'lire') && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
118 'prospects' => isModEnabled(
'societe') && $user->hasRight(
'societe',
'lire') && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
119 'suppliers' => ((isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight(
'fournisseur',
'lire'))
120 || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))
121 || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))
123 && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
124 'contacts' => isModEnabled(
'societe') && $user->hasRight(
'societe',
'contact',
'lire'),
125 'products' => isModEnabled(
'product') && $user->hasRight(
'product',
'read'),
126 'services' => isModEnabled(
'service') && $user->hasRight(
'service',
'read'),
127 'proposals' => isModEnabled(
'propal') && $user->hasRight(
'propal',
'read'),
128 'orders' => isModEnabled(
'commande') && $user->hasRight(
'commande',
'lire'),
129 'invoices' => isModEnabled(
'facture') && $user->hasRight(
'facture',
'lire'),
130 'donations' => isModEnabled(
'don') && $user->hasRight(
'don',
'lire'),
131 'contracts' => isModEnabled(
'contrat') && $user->hasRight(
'contrat',
'lire'),
132 'interventions' => isModEnabled(
'ficheinter') && $user->hasRight(
'ficheinter',
'lire'),
133 'supplier_orders' => isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire') && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
134 'supplier_invoices' => isModEnabled(
'supplier_invoice') && $user->hasRight(
'fournisseur',
'facture',
'lire') && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
135 'supplier_proposals' => isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire') && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
136 'projects' => isModEnabled(
'project') && $user->hasRight(
'projet',
'lire'),
137 'expensereports' => isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire'),
138 'holidays' => isModEnabled(
'holiday') && $user->hasRight(
'holiday',
'read'),
139 'ticket' => isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read'),
140 'dolresource' => isModEnabled(
'resource') && $user->hasRight(
'resource',
'read')
144 'members' =>
'Adherent',
145 'customers' =>
'Client',
146 'prospects' =>
'Client',
147 'suppliers' =>
'Fournisseur',
148 'contacts' =>
'Contact',
149 'products' =>
'Product',
150 'services' =>
'ProductService',
151 'proposals' =>
'Propal',
152 'orders' =>
'Commande',
153 'invoices' =>
'Facture',
154 'donations' =>
'Don',
155 'contracts' =>
'Contrat',
156 'interventions' =>
'Fichinter',
157 'supplier_orders' =>
'CommandeFournisseur',
158 'supplier_invoices' =>
'FactureFournisseur',
159 'supplier_proposals' =>
'SupplierProposal',
160 'projects' =>
'Project',
161 'expensereports' =>
'ExpenseReport',
162 'holidays' =>
'Holiday',
163 'ticket' =>
'Ticket',
164 'dolresource' =>
'Dolresource'
167 'users' => DOL_DOCUMENT_ROOT .
"/user/class/user.class.php",
168 'members' => DOL_DOCUMENT_ROOT .
"/adherents/class/adherent.class.php",
169 'customers' => DOL_DOCUMENT_ROOT .
"/societe/class/client.class.php",
170 'prospects' => DOL_DOCUMENT_ROOT .
"/societe/class/client.class.php",
171 'suppliers' => DOL_DOCUMENT_ROOT .
"/fourn/class/fournisseur.class.php",
172 'contacts' => DOL_DOCUMENT_ROOT .
"/contact/class/contact.class.php",
173 'products' => DOL_DOCUMENT_ROOT .
"/product/class/product.class.php",
174 'services' => DOL_DOCUMENT_ROOT .
"/product/class/product.class.php",
175 'proposals' => DOL_DOCUMENT_ROOT .
"/comm/propal/class/propal.class.php",
176 'orders' => DOL_DOCUMENT_ROOT .
"/commande/class/commande.class.php",
177 'invoices' => DOL_DOCUMENT_ROOT .
"/compta/facture/class/facture.class.php",
178 'donations' => DOL_DOCUMENT_ROOT .
"/don/class/don.class.php",
179 'contracts' => DOL_DOCUMENT_ROOT .
"/contrat/class/contrat.class.php",
180 'interventions' => DOL_DOCUMENT_ROOT .
"/fichinter/class/fichinter.class.php",
181 'supplier_orders' => DOL_DOCUMENT_ROOT .
"/fourn/class/fournisseur.commande.class.php",
182 'supplier_invoices' => DOL_DOCUMENT_ROOT .
"/fourn/class/fournisseur.facture.class.php",
183 'supplier_proposals' => DOL_DOCUMENT_ROOT .
"/supplier_proposal/class/supplier_proposal.class.php",
184 'projects' => DOL_DOCUMENT_ROOT .
"/projet/class/project.class.php",
185 'expensereports' => DOL_DOCUMENT_ROOT .
"/expensereport/class/expensereport.class.php",
186 'holidays' => DOL_DOCUMENT_ROOT .
"/holiday/class/holiday.class.php",
187 'ticket' => DOL_DOCUMENT_ROOT .
"/ticket/class/ticket.class.php",
188 'dolresource' => DOL_DOCUMENT_ROOT .
"/resource/class/dolresource.class.php"
191 'users' => DOL_URL_ROOT .
'/user/list.php',
192 'members' => DOL_URL_ROOT .
'/adherents/list.php?statut=1&mainmenu=members',
193 'customers' => DOL_URL_ROOT .
'/societe/list.php?type=c&mainmenu=companies',
194 'prospects' => DOL_URL_ROOT .
'/societe/list.php?type=p&mainmenu=companies',
195 'suppliers' => DOL_URL_ROOT .
'/societe/list.php?type=f&mainmenu=companies',
196 'contacts' => DOL_URL_ROOT .
'/contact/list.php?mainmenu=companies',
197 'products' => DOL_URL_ROOT .
'/product/list.php?type=0&mainmenu=products',
198 'services' => DOL_URL_ROOT .
'/product/list.php?type=1&mainmenu=products',
199 'proposals' => DOL_URL_ROOT .
'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals',
200 'orders' => DOL_URL_ROOT .
'/commande/list.php?mainmenu=commercial&leftmenu=orders',
201 'invoices' => DOL_URL_ROOT .
'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills',
202 'donations' => DOL_URL_ROOT .
'/don/list.php?leftmenu=donations',
203 'contracts' => DOL_URL_ROOT .
'/contrat/list.php?mainmenu=commercial&leftmenu=contracts',
204 'interventions' => DOL_URL_ROOT .
'/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter',
205 'supplier_orders' => DOL_URL_ROOT .
'/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers',
206 'supplier_invoices' => DOL_URL_ROOT .
'/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills',
207 'supplier_proposals' => DOL_URL_ROOT .
'/supplier_proposal/list.php?mainmenu=commercial&leftmenu=',
208 'projects' => DOL_URL_ROOT .
'/projet/list.php?mainmenu=project',
209 'expensereports' => DOL_URL_ROOT .
'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport',
210 'holidays' => DOL_URL_ROOT .
'/holiday/list.php?mainmenu=hrm&leftmenu=holiday',
211 'ticket' => DOL_URL_ROOT .
'/ticket/list.php?leftmenu=ticket',
212 'dolresource' => DOL_URL_ROOT .
'/resource/list.php?mainmenu=agenda',
216 'members' =>
"Members",
217 'customers' =>
"ThirdPartyCustomersStats",
218 'prospects' =>
"ThirdPartyProspectsStats",
219 'suppliers' =>
"Suppliers",
220 'contacts' =>
"Contacts",
221 'products' =>
"Products",
222 'services' =>
"Services",
223 'proposals' =>
"CommercialProposalsShort",
224 'orders' =>
"CustomersOrders",
225 'invoices' =>
"BillsCustomers",
226 'donations' =>
"Donations",
227 'contracts' =>
"Contracts",
228 'interventions' =>
"Interventions",
229 'supplier_orders' =>
"SuppliersOrders",
230 'supplier_invoices' =>
"SuppliersInvoices",
231 'supplier_proposals' =>
"SupplierProposalShort",
232 'projects' =>
"Projects",
233 'expensereports' =>
"ExpenseReports",
234 'holidays' =>
"Holidays",
235 'ticket' =>
"Ticket",
236 'dolresource' =>
"Resources",
239 'customers' =>
"companies",
240 'contacts' =>
"companies",
241 'services' =>
"products",
242 'proposals' =>
"propal",
243 'invoices' =>
"bills",
244 'supplier_orders' =>
"orders",
245 'supplier_invoices' =>
"bills",
246 'supplier_proposals' =>
'supplier_proposal',
247 'expensereports' =>
"trips",
248 'holidays' =>
"holiday",
250 $boardloaded = array();
252 foreach ($keys as $val) {
253 if ($conditions[$val]) {
255 $class = $classes[$val];
257 $classkeyforcache = $class;
258 if ($classkeyforcache ==
'ProductService') {
259 $classkeyforcache =
'Product';
262 if (!isset($boardloaded[$classkeyforcache]) || !is_object($boardloaded[$classkeyforcache])) {
263 include_once $includes[$val];
265 $board =
new $class($this->db);
266 $board->load_state_board();
267 $boardloaded[$class] = $board;
269 $board = $boardloaded[$classkeyforcache];
272 $langs->load(empty($langfile[$val]) ? $val : $langfile[$val]);
274 $text = $langs->trans($titres[$val]);
275 $boxstatItem .=
'<a href="' . $links[$val] .
'" class="boxstatsindicator thumbstat nobold nounderline">';
276 $boxstatItem .=
'<div class="boxstats">';
277 $boxstatItem .=
'<span class="boxstatstext" title="' .
dol_escape_htmltag($text) .
'">' . $text .
'</span><br>';
278 $boxstatItem .=
'<span class="boxstatsindicator">' .
img_object(
"", $board->picto,
'class="inline-block"') .
' ' . (!empty($board->nb[$val]) ? $board->nb[$val] : 0) .
'</span>';
279 $boxstatItem .=
'</div>';
280 $boxstatItem .=
'</a>';
282 $boxstatItems[$val] = $boxstatItem;
286 if (!empty($boxstatFromHook) || !empty($boxstatItems)) {
287 $boxstat .= $boxstatFromHook;
289 if (is_array($boxstatItems) && count($boxstatItems) > 0) {
290 $boxstat .= implode(
'', $boxstatItems);
293 $boxstat .=
'<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
294 $boxstat .=
'<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
295 $boxstat .=
'<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
296 $boxstat .=
'<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
297 $boxstat .=
'<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
298 $boxstat .=
'<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
299 $boxstat .=
'<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
300 $boxstat .=
'<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
302 $this->info_box_contents[0][0] = array(
303 'tr' =>
'class="nohover"',
304 'td' =>
'class="tdwidgetstate"',
305 'textnoformat' => $boxstat
309 $this->info_box_contents[0][0] = array(
311 'text' => $langs->trans(
"ReadPermissionNotAllowed")