40 global $db, $langs, $conf, $user;
41 $langs->load(
"products");
43 $label = $langs->trans(
'Product');
44 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_prices') : $user->hasRight(
'product',
'read');
47 $label = $langs->trans(
'Service');
48 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_prices') : $user->hasRight(
'service',
'read');
54 $head[$h][0] = DOL_URL_ROOT.
"/product/card.php?id=".
$object->id;
55 $head[$h][1] = $label;
56 $head[$h][2] =
'card';
60 if ($usercancreadprice) {
61 $head[$h][0] = DOL_URL_ROOT.
"/product/price.php?id=".
$object->id;
62 $head[$h][1] = $langs->trans(
"SellingPrices");
63 $head[$h][2] =
'price';
67 $head[$h][1] = $langs->trans(
"SellingPrices");
68 $head[$h][2] =
'price';
69 $head[$h][5] =
'disabled';
75 if ((isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) && ($user->hasRight(
'fournisseur',
'lire') || $user->hasRight(
'supplier_order',
'read') || $user->hasRight(
'supplier_invoice',
'read'))
76 || (isModEnabled(
'margin') && $user->hasRight(
"margin",
"liretous"))
78 if ($usercancreadprice) {
79 $head[$h][0] = DOL_URL_ROOT.
"/product/price_suppliers.php?id=".
$object->id;
80 $head[$h][1] = $langs->trans(
"BuyingPrices");
81 $head[$h][2] =
'suppliers';
85 $head[$h][1] = $langs->trans(
"BuyingPrices");
86 $head[$h][2] =
'suppliers';
87 $head[$h][5] =
'disabled';
95 $head[$h][0] = DOL_URL_ROOT.
"/product/traduction.php?id=".
$object->id;
96 $head[$h][1] = $langs->trans(
"Translations");
97 $head[$h][2] =
'translation';
103 $head[$h][0] = DOL_URL_ROOT.
"/product/composition/card.php?id=".
$object->id;
104 $head[$h][1] = $langs->trans(
'AssociatedProducts');
106 $nbFatherAndChild =
$object->hasFatherOrChild();
107 if ($nbFatherAndChild > 0) {
108 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbFatherAndChild.
'</span>';
110 $head[$h][2] =
'subproduct';
114 if (isModEnabled(
'variants') && (
$object->isProduct() ||
$object->isService())) {
117 require_once DOL_DOCUMENT_ROOT.
'/variants/class/ProductCombination.class.php';
121 if ($prodcomb->fetchByFkProductChild(
$object->id) <= 0) {
122 $head[$h][0] = DOL_URL_ROOT.
"/variants/combinations.php?id=".
$object->id;
123 $head[$h][1] = $langs->trans(
'ProductCombinations');
124 $head[$h][2] =
'combinations';
125 $nbVariant = $prodcomb->countNbOfCombinationForFkProductParent(
$object->id);
126 if ($nbVariant > 0) {
127 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbVariant.
'</span>';
135 if (isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire')) {
136 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/product.php?id=".
$object->id;
137 $head[$h][1] = $langs->trans(
"Stock");
138 $head[$h][2] =
'stock';
144 if (isModEnabled(
'resource')) {
146 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=product&ref='.
$object->ref;
147 $head[$h][1] = $langs->trans(
"Resources");
148 $head[$h][2] =
'resources';
152 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=service&ref='.
$object->ref;
153 $head[$h][1] = $langs->trans(
"Resources");
154 $head[$h][2] =
'resources';
159 $head[$h][0] = DOL_URL_ROOT.
"/product/stats/facture.php?showmessage=1&id=".
$object->id;
160 $head[$h][1] = $langs->trans(
'Referers');
161 $head[$h][2] =
'referers';
164 $head[$h][0] = DOL_URL_ROOT.
"/product/stats/card.php?id=".
$object->id;
165 $head[$h][1] = $langs->trans(
'Statistics');
166 $head[$h][2] =
'stats';
178 if (!empty(
$object->note_private)) {
181 if (!empty(
$object->note_public)) {
184 $head[$h][0] = DOL_URL_ROOT.
'/product/note.php?id='.
$object->id;
185 $head[$h][1] = $langs->trans(
'Notes');
187 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
189 $head[$h][2] =
'note';
194 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
195 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
202 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
210 $nbFiles += count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
213 $head[$h][0] = DOL_URL_ROOT.
'/product/document.php?id='.
$object->id;
214 $head[$h][1] = $langs->trans(
'Documents');
215 if (($nbFiles + $nbLinks) > 0) {
216 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
218 $head[$h][2] =
'documents';
222 $head[$h][0] = DOL_URL_ROOT.
'/product/messaging.php?id='.
$object->id;
223 $head[$h][1] = $langs->trans(
"Events");
224 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
226 $head[$h][1] .= $langs->trans(
"Agenda");
228 $head[$h][2] =
'agenda';
246 global $db, $langs, $conf, $user;
249 $langs->loadLangs(array(
"products",
"productbatch"));
254 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/productlot_card.php?id=".
$object->id;
255 $head[$h][1] = $langs->trans(
"Lot");
256 $head[$h][2] =
'card';
259 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/stats/expedition.php?showmessage=1&id=".
$object->id;
260 $head[$h][1] = $langs->trans(
'Referers');
261 $head[$h][2] =
'referers';
265 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
266 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
268 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
270 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/productlot_document.php?id=".
$object->id;
271 $head[$h][1] = $langs->trans(
"Documents");
272 if (($nbFiles + $nbLinks) > 0) {
273 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
275 $head[$h][2] =
'documents';
281 if (!empty(
$object->note_private)) {
284 if (!empty(
$object->note_public)) {
287 $head[$h][0] = DOL_URL_ROOT .
'/product/stock/productlot_note.php?id=' .
$object->id;
288 $head[$h][1] = $langs->trans(
'Notes');
290 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . $nbNote .
'</span>';
292 $head[$h][2] =
'note';
324 global $langs, $conf, $user, $db;
327 $extrafields->fetch_name_optionals_label(
'product');
328 $extrafields->fetch_name_optionals_label(
'product_fournisseur_price');
333 $head[$h][0] = DOL_URL_ROOT.
"/product/admin/product.php";
334 $head[$h][1] = $langs->trans(
'Parameters');
335 $head[$h][2] =
'general';
340 0 => DOL_URL_ROOT.
"/product/admin/price_rules.php",
341 1 => $langs->trans(
'MultipriceRules'),
353 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_extrafields.php';
354 $head[$h][1] = $langs->trans(
"ExtraFields");
355 $nbExtrafields = $extrafields->attributes[
'product'][
'count'];
356 if ($nbExtrafields > 0) {
357 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
359 $head[$h][2] =
'attributes';
362 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_supplier_extrafields.php';
363 $head[$h][1] = $langs->trans(
"ProductSupplierExtraFields");
364 $nbExtrafields = $extrafields->attributes[
'product_fournisseur_price'][
'count'];
365 if ($nbExtrafields > 0) {
366 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
368 $head[$h][2] =
'supplierAttributes';
385 global $langs, $conf, $user, $db;
388 $extrafields->fetch_name_optionals_label(
'product_lot');
393 $head[$h][0] = DOL_URL_ROOT.
"/product/admin/product_lot.php";
394 $head[$h][1] = $langs->trans(
'Parameters');
395 $head[$h][2] =
'settings';
404 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_lot_extrafields.php';
405 $head[$h][1] = $langs->trans(
"ExtraFields");
406 $nbExtrafields = $extrafields->attributes[
'product_lot'][
'count'];
407 if ($nbExtrafields > 0) {
408 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
410 $head[$h][2] =
'attributes';
429 global $langs, $user, $db, $hookmanager;
431 $form =
new Form($db);
435 print
'<tr class="liste_titre">';
436 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
437 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
438 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
439 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
443 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
445 $ret = $product->load_stats_propale($socid);
449 $langs->load(
"propal");
451 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/propal.php?id='.$product->id.
'">'.
img_object(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Proposals").
'</a>';
452 print
'</td><td class="right">';
453 print $product->stats_propale[
'customers'];
454 print
'</td><td class="right">';
455 print $product->stats_propale[
'nb'];
456 print
'</td><td class="right">';
457 print
price($product->stats_propale[
'qty'], 1, $langs, 0, 0);
462 if (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
464 $ret = $product->load_stats_proposal_supplier($socid);
468 $langs->load(
"supplier_proposal");
470 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/supplier_proposal.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_proposal',
'class="pictofixedwidth"').$langs->trans(
"SupplierProposals").
'</a>';
471 print
'</td><td class="right">';
472 print $product->stats_proposal_supplier[
'suppliers'];
473 print
'</td><td class="right">';
474 print $product->stats_proposal_supplier[
'nb'];
475 print
'</td><td class="right">';
476 print
price($product->stats_proposal_supplier[
'qty'], 1, $langs, 0, 0);
481 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
483 $ret = $product->load_stats_commande($socid);
487 $langs->load(
"orders");
489 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/commande.php?id='.$product->id.
'">'.
img_object(
'',
'order',
'class="pictofixedwidth"').$langs->trans(
"CustomersOrders").
'</a>';
490 print
'</td><td class="right">';
491 print $product->stats_commande[
'customers'];
492 print
'</td><td class="right">';
493 print $product->stats_commande[
'nb'];
494 print
'</td><td class="right">';
495 print
price($product->stats_commande[
'qty'], 1, $langs, 0, 0);
500 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'commande',
'lire')) || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
502 $ret = $product->load_stats_commande_fournisseur($socid);
506 $langs->load(
"orders");
508 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/commande_fournisseur.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_order',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
509 print
'</td><td class="right">';
510 print $product->stats_commande_fournisseur[
'suppliers'];
511 print
'</td><td class="right">';
512 print $product->stats_commande_fournisseur[
'nb'];
513 print
'</td><td class="right">';
514 print
price($product->stats_commande_fournisseur[
'qty'], 1, $langs, 0, 0);
519 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
521 $ret = $product->load_stats_facture($socid);
525 $langs->load(
"bills");
527 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facture.php?id='.$product->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CustomersInvoices").
'</a>';
528 print
'</td><td class="right">';
529 print $product->stats_facture[
'customers'];
530 print
'</td><td class="right">';
531 print $product->stats_facture[
'nb'];
532 print
'</td><td class="right">';
533 print
price($product->stats_facture[
'qty'], 1, $langs, 0, 0);
538 if (isModEnabled(
"invoice") && $user->hasRight(
'facture',
'lire')) {
540 $ret = $product->load_stats_facturerec($socid);
544 $langs->load(
"bills");
546 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facturerec.php?id='.$product->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"RecurringInvoiceTemplate").
'</a>';
547 print
'</td><td class="right">';
548 print $product->stats_facture[
'customers'];
549 print
'</td><td class="right">';
550 print $product->stats_facturerec[
'nb'];
551 print
'</td><td class="right">';
552 print $product->stats_facturerec[
'qty'];
557 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'facture',
'lire')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
559 $ret = $product->load_stats_facture_fournisseur($socid);
563 $langs->load(
"bills");
565 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facture_fournisseur.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
"SuppliersInvoices").
'</a>';
566 print
'</td><td class="right">';
567 print $product->stats_facture_fournisseur[
'suppliers'];
568 print
'</td><td class="right">';
569 print $product->stats_facture_fournisseur[
'nb'];
570 print
'</td><td class="right">';
571 print
price($product->stats_facture_fournisseur[
'qty'], 1, $langs, 0, 0);
577 if (isModEnabled(
'shipping') && $user->hasRight(
'shipping',
'lire')) {
579 $ret = $product->load_stats_sending($socid);
583 $langs->load(
"sendings");
585 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/expedition.php?id='.$product->id.
'">'.
img_object(
'',
'shipment',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
586 print
'</td><td class="right">';
587 print $product->stats_expedition[
'customers'];
588 print
'</td><td class="right">';
589 print $product->stats_expedition[
'nb'];
590 print
'</td><td class="right">';
591 print $product->stats_expedition[
'qty'];
597 if ((isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire'))) {
599 $ret = $product->load_stats_reception($socid);
603 $langs->load(
"receptions");
605 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/reception.php?id='.$product->id.
'">'.
img_object(
'',
'reception',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
606 print
'</td><td class="right">';
607 print $product->stats_reception[
'suppliers'];
608 print
'</td><td class="right">';
609 print $product->stats_reception[
'nb'];
610 print
'</td><td class="right">';
611 print $product->stats_reception[
'qty'];
617 if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
619 $ret = $product->load_stats_contrat($socid);
623 $langs->load(
"contracts");
625 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/contrat.php?id='.$product->id.
'">'.
img_object(
'',
'contract',
'class="pictofixedwidth"').$langs->trans(
"Contracts").
'</a>';
626 print
'</td><td class="right">';
627 print $product->stats_contrat[
'customers'];
628 print
'</td><td class="right">';
629 print $product->stats_contrat[
'nb'];
630 print
'</td><td class="right">';
631 print
price($product->stats_contrat[
'qty'], 1, $langs, 0, 0);
637 if (isModEnabled(
'bom') && $user->hasRight(
'bom',
'read')) {
639 $ret = $product->load_stats_bom($socid);
646 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/bom.php?id='.$product->id.
'">'.
img_object(
'',
'bom',
'class="pictofixedwidth"').$langs->trans(
"BOM").
'</a>';
647 print
'</td><td class="right">';
649 print
'</td><td class="right">';
650 print $form->textwithpicto($product->stats_bom[
'nb_toconsume'], $langs->trans(
"RowMaterial"));
652 print $form->textwithpicto($product->stats_bom[
'nb_toproduce'], $langs->trans(
"Finished"));
653 print
'</td><td class="right">';
654 print $form->textwithpicto($product->stats_bom[
'qty_toconsume'], $langs->trans(
"RowMaterial"));
656 print $form->textwithpicto($product->stats_bom[
'qty_toproduce'], $langs->trans(
"Finished"));
662 if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
664 $ret = $product->load_stats_mo($socid);
670 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/mo.php?id='.$product->id.
'">'.
img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
671 print
'</td><td class="right">';
672 print $form->textwithpicto($product->stats_mo[
'customers_toconsume'], $langs->trans(
"ToConsume"));
674 print $form->textwithpicto($product->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
676 print $form->textwithpicto($product->stats_mo[
'customers_toproduce'], $langs->trans(
"QtyToProduce"));
678 print $form->textwithpicto($product->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
679 print
'</td><td class="right">';
680 print $form->textwithpicto($product->stats_mo[
'nb_toconsume'], $langs->trans(
"ToConsume"));
682 print $form->textwithpicto($product->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
684 print $form->textwithpicto($product->stats_mo[
'nb_toproduce'], $langs->trans(
"QtyToProduce"));
686 print $form->textwithpicto($product->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
687 print
'</td><td class="right">';
688 print $form->textwithpicto($product->stats_mo[
'qty_toconsume'], $langs->trans(
"ToConsume"));
690 print $form->textwithpicto($product->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
692 print $form->textwithpicto($product->stats_mo[
'qty_toproduce'], $langs->trans(
"QtyToProduce"));
694 print $form->textwithpicto($product->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
698 $parameters = array(
'socid' => $socid);
699 $reshook = $hookmanager->executeHooks(
'addMoreProductStat', $parameters, $product, $nblines);
704 print $hookmanager->resPrint;
719 global $conf, $langs, $user, $db, $hookmanager;
721 $langs->LoadLangs(array(
'sendings',
'orders',
'receptions'));
723 $form =
new Form($db);
727 print
'<tr class="liste_titre">';
728 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
729 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
730 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
731 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
735 if (isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')) {
737 $ret = $batch->loadStatsExpedition($socid);
741 $langs->load(
"bills");
743 print
'<a href="'.dol_buildpath(
'/product/stock/stats/expedition.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
744 print
'</td><td class="right">';
745 print $batch->stats_expedition[
'customers'];
746 print
'</td><td class="right">';
747 print $batch->stats_expedition[
'nb'];
748 print
'</td><td class="right">';
749 print $batch->stats_expedition[
'qty'];
754 if (isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire')) {
756 $ret = $batch->loadStatsReception($socid);
760 $langs->load(
"bills");
762 print
'<a href="'.dol_buildpath(
'/product/stock/stats/reception.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
763 print
'</td><td class="right">';
764 print $batch->stats_reception[
'customers'];
765 print
'</td><td class="right">';
766 print $batch->stats_reception[
'nb'];
767 print
'</td><td class="right">';
768 print $batch->stats_reception[
'qty'];
771 } elseif (isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire')) {
773 $ret = $batch->loadStatsSupplierOrder($socid);
777 $langs->load(
"bills");
779 print
'<a href="'.dol_buildpath(
'/product/stock/stats/commande_fournisseur.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
780 print
'</td><td class="right">';
781 print $batch->stats_supplier_order[
'customers'];
782 print
'</td><td class="right">';
783 print $batch->stats_supplier_order[
'nb'];
784 print
'</td><td class="right">';
785 print $batch->stats_supplier_order[
'qty'];
790 if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
792 $ret = $batch->loadStatsMo($socid);
798 print
'<a href="'.dol_buildpath(
'/product/stock/stats/mo.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
799 print
'</td><td class="right">';
801 print $form->textwithpicto($batch->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
803 print $form->textwithpicto($batch->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
804 print
'</td><td class="right">';
806 print $form->textwithpicto($batch->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
808 print $form->textwithpicto($batch->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
809 print
'</td><td class="right">';
811 print $form->textwithpicto($batch->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
813 print $form->textwithpicto($batch->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
818 $parameters = array(
'socid' => $socid);
819 $reshook = $hookmanager->executeHooks(
'addMoreBatchProductStat', $parameters, $batch, $nblines);
824 print $hookmanager->resPrint;
844 return measuringUnitString($unit, $measuring_style, $scale, $use_short_label, $outputlangs);
858function measuringUnitString($unit, $measuring_style =
'', $scale =
'', $use_short_label = 0, $outputlangs =
null)
861 global $measuring_unit_cache;
863 if (empty($outputlangs)) {
864 $outputlangs = $langs;
867 if (empty($measuring_unit_cache[$unit.
'_'.$measuring_style.
'_'.$scale.
'_'.$use_short_label])) {
868 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
869 $measuringUnits =
new CUnits($db);
871 if ($measuring_style ==
'' && $scale ==
'') {
872 $arrayforfilter = array(
876 } elseif ($scale !==
'') {
877 $arrayforfilter = array(
879 't.unit_type' => $measuring_style,
883 $arrayforfilter = array(
885 't.unit_type' => $measuring_style,
889 $result = $measuringUnits->fetchAll(
'',
'', 0, 0, $arrayforfilter);
894 if (is_array($measuringUnits->records) && count($measuringUnits->records) > 0) {
895 if ($use_short_label == 1) {
896 $labeltoreturn = $measuringUnits->records[key($measuringUnits->records)]->short_label;
897 } elseif ($use_short_label == 2) {
898 $labeltoreturn = $outputlangs->transnoentitiesnoconv(ucfirst($measuringUnits->records[key($measuringUnits->records)]->label).
'Short');
900 $labeltoreturn = $outputlangs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label);
905 $measuring_unit_cache[$unit.
'_'.$measuring_style.
'_'.$scale.
'_'.$use_short_label] = $labeltoreturn;
906 return $labeltoreturn;
909 return $measuring_unit_cache[$unit.
'_'.$measuring_style.
'_'.$scale.
'_'.$use_short_label];
922 $measuring_units = array();
923 $measuring_units[0] = 0;
924 $measuring_units[-1] = -2;
925 $measuring_units[-2] = -4;
926 $measuring_units[-3] = -6;
927 $measuring_units[98] = 98;
928 $measuring_units[99] = 99;
929 return $measuring_units[$unit];
942 $measuring_units = array();
943 $measuring_units[0] = 0;
944 $measuring_units[-1] = -3;
945 $measuring_units[-2] = -6;
946 $measuring_units[-3] = -9;
947 $measuring_units[98] = 88;
948 $measuring_units[99] = 89;
949 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.
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($unit, $measuring_style='', $scale='', $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
measuring_units_string($scale='', $measuring_style='', $unit=0, $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_squared($unit)
Transform a given unit scale into the square of that unit, if known.
measuring_units_cubed($unit)
Transform a given unit scale into the cube of that unit, if known.