63 $langs->load(
"boxes");
66 $this->info_box_head = array(
'text' => $langs->trans(
"DolibarrStateBoard"));
70 $hookmanager->initHooks(array(
'index'));
73 $parameters = array();
74 $hookmanager->executeHooks(
'addStatisticLine', $parameters,
$object, $action);
75 $boxstatItems = array();
76 $boxstatFromHook =
'';
77 $boxstatFromHook = $hookmanager->resPrint;
105 'users' => $user->hasRight(
'user',
'user',
'lire'),
106 'members' => isModEnabled(
'member') && $user->hasRight(
'adherent',
'lire'),
107 'customers' => isModEnabled(
'societe') && $user->hasRight(
'societe',
'lire') && !
getDolGlobalString(
'SOCIETE_DISABLE_CUSTOMERS') && !
getDolGlobalString(
'SOCIETE_DISABLE_CUSTOMERS_STATS'),
108 'prospects' => isModEnabled(
'societe') && $user->hasRight(
'societe',
'lire') && !
getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTS') && !
getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTS_STATS'),
110 (isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'lire'))
111 || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))
112 || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))
115 'contacts' => isModEnabled(
'societe') && $user->hasRight(
'societe',
'contact',
'lire'),
116 'products' => isModEnabled(
'product') && $user->hasRight(
'product',
'read'),
117 'services' => isModEnabled(
'service') && $user->hasRight(
'service',
'read'),
118 'proposals' => isModEnabled(
'propal') && $user->hasRight(
'propal',
'read'),
119 'orders' => isModEnabled(
'order') && $user->hasRight(
'commande',
'lire'),
120 'invoices' => isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire'),
121 'donations' => isModEnabled(
'don') && $user->hasRight(
'don',
'lire'),
122 'contracts' => isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire'),
123 'interventions' => isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire'),
124 'supplier_orders' => isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire') && !
getDolGlobalString(
'SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS'),
125 'supplier_invoices' => isModEnabled(
'supplier_invoice') && $user->hasRight(
'fournisseur',
'facture',
'lire') && !
getDolGlobalString(
'SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS'),
126 'supplier_proposals' => isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire') && !
getDolGlobalString(
'SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS'),
127 'projects' => isModEnabled(
'project') && $user->hasRight(
'projet',
'lire'),
128 'expensereports' => isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire'),
129 'holidays' => isModEnabled(
'holiday') && $user->hasRight(
'holiday',
'read'),
130 'ticket' => isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read'),
131 'dolresource' => isModEnabled(
'resource') && $user->hasRight(
'resource',
'read')
135 'members' =>
'Adherent',
136 'customers' =>
'Client',
137 'prospects' =>
'Client',
138 'suppliers' =>
'Fournisseur',
139 'contacts' =>
'Contact',
140 'products' =>
'Product',
141 'services' =>
'ProductService',
142 'proposals' =>
'Propal',
143 'orders' =>
'Commande',
144 'invoices' =>
'Facture',
145 'donations' =>
'Don',
146 'contracts' =>
'Contrat',
147 'interventions' =>
'Fichinter',
148 'supplier_orders' =>
'CommandeFournisseur',
149 'supplier_invoices' =>
'FactureFournisseur',
150 'supplier_proposals' =>
'SupplierProposal',
151 'projects' =>
'Project',
152 'expensereports' =>
'ExpenseReport',
153 'holidays' =>
'Holiday',
154 'ticket' =>
'Ticket',
155 'dolresource' =>
'Dolresource'
158 'users' => DOL_DOCUMENT_ROOT .
"/user/class/user.class.php",
159 'members' => DOL_DOCUMENT_ROOT .
"/adherents/class/adherent.class.php",
160 'customers' => DOL_DOCUMENT_ROOT .
"/societe/class/client.class.php",
161 'prospects' => DOL_DOCUMENT_ROOT .
"/societe/class/client.class.php",
162 'suppliers' => DOL_DOCUMENT_ROOT .
"/fourn/class/fournisseur.class.php",
163 'contacts' => DOL_DOCUMENT_ROOT .
"/contact/class/contact.class.php",
164 'products' => DOL_DOCUMENT_ROOT .
"/product/class/product.class.php",
165 'services' => DOL_DOCUMENT_ROOT .
"/product/class/product.class.php",
166 'proposals' => DOL_DOCUMENT_ROOT .
"/comm/propal/class/propal.class.php",
167 'orders' => DOL_DOCUMENT_ROOT .
"/commande/class/commande.class.php",
168 'invoices' => DOL_DOCUMENT_ROOT .
"/compta/facture/class/facture.class.php",
169 'donations' => DOL_DOCUMENT_ROOT .
"/don/class/don.class.php",
170 'contracts' => DOL_DOCUMENT_ROOT .
"/contrat/class/contrat.class.php",
171 'interventions' => DOL_DOCUMENT_ROOT .
"/fichinter/class/fichinter.class.php",
172 'supplier_orders' => DOL_DOCUMENT_ROOT .
"/fourn/class/fournisseur.commande.class.php",
173 'supplier_invoices' => DOL_DOCUMENT_ROOT .
"/fourn/class/fournisseur.facture.class.php",
174 'supplier_proposals' => DOL_DOCUMENT_ROOT .
"/supplier_proposal/class/supplier_proposal.class.php",
175 'projects' => DOL_DOCUMENT_ROOT .
"/projet/class/project.class.php",
176 'expensereports' => DOL_DOCUMENT_ROOT .
"/expensereport/class/expensereport.class.php",
177 'holidays' => DOL_DOCUMENT_ROOT .
"/holiday/class/holiday.class.php",
178 'ticket' => DOL_DOCUMENT_ROOT .
"/ticket/class/ticket.class.php",
179 'dolresource' => DOL_DOCUMENT_ROOT .
"/resource/class/dolresource.class.php"
182 'users' => DOL_URL_ROOT .
'/user/list.php',
183 'members' => DOL_URL_ROOT .
'/adherents/list.php?statut=1&mainmenu=members',
184 'customers' => DOL_URL_ROOT .
'/societe/list.php?type=c&mainmenu=companies',
185 'prospects' => DOL_URL_ROOT .
'/societe/list.php?type=p&mainmenu=companies',
186 'suppliers' => DOL_URL_ROOT .
'/societe/list.php?type=f&mainmenu=companies',
187 'contacts' => DOL_URL_ROOT .
'/contact/list.php?mainmenu=companies',
188 'products' => DOL_URL_ROOT .
'/product/list.php?type=0&mainmenu=products',
189 'services' => DOL_URL_ROOT .
'/product/list.php?type=1&mainmenu=products',
190 'proposals' => DOL_URL_ROOT .
'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals',
191 'orders' => DOL_URL_ROOT .
'/commande/list.php?mainmenu=commercial&leftmenu=orders',
192 'invoices' => DOL_URL_ROOT .
'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills',
193 'donations' => DOL_URL_ROOT .
'/don/list.php?leftmenu=donations',
194 'contracts' => DOL_URL_ROOT .
'/contrat/list.php?mainmenu=commercial&leftmenu=contracts',
195 'interventions' => DOL_URL_ROOT .
'/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter',
196 'supplier_orders' => DOL_URL_ROOT .
'/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers',
197 'supplier_invoices' => DOL_URL_ROOT .
'/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills',
198 'supplier_proposals' => DOL_URL_ROOT .
'/supplier_proposal/list.php?mainmenu=commercial&leftmenu=',
199 'projects' => DOL_URL_ROOT .
'/projet/list.php?mainmenu=project',
200 'expensereports' => DOL_URL_ROOT .
'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport',
201 'holidays' => DOL_URL_ROOT .
'/holiday/list.php?mainmenu=hrm&leftmenu=holiday',
202 'ticket' => DOL_URL_ROOT .
'/ticket/list.php?leftmenu=ticket',
203 'dolresource' => DOL_URL_ROOT .
'/resource/list.php?mainmenu=agenda',
207 'members' =>
"Members",
208 'customers' =>
"ThirdPartyCustomersStats",
209 'prospects' =>
"ThirdPartyProspectsStats",
210 'suppliers' =>
"Suppliers",
211 'contacts' =>
"Contacts",
212 'products' =>
"Products",
213 'services' =>
"Services",
214 'proposals' =>
"CommercialProposalsShort",
215 'orders' =>
"CustomersOrders",
216 'invoices' =>
"BillsCustomers",
217 'donations' =>
"Donations",
218 'contracts' =>
"Contracts",
219 'interventions' =>
"Interventions",
220 'supplier_orders' =>
"SuppliersOrders",
221 'supplier_invoices' =>
"SuppliersInvoices",
222 'supplier_proposals' =>
"SupplierProposalShort",
223 'projects' =>
"Projects",
224 'expensereports' =>
"ExpenseReports",
225 'holidays' =>
"Holidays",
226 'ticket' =>
"Ticket",
227 'dolresource' =>
"Resources",
230 'customers' =>
"companies",
231 'contacts' =>
"companies",
232 'services' =>
"products",
233 'proposals' =>
"propal",
234 'invoices' =>
"bills",
235 'supplier_orders' =>
"orders",
236 'supplier_invoices' =>
"bills",
237 'supplier_proposals' =>
'supplier_proposal',
238 'expensereports' =>
"trips",
239 'holidays' =>
"holiday",
241 $boardloaded = array();
243 foreach ($keys as $val) {
244 if ($conditions[$val]) {
246 $class = $classes[$val];
248 $classkeyforcache = $class;
249 if ($classkeyforcache ==
'ProductService') {
250 $classkeyforcache =
'Product';
253 if (!isset($boardloaded[$classkeyforcache]) || !is_object($boardloaded[$classkeyforcache])) {
254 include_once $includes[$val];
256 $board =
new $class($this->db);
257 if (method_exists($board,
'load_state_board')) {
259 $board->load_state_board();
260 } elseif (method_exists($board,
'loadStateBoard')) {
261 $board->loadStateBoard();
265 $boardloaded[$class] = $board;
267 $board = $boardloaded[$classkeyforcache];
270 $langs->load(empty($langfile[$val]) ? $val : $langfile[$val]);
272 $text = $langs->trans($titres[$val]);
273 $boxstatItem .=
'<a href="' . $links[$val] .
'" class="boxstatsindicator thumbstat nobold nounderline">';
274 $boxstatItem .=
'<div class="boxstats">';
275 $boxstatItem .=
'<span class="boxstatstext" title="' .
dol_escape_htmltag($text) .
'">' . $text .
'</span><br>';
276 $boxstatItem .=
'<span class="boxstatsindicator">' .
img_object(
"", $board->picto,
'class="inline-block"') .
' ' . (!empty($board->nb[$val]) ? $board->nb[$val] : 0) .
'</span>';
277 $boxstatItem .=
'</div>';
278 $boxstatItem .=
'</a>';
280 $boxstatItems[$val] = $boxstatItem;
284 if (!empty($boxstatFromHook) || !empty($boxstatItems)) {
285 $boxstat .= $boxstatFromHook;
287 if (is_array($boxstatItems) && count($boxstatItems) > 0) {
288 $boxstat .= implode(
'', $boxstatItems);
291 $boxstat .=
'<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
292 $boxstat .=
'<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
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>';
300 $this->info_box_contents[0][0] = array(
301 'tr' =>
'class="nohover"',
302 'td' =>
'class="tdwidgetstate center"',
303 'textnoformat' => $boxstat
307 $this->info_box_contents[0][0] = array(
309 'text' => $langs->trans(
"ReadPermissionNotAllowed")