39 global $db, $langs, $conf, $user;
40 $langs->load(
"products");
42 $label = $langs->trans(
'Product');
43 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_prices') : $user->hasRight(
'product',
'read');
46 $label = $langs->trans(
'Service');
47 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_prices') : $user->hasRight(
'service',
'read');
53 $head[$h][0] = DOL_URL_ROOT.
"/product/card.php?id=".
$object->id;
54 $head[$h][1] = $label;
55 $head[$h][2] =
'card';
59 if ($usercancreadprice) {
60 $head[$h][0] = DOL_URL_ROOT.
"/product/price.php?id=".
$object->id;
61 $head[$h][1] = $langs->trans(
"SellingPrices");
62 $head[$h][2] =
'price';
66 $head[$h][1] = $langs->trans(
"SellingPrices");
67 $head[$h][2] =
'price';
68 $head[$h][5] =
'disabled';
74 if ((isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) && ($user->hasRight(
'fournisseur',
'lire') || $user->hasRight(
'supplier_order',
'read') || $user->hasRight(
'supplier_invoice',
'read'))
75 || (isModEnabled(
'margin') && $user->hasRight(
"margin",
"liretous"))
77 if ($usercancreadprice) {
78 $head[$h][0] = DOL_URL_ROOT.
"/product/price_suppliers.php?id=".
$object->id;
79 $head[$h][1] = $langs->trans(
"BuyingPrices");
80 $head[$h][2] =
'suppliers';
84 $head[$h][1] = $langs->trans(
"BuyingPrices");
85 $head[$h][2] =
'suppliers';
86 $head[$h][5] =
'disabled';
94 $head[$h][0] = DOL_URL_ROOT.
"/product/traduction.php?id=".
$object->id;
95 $head[$h][1] = $langs->trans(
"Translations");
96 $head[$h][2] =
'translation';
102 $head[$h][0] = DOL_URL_ROOT.
"/product/composition/card.php?id=".
$object->id;
103 $head[$h][1] = $langs->trans(
'AssociatedProducts');
105 $nbFatherAndChild =
$object->hasFatherOrChild();
106 if ($nbFatherAndChild > 0) {
107 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbFatherAndChild.
'</span>';
109 $head[$h][2] =
'subproduct';
113 if (isModEnabled(
'variants') && (
$object->isProduct() ||
$object->isService())) {
116 require_once DOL_DOCUMENT_ROOT.
'/variants/class/ProductCombination.class.php';
120 if ($prodcomb->fetchByFkProductChild(
$object->id) <= 0) {
121 $head[$h][0] = DOL_URL_ROOT.
"/variants/combinations.php?id=".
$object->id;
122 $head[$h][1] = $langs->trans(
'ProductCombinations');
123 $head[$h][2] =
'combinations';
124 $nbVariant = $prodcomb->countNbOfCombinationForFkProductParent(
$object->id);
125 if ($nbVariant > 0) {
126 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbVariant.
'</span>';
134 if (isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire')) {
135 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/product.php?id=".
$object->id;
136 $head[$h][1] = $langs->trans(
"Stock");
137 $head[$h][2] =
'stock';
143 if (isModEnabled(
'resource')) {
145 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=product&ref='.
$object->ref;
146 $head[$h][1] = $langs->trans(
"Resources");
147 $head[$h][2] =
'resources';
151 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=service&ref='.
$object->ref;
152 $head[$h][1] = $langs->trans(
"Resources");
153 $head[$h][2] =
'resources';
158 $head[$h][0] = DOL_URL_ROOT.
"/product/stats/facture.php?showmessage=1&id=".
$object->id;
159 $head[$h][1] = $langs->trans(
'Referers');
160 $head[$h][2] =
'referers';
163 $head[$h][0] = DOL_URL_ROOT.
"/product/stats/card.php?id=".
$object->id;
164 $head[$h][1] = $langs->trans(
'Statistics');
165 $head[$h][2] =
'stats';
177 if (!empty(
$object->note_private)) {
180 if (!empty(
$object->note_public)) {
183 $head[$h][0] = DOL_URL_ROOT.
'/product/note.php?id='.
$object->id;
184 $head[$h][1] = $langs->trans(
'Notes');
186 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
188 $head[$h][2] =
'note';
193 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
194 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
201 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
209 $nbFiles += count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
212 $head[$h][0] = DOL_URL_ROOT.
'/product/document.php?id='.
$object->id;
213 $head[$h][1] = $langs->trans(
'Documents');
214 if (($nbFiles + $nbLinks) > 0) {
215 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
217 $head[$h][2] =
'documents';
221 $head[$h][0] = DOL_URL_ROOT.
'/product/messaging.php?id='.
$object->id;
222 $head[$h][1] = $langs->trans(
"Events");
223 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
225 $head[$h][1] .= $langs->trans(
"Agenda");
227 $head[$h][2] =
'agenda';
245 global $db, $langs, $conf, $user;
248 $langs->loadLangs(array(
"products",
"productbatch"));
253 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/productlot_card.php?id=".
$object->id;
254 $head[$h][1] = $langs->trans(
"Lot");
255 $head[$h][2] =
'card';
258 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/stats/expedition.php?showmessage=1&id=".
$object->id;
259 $head[$h][1] = $langs->trans(
'Referers');
260 $head[$h][2] =
'referers';
264 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
265 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
267 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
269 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/productlot_document.php?id=".
$object->id;
270 $head[$h][1] = $langs->trans(
"Documents");
271 if (($nbFiles + $nbLinks) > 0) {
272 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
274 $head[$h][2] =
'documents';
280 if (!empty(
$object->note_private)) {
283 if (!empty(
$object->note_public)) {
286 $head[$h][0] = DOL_URL_ROOT .
'/product/stock/productlot_note.php?id=' .
$object->id;
287 $head[$h][1] = $langs->trans(
'Notes');
289 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . $nbNote .
'</span>';
291 $head[$h][2] =
'note';
323 global $langs, $conf, $user, $db;
326 $extrafields->fetch_name_optionals_label(
'product');
327 $extrafields->fetch_name_optionals_label(
'product_fournisseur_price');
332 $head[$h][0] = DOL_URL_ROOT.
"/product/admin/product.php";
333 $head[$h][1] = $langs->trans(
'Parameters');
334 $head[$h][2] =
'general';
339 0 => DOL_URL_ROOT.
"/product/admin/price_rules.php",
340 1 => $langs->trans(
'MultipriceRules'),
352 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_extrafields.php';
353 $head[$h][1] = $langs->trans(
"ExtraFields");
354 $nbExtrafields = $extrafields->attributes[
'product'][
'count'];
355 if ($nbExtrafields > 0) {
356 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
358 $head[$h][2] =
'attributes';
361 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_supplier_extrafields.php';
362 $head[$h][1] = $langs->trans(
"ProductSupplierExtraFields");
363 $nbExtrafields = $extrafields->attributes[
'product_fournisseur_price'][
'count'];
364 if ($nbExtrafields > 0) {
365 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
367 $head[$h][2] =
'supplierAttributes';
384 global $langs, $conf, $user, $db;
387 $extrafields->fetch_name_optionals_label(
'product_lot');
392 $head[$h][0] = DOL_URL_ROOT.
"/product/admin/product_lot.php";
393 $head[$h][1] = $langs->trans(
'Parameters');
394 $head[$h][2] =
'settings';
403 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_lot_extrafields.php';
404 $head[$h][1] = $langs->trans(
"ExtraFields");
405 $nbExtrafields = $extrafields->attributes[
'product_lot'][
'count'];
406 if ($nbExtrafields > 0) {
407 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
409 $head[$h][2] =
'attributes';
428 global $langs, $user, $db, $hookmanager;
430 $form =
new Form($db);
434 print
'<tr class="liste_titre">';
435 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
436 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
437 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
438 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
442 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
444 $ret = $product->load_stats_propale($socid);
448 $langs->load(
"propal");
450 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/propal.php?id='.$product->id.
'">'.
img_object(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Proposals").
'</a>';
451 print
'</td><td class="right">';
452 print $product->stats_propale[
'customers'];
453 print
'</td><td class="right">';
454 print $product->stats_propale[
'nb'];
455 print
'</td><td class="right">';
456 print
price($product->stats_propale[
'qty'], 1, $langs, 0, 0);
461 if (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
463 $ret = $product->load_stats_proposal_supplier($socid);
467 $langs->load(
"supplier_proposal");
469 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/supplier_proposal.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_proposal',
'class="pictofixedwidth"').$langs->trans(
"SupplierProposals").
'</a>';
470 print
'</td><td class="right">';
471 print $product->stats_proposal_supplier[
'suppliers'];
472 print
'</td><td class="right">';
473 print $product->stats_proposal_supplier[
'nb'];
474 print
'</td><td class="right">';
475 print
price($product->stats_proposal_supplier[
'qty'], 1, $langs, 0, 0);
480 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
482 $ret = $product->load_stats_commande($socid);
486 $langs->load(
"orders");
488 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/commande.php?id='.$product->id.
'">'.
img_object(
'',
'order',
'class="pictofixedwidth"').$langs->trans(
"CustomersOrders").
'</a>';
489 print
'</td><td class="right">';
490 print $product->stats_commande[
'customers'];
491 print
'</td><td class="right">';
492 print $product->stats_commande[
'nb'];
493 print
'</td><td class="right">';
494 print
price($product->stats_commande[
'qty'], 1, $langs, 0, 0);
499 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'commande',
'lire')) || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
501 $ret = $product->load_stats_commande_fournisseur($socid);
505 $langs->load(
"orders");
507 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/commande_fournisseur.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_order',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
508 print
'</td><td class="right">';
509 print $product->stats_commande_fournisseur[
'suppliers'];
510 print
'</td><td class="right">';
511 print $product->stats_commande_fournisseur[
'nb'];
512 print
'</td><td class="right">';
513 print
price($product->stats_commande_fournisseur[
'qty'], 1, $langs, 0, 0);
518 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
520 $ret = $product->load_stats_facture($socid);
524 $langs->load(
"bills");
526 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facture.php?id='.$product->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CustomersInvoices").
'</a>';
527 print
'</td><td class="right">';
528 print $product->stats_facture[
'customers'];
529 print
'</td><td class="right">';
530 print $product->stats_facture[
'nb'];
531 print
'</td><td class="right">';
532 print
price($product->stats_facture[
'qty'], 1, $langs, 0, 0);
537 if (isModEnabled(
"invoice") && $user->hasRight(
'facture',
'lire')) {
539 $ret = $product->load_stats_facturerec($socid);
543 $langs->load(
"bills");
545 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facturerec.php?id='.$product->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"RecurringInvoiceTemplate").
'</a>';
546 print
'</td><td class="right">';
547 print $product->stats_facture[
'customers'];
548 print
'</td><td class="right">';
549 print $product->stats_facturerec[
'nb'];
550 print
'</td><td class="right">';
551 print $product->stats_facturerec[
'qty'];
556 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'facture',
'lire')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
558 $ret = $product->load_stats_facture_fournisseur($socid);
562 $langs->load(
"bills");
564 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facture_fournisseur.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
"SuppliersInvoices").
'</a>';
565 print
'</td><td class="right">';
566 print $product->stats_facture_fournisseur[
'suppliers'];
567 print
'</td><td class="right">';
568 print $product->stats_facture_fournisseur[
'nb'];
569 print
'</td><td class="right">';
570 print
price($product->stats_facture_fournisseur[
'qty'], 1, $langs, 0, 0);
576 if (isModEnabled(
'shipping') && $user->hasRight(
'shipping',
'lire')) {
578 $ret = $product->load_stats_sending($socid);
582 $langs->load(
"sendings");
584 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/expedition.php?id='.$product->id.
'">'.
img_object(
'',
'shipment',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
585 print
'</td><td class="right">';
586 print $product->stats_expedition[
'customers'];
587 print
'</td><td class="right">';
588 print $product->stats_expedition[
'nb'];
589 print
'</td><td class="right">';
590 print $product->stats_expedition[
'qty'];
596 if ((isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire'))) {
598 $ret = $product->load_stats_reception($socid);
602 $langs->load(
"receptions");
604 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/reception.php?id='.$product->id.
'">'.
img_object(
'',
'reception',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
605 print
'</td><td class="right">';
606 print $product->stats_reception[
'suppliers'];
607 print
'</td><td class="right">';
608 print $product->stats_reception[
'nb'];
609 print
'</td><td class="right">';
610 print $product->stats_reception[
'qty'];
616 if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
618 $ret = $product->load_stats_contrat($socid);
622 $langs->load(
"contracts");
624 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/contrat.php?id='.$product->id.
'">'.
img_object(
'',
'contract',
'class="pictofixedwidth"').$langs->trans(
"Contracts").
'</a>';
625 print
'</td><td class="right">';
626 print $product->stats_contrat[
'customers'];
627 print
'</td><td class="right">';
628 print $product->stats_contrat[
'nb'];
629 print
'</td><td class="right">';
630 print
price($product->stats_contrat[
'qty'], 1, $langs, 0, 0);
636 if (isModEnabled(
'bom') && $user->hasRight(
'bom',
'read')) {
638 $ret = $product->load_stats_bom($socid);
645 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/bom.php?id='.$product->id.
'">'.
img_object(
'',
'bom',
'class="pictofixedwidth"').$langs->trans(
"BOM").
'</a>';
646 print
'</td><td class="right">';
648 print
'</td><td class="right">';
649 print $form->textwithpicto($product->stats_bom[
'nb_toconsume'], $langs->trans(
"RowMaterial"));
651 print $form->textwithpicto($product->stats_bom[
'nb_toproduce'], $langs->trans(
"Finished"));
652 print
'</td><td class="right">';
653 print $form->textwithpicto($product->stats_bom[
'qty_toconsume'], $langs->trans(
"RowMaterial"));
655 print $form->textwithpicto($product->stats_bom[
'qty_toproduce'], $langs->trans(
"Finished"));
661 if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
663 $ret = $product->load_stats_mo($socid);
669 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/mo.php?id='.$product->id.
'">'.
img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
670 print
'</td><td class="right">';
671 print $form->textwithpicto($product->stats_mo[
'customers_toconsume'], $langs->trans(
"ToConsume"));
673 print $form->textwithpicto($product->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
675 print $form->textwithpicto($product->stats_mo[
'customers_toproduce'], $langs->trans(
"QtyToProduce"));
677 print $form->textwithpicto($product->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
678 print
'</td><td class="right">';
679 print $form->textwithpicto($product->stats_mo[
'nb_toconsume'], $langs->trans(
"ToConsume"));
681 print $form->textwithpicto($product->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
683 print $form->textwithpicto($product->stats_mo[
'nb_toproduce'], $langs->trans(
"QtyToProduce"));
685 print $form->textwithpicto($product->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
686 print
'</td><td class="right">';
687 print $form->textwithpicto($product->stats_mo[
'qty_toconsume'], $langs->trans(
"ToConsume"));
689 print $form->textwithpicto($product->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
691 print $form->textwithpicto($product->stats_mo[
'qty_toproduce'], $langs->trans(
"QtyToProduce"));
693 print $form->textwithpicto($product->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
697 $parameters = array(
'socid'=>$socid);
698 $reshook = $hookmanager->executeHooks(
'addMoreProductStat', $parameters, $product, $nblines);
703 print $hookmanager->resPrint;
718 global $conf, $langs, $user, $db, $hookmanager;
720 $langs->LoadLangs(array(
'sendings',
'orders',
'receptions'));
722 $form =
new Form($db);
726 print
'<tr class="liste_titre">';
727 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
728 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
729 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
730 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
734 if (isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')) {
736 $ret = $batch->loadStatsExpedition($socid);
740 $langs->load(
"bills");
742 print
'<a href="'.dol_buildpath(
'/product/stock/stats/expedition.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
743 print
'</td><td class="right">';
744 print $batch->stats_expedition[
'customers'];
745 print
'</td><td class="right">';
746 print $batch->stats_expedition[
'nb'];
747 print
'</td><td class="right">';
748 print $batch->stats_expedition[
'qty'];
753 if (isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire')) {
755 $ret = $batch->loadStatsReception($socid);
759 $langs->load(
"bills");
761 print
'<a href="'.dol_buildpath(
'/product/stock/stats/reception.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
762 print
'</td><td class="right">';
763 print $batch->stats_reception[
'customers'];
764 print
'</td><td class="right">';
765 print $batch->stats_reception[
'nb'];
766 print
'</td><td class="right">';
767 print $batch->stats_reception[
'qty'];
770 } elseif (isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire')) {
772 $ret = $batch->loadStatsSupplierOrder($socid);
776 $langs->load(
"bills");
778 print
'<a href="'.dol_buildpath(
'/product/stock/stats/commande_fournisseur.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
779 print
'</td><td class="right">';
780 print $batch->stats_supplier_order[
'customers'];
781 print
'</td><td class="right">';
782 print $batch->stats_supplier_order[
'nb'];
783 print
'</td><td class="right">';
784 print $batch->stats_supplier_order[
'qty'];
789 if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
791 $ret = $batch->loadStatsMo($socid);
797 print
'<a href="'.dol_buildpath(
'/product/stock/stats/mo.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
798 print
'</td><td class="right">';
800 print $form->textwithpicto($batch->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
802 print $form->textwithpicto($batch->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
803 print
'</td><td class="right">';
805 print $form->textwithpicto($batch->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
807 print $form->textwithpicto($batch->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
808 print
'</td><td class="right">';
810 print $form->textwithpicto($batch->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
812 print $form->textwithpicto($batch->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
817 $parameters = array(
'socid'=>$socid);
818 $reshook = $hookmanager->executeHooks(
'addMoreBatchProductStat', $parameters, $batch, $nblines);
823 print $hookmanager->resPrint;
843 return measuringUnitString($unit, $measuring_style, $scale, $use_short_label, $outputlangs);
857function measuringUnitString($unit, $measuring_style =
'', $scale =
'', $use_short_label = 0, $outputlangs =
null)
860 global $measuring_unit_cache;
862 if (empty($outputlangs)) {
863 $outputlangs = $langs;
866 if (empty($measuring_unit_cache[$unit.
'_'.$measuring_style.
'_'.$scale.
'_'.$use_short_label])) {
867 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
868 $measuringUnits =
new CUnits($db);
870 if ($measuring_style ==
'' && $scale ==
'') {
871 $arrayforfilter = array(
875 } elseif ($scale !==
'') {
876 $arrayforfilter = array(
878 't.unit_type' => $measuring_style,
882 $arrayforfilter = array(
884 't.unit_type' => $measuring_style,
888 $result = $measuringUnits->fetchAll(
'',
'', 0, 0, $arrayforfilter);
893 if (is_array($measuringUnits->records) && count($measuringUnits->records) > 0) {
894 if ($use_short_label == 1) {
895 $labeltoreturn = $measuringUnits->records[key($measuringUnits->records)]->short_label;
896 } elseif ($use_short_label == 2) {
897 $labeltoreturn = $outputlangs->transnoentitiesnoconv(ucfirst($measuringUnits->records[key($measuringUnits->records)]->label).
'Short');
899 $labeltoreturn = $outputlangs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label);
904 $measuring_unit_cache[$unit.
'_'.$measuring_style.
'_'.$scale.
'_'.$use_short_label] = $labeltoreturn;
905 return $labeltoreturn;
908 return $measuring_unit_cache[$unit.
'_'.$measuring_style.
'_'.$scale.
'_'.$use_short_label];
921 $measuring_units = array();
922 $measuring_units[0] = 0;
923 $measuring_units[-1] = -2;
924 $measuring_units[-2] = -4;
925 $measuring_units[-3] = -6;
926 $measuring_units[98] = 98;
927 $measuring_units[99] = 99;
928 return $measuring_units[$unit];
941 $measuring_units = array();
942 $measuring_units[0] = 0;
943 $measuring_units[-1] = -3;
944 $measuring_units[-2] = -6;
945 $measuring_units[-3] = -9;
946 $measuring_units[98] = 88;
947 $measuring_units[99] = 89;
948 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)
setEventMessage($mesgs, $style='mesgs', $noduplicate=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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 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.