From 2cadf87ef2f47ec68f3d9a224a2741b2e67fe088 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 3 Nov 2020 14:44:17 +0100 Subject: [PATCH 1/6] FIX 14750 fix of custom contact type in project list --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index b1d5982ead1..40c23278396 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1252,7 +1252,7 @@ class Project extends CommonObject $nblinks = 0; while ($nblinks < $num) { - if ($source == 'internal' && preg_match('/^PROJECT/', $userRole[$nblinks]['code']) && $user->id == $userRole[$nblinks]['id']) + if ($source == 'internal' && $user->id == $userRole[$nblinks]['id']) { if ($mode == 'read' && $user->rights->projet->lire) $userAccess++; if ($mode == 'write' && $user->rights->projet->creer) $userAccess++; From f7253ab032656b2f606edc8c98fd041573b00117 Mon Sep 17 00:00:00 2001 From: kamel Date: Tue, 3 Nov 2020 15:12:56 +0100 Subject: [PATCH 2/6] NEW: Add new hook on document.php page initHooks: document method: downloadDocument parameters: ecmfile, modulepart, original_file, entity, refname, fullpath_original_file, filename, fullpath_original_file_osencoded --- htdocs/document.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/htdocs/document.php b/htdocs/document.php index a608dfe820e..c13778defb1 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -243,6 +243,23 @@ if (!file_exists($fullpath_original_file_osencoded)) exit; } +// Hooks +if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); +} +$hookmanager->initHooks(array('document')); +$parameters = array('ecmfile' => $ecmfile, 'modulepart' => $modulepart, 'original_file' => $original_file, + 'entity' => $entity, 'refname' => $refname, 'fullpath_original_file' => $fullpath_original_file, + 'filename' => $filename, 'fullpath_original_file_osencoded' => $fullpath_original_file_osencoded); +$reshook = $hookmanager->executeHooks('downloadDocument', $parameters); // Note that $action and $object may have been +if ($reshook < 0) { + $errors = $hookmanager->error . (is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '') . join($separator, $hookmanager->errors) : ''); + dol_syslog("document.php - Errors when executing the hook 'downloadDocument' : " . $errors); + print "ErrorDownloadDocumentHooks: " . $errors; + exit; +} + // Permissions are ok and file found, so we return it top_httphead($type); header('Content-Description: File Transfer'); From 5866facf11db40bcd84c7d074bd4a17bc97e5a6b Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 4 Nov 2020 20:31:55 +0100 Subject: [PATCH 3/6] Update commonobject. Don't think $fk_delivery_address is deprecated, also no alternative indicated. Switch of implode paramenters. showInputField preselected value for array type can be array. --- htdocs/core/class/commonobject.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5d6771d88df..93573415afe 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -312,7 +312,6 @@ abstract class CommonObject /** * @var int Delivery address ID * @see setDeliveryAddress() - * @deprecated */ public $fk_delivery_address; @@ -5009,7 +5008,7 @@ abstract class CommonObject { $value_arr = GETPOST($postfieldkey, 'array'); // check if an array if (!empty($value_arr)) { - $value_key = implode($value_arr, ','); + $value_key = implode(',', $value_arr); } else { $value_key = ''; } @@ -5801,7 +5800,7 @@ abstract class CommonObject * * @param array $val Array of properties for field to show (used only if ->fields not defined) * @param string $key Key of attribute - * @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value) + * @param string|array $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value, for array type must be array) * @param string $moreparam To add more parameters on html input tag * @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names) From 59e78e6a9ff8ad9efcbb8cd6a9ba3161dd9b180b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 5 Nov 2020 08:38:54 +0100 Subject: [PATCH 4/6] doxygen --- htdocs/ticket/class/ticket.class.php | 37 ++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index e39a4b4b962..0b7ce39a83c 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Christophe Battarel - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2020 Frédéric France * Copyright (C) 2020 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -108,8 +108,13 @@ class Ticket extends CommonObject /** * @var int Ticket statut + * @deprecated + */ + public $fk_statut; + + /** + * @var int Ticket status */ - public $fk_statut; // deprecated public $status; /** @@ -188,7 +193,7 @@ class Ticket extends CommonObject public $cache_category_tickets; /** - * @var int Notify tiers at create + * @var int Notify thirdparty at create */ public $notify_tiers_at_create; @@ -279,8 +284,26 @@ class Ticket extends CommonObject { $this->db = $db; - $this->statuts_short = array(self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', self::STATUS_ASSIGNED => 'Assigned', self::STATUS_IN_PROGRESS => 'InProgress', self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', self::STATUS_WAITING => 'Suspended', self::STATUS_CLOSED => 'Closed', self::STATUS_CANCELED => 'Canceled'); - $this->statuts = array(self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', self::STATUS_ASSIGNED => 'Assigned', self::STATUS_IN_PROGRESS => 'InProgress', self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', self::STATUS_WAITING => 'Suspended', self::STATUS_CLOSED => 'Closed', self::STATUS_CANCELED => 'Canceled'); + $this->statuts_short = array( + self::STATUS_NOT_READ => 'Unread', + self::STATUS_READ => 'Read', + self::STATUS_ASSIGNED => 'Assigned', + self::STATUS_IN_PROGRESS => 'InProgress', + self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', + self::STATUS_WAITING => 'Suspended', + self::STATUS_CLOSED => 'Closed', + self::STATUS_CANCELED => 'Canceled' + ); + $this->statuts = array( + self::STATUS_NOT_READ => 'Unread', + self::STATUS_READ => 'Read', + self::STATUS_ASSIGNED => 'Assigned', + self::STATUS_IN_PROGRESS => 'InProgress', + self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', + self::STATUS_WAITING => 'Suspended', + self::STATUS_CLOSED => 'Closed', + self::STATUS_CANCELED => 'Canceled' + ); } /** @@ -1058,7 +1081,7 @@ class Ticket extends CommonObject public function initAsSpecimen() { $this->id = 0; - + $this->entity = 1; $this->ref = 'TI0501-001'; $this->track_id = 'XXXXaaaa'; $this->origin_email = 'email@email.com'; @@ -1067,7 +1090,7 @@ class Ticket extends CommonObject $this->fk_user_assign = 1; $this->subject = 'Subject of ticket'; $this->message = 'Message of ticket'; - $this->fk_statut = 0; + $this->status = 0; $this->resolution = '1'; $this->progress = '10'; $this->timing = '30'; From 32391d211ac6ea34ca7b9a17b1d4ede465d07d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 5 Nov 2020 08:55:04 +0100 Subject: [PATCH 5/6] doxygen --- htdocs/user/class/user.class.php | 56 ++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 067e7aff370..7aa4a79800f 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -64,6 +64,9 @@ class User extends CommonObject */ public $ismultientitymanaged = 1; + /** + * @var string picto + */ public $picto = 'user'; public $id = 0; @@ -73,7 +76,15 @@ class User extends CommonObject public $employee; public $gender; public $birth; + + /** + * @var string email + */ public $email; + + /** + * @var string personal email + */ public $personal_email; @@ -90,7 +101,14 @@ class User extends CommonObject */ public $address; + /** + * @var string zip code + */ public $zip; + + /** + * @var string town + */ public $town; public $state_id; // The state/department public $state_code; @@ -108,11 +126,19 @@ class User extends CommonObject */ public $entity; - //! Clear password in memory + /** + * @var string Clear password in memory + */ public $pass; - //! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0) + + /** + * @var string Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0) + */ public $pass_indatabase; - //! Encrypted password in database (always defined) + + /** + * @var string Encrypted password in database (always defined) + */ public $pass_indatabase_crypted; /** @@ -284,29 +310,25 @@ class User extends CommonObject $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON u.fk_state = d.rowid"; - if ($entity < 0) - { - if ((empty($conf->multicompany->enabled) || empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (!empty($user->entity))) - { + if ($entity < 0) { + if ((empty($conf->multicompany->enabled) || empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (!empty($user->entity))) { $sql .= " WHERE u.entity IN (0,".$conf->entity.")"; } else { $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database } - } else // The fetch was forced on an entity - { - if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) + } else {// The fetch was forced on an entity + if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database - else $sql .= " WHERE u.entity IN (0, ".(($entity != '' && $entity >= 0) ? $entity : $conf->entity).")"; // search in entity provided in parameter + } else { + $sql .= " WHERE u.entity IN (0, ".(($entity != '' && $entity >= 0) ? $entity : $conf->entity).")"; // search in entity provided in parameter + } } - if ($sid) // permet une recherche du user par son SID ActiveDirectory ou Samba - { + if ($sid) { // permet une recherche du user par son SID ActiveDirectory ou Samba $sql .= " AND (u.ldap_sid = '".$this->db->escape($sid)."' OR u.login = '".$this->db->escape($login)."') LIMIT 1"; - } elseif ($login) - { + } elseif ($login) { $sql .= " AND u.login = '".$this->db->escape($login)."'"; - } elseif ($email) - { + } elseif ($email) { $sql .= " AND u.email = '".$this->db->escape($email)."'"; } else { $sql .= " AND u.rowid = ".$id; From 824b778d51cd9ff963d314d308ea0a19448fdfff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Nov 2020 09:07:06 +0100 Subject: [PATCH 6/6] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 93573415afe..2bd32df1f05 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -312,6 +312,7 @@ abstract class CommonObject /** * @var int Delivery address ID * @see setDeliveryAddress() + * @deprecated */ public $fk_delivery_address;