38 global $db, $langs, $conf, $user;
39 $langs->load(
"products");
41 $label = $langs->trans(
'Product');
42 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_prices') : $user->hasRight(
'product',
'read');
44 if ($object->isService()) {
45 $label = $langs->trans(
'Service');
46 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_prices') : $user->hasRight(
'service',
'read');
52 $head[$h][0] = DOL_URL_ROOT.
"/product/card.php?id=".$object->id;
53 $head[$h][1] = $label;
54 $head[$h][2] =
'card';
58 if ($usercancreadprice) {
59 $head[$h][0] = DOL_URL_ROOT.
"/product/price.php?id=".$object->id;
60 $head[$h][1] = $langs->trans(
"SellingPrices");
61 $head[$h][2] =
'price';
65 $head[$h][1] = $langs->trans(
"SellingPrices");
66 $head[$h][2] =
'price';
67 $head[$h][5] =
'disabled';
73 if ((isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) && ($user->hasRight(
'fournisseur',
'lire') || $user->hasRight(
'supplier_order',
'read') || $user->hasRight(
'supplier_invoice',
'read'))
74 || (isModEnabled(
'margin') && $user->hasRight(
"margin",
"liretous"))
76 if ($usercancreadprice) {
77 $head[$h][0] = DOL_URL_ROOT.
"/product/fournisseurs.php?id=".$object->id;
78 $head[$h][1] = $langs->trans(
"BuyingPrices");
79 $head[$h][2] =
'suppliers';
83 $head[$h][1] = $langs->trans(
"BuyingPrices");
84 $head[$h][2] =
'suppliers';
85 $head[$h][5] =
'disabled';
93 $head[$h][0] = DOL_URL_ROOT.
"/product/traduction.php?id=".$object->id;
94 $head[$h][1] = $langs->trans(
"Translations");
95 $head[$h][2] =
'translation';
101 $head[$h][0] = DOL_URL_ROOT.
"/product/composition/card.php?id=".$object->id;
102 $head[$h][1] = $langs->trans(
'AssociatedProducts');
104 $nbFatherAndChild = $object->hasFatherOrChild();
105 if ($nbFatherAndChild > 0) {
106 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbFatherAndChild.
'</span>';
108 $head[$h][2] =
'subproduct';
112 if (isModEnabled(
'variants') && ($object->isProduct() || $object->isService())) {
115 require_once DOL_DOCUMENT_ROOT.
'/variants/class/ProductCombination.class.php';
119 if ($prodcomb->fetchByFkProductChild($object->id) <= 0) {
120 $head[$h][0] = DOL_URL_ROOT.
"/variants/combinations.php?id=".$object->id;
121 $head[$h][1] = $langs->trans(
'ProductCombinations');
122 $head[$h][2] =
'combinations';
123 $nbVariant = $prodcomb->countNbOfCombinationForFkProductParent($object->id);
124 if ($nbVariant > 0) {
125 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbVariant.
'</span>';
132 if ($object->isProduct() || ($object->isService() &&
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES'))) {
133 if (isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire')) {
134 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/product.php?id=".$object->id;
135 $head[$h][1] = $langs->trans(
"Stock");
136 $head[$h][2] =
'stock';
142 if (isModEnabled(
'resource')) {
144 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=product&ref='.$object->ref;
145 $head[$h][1] = $langs->trans(
"Resources");
146 $head[$h][2] =
'resources';
150 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=service&ref='.$object->ref;
151 $head[$h][1] = $langs->trans(
"Resources");
152 $head[$h][2] =
'resources';
157 $head[$h][0] = DOL_URL_ROOT.
"/product/stats/facture.php?showmessage=1&id=".$object->id;
158 $head[$h][1] = $langs->trans(
'Referers');
159 $head[$h][2] =
'referers';
162 $head[$h][0] = DOL_URL_ROOT.
"/product/stats/card.php?id=".$object->id;
163 $head[$h][1] = $langs->trans(
'Statistics');
164 $head[$h][2] =
'stats';
176 if (!empty($object->note_private)) {
179 if (!empty($object->note_public)) {
182 $head[$h][0] = DOL_URL_ROOT.
'/product/note.php?id='.$object->id;
183 $head[$h][1] = $langs->trans(
'Notes');
185 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
187 $head[$h][2] =
'note';
192 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
193 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
195 $upload_dir = $conf->product->multidir_output[$object->entity].
'/'.
dol_sanitizeFileName($object->ref);
198 $upload_dir = $conf->service->multidir_output[$object->entity].
'/'.
dol_sanitizeFileName($object->ref);
200 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
203 $upload_dir = $conf->product->multidir_output[$object->entity].
'/'.
get_exdir($object->id, 2, 0, 0, $object,
'product').$object->id.
'/photos';
206 $upload_dir = $conf->service->multidir_output[$object->entity].
'/'.
get_exdir($object->id, 2, 0, 0, $object,
'product').$object->id.
'/photos';
208 $nbFiles += count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
210 $nbLinks =
Link::count($db, $object->element, $object->id);
211 $head[$h][0] = DOL_URL_ROOT.
'/product/document.php?id='.$object->id;
212 $head[$h][1] = $langs->trans(
'Documents');
213 if (($nbFiles + $nbLinks) > 0) {
214 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
216 $head[$h][2] =
'documents';
220 $head[$h][0] = DOL_URL_ROOT.
'/product/agenda.php?id='.$object->id;
221 $head[$h][1] = $langs->trans(
"Events");
222 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
224 $head[$h][1] .= $langs->trans(
"Agenda");
226 $head[$h][2] =
'agenda';
244 global $db, $langs, $conf, $user;
247 $langs->loadLangs(array(
"products",
"productbatch"));
252 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/productlot_card.php?id=".$object->id;
253 $head[$h][1] = $langs->trans(
"Lot");
254 $head[$h][2] =
'card';
257 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/stats/expedition.php?showmessage=1&id=".$object->id;
258 $head[$h][1] = $langs->trans(
'Referers');
259 $head[$h][2] =
'referers';
263 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
264 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
265 $upload_dir = $conf->productbatch->multidir_output[$object->entity].
'/'.
dol_sanitizeFileName($object->ref);
266 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
267 $nbLinks =
Link::count($db, $object->element, $object->id);
268 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/productlot_document.php?id=".$object->id;
269 $head[$h][1] = $langs->trans(
"Documents");
270 if (($nbFiles + $nbLinks) > 0) {
271 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
273 $head[$h][2] =
'documents';
279 if (!empty($object->note_private)) {
282 if (!empty($object->note_public)) {
285 $head[$h][0] = DOL_URL_ROOT .
'/product/stock/productlot_note.php?id=' . $object->id;
286 $head[$h][1] = $langs->trans(
'Notes');
288 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . $nbNote .
'</span>';
290 $head[$h][2] =
'note';
322 global $langs, $conf, $user, $db;
325 $extrafields->fetch_name_optionals_label(
'product');
326 $extrafields->fetch_name_optionals_label(
'product_fournisseur_price');
331 $head[$h][0] = DOL_URL_ROOT.
"/product/admin/product.php";
332 $head[$h][1] = $langs->trans(
'Parameters');
333 $head[$h][2] =
'general';
338 0 => DOL_URL_ROOT.
"/product/admin/price_rules.php",
339 1 => $langs->trans(
'MultipriceRules'),
351 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_extrafields.php';
352 $head[$h][1] = $langs->trans(
"ExtraFields");
353 $nbExtrafields = $extrafields->attributes[
'product'][
'count'];
354 if ($nbExtrafields > 0) {
355 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
357 $head[$h][2] =
'attributes';
360 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_supplier_extrafields.php';
361 $head[$h][1] = $langs->trans(
"ProductSupplierExtraFields");
362 $nbExtrafields = $extrafields->attributes[
'product_fournisseur_price'][
'count'];
363 if ($nbExtrafields > 0) {
364 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
366 $head[$h][2] =
'supplierAttributes';
383 global $langs, $conf, $user, $db;
386 $extrafields->fetch_name_optionals_label(
'product_lot');
391 $head[$h][0] = DOL_URL_ROOT.
"/product/admin/product_lot.php";
392 $head[$h][1] = $langs->trans(
'Parameters');
393 $head[$h][2] =
'settings';
402 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_lot_extrafields.php';
403 $head[$h][1] = $langs->trans(
"ExtraFields");
404 $nbExtrafields = $extrafields->attributes[
'product_lot'][
'count'];
405 if ($nbExtrafields > 0) {
406 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
408 $head[$h][2] =
'attributes';
427 global $conf, $langs, $user, $db, $hookmanager;
429 $form =
new Form($db);
433 print
'<tr class="liste_titre">';
434 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
435 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
436 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
437 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
441 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
443 $ret = $product->load_stats_propale($socid);
447 $langs->load(
"propal");
449 print
'<a href="propal.php?id='.$product->id.
'">'.
img_object(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Proposals").
'</a>';
450 print
'</td><td class="right">';
451 print $product->stats_propale[
'customers'];
452 print
'</td><td class="right">';
453 print $product->stats_propale[
'nb'];
454 print
'</td><td class="right">';
455 print
price($product->stats_propale[
'qty'], 1, $langs, 0, 0);
460 if (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
462 $ret = $product->load_stats_proposal_supplier($socid);
466 $langs->load(
"supplier_proposal");
468 print
'<a href="supplier_proposal.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_proposal',
'class="pictofixedwidth"').$langs->trans(
"SupplierProposals").
'</a>';
469 print
'</td><td class="right">';
470 print $product->stats_proposal_supplier[
'suppliers'];
471 print
'</td><td class="right">';
472 print $product->stats_proposal_supplier[
'nb'];
473 print
'</td><td class="right">';
474 print
price($product->stats_proposal_supplier[
'qty'], 1, $langs, 0, 0);
479 if (isModEnabled(
'commande') && $user->hasRight(
'commande',
'lire')) {
481 $ret = $product->load_stats_commande($socid);
485 $langs->load(
"orders");
487 print
'<a href="commande.php?id='.$product->id.
'">'.
img_object(
'',
'order',
'class="pictofixedwidth"').$langs->trans(
"CustomersOrders").
'</a>';
488 print
'</td><td class="right">';
489 print $product->stats_commande[
'customers'];
490 print
'</td><td class="right">';
491 print $product->stats_commande[
'nb'];
492 print
'</td><td class="right">';
493 print
price($product->stats_commande[
'qty'], 1, $langs, 0, 0);
498 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'commande',
'lire')) || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
500 $ret = $product->load_stats_commande_fournisseur($socid);
504 $langs->load(
"orders");
506 print
'<a href="commande_fournisseur.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_order',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
507 print
'</td><td class="right">';
508 print $product->stats_commande_fournisseur[
'suppliers'];
509 print
'</td><td class="right">';
510 print $product->stats_commande_fournisseur[
'nb'];
511 print
'</td><td class="right">';
512 print
price($product->stats_commande_fournisseur[
'qty'], 1, $langs, 0, 0);
517 if (isModEnabled(
'facture') && $user->hasRight(
'facture',
'lire')) {
519 $ret = $product->load_stats_facture($socid);
523 $langs->load(
"bills");
525 print
'<a href="facture.php?id='.$product->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CustomersInvoices").
'</a>';
526 print
'</td><td class="right">';
527 print $product->stats_facture[
'customers'];
528 print
'</td><td class="right">';
529 print $product->stats_facture[
'nb'];
530 print
'</td><td class="right">';
531 print
price($product->stats_facture[
'qty'], 1, $langs, 0, 0);
536 if (isModEnabled(
"facture") && $user->hasRight(
'facture',
'lire')) {
538 $ret = $product->load_stats_facturerec($socid);
542 $langs->load(
"bills");
544 print
'<a href="facturerec.php?id='.$product->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"RecurringInvoiceTemplate").
'</a>';
545 print
'</td><td class="right">';
546 print $product->stats_facture[
'customers'];
547 print
'</td><td class="right">';
548 print $product->stats_facturerec[
'nb'];
549 print
'</td><td class="right">';
550 print $product->stats_facturerec[
'qty'];
555 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'facture',
'lire')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
557 $ret = $product->load_stats_facture_fournisseur($socid);
561 $langs->load(
"bills");
563 print
'<a href="facture_fournisseur.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
"SuppliersInvoices").
'</a>';
564 print
'</td><td class="right">';
565 print $product->stats_facture_fournisseur[
'suppliers'];
566 print
'</td><td class="right">';
567 print $product->stats_facture_fournisseur[
'nb'];
568 print
'</td><td class="right">';
569 print
price($product->stats_facture_fournisseur[
'qty'], 1, $langs, 0, 0);
575 if (isModEnabled(
'contrat') && $user->hasRight(
'contrat',
'lire')) {
577 $ret = $product->load_stats_contrat($socid);
581 $langs->load(
"contracts");
583 print
'<a href="contrat.php?id='.$product->id.
'">'.
img_object(
'',
'contract',
'class="pictofixedwidth"').$langs->trans(
"Contracts").
'</a>';
584 print
'</td><td class="right">';
585 print $product->stats_contrat[
'customers'];
586 print
'</td><td class="right">';
587 print $product->stats_contrat[
'nb'];
588 print
'</td><td class="right">';
589 print
price($product->stats_contrat[
'qty'], 1, $langs, 0, 0);
595 if (isModEnabled(
'bom') && $user->hasRight(
'bom',
'read')) {
597 $ret = $product->load_stats_bom($socid);
604 print
'<a href="bom.php?id='.$product->id.
'">'.
img_object(
'',
'bom',
'class="pictofixedwidth"').$langs->trans(
"BOM").
'</a>';
605 print
'</td><td class="right">';
607 print
'</td><td class="right">';
608 print $form->textwithpicto($product->stats_bom[
'nb_toconsume'], $langs->trans(
"RowMaterial"));
609 print $form->textwithpicto($product->stats_bom[
'nb_toproduce'], $langs->trans(
"Finished"));
610 print
'</td><td class="right">';
611 print $form->textwithpicto($product->stats_bom[
'qty_toconsume'], $langs->trans(
"RowMaterial"));
612 print $form->textwithpicto($product->stats_bom[
'qty_toproduce'], $langs->trans(
"Finished"));
618 if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
620 $ret = $product->load_stats_mo($socid);
626 print
'<a href="mo.php?id='.$product->id.
'">'.
img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
627 print
'</td><td class="right">';
628 print $form->textwithpicto($product->stats_mo[
'customers_toconsume'], $langs->trans(
"ToConsume"));
629 print $form->textwithpicto($product->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
630 print $form->textwithpicto($product->stats_mo[
'customers_toproduce'], $langs->trans(
"QtyToProduce"));
631 print $form->textwithpicto($product->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
632 print
'</td><td class="right">';
633 print $form->textwithpicto($product->stats_mo[
'nb_toconsume'], $langs->trans(
"ToConsume"));
634 print $form->textwithpicto($product->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
635 print $form->textwithpicto($product->stats_mo[
'nb_toproduce'], $langs->trans(
"QtyToProduce"));
636 print $form->textwithpicto($product->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
637 print
'</td><td class="right">';
638 print $form->textwithpicto($product->stats_mo[
'qty_toconsume'], $langs->trans(
"ToConsume"));
639 print $form->textwithpicto($product->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
640 print $form->textwithpicto($product->stats_mo[
'qty_toproduce'], $langs->trans(
"QtyToProduce"));
641 print $form->textwithpicto($product->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
645 $parameters = array(
'socid'=>$socid);
646 $reshook = $hookmanager->executeHooks(
'addMoreProductStat', $parameters, $product, $nblines);
651 print $hookmanager->resPrint;
666 global $conf, $langs, $user, $db, $hookmanager;
668 $langs->LoadLangs(array(
'sendings',
'orders',
'receptions'));
670 $form =
new Form($db);
674 print
'<tr class="liste_titre">';
675 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
676 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
677 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
678 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
682 if (isModEnabled(
'expedition') && $user->hasRight(
'expedition',
'lire')) {
684 $ret = $batch->loadStatsExpedition($socid);
688 $langs->load(
"bills");
690 print
'<a href="'.dol_buildpath(
'/product/stock/stats/expedition.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
691 print
'</td><td class="right">';
692 print $batch->stats_expedition[
'customers'];
693 print
'</td><td class="right">';
694 print $batch->stats_expedition[
'nb'];
695 print
'</td><td class="right">';
696 print $batch->stats_expedition[
'qty'];
701 if (isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire')) {
703 $ret = $batch->loadStatsReception($socid);
707 $langs->load(
"bills");
709 print
'<a href="'.dol_buildpath(
'/product/stock/stats/reception.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
710 print
'</td><td class="right">';
711 print $batch->stats_reception[
'customers'];
712 print
'</td><td class="right">';
713 print $batch->stats_reception[
'nb'];
714 print
'</td><td class="right">';
715 print $batch->stats_reception[
'qty'];
718 } elseif (isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire')) {
720 $ret = $batch->loadStatsSupplierOrder($socid);
724 $langs->load(
"bills");
726 print
'<a href="'.dol_buildpath(
'/product/stock/stats/commande_fournisseur.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
727 print
'</td><td class="right">';
728 print $batch->stats_supplier_order[
'customers'];
729 print
'</td><td class="right">';
730 print $batch->stats_supplier_order[
'nb'];
731 print
'</td><td class="right">';
732 print $batch->stats_supplier_order[
'qty'];
737 if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
739 $ret = $batch->loadStatsMo($socid);
745 print
'<a href="'.dol_buildpath(
'/product/stock/stats/mo.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
746 print
'</td><td class="right">';
748 print $form->textwithpicto($batch->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
750 print $form->textwithpicto($batch->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
751 print
'</td><td class="right">';
753 print $form->textwithpicto($batch->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
755 print $form->textwithpicto($batch->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
756 print
'</td><td class="right">';
758 print $form->textwithpicto($batch->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
760 print $form->textwithpicto($batch->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
765 $parameters = array(
'socid'=>$socid);
766 $reshook = $hookmanager->executeHooks(
'addMoreBatchProductStat', $parameters, $batch, $nblines);
771 print $hookmanager->resPrint;
791 return measuringUnitString($unit, $measuring_style, $scale, $use_short_label, $outputlangs);
805function measuringUnitString($unit, $measuring_style =
'', $scale =
'', $use_short_label = 0, $outputlangs =
null)
808 global $measuring_unit_cache;
810 if (empty($outputlangs)) {
811 $outputlangs = $langs;
814 if (empty($measuring_unit_cache[$unit.
'_'.$measuring_style.
'_'.$scale.
'_'.$use_short_label])) {
815 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
816 $measuringUnits =
new CUnits($db);
818 if ($measuring_style ==
'' && $scale ==
'') {
819 $arrayforfilter = array(
823 } elseif ($scale !==
'') {
824 $arrayforfilter = array(
826 't.unit_type' => $measuring_style,
830 $arrayforfilter = array(
832 't.unit_type' => $measuring_style,
836 $result = $measuringUnits->fetchAll(
'',
'', 0, 0, $arrayforfilter);
841 if (is_array($measuringUnits->records) && count($measuringUnits->records) > 0) {
842 if ($use_short_label) {
843 $labeltoreturn = $measuringUnits->records[key($measuringUnits->records)]->short_label;
845 $labeltoreturn = $outputlangs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label);
850 $measuring_unit_cache[$unit.
'_'.$measuring_style.
'_'.$scale.
'_'.$use_short_label] = $labeltoreturn;
851 return $labeltoreturn;
854 return $measuring_unit_cache[$unit.
'_'.$measuring_style.
'_'.$scale.
'_'.$use_short_label];
867 $measuring_units = array();
868 $measuring_units[0] = 0;
869 $measuring_units[-1] = -2;
870 $measuring_units[-2] = -4;
871 $measuring_units[-3] = -6;
872 $measuring_units[98] = 98;
873 $measuring_units[99] = 99;
874 return $measuring_units[$unit];
887 $measuring_units = array();
888 $measuring_units[0] = 0;
889 $measuring_units[-1] = -3;
890 $measuring_units[-2] = -6;
891 $measuring_units[-3] = -9;
892 $measuring_units[98] = 88;
893 $measuring_units[99] = 89;
894 return $measuring_units[$unit];
Class of dictionary type of thirdparty (used by imports)
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class ProductCombination Used to represent a product combination.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
dol_dir_list($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.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $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.
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 informations.
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 company.
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 informations.
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.