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