From 884b74a6bb322a44e129ea54cf77e4399ad54536 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Wed, 7 Mar 2018 17:12:59 +0100 Subject: [PATCH 1/4] FIX: warning when adding ECM files using old photo path --- htdocs/core/class/html.formfile.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index a48ae7477fc..d84357c3559 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1018,7 +1018,17 @@ class FormFile // Get list of files stored into database for same relative directory if ($relativedir) { - $filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC); + $filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC); + + if($modulepart == 'produit' && ! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO) && ! empty($object->id)) { + if (! empty($conf->product->enabled)) $upload_dirold = $conf->product->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2),1,1).'/'.substr(substr("000".$object->id, -2),0,1).'/'.$object->id."/photos"; + else $upload_dirold = $conf->service->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2),1,1).'/'.substr(substr("000".$object->id, -2),0,1).'/'.$object->id."/photos"; + + $relativedirold = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $upload_dirold); + $relativedirold = preg_replace('/^[\\/]/','',$relativedirold); + + $filearrayindatabase = array_merge($filearrayindatabase, dol_dir_list_in_database($relativedirold, '', null, 'name', SORT_ASC)); + } //var_dump($filearray); //var_dump($filearrayindatabase); From c00885384232356c0c51475a861c204242255334 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 10 Mar 2018 23:03:41 +0100 Subject: [PATCH 2/4] Fix #8057 --- htdocs/contact/class/contact.class.php | 21 +++++++++++-------- .../mailings/advthirdparties.modules.php | 6 +++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 3b7ce848731..21c7527dae2 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -991,9 +991,10 @@ class Contact extends CommonObject * @param string $option Where the link point to * @param int $maxlen Max length of * @param string $moreparam Add more param into URL + * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='') + function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='',$notooltip=0) { global $conf, $langs, $hookmanager; @@ -1012,13 +1013,15 @@ class Contact extends CommonObject $link = 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label=$langs->trans("ShowContact"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.= ' class="classfortooltip">'; + if (empty($notooltip)) { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowContact"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.= ' class="classfortooltip"'; + } if (! is_object($hookmanager)) { @@ -1030,7 +1033,7 @@ class Contact extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; - $link.=$linkclose; + $link.=$linkclose.'>'; $linkend=''; diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index 9252ae5ec3a..a747bc3625c 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -100,7 +100,7 @@ class mailing_advthirdparties extends MailingTargets 'source_url' => $this->url($obj->id,'thirdparty'), 'source_id' => $obj->id, 'source_type' => 'thirdparty' - ); + ); } } @@ -289,11 +289,11 @@ class mailing_advthirdparties extends MailingTargets if ($type=='thirdparty') { $companystatic=new Societe($this->db); $companystatic->fetch($id); - return $companystatic->getNomUrl(0); + return $companystatic->getNomUrl(0,'',0,1); } elseif ($type=='contact') { $contactstatic=new Contact($this->db); $contactstatic->fetch($id); - return $contactstatic->getNomUrl(0); + return $contactstatic->getNomUrl(0,'',0,'',1); } } From c2397fad60d61f5939bf57775c9a3e7e8a95815b Mon Sep 17 00:00:00 2001 From: Inovea Conseil Date: Sat, 10 Mar 2018 23:49:43 +0100 Subject: [PATCH 3/4] Fix #8092 --- htdocs/societe/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d3f629952b1..b5d643abc98 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -10,6 +10,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -295,7 +296,8 @@ if (empty($reshook)) if (! $error) { $result = $object->insertExtraFields(); - if ($result < 0) $error++; + if ($result < 0) $errors = $object->errors; + } if ($error) $action = 'edit_extras'; } From 03f7df88c622708db3d8f95b18317d29f3e4823c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Mar 2018 00:05:32 +0100 Subject: [PATCH 4/4] Update card.php --- htdocs/societe/card.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index b5d643abc98..42abde0e09b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -292,12 +292,15 @@ if (empty($reshook)) // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); - if ($ret < 0) $error++; + if ($ret < 0) { $error++; } if (! $error) { $result = $object->insertExtraFields(); - if ($result < 0) $errors = $object->errors; - + if ($result < 0) + { + $error++; + $errors = $object->errors; + } } if ($error) $action = 'edit_extras'; }