From 69582c65f97f960b7a4c1e88e593a6b0eae7aff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Feb 2023 20:33:35 +0100 Subject: [PATCH 1/3] enhance mo tooltip --- htdocs/mrp/class/mo.class.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 64156ca9b37..446880684d5 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2020 Lenin Rivas - * Copyright (C) ---Put here your own copyright and developer email--- + * Copyright (C) 2023 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,8 +26,6 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; /** * Class for Mo @@ -1118,7 +1116,8 @@ class Mo extends CommonObject { global $conf, $langs; - $langs->load('mrp'); + $langs->loadLangs(['mrp', 'products']); + $nofetch = isset($params['nofetch']) ? true : false; $datas = []; @@ -1133,6 +1132,21 @@ class Mo extends CommonObject if (isset($this->mrptype)) { $datas['type'] = '
'.$langs->trans('Type').': '.$this->fields['mrptype']['arrayofkeyval'][$this->mrptype]; } + if (isset($this->qty)) { + $datas['qty'] = '
'.$langs->trans('QtyToProduce').': '.$this->qty; + } + if (!$nofetch && isset($this->fk_product)) { + require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + $product = new Product($this->db); + $product->fetch($this->fk_product); + $datas['product'] = '
'.$langs->trans('Product').': '.$product->getNomUrl(1, '', 0, -1, 1); + } + if (!$nofetch && isset($this->fk_warehouse)) { + require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; + $warehouse = new Entrepot($this->db); + $warehouse->fetch($this->fk_warehouse); + $datas['warehouse'] = '
'.$langs->trans('WarehouseForProduction').': '.$warehouse->getNomUrl(1, '', 0, 1); + } return $datas; } @@ -1160,13 +1174,13 @@ class Mo extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); } $label = implode($this->getTooltipContentArray($params)); From aa44514065915f1912afd1aee11821b835d2aae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Feb 2023 20:36:39 +0100 Subject: [PATCH 2/3] enhance mo tooltip --- htdocs/product/stock/class/entrepot.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index a165bf79038..006eb353a6c 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -706,9 +706,9 @@ class Entrepot extends CommonObject if (isset($this->statut)) { $datas['picto'] .= ' '.$this->getLibStatut(5); } - $datas['ref'] .= '
'.$langs->trans('Ref').': '.(empty($this->ref) ? $this->label : $this->ref); + $datas['ref'] = '
'.$langs->trans('Ref').': '.(empty($this->ref) ? $this->label : $this->ref); if (!empty($this->lieu)) { - $datas['locationsummary'] .= '
'.$langs->trans('LocationSummary').': '.$this->lieu; + $datas['locationsummary'] = '
'.$langs->trans('LocationSummary').': '.$this->lieu; } return $datas; From c136d2c5b6018750da47fc9b7668f18ee00c66b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Feb 2023 20:45:13 +0100 Subject: [PATCH 3/3] enhance mo tooltip --- htdocs/workstation/class/workstation.class.php | 2 +- htdocs/workstation/workstation_agenda.php | 2 +- htdocs/workstation/workstation_card.php | 2 +- htdocs/workstation/workstation_document.php | 2 +- htdocs/workstation/workstation_list.php | 2 +- htdocs/workstation/workstation_note.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index dcb966daa6c..14d5bab575f 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -694,7 +694,7 @@ class Workstation extends CommonObject { global $conf, $langs; - $langs->load('holiday'); + $langs->load('mrp'); $datas = []; $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Workstation").''; diff --git a/htdocs/workstation/workstation_agenda.php b/htdocs/workstation/workstation_agenda.php index 70ed0c75617..c5c73c3f668 100644 --- a/htdocs/workstation/workstation_agenda.php +++ b/htdocs/workstation/workstation_agenda.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php'; require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('workstation', 'other')); +$langs->loadLangs(array('mrp', 'other')); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 0e16293bd11..821317ba270 100644 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstationusergroup.class.ph require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('workstation', 'other')); +$langs->loadLangs(array('mrp', 'other')); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/workstation/workstation_document.php b/htdocs/workstation/workstation_document.php index 2ccf1936615..631783abd67 100644 --- a/htdocs/workstation/workstation_document.php +++ b/htdocs/workstation/workstation_document.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php'; require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('companies', 'mails', 'other', 'workstation')); +$langs->loadLangs(array('companies', 'mails', 'other', 'mrp')); $action = GETPOST('action', 'aZ09'); diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index 91818e2b344..699bc52045b 100644 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'; require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php'; // Load translation files required by the page -$langs->loadLangs(array('workstation', 'other')); +$langs->loadLangs(array('mrp', 'other')); $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) diff --git a/htdocs/workstation/workstation_note.php b/htdocs/workstation/workstation_note.php index d5eb05737f0..e3e98e17d85 100644 --- a/htdocs/workstation/workstation_note.php +++ b/htdocs/workstation/workstation_note.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php'; require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('workstation', 'companies')); +$langs->loadLangs(array('mrp', 'companies')); // Get parameters $id = GETPOST('id', 'int');