Merge pull request #6012 from atm-florian/dev_NEW_copyeventfiles

NEW : option to copy attachment files of emails into the event document area
This commit is contained in:
Laurent Destailleur 2017-03-14 11:04:05 +01:00 committed by GitHub
commit 78c3a1a3a1
2 changed files with 136 additions and 121 deletions

View File

@ -865,6 +865,21 @@ class InterfaceActionsAuto extends DolibarrTriggers
$ret=$actioncomm->create($user); // User creating action $ret=$actioncomm->create($user); // User creating action
if ($ret > 0 && $conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO)
{
if (is_array($object->attachedfiles) && array_key_exists('paths',$object->attachedfiles) && count($object->attachedfiles['paths'])>0) {
foreach($object->attachedfiles['paths'] as $key=>$filespath) {
$srcfile = $filespath;
$destdir = $conf->agenda->dir_output . '/' . $ret;
$destfile = $destdir . '/' . $object->attachedfiles['names'][$key];
if (dol_mkdir($destdir) >= 0) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_copy($srcfile, $destfile);
}
}
}
}
unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action. unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action.
if ($ret > 0) if ($ret > 0)