From 2a2b372ba9cefc09fcd21a29ea4784fc16c60b28 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 10 Dec 2020 15:08:36 +0100 Subject: [PATCH 1/4] fix: manage price min for PRICE PER CUSTOMER --- htdocs/comm/propal/card.php | 1 + htdocs/commande/card.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index db64dd65fe9..12146179db0 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -911,6 +911,7 @@ if (empty($reshook)) if (count($prodcustprice->lines) > 0) { $pu_ht = price($prodcustprice->lines[0]->price); $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_min = price($prodcustprice->lines[0]->price_min); $price_base_type = $prodcustprice->lines[0]->price_base_type; $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 80ff2180801..e72ddbf8818 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -749,6 +749,7 @@ if (empty($reshook)) { $pu_ht = price($prodcustprice->lines[0]->price); $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_min = price($prodcustprice->lines[0]->price_min); $price_base_type = $prodcustprice->lines[0]->price_base_type; $tva_tx = $prodcustprice->lines[0]->tva_tx; if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; From dca48e4fb67654ac7923963360ccf47c92c71ef8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 11 Dec 2020 10:21:10 +0100 Subject: [PATCH 2/4] NEW : add ECM files table info into API document entry GET --- htdocs/api/class/api_documents.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 92404b81a35..da9545aa248 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -497,6 +497,17 @@ class Documents extends DolibarrApi $filearray = dol_dir_list($upload_dir, $type, $recursive, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); if (empty($filearray)) { throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->ref) ? ' or Ref '.$object->ref : '').' does not return any document.'); + } else { + if (($object->id) > 0 && !empty($modulepart)) { + require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php'; + $ecmfile = new EcmFiles($this->db); + $result = $ecmfile->fetchAll('', '', 0, 0, array('t.src_object_type' => $modulepart, 't.src_object_id' => $object->id)); + if ($result < 0) { + throw new RestException(503, 'Error when retrieve ecm list : ' . $this->db->lasterror()); + } elseif (is_array($ecmfile->lines) && count($ecmfile->lines) > 0) { + $filearray['ecmfiles_infos'] = $ecmfile->lines; + } + } } return $filearray; From eb2d7fa657968379d2f3daae0787aa89dc823170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 11 Dec 2020 13:43:03 +0100 Subject: [PATCH 3/4] fix phpcs --- htdocs/core/class/html.form.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 24b3a5c2bbf..8a928aeeb34 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5930,24 +5930,24 @@ class Form * * @param string $prefix Prefix * @param string $selected Selected duration type - * @param array|null $ecludetypes Array of duration types to exclude. Example array('y', 'm') + * @param array|null $excludetypes Array of duration types to exclude. Example array('y', 'm') * @return string HTML select string */ - public function selectTypeDuration($prefix, $selected = 'i', $excludtypes = null) + public function selectTypeDuration($prefix, $selected = 'i', $excludetypes = null) { global $langs; $TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes')); // Removed undesired duration types - if (is_array($excludtypes)) { - foreach($excludtypes as $value) { + if (is_array($excludetypes)) { + foreach($excludetypes as $value) { unset($TDurationTypes[$value]); } } $retstring = '';