From ab1e43a364e8d4f00a53fc64b5a9be893a5709de Mon Sep 17 00:00:00 2001
From: David Surville <david.surville@unicaen.fr>
Date: Fri, 9 Jun 2023 11:05:00 +0200
Subject: [PATCH] =?UTF-8?q?[Fix]=20L'appel=20de=20la=20fonction=20de=20cr?=
 =?UTF-8?q?=C3=A9ation=20d'un=20compte=20Zimbra=20dans=20le=20processus=20?=
 =?UTF-8?q?de=20cr=C3=A9ation=20d'une=20bo=C3=AEte=20g=C3=A9n=C3=A9rique?=
 =?UTF-8?q?=20ne=20correspondait=20pas=20=C3=A0=20la=20signature=20de=20ce?=
 =?UTF-8?q?tte=20fonction?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 CHANGELOG.md                                              | 5 +++++
 .../Processus/ZimbraBoiteGeneriqueProcessus.php           | 3 ++-
 src/UnicaenZimbra/Service/ZimbraAccountService.php        | 8 ++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 33ac7ba..df74a2f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,11 @@
 CHANGELOG
 =========
 
+4.0.3 (09/06/2023)
+------------------
+
+- [Fix] L'appel de la fonction de création d'un compte Zimbra dans le processus de création d'une boîte générique ne correspondait pas à la signature de cette fonction
+
 4.0.2 (15/03/2023)
 ------------------
 
diff --git a/src/UnicaenZimbra/Processus/ZimbraBoiteGeneriqueProcessus.php b/src/UnicaenZimbra/Processus/ZimbraBoiteGeneriqueProcessus.php
index 72be04c..fc87034 100644
--- a/src/UnicaenZimbra/Processus/ZimbraBoiteGeneriqueProcessus.php
+++ b/src/UnicaenZimbra/Processus/ZimbraBoiteGeneriqueProcessus.php
@@ -53,9 +53,10 @@ class ZimbraBoiteGeneriqueProcessus extends AbstractProcessus
     {
         $account = new Account;
         $account->name = $mail;
+        $account->password = $password;
         $account->description = $description;
         $account->zimbraCOSId = $this->getOptions()->getBoiteGeneriqueCosId();
-        $this->accountService->create($account, $password);
+        $this->accountService->create($account);
         $this->accountService->addAlias($account, $name . substr($mail, strpos($mail, '@')));
 
         return $this;
diff --git a/src/UnicaenZimbra/Service/ZimbraAccountService.php b/src/UnicaenZimbra/Service/ZimbraAccountService.php
index 30dd388..2b760df 100644
--- a/src/UnicaenZimbra/Service/ZimbraAccountService.php
+++ b/src/UnicaenZimbra/Service/ZimbraAccountService.php
@@ -193,11 +193,19 @@ class ZimbraAccountService extends AbstractService
             $attrs['name'] = $value->getName();
             $params = $value->getConvertedChanges();
             if (isset($params['name'])) unset($params['name']);
+            if (isset($params['password'])) {
+                $attrs['password'] = $params['password'];
+                unset($params['password']);
+            }
             $params = $this->getZimbra()->makeZimbraAttributes($params);
             $account = $value;
         } elseif (is_string($value)) {
             $attrs['name'] = $value;
             if (isset($params['name'])) unset($params['name']);
+            if (isset($params['password'])) {
+                $attrs['password'] = $params['password'];
+                unset($params['password']);
+            }
             $params = $this->getZimbra()->makeZimbraAttributes($params);
             $account = new AccountEntity;
         }
-- 
GitLab