diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 7c43286ed9f..a87c90a6dd9 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1582,7 +1582,9 @@ class EmailCollector extends CommonObject $plainmsg = $imapemail->getTextBody(); } if ($imapemail->hasAttachments()) { - $attachments = $imapemail->getAttachments(); + $attachments = $imapemail->getAttachments()->all(); + } else { + $attachments = []; } } else { $this->getmsg($connection, $imapemail); @@ -2440,6 +2442,20 @@ class EmailCollector extends CommonObject $errorforactions++; $this->error = 'Failed to create project: '.$langs->trans($projecttocreate->error); $this->errors = $projecttocreate->errors; + } else { + if ($attachments) { + $destdir = $conf->project->dir_output.'/'.$projecttocreate->ref; + if (!dol_is_dir($destdir)) { + dol_mkdir($destdir); + } + if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { + foreach ($attachments as $attachment) { + $attachment->save($destdir.'/'); + } + } else { + $this->getmsg($connection, $imapemail, $destdir); + } + } } } } @@ -2550,13 +2566,16 @@ class EmailCollector extends CommonObject $this->errors = $tickettocreate->errors; } else { if ($attachments) { + $destdir = $conf->ticket->dir_output.'/'.$tickettocreate->ref; + if (!dol_is_dir($destdir)) { + dol_mkdir($destdir); + } if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { - $destdir = $conf->ticket->dir_output.'/'.$tickettocreate->ref; - if (!dol_is_dir($destdir)) { - return -1; - dol_mkdir($destdir); - $this->getmsg($connection, $imapemail, $destdir); + foreach ($attachments as $attachment) { + $attachment->save($destdir.'/'); } + } else { + $this->getmsg($connection, $imapemail, $destdir); } } } diff --git a/htdocs/includes/webklex/php-imap/deleted.txt b/htdocs/includes/webklex/php-imap/deleted.txt index 9993acc6994..7eba7283d76 100644 --- a/htdocs/includes/webklex/php-imap/deleted.txt +++ b/htdocs/includes/webklex/php-imap/deleted.txt @@ -13,4 +13,5 @@ ./vendor/phpdocumentor ./vendor/nesbot/carbon/src/Carbon/Lang ./vendor/doctrine +./vendor/bin ./tests diff --git a/htdocs/includes/webklex/php-imap/vendor/composer/autoload_static.php b/htdocs/includes/webklex/php-imap/vendor/composer/autoload_static.php index db56e4812b6..0120578feb6 100644 --- a/htdocs/includes/webklex/php-imap/vendor/composer/autoload_static.php +++ b/htdocs/includes/webklex/php-imap/vendor/composer/autoload_static.php @@ -16,24 +16,24 @@ class ComposerStaticInit4da13270269c89a28e472e1f7324e6d1 ); public static $prefixLengthsPsr4 = array ( - 'v' => + 'v' => array ( 'voku\\' => 5, ), - 'p' => + 'p' => array ( 'phpDocumentor\\Reflection\\' => 25, ), - 'W' => + 'W' => array ( 'Webmozart\\Assert\\' => 17, 'Webklex\\PHPIMAP\\' => 16, ), - 'T' => + 'T' => array ( - 'Tests\\' => 6, + // 'Tests\\' => 6, ), - 'S' => + 'S' => array ( 'Symfony\\Polyfill\\Php80\\' => 23, 'Symfony\\Polyfill\\Mbstring\\' => 26, @@ -43,115 +43,115 @@ class ComposerStaticInit4da13270269c89a28e472e1f7324e6d1 'Symfony\\Component\\Translation\\' => 30, 'Symfony\\Component\\HttpFoundation\\' => 33, ), - 'P' => + 'P' => array ( 'Psr\\SimpleCache\\' => 16, 'Psr\\Container\\' => 14, 'Prophecy\\' => 9, ), - 'I' => + 'I' => array ( 'Illuminate\\Support\\' => 19, 'Illuminate\\Pagination\\' => 22, 'Illuminate\\Contracts\\' => 21, ), - 'D' => + 'D' => array ( 'Doctrine\\Instantiator\\' => 22, 'Doctrine\\Inflector\\' => 19, ), - 'C' => + 'C' => array ( 'Carbon\\' => 7, ), ); public static $prefixDirsPsr4 = array ( - 'voku\\' => + 'voku\\' => array ( 0 => __DIR__ . '/..' . '/voku/portable-ascii/src/voku', ), - 'phpDocumentor\\Reflection\\' => + 'phpDocumentor\\Reflection\\' => array ( 0 => __DIR__ . '/..' . '/phpdocumentor/reflection-common/src', 1 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src', 2 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src', ), - 'Webmozart\\Assert\\' => + 'Webmozart\\Assert\\' => array ( 0 => __DIR__ . '/..' . '/webmozart/assert/src', ), - 'Webklex\\PHPIMAP\\' => + 'Webklex\\PHPIMAP\\' => array ( 0 => __DIR__ . '/../..' . '/src', ), - 'Tests\\' => + 'Tests\\' => array ( 0 => __DIR__ . '/../..' . '/tests', ), - 'Symfony\\Polyfill\\Php80\\' => + 'Symfony\\Polyfill\\Php80\\' => array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-php80', ), - 'Symfony\\Polyfill\\Mbstring\\' => + 'Symfony\\Polyfill\\Mbstring\\' => array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', ), - 'Symfony\\Polyfill\\Ctype\\' => + 'Symfony\\Polyfill\\Ctype\\' => array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', ), - 'Symfony\\Contracts\\Translation\\' => + 'Symfony\\Contracts\\Translation\\' => array ( 0 => __DIR__ . '/..' . '/symfony/translation-contracts', ), - 'Symfony\\Component\\Yaml\\' => + 'Symfony\\Component\\Yaml\\' => array ( 0 => __DIR__ . '/..' . '/symfony/yaml', ), - 'Symfony\\Component\\Translation\\' => + 'Symfony\\Component\\Translation\\' => array ( 0 => __DIR__ . '/..' . '/symfony/translation', ), - 'Symfony\\Component\\HttpFoundation\\' => + 'Symfony\\Component\\HttpFoundation\\' => array ( 0 => __DIR__ . '/..' . '/symfony/http-foundation', ), - 'Psr\\SimpleCache\\' => + 'Psr\\SimpleCache\\' => array ( 0 => __DIR__ . '/..' . '/psr/simple-cache/src', ), - 'Psr\\Container\\' => + 'Psr\\Container\\' => array ( 0 => __DIR__ . '/..' . '/psr/container/src', ), - 'Prophecy\\' => + 'Prophecy\\' => array ( 0 => __DIR__ . '/..' . '/phpspec/prophecy/src/Prophecy', ), - 'Illuminate\\Support\\' => + 'Illuminate\\Support\\' => array ( 0 => __DIR__ . '/..' . '/illuminate/macroable', 1 => __DIR__ . '/..' . '/illuminate/collections', 2 => __DIR__ . '/..' . '/illuminate/support', ), - 'Illuminate\\Pagination\\' => + 'Illuminate\\Pagination\\' => array ( 0 => __DIR__ . '/..' . '/illuminate/pagination', ), - 'Illuminate\\Contracts\\' => + 'Illuminate\\Contracts\\' => array ( 0 => __DIR__ . '/..' . '/illuminate/contracts', ), - 'Doctrine\\Instantiator\\' => + 'Doctrine\\Instantiator\\' => array ( 0 => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator', ), - 'Doctrine\\Inflector\\' => + 'Doctrine\\Inflector\\' => array ( 0 => __DIR__ . '/..' . '/doctrine/inflector/lib/Doctrine/Inflector', ), - 'Carbon\\' => + 'Carbon\\' => array ( 0 => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon', ),