Files sent from ECM module are also indexed in database.
This commit is contained in:
parent
b66ba6c57c
commit
1e45e64a9a
@ -1178,12 +1178,14 @@ function dol_init_file_process($pathtoscan='', $trackid='')
|
|||||||
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
|
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
|
||||||
* @param string $link Link to add (to add a link instead of a file)
|
* @param string $link Link to add (to add a link instead of a file)
|
||||||
* @param string $trackid Track id (used to prefix name of session vars to avoid conflict)
|
* @param string $trackid Track id (used to prefix name of session vars to avoid conflict)
|
||||||
* @return void
|
* @return int <=0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null, $trackid='')
|
function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null, $trackid='')
|
||||||
{
|
{
|
||||||
global $db,$user,$conf,$langs;
|
global $db,$user,$conf,$langs;
|
||||||
|
|
||||||
|
$res = 0;
|
||||||
|
|
||||||
if (! empty($_FILES[$varfiles])) // For view $_FILES[$varfiles]['error']
|
if (! empty($_FILES[$varfiles])) // For view $_FILES[$varfiles]['error']
|
||||||
{
|
{
|
||||||
dol_syslog('dol_add_file_process upload_dir='.$upload_dir.' allowoverwrite='.$allowoverwrite.' donotupdatesession='.$donotupdatesession.' savingdocmask='.$savingdocmask, LOG_DEBUG);
|
dol_syslog('dol_add_file_process upload_dir='.$upload_dir.' allowoverwrite='.$allowoverwrite.' donotupdatesession='.$donotupdatesession.' savingdocmask='.$savingdocmask, LOG_DEBUG);
|
||||||
@ -1278,6 +1280,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$res = 1;
|
||||||
setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs');
|
setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1320,6 +1323,8 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
|||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("File")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("File")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -106,11 +106,16 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
|||||||
else {
|
else {
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
$res = dol_add_file_process($upload_dir, 0, 1, 'userfile', '', '', '');
|
||||||
|
if ($res > 0)
|
||||||
|
{
|
||||||
|
$result=$ecmdir->changeNbOfFiles('+');
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (dol_mkdir($upload_dir) >= 0)
|
if (dol_mkdir($upload_dir) >= 0)
|
||||||
{
|
{
|
||||||
$resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0, 0, $_FILES['userfile']['error']);
|
$resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0, 0, $_FILES['userfile']['error']);
|
||||||
@ -139,7 +144,7 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
|||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages($langs->trans("ErrorFailToCreateDir",$upload_dir), null, 'errors');
|
setEventMessages($langs->trans("ErrorFailToCreateDir",$upload_dir), null, 'errors');
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user