42 global $db, $langs,
$conf, $user;
43 $langs->load(
"products");
45 $label = $langs->trans(
'Product');
46 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_prices') : $user->hasRight(
'product',
'read');
49 $label = $langs->trans(
'Service');
50 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_prices') : $user->hasRight(
'service',
'read');
56 $head[$h][0] = DOL_URL_ROOT.
"/product/card.php?id=".
$object->id;
57 $head[$h][1] = $label;
58 $head[$h][2] =
'card';
62 if ($usercancreadprice) {
63 $head[$h][0] = DOL_URL_ROOT.
"/product/price.php?id=".
$object->id;
64 $head[$h][1] = $langs->trans(
"SellingPrices");
65 $head[$h][2] =
'price';
69 $head[$h][1] = $langs->trans(
"SellingPrices");
70 $head[$h][2] =
'price';
71 $head[$h][5] =
'disabled';
77 if ((isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) && ($user->hasRight(
'fournisseur',
'lire') || $user->hasRight(
'supplier_order',
'read') || $user->hasRight(
'supplier_invoice',
'read'))
78 || (isModEnabled(
'margin') && $user->hasRight(
"margin",
"liretous"))
80 if ($usercancreadprice) {
81 $head[$h][0] = DOL_URL_ROOT.
"/product/price_suppliers.php?id=".
$object->id;
82 $head[$h][1] = $langs->trans(
"BuyingPrices");
83 $head[$h][2] =
'suppliers';
87 $head[$h][1] = $langs->trans(
"BuyingPrices");
88 $head[$h][2] =
'suppliers';
89 $head[$h][5] =
'disabled';
97 $head[$h][0] = DOL_URL_ROOT.
"/product/traduction.php?id=".
$object->id;
98 $head[$h][1] = $langs->trans(
"Translations");
99 $nbTranslations = !empty(
$object->multilangs) ? count(
$object->multilangs) : 0;
100 if ($nbTranslations > 0) {
101 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbTranslations.
'</span>';
103 $head[$h][2] =
'translation';
109 $head[$h][0] = DOL_URL_ROOT.
"/product/composition/card.php?id=".
$object->id;
110 $head[$h][1] = $langs->trans(
'AssociatedProducts');
112 $nbFatherAndChild =
$object->hasFatherOrChild();
113 if ($nbFatherAndChild > 0) {
114 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbFatherAndChild.
'</span>';
116 $head[$h][2] =
'subproduct';
120 if (isModEnabled(
'variants') && (
$object->isProduct() ||
$object->isService())) {
123 require_once DOL_DOCUMENT_ROOT.
'/variants/class/ProductCombination.class.php';
127 if ($prodcomb->fetchByFkProductChild(
$object->id) <= 0) {
128 $head[$h][0] = DOL_URL_ROOT.
"/variants/combinations.php?id=".
$object->id;
129 $head[$h][1] = $langs->trans(
'ProductCombinations');
130 $head[$h][2] =
'combinations';
131 $nbVariant = $prodcomb->countNbOfCombinationForFkProductParent(
$object->id);
132 if ($nbVariant > 0) {
133 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbVariant.
'</span>';
141 if (isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire')) {
142 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/product.php?id=".
$object->id;
143 $head[$h][1] = $langs->trans(
"Stock");
144 $head[$h][2] =
'stock';
150 if (isModEnabled(
'resource')) {
152 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=product&ref='.
$object->ref;
153 $head[$h][1] = $langs->trans(
"Resources");
154 $head[$h][2] =
'resources';
158 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=service&ref='.
$object->ref;
159 $head[$h][1] = $langs->trans(
"Resources");
160 $head[$h][2] =
'resources';
165 $head[$h][0] = DOL_URL_ROOT.
"/product/stats/facture.php?showmessage=1&id=".
$object->id;
166 $head[$h][1] = $langs->trans(
'Referers');
167 $head[$h][2] =
'referers';
170 $head[$h][0] = DOL_URL_ROOT.
"/product/stats/card.php?id=".
$object->id;
171 $head[$h][1] = $langs->trans(
'Statistics');
172 $head[$h][2] =
'stats';
184 if (!empty(
$object->note_private)) {
187 if (!empty(
$object->note_public)) {
190 $head[$h][0] = DOL_URL_ROOT.
'/product/note.php?id='.
$object->id;
191 $head[$h][1] = $langs->trans(
'Notes');
193 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
195 $head[$h][2] =
'note';
200 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
201 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
209 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
217 $nbFiles += count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
220 $head[$h][0] = DOL_URL_ROOT.
'/product/document.php?id='.
$object->id;
221 $head[$h][1] = $langs->trans(
'Documents');
222 if (($nbFiles + $nbLinks) > 0) {
223 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
225 $head[$h][2] =
'documents';
229 $head[$h][0] = DOL_URL_ROOT.
'/product/messaging.php?id='.
$object->id;
230 $head[$h][1] = $langs->trans(
"Events");
231 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
233 $head[$h][1] .= $langs->trans(
"Agenda");
235 $head[$h][2] =
'agenda';
253 global $db, $langs,
$conf, $user;
256 $langs->loadLangs(array(
"products",
"productbatch"));
261 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/productlot_card.php?id=".
$object->id;
262 $head[$h][1] = $langs->trans(
"Lot");
263 $head[$h][2] =
'card';
266 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/stats/expedition.php?showmessage=1&id=".
$object->id;
267 $head[$h][1] = $langs->trans(
'Referers');
268 $head[$h][2] =
'referers';
272 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
273 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
275 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
277 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/productlot_document.php?id=".
$object->id;
278 $head[$h][1] = $langs->trans(
"Documents");
279 if (($nbFiles + $nbLinks) > 0) {
280 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
282 $head[$h][2] =
'documents';
288 if (!empty(
$object->note_private)) {
291 if (!empty(
$object->note_public)) {
294 $head[$h][0] = DOL_URL_ROOT .
'/product/stock/productlot_note.php?id=' .
$object->id;
295 $head[$h][1] = $langs->trans(
'Notes');
297 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . $nbNote .
'</span>';
299 $head[$h][2] =
'note';
331 global $langs,
$conf, $user, $db;
334 $extrafields->fetch_name_optionals_label(
'product');
335 $extrafields->fetch_name_optionals_label(
'product_price');
336 $extrafields->fetch_name_optionals_label(
'product_customer_price');
337 $extrafields->fetch_name_optionals_label(
'product_fournisseur_price');
342 $head[$h][0] = DOL_URL_ROOT.
"/product/admin/product.php";
343 $head[$h][1] = $langs->trans(
'Parameters');
344 $head[$h][2] =
'general';
349 0 => DOL_URL_ROOT.
"/product/admin/price_rules.php",
350 1 => $langs->trans(
'MultipriceRules'),
362 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_extrafields.php';
363 $head[$h][1] = $langs->trans(
"ExtraFields");
364 $nbExtrafields = $extrafields->attributes[
'product'][
'count'];
365 if ($nbExtrafields > 0) {
366 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
368 $head[$h][2] =
'attributes';
371 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_price_extrafields.php';
372 $head[$h][1] = $langs->trans(
"ProductLevelExtraFields");
373 $nbExtrafields = $extrafields->attributes[
'product_price'][
'count'];
374 if ($nbExtrafields > 0) {
375 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
377 $head[$h][2] =
'levelAttributes';
380 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_customer_extrafields.php';
381 $head[$h][1] = $langs->trans(
"ProductCustomerExtraFields");
382 $nbExtrafields = $extrafields->attributes[
'product_customer_price'][
'count'];
383 if ($nbExtrafields > 0) {
384 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
386 $head[$h][2] =
'customerAttributes';
389 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_supplier_extrafields.php';
390 $head[$h][1] = $langs->trans(
"ProductSupplierExtraFields");
391 $nbExtrafields = $extrafields->attributes[
'product_fournisseur_price'][
'count'];
392 if ($nbExtrafields > 0) {
393 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
395 $head[$h][2] =
'supplierAttributes';
412 global $langs,
$conf, $user, $db;
415 $extrafields->fetch_name_optionals_label(
'product_lot');
420 $head[$h][0] = DOL_URL_ROOT.
"/product/admin/product_lot.php";
421 $head[$h][1] = $langs->trans(
'Parameters');
422 $head[$h][2] =
'settings';
431 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_lot_extrafields.php';
432 $head[$h][1] = $langs->trans(
"ExtraFields");
433 $nbExtrafields = $extrafields->attributes[
'product_lot'][
'count'];
434 if ($nbExtrafields > 0) {
435 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
437 $head[$h][2] =
'attributes';
456 global $langs, $user, $db, $hookmanager;
458 $form =
new Form($db);
462 print
'<tr class="liste_titre">';
463 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
464 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
465 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
466 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
470 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
472 $ret = $product->load_stats_propale($socid);
476 $langs->load(
"propal");
478 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/propal.php?id='.$product->id.
'">'.
img_object(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Proposals").
'</a>';
479 print
'</td><td class="right">';
480 print $product->stats_propale[
'customers'];
481 print
'</td><td class="right">';
482 print $product->stats_propale[
'nb'];
483 print
'</td><td class="right">';
484 print
price($product->stats_propale[
'qty'], 1, $langs, 0, 0);
489 if (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
491 $ret = $product->load_stats_proposal_supplier($socid);
495 $langs->load(
"supplier_proposal");
497 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/supplier_proposal.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_proposal',
'class="pictofixedwidth"').$langs->trans(
"SupplierProposals").
'</a>';
498 print
'</td><td class="right">';
499 print $product->stats_proposal_supplier[
'suppliers'];
500 print
'</td><td class="right">';
501 print $product->stats_proposal_supplier[
'nb'];
502 print
'</td><td class="right">';
503 print
price($product->stats_proposal_supplier[
'qty'], 1, $langs, 0, 0);
508 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
510 $ret = $product->load_stats_commande($socid);
514 $langs->load(
"orders");
516 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/commande.php?id='.$product->id.
'">'.
img_object(
'',
'order',
'class="pictofixedwidth"').$langs->trans(
"CustomersOrders").
'</a>';
517 print
'</td><td class="right">';
518 print $product->stats_commande[
'customers'];
519 print
'</td><td class="right">';
520 print $product->stats_commande[
'nb'];
521 print
'</td><td class="right">';
522 print
price($product->stats_commande[
'qty'], 1, $langs, 0, 0);
527 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'commande',
'lire')) || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
529 $ret = $product->load_stats_commande_fournisseur($socid);
533 $langs->load(
"orders");
535 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/commande_fournisseur.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_order',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
536 print
'</td><td class="right">';
537 print $product->stats_commande_fournisseur[
'suppliers'];
538 print
'</td><td class="right">';
539 print $product->stats_commande_fournisseur[
'nb'];
540 print
'</td><td class="right">';
541 print
price($product->stats_commande_fournisseur[
'qty'], 1, $langs, 0, 0);
546 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
548 $ret = $product->load_stats_facture($socid);
552 $langs->load(
"bills");
554 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facture.php?id='.$product->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CustomersInvoices").
'</a>';
555 print
'</td><td class="right">';
556 print $product->stats_facture[
'customers'];
557 print
'</td><td class="right">';
558 print $product->stats_facture[
'nb'];
559 print
'</td><td class="right">';
560 print
price($product->stats_facture[
'qty'], 1, $langs, 0, 0);
565 if (isModEnabled(
"invoice") && $user->hasRight(
'facture',
'lire')) {
567 $ret = $product->load_stats_facturerec($socid);
571 $langs->load(
"bills");
573 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facturerec.php?id='.$product->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"RecurringInvoiceTemplate").
'</a>';
574 print
'</td><td class="right">';
575 print $product->stats_facture[
'customers'];
576 print
'</td><td class="right">';
577 print $product->stats_facturerec[
'nb'];
578 print
'</td><td class="right">';
579 print $product->stats_facturerec[
'qty'];
584 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'facture',
'lire')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
586 $ret = $product->load_stats_facture_fournisseur($socid);
590 $langs->load(
"bills");
592 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facture_fournisseur.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
"SuppliersInvoices").
'</a>';
593 print
'</td><td class="right">';
594 print $product->stats_facture_fournisseur[
'suppliers'];
595 print
'</td><td class="right">';
596 print $product->stats_facture_fournisseur[
'nb'];
597 print
'</td><td class="right">';
598 print
price($product->stats_facture_fournisseur[
'qty'], 1, $langs, 0, 0);
604 if (isModEnabled(
'shipping') && $user->hasRight(
'shipping',
'lire')) {
606 $ret = $product->load_stats_sending($socid);
610 $langs->load(
"sendings");
612 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/expedition.php?id='.$product->id.
'">'.
img_object(
'',
'shipment',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
613 print
'</td><td class="right">';
614 print $product->stats_expedition[
'customers'];
615 print
'</td><td class="right">';
616 print $product->stats_expedition[
'nb'];
617 print
'</td><td class="right">';
618 print $product->stats_expedition[
'qty'];
624 if ((isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire'))) {
626 $ret = $product->load_stats_reception($socid);
630 $langs->load(
"receptions");
632 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/reception.php?id='.$product->id.
'">'.
img_object(
'',
'reception',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
633 print
'</td><td class="right">';
634 print $product->stats_reception[
'suppliers'];
635 print
'</td><td class="right">';
636 print $product->stats_reception[
'nb'];
637 print
'</td><td class="right">';
638 print $product->stats_reception[
'qty'];
644 if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
646 $ret = $product->load_stats_contrat($socid);
650 $langs->load(
"contracts");
652 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/contrat.php?id='.$product->id.
'">'.
img_object(
'',
'contract',
'class="pictofixedwidth"').$langs->trans(
"Contracts").
'</a>';
653 print
'</td><td class="right">';
654 print $product->stats_contrat[
'customers'];
655 print
'</td><td class="right">';
656 print $product->stats_contrat[
'nb'];
657 print
'</td><td class="right">';
658 print
price($product->stats_contrat[
'qty'], 1, $langs, 0, 0);
664 if (isModEnabled(
'bom') && $user->hasRight(
'bom',
'read')) {
666 $ret = $product->load_stats_bom($socid);
673 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/bom.php?id='.$product->id.
'">'.
img_object(
'',
'bom',
'class="pictofixedwidth"').$langs->trans(
"BOM").
'</a>';
674 print
'</td><td class="right">';
676 print
'</td><td class="right">';
677 print $form->textwithpicto($product->stats_bom[
'nb_toconsume'], $langs->trans(
"RowMaterial"));
679 print $form->textwithpicto($product->stats_bom[
'nb_toproduce'], $langs->trans(
"Finished"));
680 print
'</td><td class="right">';
681 print $form->textwithpicto($product->stats_bom[
'qty_toconsume'], $langs->trans(
"RowMaterial"));
683 print $form->textwithpicto($product->stats_bom[
'qty_toproduce'], $langs->trans(
"Finished"));
689 if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
691 $ret = $product->load_stats_mo($socid);
697 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/mo.php?id='.$product->id.
'">'.
img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
698 print
'</td><td class="right">';
699 print $form->textwithpicto($product->stats_mo[
'customers_toconsume'], $langs->trans(
"ToConsume"));
701 print $form->textwithpicto($product->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
703 print $form->textwithpicto($product->stats_mo[
'customers_toproduce'], $langs->trans(
"QtyToProduce"));
705 print $form->textwithpicto($product->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
706 print
'</td><td class="right">';
707 print $form->textwithpicto($product->stats_mo[
'nb_toconsume'], $langs->trans(
"ToConsume"));
709 print $form->textwithpicto($product->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
711 print $form->textwithpicto($product->stats_mo[
'nb_toproduce'], $langs->trans(
"QtyToProduce"));
713 print $form->textwithpicto($product->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
714 print
'</td><td class="right">';
715 print $form->textwithpicto($product->stats_mo[
'qty_toconsume'], $langs->trans(
"ToConsume"));
717 print $form->textwithpicto($product->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
719 print $form->textwithpicto($product->stats_mo[
'qty_toproduce'], $langs->trans(
"QtyToProduce"));
721 print $form->textwithpicto($product->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
725 $parameters = array(
'socid' => $socid);
726 $reshook = $hookmanager->executeHooks(
'addMoreProductStat', $parameters, $product, $nblines);
731 print $hookmanager->resPrint;
746 global
$conf, $langs, $user, $db, $hookmanager;
748 $langs->LoadLangs(array(
'sendings',
'orders',
'receptions'));
750 $form =
new Form($db);
754 print
'<tr class="liste_titre">';
755 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
756 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
757 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
758 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
762 if (isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')) {
764 $ret = $batch->loadStatsExpedition($socid);
768 $langs->load(
"bills");
770 print
'<a href="'.dol_buildpath(
'/product/stock/stats/expedition.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
771 print
'</td><td class="right">';
772 print $batch->stats_expedition[
'customers'];
773 print
'</td><td class="right">';
774 print $batch->stats_expedition[
'nb'];
775 print
'</td><td class="right">';
776 print $batch->stats_expedition[
'qty'];
781 if (isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire')) {
783 $ret = $batch->loadStatsReception($socid);
787 $langs->load(
"bills");
789 print
'<a href="'.dol_buildpath(
'/product/stock/stats/reception.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
790 print
'</td><td class="right">';
791 print $batch->stats_reception[
'customers'];
792 print
'</td><td class="right">';
793 print $batch->stats_reception[
'nb'];
794 print
'</td><td class="right">';
795 print $batch->stats_reception[
'qty'];
798 } elseif (isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire')) {
800 $ret = $batch->loadStatsSupplierOrder($socid);
804 $langs->load(
"bills");
806 print
'<a href="'.dol_buildpath(
'/product/stock/stats/commande_fournisseur.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
807 print
'</td><td class="right">';
808 print $batch->stats_supplier_order[
'customers'];
809 print
'</td><td class="right">';
810 print $batch->stats_supplier_order[
'nb'];
811 print
'</td><td class="right">';
812 print $batch->stats_supplier_order[
'qty'];
817 if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
819 $ret = $batch->loadStatsMo($socid);
825 print
'<a href="'.dol_buildpath(
'/product/stock/stats/mo.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
826 print
'</td><td class="right">';
828 print $form->textwithpicto($batch->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
830 print $form->textwithpicto($batch->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
831 print
'</td><td class="right">';
833 print $form->textwithpicto($batch->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
835 print $form->textwithpicto($batch->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
836 print
'</td><td class="right">';
838 print $form->textwithpicto($batch->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
840 print $form->textwithpicto($batch->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
845 $parameters = array(
'socid' => $socid);
846 $reshook = $hookmanager->executeHooks(
'addMoreBatchProductStat', $parameters, $batch, $nblines);
851 print $hookmanager->resPrint;
869function measuring_units_string($unitscale =
'', $measuring_style =
'', $unitid = 0, $use_short_label = 0, $outputlangs =
null)
871 return measuringUnitString($unitid, $measuring_style, $unitscale, $use_short_label, $outputlangs);
885function measuringUnitString($unitid, $measuring_style =
'', $unitscale =
'', $use_short_label = 0, $outputlangs =
null)
888 global $measuring_unit_cache;
890 if (empty($outputlangs)) {
891 $outputlangs = $langs;
894 if (empty($measuring_unit_cache[$unitid.
'_'.$measuring_style.
'_'.$unitscale.
'_'.$use_short_label])) {
895 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
896 $measuringUnits =
new CUnits($db);
898 if ($measuring_style ==
'' && $unitscale ==
'') {
899 $arrayforfilter = array(
900 't.rowid' => $unitid,
903 } elseif ($unitscale !==
'') {
904 $arrayforfilter = array(
905 't.scale' => $unitscale,
906 't.unit_type' => $measuring_style,
910 $arrayforfilter = array(
911 't.rowid' => $unitid,
912 't.unit_type' => $measuring_style,
916 $result = $measuringUnits->fetchAll(
'',
'', 0, 0, $arrayforfilter);
921 if (is_array($measuringUnits->records) && count($measuringUnits->records) > 0) {
922 if ($use_short_label == 1) {
923 $labeltoreturn = $measuringUnits->records[key($measuringUnits->records)]->short_label;
924 } elseif ($use_short_label == 2) {
925 $labeltoreturn = $outputlangs->transnoentitiesnoconv(ucfirst($measuringUnits->records[key($measuringUnits->records)]->label).
'Short');
927 $labeltoreturn = $outputlangs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label);
932 $measuring_unit_cache[$unitid.
'_'.$measuring_style.
'_'.$unitscale.
'_'.$use_short_label] = $labeltoreturn;
933 return $labeltoreturn;
936 return $measuring_unit_cache[$unitid.
'_'.$measuring_style.
'_'.$unitscale.
'_'.$use_short_label];
949 $measuring_units = array();
950 $measuring_units[0] = 0;
951 $measuring_units[-1] = -2;
952 $measuring_units[-2] = -4;
953 $measuring_units[-3] = -6;
954 $measuring_units[98] = 98;
955 $measuring_units[99] = 99;
956 return $measuring_units[$unitscale];
969 $measuring_units = array();
970 $measuring_units[0] = 0;
971 $measuring_units[-1] = -3;
972 $measuring_units[-2] = -6;
973 $measuring_units[-3] = -9;
974 $measuring_units[98] = 88;
975 $measuring_units[99] = 89;
976 return $measuring_units[$unit];
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class of dictionary type of thirdparty (used by imports)
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class ProductCombination Used to represent the relation between a product and one of its variants.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
measuring_units_squared($unitscale)
Transform a given unit scale into the square of that unit, if known.
show_stats_for_batch($batch, $socid)
Show stats for product batch.
product_prepare_head($object)
Prepare array with list of tabs.
product_admin_prepare_head()
Return array head with list of tabs to view object information.
measuringUnitString($unitid, $measuring_style='', $unitscale='', $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
show_stats_for_company($product, $socid)
Show stats for a product.
productlot_prepare_head($object)
Prepare array with list of tabs.
product_lot_admin_prepare_head()
Return array head with list of tabs to view object information.
measuring_units_string($unitscale='', $measuring_style='', $unitid=0, $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
measuring_units_cubed($unit)
Transform a given unit scale into the cube of that unit, if known.