From f0f24291d4662f60ca97a79b087a2b29de47a3a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Jun 2022 10:40:10 +0200 Subject: [PATCH] Debug v16 --- htdocs/core/class/commonobject.class.php | 10 +++++++--- htdocs/core/tpl/commonfields_edit.tpl.php | 4 ++++ htdocs/langs/en_US/errors.lang | 1 + htdocs/partnership/class/partnership.class.php | 4 ++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f429225640b..9b8fea19e5f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7556,11 +7556,15 @@ abstract class CommonObject if ($classname && class_exists($classname)) { $object = new $classname($this->db); if ($object->element === 'product') { // Special cas for product because default valut of fetch are wrong - $object->fetch($value, '', '', '', 0, 1, 1); + $result = $object->fetch($value, '', '', '', 0, 1, 1); } else { - $object->fetch($value); + $result = $object->fetch($value); + } + if ($result > 0) { + $value = $object->getNomUrl($getnomurlparam, $getnomurlparam2); + } else { + $value = ''; } - $value = $object->getNomUrl($getnomurlparam, $getnomurlparam2); } } else { dol_syslog('Error bad setup of extrafield', LOG_WARNING); diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php index 39103fdbb0a..1439ce73afe 100644 --- a/htdocs/core/tpl/commonfields_edit.tpl.php +++ b/htdocs/core/tpl/commonfields_edit.tpl.php @@ -63,9 +63,11 @@ foreach ($object->fields as $key => $val) { } print ''; print ''; + if (!empty($val['picto'])) { print img_picto('', $val['picto'], '', false, 0, 0, '', 'pictofixedwidth'); } + if (in_array($val['type'], array('int', 'integer'))) { $value = GETPOSTISSET($key) ?GETPOST($key, 'int') : $object->$key; } elseif ($val['type'] == 'double') { @@ -78,6 +80,8 @@ foreach ($object->fields as $key => $val) { $check = 'restricthtml'; } $value = GETPOSTISSET($key) ? GETPOST($key, $check) : $object->$key; + } elseif (in_array($val['type'], array('date', 'datetime'))) { + $value = GETPOSTISSET($key) ? dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), GETPOST($key.'sec', 'int'), GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')) : $object->$key; } elseif ($val['type'] == 'price') { $value = GETPOSTISSET($key) ? price2num(GETPOST($key)) : price2num($object->$key); } elseif ($key == 'lang') { diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 3955f0f9bb3..ba9cf1cb19a 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -287,6 +287,7 @@ ErrorInvoiceLoadThirdParty=Can't load third-party object for invoice "%s" ErrorInvoiceLoadThirdPartyKey=Third-party key "%s" no set for invoice "%s" ErrorDeleteLineNotAllowedByObjectStatus=Delete line is not allowed by current object status ErrorAjaxRequestFailed=Request failed +ErrorThirpdartyOrMemberidIsMandatory=Third party or Member of partnership is mandatory # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 126ea58076b..a14a5a93ff0 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -247,7 +247,7 @@ class Partnership extends CommonObject public function create(User $user, $notrigger = false) { if ($this->fk_soc <= 0 && $this->fk_member <= 0) { - $this->error[] = "ErrorThirpdartyOrMemberidIsManadatory"; + $this->error[] = "ErrorThirpdartyOrMemberidIsMandatory"; return -1; } @@ -555,7 +555,7 @@ class Partnership extends CommonObject public function update(User $user, $notrigger = false) { if ($this->fk_soc <= 0 && $this->fk_member <= 0) { - $this->error[] = "ErrorThirpdartyOrMemberidIsManadatory"; + $this->error[] = "ErrorThirpdartyOrMemberidIsMandatory"; return -1; }