NEW : option to copy into attachement files of events, files send by
mail (with auto event creation)
This commit is contained in:
parent
0b3765dd9a
commit
71cff4032c
@ -345,6 +345,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$object->trackid = $trackid;
|
||||
$object->fk_element = $object->id;
|
||||
$object->elementtype = $object->element;
|
||||
$object->attachedfiles = $attachedfiles;
|
||||
|
||||
// Call of triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
|
||||
@ -856,6 +856,21 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
$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.
|
||||
|
||||
if ($ret > 0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user