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');
47 $usercancreadsupplierprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_supplier_prices') : $user->hasRight(
'product',
'read');
50 $label = $langs->trans(
'Service');
51 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_prices') : $user->hasRight(
'service',
'read');
52 $usercancreadsupplierprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_supplier_prices') : $user->hasRight(
'service',
'read');
59 $head[$h][1] = $label;
60 $head[$h][2] =
'card';
64 if ($usercancreadprice) {
66 $head[$h][1] = $langs->trans(
"SellingPrices");
67 $head[$h][2] =
'price';
71 $head[$h][1] = $langs->trans(
"SellingPrices");
72 $head[$h][2] =
'price';
73 $head[$h][5] =
'disabled';
79 if ((
isModEnabled(
"supplier_proposal") ||
isModEnabled(
"supplier_order") ||
isModEnabled(
"supplier_invoice")) && ($user->hasRight(
'fournisseur',
'lire') || $user->hasRight(
'supplier_order',
'read') || $user->hasRight(
'supplier_invoice',
'read'))
80 || (
isModEnabled(
'margin') && $user->hasRight(
"margin",
"liretous"))
82 if ($usercancreadsupplierprice) {
83 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/product/price_suppliers.php', [
'id' =>
$object->id]);
84 $head[$h][1] = $langs->trans(
"BuyingPrices");
85 $head[$h][2] =
'suppliers';
89 $head[$h][1] = $langs->trans(
"BuyingPrices");
90 $head[$h][2] =
'suppliers';
91 $head[$h][5] =
'disabled';
99 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/product/traduction.php', [
'id' =>
$object->id]);
100 $head[$h][1] = $langs->trans(
"Translations");
101 $nbTranslations = !empty(
$object->multilangs) ? count(
$object->multilangs) : 0;
102 if ($nbTranslations > 0) {
103 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbTranslations.
'</span>';
105 $head[$h][2] =
'translation';
111 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/product/composition/card.php', [
'id' =>
$object->id]);
112 $head[$h][1] = $langs->trans(
'AssociatedProducts');
114 $nbFather =
$object->hasFatherOrChild(-1);
115 $nbChild =
$object->hasFatherOrChild(1);
116 if ($nbFather > 0 || $nbChild > 0) {
117 $head[$h][1] .=
'<span class="badge marginleftonlyshort">';
119 $head[$h][1] .= $nbFather;
121 $head[$h][1] .= ($nbFather && $nbChild) ?
'+' :
'';
123 $head[$h][1] .= $nbChild;
125 $head[$h][1] .=
'</span>';
127 $head[$h][2] =
'subproduct';
134 require_once DOL_DOCUMENT_ROOT.
'/variants/class/ProductCombination.class.php';
138 if ($prodcomb->fetchByFkProductChild(
$object->id) <= 0) {
139 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/variants/combinations.php', [
'id' =>
$object->id]);
140 $head[$h][1] = $langs->trans(
'ProductCombinations');
141 $head[$h][2] =
'combinations';
142 $nbVariant = $prodcomb->countNbOfCombinationForFkProductParent(
$object->id);
143 if ($nbVariant > 0) {
144 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbVariant.
'</span>';
152 if (
isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire')) {
153 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/product/stock/product.php', [
'id' =>
$object->id]);
154 $head[$h][1] = $langs->trans(
"Stock");
155 $head[$h][2] =
'stock';
163 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/resource/element_resource.php', [
'element' =>
'product',
'element_id' =>
$object->id]);
164 $head[$h][1] = $langs->trans(
"Resources");
165 $head[$h][2] =
'resources';
169 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/resource/element_resource.php', [
'element' =>
'service',
'element_id' =>
$object->id]);
170 $head[$h][1] = $langs->trans(
"Resources");
171 $head[$h][2] =
'resources';
177 if (
$object->origin_type ==
'product' &&
$object->origin_id > 0) {
179 $objectsrc->fetch(
$object->origin_id);
181 $nbContact = count($objectsrc->liste_contact(-1,
'internal')) + count($objectsrc->liste_contact(-1,
'external'));
182 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/product/contact.php', [
'id' =>
$object->id]);
183 $head[$h][1] = $langs->trans(
"ContactsAddresses");
184 if ($nbContact > 0) {
185 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
187 $head[$h][2] =
'contact';
190 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/product/stats/facture.php', [
'showmessage' => 1,
'id' =>
$object->id]);
191 $head[$h][1] = $langs->trans(
'Referers');
192 $head[$h][2] =
'referers';
195 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/product/stats/index.php', [
'id' =>
$object->id]);
196 $head[$h][1] = $langs->trans(
'Statistics');
197 $head[$h][2] =
'stats';
209 if (!empty(
$object->note_private)) {
212 if (!empty(
$object->note_public)) {
216 $head[$h][1] = $langs->trans(
'Notes');
218 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
220 $head[$h][2] =
'note';
225 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
226 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
235 if ($upload_dir !==
null) {
236 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
245 if ($upload_dir !==
null) {
246 $nbFiles += count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
250 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/product/document.php', [
'id' =>
$object->id]);
251 $head[$h][1] = $langs->trans(
'Documents');
252 if (($nbFiles + $nbLinks) > 0) {
253 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
255 $head[$h][2] =
'documents';
259 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/product/messaging.php', [
'id' =>
$object->id]);
260 $head[$h][1] = $langs->trans(
"Events");
261 if (
isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
264 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
265 $cachekey =
'count_events_product_'.$object->id;
267 if (!is_null($dataretrieved)) {
268 $nbEvent = $dataretrieved;
270 $sql =
"SELECT COUNT(id) as nb";
271 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
272 $sql .=
" WHERE fk_element = ".((int)
$object->id);
273 $sql .=
" AND elementtype = 'product'";
274 $resql = $db->query($sql);
276 $obj = $db->fetch_object($resql);
279 dol_syslog(
'Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
285 $head[$h][1] .= $langs->trans(
"Agenda");
287 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
290 $head[$h][2] =
'agenda';
386 global $langs,
$conf, $extrafields;
388 $extrafields->fetch_name_optionals_label(
'product');
389 $extrafields->fetch_name_optionals_label(
'product_lang');
390 $extrafields->fetch_name_optionals_label(
'product_price');
391 $extrafields->fetch_name_optionals_label(
'product_customer_price');
392 $extrafields->fetch_name_optionals_label(
'product_fournisseur_price');
397 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/product/admin/product.php");
398 $head[$h][1] = $langs->trans(
'Parameters');
399 $head[$h][2] =
'general';
404 0 =>
dolBuildUrl(DOL_URL_ROOT.
"/product/admin/price_rules.php"),
405 1 => $langs->trans(
'MultipriceRules'),
417 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/extrafields.php', array(
'elementtype' =>
'product'));
418 $head[$h][1] = $langs->trans(
"ExtraFields");
419 $nbExtrafields = isset($extrafields->attributes[
'product'][
'count']) ? $extrafields->attributes[
'product'][
'count'] : 0;
420 if ($nbExtrafields > 0) {
421 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
423 $head[$h][2] =
'attributes';
428 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/extrafields.php', array(
'elementtype' =>
'product_lang'));
429 $head[$h][1] = $langs->trans(
"TranslationsExtrafields");
430 $nbExtrafields = isset($extrafields->attributes[
'product_lang'][
'count']) ? $extrafields->attributes[
'product_lang'][
'count'] : 0;
431 if ($nbExtrafields > 0) {
432 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
434 $head[$h][2] =
'translationAttributes';
440 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/extrafields.php', array(
'elementtype' =>
'product_price'));
441 $head[$h][1] = $langs->trans(
"ProductLevelExtraFields");
442 $nbExtrafields = isset($extrafields->attributes[
'product_price'][
'count']) ? $extrafields->attributes[
'product_price'][
'count'] : 0;
443 if ($nbExtrafields > 0) {
444 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
446 $head[$h][2] =
'levelAttributes';
452 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/extrafields.php', array(
'elementtype' =>
'product_customer_price'));
453 $head[$h][1] = $langs->trans(
"ProductCustomerExtraFields");
454 $nbExtrafields = isset($extrafields->attributes[
'product_customer_price'][
'count']) ? $extrafields->attributes[
'product_customer_price'][
'count'] : 0;
455 if ($nbExtrafields > 0) {
456 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
458 $head[$h][2] =
'customerAttributes';
463 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/extrafields.php', array(
'elementtype' =>
'product_fournisseur_price'));
464 $head[$h][1] = $langs->trans(
"ProductSupplierExtraFields");
465 $nbExtrafields = isset($extrafields->attributes[
'product_fournisseur_price'][
'count']) ? $extrafields->attributes[
'product_fournisseur_price'][
'count'] : 0;
466 if ($nbExtrafields > 0) {
467 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
469 $head[$h][2] =
'supplierAttributes';
529 global $langs, $user, $db, $hookmanager;
531 $form =
new Form($db);
535 print
'<tr class="liste_titre">';
536 print
'<td class="liste_titre left">';
537 print $form->textwithpicto($langs->trans(
"Referers"), $langs->trans(
"ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv(
"Referers")));
539 print
'<td class="liste_titre right">'.$langs->trans(
"NbOfThirdParties").
'</td>';
540 print
'<td class="liste_titre right">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
541 print
'<td class="liste_titre right">'.$langs->trans(
"TotalQuantity").
'</td>';
545 if (
isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
547 $ret = $product->load_stats_propale($socid);
549 dol_print_error($db);
551 $langs->load(
"propal");
553 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stats/propal.php', [
'id' => $product->id],
false,
'anchorundermenu').
'">'.img_object(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Proposals").
'</a>';
554 print
'</td><td class="right">';
555 print $product->stats_propale[
'customers'];
556 print
'</td><td class="right">';
557 print $product->stats_propale[
'nb'];
558 print
'</td><td class="right">';
559 print
price($product->stats_propale[
'qty'], 1, $langs, 0, 0);
564 if (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
566 $ret = $product->load_stats_proposal_supplier($socid);
568 dol_print_error($db);
570 $langs->load(
"supplier_proposal");
572 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stats/supplier_proposal.php', [
'id' => $product->id],
false,
'anchorundermenu').
'">'.img_object(
'',
'supplier_proposal',
'class="pictofixedwidth"').$langs->trans(
"SupplierProposals").
'</a>';
573 print
'</td><td class="right">';
574 print $product->stats_proposal_supplier[
'suppliers'];
575 print
'</td><td class="right">';
576 print $product->stats_proposal_supplier[
'nb'];
577 print
'</td><td class="right">';
578 print
price($product->stats_proposal_supplier[
'qty'], 1, $langs, 0, 0);
583 if (
isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
585 $ret = $product->load_stats_commande($socid);
587 dol_print_error($db);
589 $langs->load(
"orders");
591 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stats/commande.php', [
'id' => $product->id],
false,
'anchorundermenu').
'">'.img_object(
'',
'order',
'class="pictofixedwidth"').$langs->trans(
"CustomersOrders").
'</a>';
592 print
'</td><td class="right">';
593 print $product->stats_commande[
'customers'];
594 print
'</td><td class="right">';
595 print $product->stats_commande[
'nb'];
596 print
'</td><td class="right">';
597 print
price($product->stats_commande[
'qty'], 1, $langs, 0, 0);
602 if ((
isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'commande',
'lire')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
604 $ret = $product->load_stats_commande_fournisseur($socid);
606 dol_print_error($db);
608 $langs->load(
"orders");
610 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stats/commande_fournisseur.php', [
'id' => $product->id],
false,
'anchorundermenu').
'">'.img_object(
'',
'supplier_order',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
611 print
'</td><td class="right">';
612 print $product->stats_commande_fournisseur[
'suppliers'];
613 print
'</td><td class="right">';
614 print $product->stats_commande_fournisseur[
'nb'];
615 print
'</td><td class="right">';
616 print
price($product->stats_commande_fournisseur[
'qty'], 1, $langs, 0, 0);
621 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
623 $ret = $product->load_stats_facture($socid);
625 dol_print_error($db);
627 $langs->load(
"bills");
629 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stats/facture.php', [
'id' => $product->id],
false,
'anchorundermenu').
'">'.img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CustomersInvoices").
'</a>';
630 print
'</td><td class="right">';
631 print $product->stats_facture[
'customers'];
632 print
'</td><td class="right">';
633 print $product->stats_facture[
'nb'];
634 print
'</td><td class="right">';
635 print
price($product->stats_facture[
'qty'], 1, $langs, 0, 0);
640 if (
isModEnabled(
"invoice") && $user->hasRight(
'facture',
'lire')) {
642 $ret = $product->load_stats_facturerec($socid);
644 dol_print_error($db);
646 $langs->load(
"bills");
648 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stats/facturerec.php', [
'id' => $product->id],
false,
'anchorundermenu').
'">'.img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"RecurringInvoiceTemplate").
'</a>';
649 print
'</td><td class="right">';
650 print $product->stats_facturerec[
'customers'];
651 print
'</td><td class="right">';
652 print $product->stats_facturerec[
'nb'];
653 print
'</td><td class="right">';
654 print $product->stats_facturerec[
'qty'];
659 if ((
isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'facture',
'lire')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
661 $ret = $product->load_stats_facture_fournisseur($socid);
663 dol_print_error($db);
665 $langs->load(
"bills");
667 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stats/facture_fournisseur.php', [
'id' => $product->id],
false,
'anchorundermenu').
'">'.img_object(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
"SuppliersInvoices").
'</a>';
668 print
'</td><td class="right">';
669 print $product->stats_facture_fournisseur[
'suppliers'];
670 print
'</td><td class="right">';
671 print $product->stats_facture_fournisseur[
'nb'];
672 print
'</td><td class="right">';
673 print
price($product->stats_facture_fournisseur[
'qty'], 1, $langs, 0, 0);
700 if (
isModEnabled(
'shipping') && $user->hasRight(
'shipping',
'lire')) {
702 $ret = $product->load_stats_sending($socid);
704 dol_print_error($db);
706 $langs->load(
"sendings");
708 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stats/expedition.php', [
'id' => $product->id],
false,
'anchorundermenu').
'">'.img_object(
'',
'shipment',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
709 print
'</td><td class="right">';
710 print $product->stats_expedition[
'customers'];
711 print
'</td><td class="right">';
712 print $product->stats_expedition[
'nb'];
713 print
'</td><td class="right">';
714 print $product->stats_expedition[
'qty'];
720 if ((
isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire'))) {
722 $ret = $product->load_stats_reception($socid);
724 dol_print_error($db);
726 $langs->load(
"receptions");
728 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stats/reception.php', [
'id' => $product->id],
false,
'anchorundermenu').
'">'.img_object(
'',
'reception',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
729 print
'</td><td class="right">';
730 print $product->stats_reception[
'suppliers'];
731 print
'</td><td class="right">';
732 print $product->stats_reception[
'nb'];
733 print
'</td><td class="right">';
734 print $product->stats_reception[
'qty'];
740 if (
isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
742 $ret = $product->load_stats_contrat($socid);
744 dol_print_error($db);
746 $langs->load(
"contracts");
748 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stats/contrat.php', [
'id' => $product->id],
false,
'anchorundermenu').
'">'.img_object(
'',
'contract',
'class="pictofixedwidth"').$langs->trans(
"Contracts").
'</a>';
749 print
'</td><td class="right">';
750 print $product->stats_contrat[
'customers'];
751 print
'</td><td class="right">';
752 print $product->stats_contrat[
'nb'];
753 print
'</td><td class="right">';
754 print
price($product->stats_contrat[
'qty'], 1, $langs, 0, 0);
760 if (
isModEnabled(
'bom') && $user->hasRight(
'bom',
'read')) {
762 $ret = $product->load_stats_bom($socid);
764 setEventMessage($product->error,
'errors');
769 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stats/bom.php', [
'id' => $product->id],
false,
'anchorundermenu').
'">'.img_object(
'',
'bom',
'class="pictofixedwidth"').$langs->trans(
"BOM").
'</a>';
770 print
'</td><td class="right">';
772 print
'</td><td class="right">';
773 print $form->textwithpicto((
string) $product->stats_bom[
'nb_toconsume'], $langs->trans(
"RowMaterial"));
775 print $form->textwithpicto((
string) $product->stats_bom[
'nb_toproduce'], $langs->trans(
"Finished"));
776 print
'</td><td class="right">';
777 print $form->textwithpicto((
string) $product->stats_bom[
'qty_toconsume'], $langs->trans(
"RowMaterial"));
779 print $form->textwithpicto((
string) $product->stats_bom[
'qty_toproduce'], $langs->trans(
"Finished"));
785 if (
isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
787 $ret = $product->load_stats_mo($socid);
789 setEventMessages($product->error, $product->errors,
'errors');
793 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stats/mo.php', [
'id' => $product->id],
false,
'anchorundermenu').
'">'.img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
794 print
'</td><td class="right">';
795 print $form->textwithpicto((
string) $product->stats_mo[
'customers_toconsume'], $langs->trans(
"ToConsume"));
797 print $form->textwithpicto((
string) $product->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
799 print $form->textwithpicto((
string) $product->stats_mo[
'customers_toproduce'], $langs->trans(
"QtyToProduce"));
801 print $form->textwithpicto((
string) $product->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
802 print
'</td><td class="right">';
803 print $form->textwithpicto((
string) $product->stats_mo[
'nb_toconsume'], $langs->trans(
"ToConsume"));
805 print $form->textwithpicto((
string) $product->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
807 print $form->textwithpicto((
string) $product->stats_mo[
'nb_toproduce'], $langs->trans(
"QtyToProduce"));
809 print $form->textwithpicto((
string) $product->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
810 print
'</td><td class="right">';
811 print $form->textwithpicto((
string) $product->stats_mo[
'qty_toconsume'], $langs->trans(
"ToConsume"));
813 print $form->textwithpicto((
string) $product->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
815 print $form->textwithpicto((
string) $product->stats_mo[
'qty_toproduce'], $langs->trans(
"QtyToProduce"));
817 print $form->textwithpicto((
string) $product->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
821 $parameters = array(
'socid' => $socid);
822 $reshook = $hookmanager->executeHooks(
'addMoreProductStat', $parameters, $product, $nblines);
824 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
827 print $hookmanager->resPrint;
842 global
$conf, $langs, $user, $db, $hookmanager;
844 $langs->LoadLangs(array(
'sendings',
'orders',
'receptions'));
846 $form =
new Form($db);
850 print
'<tr class="liste_titre">';
851 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
852 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
853 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
854 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
858 if (
isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')) {
860 $ret = $batch->loadStatsExpedition($socid);
862 dol_print_error($db);
864 $langs->load(
"bills");
866 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stock/stats/expedition.php', [
'id' => $batch->id]).
'">'.img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
867 print
'</td><td class="right">';
868 print $batch->stats_expedition[
'customers'];
869 print
'</td><td class="right">';
870 print $batch->stats_expedition[
'nb'];
871 print
'</td><td class="right">';
872 print $batch->stats_expedition[
'qty'];
877 if (
isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire')) {
879 $ret = $batch->loadStatsReception($socid);
881 dol_print_error($db);
883 $langs->load(
"bills");
885 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stock/stats/reception.php', [
'id' => $batch->id]).
'">'.img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
886 print
'</td><td class="right">';
887 print $batch->stats_reception[
'customers'];
888 print
'</td><td class="right">';
889 print $batch->stats_reception[
'nb'];
890 print
'</td><td class="right">';
891 print $batch->stats_reception[
'qty'];
894 } elseif (
isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire')) {
896 $ret = $batch->loadStatsSupplierOrder($socid);
898 dol_print_error($db);
900 $langs->load(
"bills");
902 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stock/stats/commande_fournisseur.php', [
'id' => $batch->id]).
'">'.img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
903 print
'</td><td class="right">';
904 print $batch->stats_supplier_order[
'customers'];
905 print
'</td><td class="right">';
906 print $batch->stats_supplier_order[
'nb'];
907 print
'</td><td class="right">';
908 print $batch->stats_supplier_order[
'qty'];
913 if (
isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
915 $ret = $batch->loadStatsMo($socid);
917 dol_print_error($db);
921 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/product/stock/stats/mo.php', [
'id' => $batch->id]).
'">'.img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
922 print
'</td><td class="right">';
924 print $form->textwithpicto((
string) $batch->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
926 print $form->textwithpicto((
string) $batch->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
927 print
'</td><td class="right">';
929 print $form->textwithpicto((
string) $batch->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
931 print $form->textwithpicto((
string) $batch->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
932 print
'</td><td class="right">';
934 print $form->textwithpicto((
string) $batch->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
936 print $form->textwithpicto((
string) $batch->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
941 $parameters = array(
'socid' => $socid);
942 $reshook = $hookmanager->executeHooks(
'addMoreBatchProductStat', $parameters, $batch, $nblines);
944 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
947 print $hookmanager->resPrint;
981function measuringUnitString($unitid, $measuring_style =
'', $unitscale =
null, $use_short_label = 0, $outputlangs =
null)
984 global $measuring_unit_cache;
986 if (empty($outputlangs)) {
987 $outputlangs = $langs;
990 if (empty($measuring_unit_cache[$unitid.
'_'.$measuring_style.
'_'.$unitscale.
'_'.$use_short_label])) {
991 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
992 $measuringUnits =
new CUnits($db);
994 if ($measuring_style ==
'' && $unitscale ==
'') {
995 $arrayforfilter = array(
996 't.rowid' => $unitid,
999 } elseif ($unitscale !==
'') {
1000 $arrayforfilter = array(
1001 't.scale' => $unitscale,
1002 't.unit_type' => $measuring_style,
1006 $arrayforfilter = array(
1007 't.rowid' => $unitid,
1008 't.unit_type' => $measuring_style,
1012 $result = $measuringUnits->fetchAll(
'',
'', 0, 0, $arrayforfilter);
1017 if (is_array($measuringUnits->records) && count($measuringUnits->records) > 0) {
1018 if ($use_short_label == 1) {
1019 $labeltoreturn = $measuringUnits->records[key($measuringUnits->records)]->short_label;
1020 } elseif ($use_short_label == 2) {
1021 $labeltoreturn = $outputlangs->transnoentitiesnoconv(ucfirst((
string) $measuringUnits->records[key($measuringUnits->records)]->label).
'Short');
1023 $labeltoreturn = $outputlangs->transnoentitiesnoconv((
string) $measuringUnits->records[key($measuringUnits->records)]->label);
1026 $labeltoreturn =
'';
1028 $measuring_unit_cache[$unitid.
'_'.$measuring_style.
'_'.$unitscale.
'_'.$use_short_label] = $labeltoreturn;
1029 return $labeltoreturn;
1032 return $measuring_unit_cache[$unitid.
'_'.$measuring_style.
'_'.$unitscale.
'_'.$use_short_label];
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.