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, $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';
373 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_price_extrafields.php';
374 $head[$h][1] = $langs->trans(
"ProductLevelExtraFields");
375 $nbExtrafields = $extrafields->attributes[
'product_price'][
'count'];
376 if ($nbExtrafields > 0) {
377 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
379 $head[$h][2] =
'levelAttributes';
385 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_customer_extrafields.php';
386 $head[$h][1] = $langs->trans(
"ProductCustomerExtraFields");
387 $nbExtrafields = $extrafields->attributes[
'product_customer_price'][
'count'];
388 if ($nbExtrafields > 0) {
389 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
391 $head[$h][2] =
'customerAttributes';
396 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_supplier_extrafields.php';
397 $head[$h][1] = $langs->trans(
"ProductSupplierExtraFields");
398 $nbExtrafields = $extrafields->attributes[
'product_fournisseur_price'][
'count'];
399 if ($nbExtrafields > 0) {
400 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
402 $head[$h][2] =
'supplierAttributes';
419 global $langs,
$conf, $user, $db;
422 $extrafields->fetch_name_optionals_label(
'product_lot');
427 $head[$h][0] = DOL_URL_ROOT.
"/product/admin/product_lot.php";
428 $head[$h][1] = $langs->trans(
'Parameters');
429 $head[$h][2] =
'settings';
438 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_lot_extrafields.php';
439 $head[$h][1] = $langs->trans(
"ExtraFields");
440 $nbExtrafields = $extrafields->attributes[
'product_lot'][
'count'];
441 if ($nbExtrafields > 0) {
442 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
444 $head[$h][2] =
'attributes';
463 global $langs, $user, $db, $hookmanager;
465 $form =
new Form($db);
469 print
'<tr class="liste_titre">';
470 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
471 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
472 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
473 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
477 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
479 $ret = $product->load_stats_propale($socid);
483 $langs->load(
"propal");
485 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/propal.php?id='.$product->id.
'">'.
img_object(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Proposals").
'</a>';
486 print
'</td><td class="right">';
487 print $product->stats_propale[
'customers'];
488 print
'</td><td class="right">';
489 print $product->stats_propale[
'nb'];
490 print
'</td><td class="right">';
491 print
price($product->stats_propale[
'qty'], 1, $langs, 0, 0);
496 if (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
498 $ret = $product->load_stats_proposal_supplier($socid);
502 $langs->load(
"supplier_proposal");
504 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/supplier_proposal.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_proposal',
'class="pictofixedwidth"').$langs->trans(
"SupplierProposals").
'</a>';
505 print
'</td><td class="right">';
506 print $product->stats_proposal_supplier[
'suppliers'];
507 print
'</td><td class="right">';
508 print $product->stats_proposal_supplier[
'nb'];
509 print
'</td><td class="right">';
510 print
price($product->stats_proposal_supplier[
'qty'], 1, $langs, 0, 0);
515 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
517 $ret = $product->load_stats_commande($socid);
521 $langs->load(
"orders");
523 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/commande.php?id='.$product->id.
'">'.
img_object(
'',
'order',
'class="pictofixedwidth"').$langs->trans(
"CustomersOrders").
'</a>';
524 print
'</td><td class="right">';
525 print $product->stats_commande[
'customers'];
526 print
'</td><td class="right">';
527 print $product->stats_commande[
'nb'];
528 print
'</td><td class="right">';
529 print
price($product->stats_commande[
'qty'], 1, $langs, 0, 0);
534 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'commande',
'lire')) || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
536 $ret = $product->load_stats_commande_fournisseur($socid);
540 $langs->load(
"orders");
542 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/commande_fournisseur.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_order',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
543 print
'</td><td class="right">';
544 print $product->stats_commande_fournisseur[
'suppliers'];
545 print
'</td><td class="right">';
546 print $product->stats_commande_fournisseur[
'nb'];
547 print
'</td><td class="right">';
548 print
price($product->stats_commande_fournisseur[
'qty'], 1, $langs, 0, 0);
553 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
555 $ret = $product->load_stats_facture($socid);
559 $langs->load(
"bills");
561 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facture.php?id='.$product->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CustomersInvoices").
'</a>';
562 print
'</td><td class="right">';
563 print $product->stats_facture[
'customers'];
564 print
'</td><td class="right">';
565 print $product->stats_facture[
'nb'];
566 print
'</td><td class="right">';
567 print
price($product->stats_facture[
'qty'], 1, $langs, 0, 0);
572 if (isModEnabled(
"invoice") && $user->hasRight(
'facture',
'lire')) {
574 $ret = $product->load_stats_facturerec($socid);
578 $langs->load(
"bills");
580 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facturerec.php?id='.$product->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"RecurringInvoiceTemplate").
'</a>';
581 print
'</td><td class="right">';
582 print $product->stats_facturerec[
'customers'];
583 print
'</td><td class="right">';
584 print $product->stats_facturerec[
'nb'];
585 print
'</td><td class="right">';
586 print $product->stats_facturerec[
'qty'];
591 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'facture',
'lire')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
593 $ret = $product->load_stats_facture_fournisseur($socid);
597 $langs->load(
"bills");
599 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facture_fournisseur.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
"SuppliersInvoices").
'</a>';
600 print
'</td><td class="right">';
601 print $product->stats_facture_fournisseur[
'suppliers'];
602 print
'</td><td class="right">';
603 print $product->stats_facture_fournisseur[
'nb'];
604 print
'</td><td class="right">';
605 print
price($product->stats_facture_fournisseur[
'qty'], 1, $langs, 0, 0);
632 if (isModEnabled(
'shipping') && $user->hasRight(
'shipping',
'lire')) {
634 $ret = $product->load_stats_sending($socid);
638 $langs->load(
"sendings");
640 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/expedition.php?id='.$product->id.
'">'.
img_object(
'',
'shipment',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
641 print
'</td><td class="right">';
642 print $product->stats_expedition[
'customers'];
643 print
'</td><td class="right">';
644 print $product->stats_expedition[
'nb'];
645 print
'</td><td class="right">';
646 print $product->stats_expedition[
'qty'];
652 if ((isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire'))) {
654 $ret = $product->load_stats_reception($socid);
658 $langs->load(
"receptions");
660 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/reception.php?id='.$product->id.
'">'.
img_object(
'',
'reception',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
661 print
'</td><td class="right">';
662 print $product->stats_reception[
'suppliers'];
663 print
'</td><td class="right">';
664 print $product->stats_reception[
'nb'];
665 print
'</td><td class="right">';
666 print $product->stats_reception[
'qty'];
672 if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
674 $ret = $product->load_stats_contrat($socid);
678 $langs->load(
"contracts");
680 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/contrat.php?id='.$product->id.
'">'.
img_object(
'',
'contract',
'class="pictofixedwidth"').$langs->trans(
"Contracts").
'</a>';
681 print
'</td><td class="right">';
682 print $product->stats_contrat[
'customers'];
683 print
'</td><td class="right">';
684 print $product->stats_contrat[
'nb'];
685 print
'</td><td class="right">';
686 print
price($product->stats_contrat[
'qty'], 1, $langs, 0, 0);
692 if (isModEnabled(
'bom') && $user->hasRight(
'bom',
'read')) {
694 $ret = $product->load_stats_bom($socid);
701 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/bom.php?id='.$product->id.
'">'.
img_object(
'',
'bom',
'class="pictofixedwidth"').$langs->trans(
"BOM").
'</a>';
702 print
'</td><td class="right">';
704 print
'</td><td class="right">';
705 print $form->textwithpicto($product->stats_bom[
'nb_toconsume'], $langs->trans(
"RowMaterial"));
707 print $form->textwithpicto($product->stats_bom[
'nb_toproduce'], $langs->trans(
"Finished"));
708 print
'</td><td class="right">';
709 print $form->textwithpicto($product->stats_bom[
'qty_toconsume'], $langs->trans(
"RowMaterial"));
711 print $form->textwithpicto($product->stats_bom[
'qty_toproduce'], $langs->trans(
"Finished"));
717 if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
719 $ret = $product->load_stats_mo($socid);
725 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/mo.php?id='.$product->id.
'">'.
img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
726 print
'</td><td class="right">';
727 print $form->textwithpicto($product->stats_mo[
'customers_toconsume'], $langs->trans(
"ToConsume"));
729 print $form->textwithpicto($product->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
731 print $form->textwithpicto($product->stats_mo[
'customers_toproduce'], $langs->trans(
"QtyToProduce"));
733 print $form->textwithpicto($product->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
734 print
'</td><td class="right">';
735 print $form->textwithpicto($product->stats_mo[
'nb_toconsume'], $langs->trans(
"ToConsume"));
737 print $form->textwithpicto($product->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
739 print $form->textwithpicto($product->stats_mo[
'nb_toproduce'], $langs->trans(
"QtyToProduce"));
741 print $form->textwithpicto($product->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
742 print
'</td><td class="right">';
743 print $form->textwithpicto($product->stats_mo[
'qty_toconsume'], $langs->trans(
"ToConsume"));
745 print $form->textwithpicto($product->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
747 print $form->textwithpicto($product->stats_mo[
'qty_toproduce'], $langs->trans(
"QtyToProduce"));
749 print $form->textwithpicto($product->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
753 $parameters = array(
'socid' => $socid);
754 $reshook = $hookmanager->executeHooks(
'addMoreProductStat', $parameters, $product, $nblines);
759 print $hookmanager->resPrint;
774 global
$conf, $langs, $user, $db, $hookmanager;
776 $langs->LoadLangs(array(
'sendings',
'orders',
'receptions'));
778 $form =
new Form($db);
782 print
'<tr class="liste_titre">';
783 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
784 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
785 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
786 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
790 if (isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')) {
792 $ret = $batch->loadStatsExpedition($socid);
796 $langs->load(
"bills");
798 print
'<a href="'.dol_buildpath(
'/product/stock/stats/expedition.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
799 print
'</td><td class="right">';
800 print $batch->stats_expedition[
'customers'];
801 print
'</td><td class="right">';
802 print $batch->stats_expedition[
'nb'];
803 print
'</td><td class="right">';
804 print $batch->stats_expedition[
'qty'];
809 if (isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire')) {
811 $ret = $batch->loadStatsReception($socid);
815 $langs->load(
"bills");
817 print
'<a href="'.dol_buildpath(
'/product/stock/stats/reception.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
818 print
'</td><td class="right">';
819 print $batch->stats_reception[
'customers'];
820 print
'</td><td class="right">';
821 print $batch->stats_reception[
'nb'];
822 print
'</td><td class="right">';
823 print $batch->stats_reception[
'qty'];
826 } elseif (isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire')) {
828 $ret = $batch->loadStatsSupplierOrder($socid);
832 $langs->load(
"bills");
834 print
'<a href="'.dol_buildpath(
'/product/stock/stats/commande_fournisseur.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
835 print
'</td><td class="right">';
836 print $batch->stats_supplier_order[
'customers'];
837 print
'</td><td class="right">';
838 print $batch->stats_supplier_order[
'nb'];
839 print
'</td><td class="right">';
840 print $batch->stats_supplier_order[
'qty'];
845 if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
847 $ret = $batch->loadStatsMo($socid);
853 print
'<a href="'.dol_buildpath(
'/product/stock/stats/mo.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
854 print
'</td><td class="right">';
856 print $form->textwithpicto($batch->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
858 print $form->textwithpicto($batch->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
859 print
'</td><td class="right">';
861 print $form->textwithpicto($batch->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
863 print $form->textwithpicto($batch->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
864 print
'</td><td class="right">';
866 print $form->textwithpicto($batch->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
868 print $form->textwithpicto($batch->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
873 $parameters = array(
'socid' => $socid);
874 $reshook = $hookmanager->executeHooks(
'addMoreBatchProductStat', $parameters, $batch, $nblines);
879 print $hookmanager->resPrint;
897function measuring_units_string($unitscale =
'', $measuring_style =
'', $unitid = 0, $use_short_label = 0, $outputlangs =
null)
899 return measuringUnitString($unitid, $measuring_style, $unitscale, $use_short_label, $outputlangs);
913function measuringUnitString($unitid, $measuring_style =
'', $unitscale =
'', $use_short_label = 0, $outputlangs =
null)
916 global $measuring_unit_cache;
918 if (empty($outputlangs)) {
919 $outputlangs = $langs;
922 if (empty($measuring_unit_cache[$unitid.
'_'.$measuring_style.
'_'.$unitscale.
'_'.$use_short_label])) {
923 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
924 $measuringUnits =
new CUnits($db);
926 if ($measuring_style ==
'' && $unitscale ==
'') {
927 $arrayforfilter = array(
928 't.rowid' => $unitid,
931 } elseif ($unitscale !==
'') {
932 $arrayforfilter = array(
933 't.scale' => $unitscale,
934 't.unit_type' => $measuring_style,
938 $arrayforfilter = array(
939 't.rowid' => $unitid,
940 't.unit_type' => $measuring_style,
944 $result = $measuringUnits->fetchAll(
'',
'', 0, 0, $arrayforfilter);
949 if (is_array($measuringUnits->records) && count($measuringUnits->records) > 0) {
950 if ($use_short_label == 1) {
951 $labeltoreturn = $measuringUnits->records[key($measuringUnits->records)]->short_label;
952 } elseif ($use_short_label == 2) {
953 $labeltoreturn = $outputlangs->transnoentitiesnoconv(ucfirst($measuringUnits->records[key($measuringUnits->records)]->label).
'Short');
955 $labeltoreturn = $outputlangs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label);
960 $measuring_unit_cache[$unitid.
'_'.$measuring_style.
'_'.$unitscale.
'_'.$use_short_label] = $labeltoreturn;
961 return $labeltoreturn;
964 return $measuring_unit_cache[$unitid.
'_'.$measuring_style.
'_'.$unitscale.
'_'.$use_short_label];
977 $measuring_units = array();
978 $measuring_units[0] = 0;
979 $measuring_units[-1] = -2;
980 $measuring_units[-2] = -4;
981 $measuring_units[-3] = -6;
982 $measuring_units[98] = 98;
983 $measuring_units[99] = 99;
984 return $measuring_units[$unitscale];
997 $measuring_units = array();
998 $measuring_units[0] = 0;
999 $measuring_units[-1] = -3;
1000 $measuring_units[-2] = -6;
1001 $measuring_units[-3] = -9;
1002 $measuring_units[98] = 88;
1003 $measuring_units[99] = 89;
1004 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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
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_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).
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
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.