I solved my case,
I did a trigger in before open the case in the subprocess that copy all the files from the Parent Case to a new folder with files,
The idea is to pass the parente TaskUID to the childs subprocesses, and then, in the subprocess, select all documents from parents and with loop, generate the files and insert in the tables about document information,
Code: Select all//@@AppIDPadre
//6763916014d630cbbb81e26092883104
if(!isset(@@txtAbierto))
{
$appidpadre = @@AppIDPadre;
$appidnuevo = @@APPLICATION;
//$appidnuevo = G::generateUniqueID();
//$gerenteUID = G::generateUniqueID();
$resultdocs = executeQuery("select * from app_document where app_uid = '$appidpadre'");
$iRowD = count($resultdocs);
mkdir('c:/Program Files/ProcessMaker/processmaker/shared/sites/workflow/files/'.$appidnuevo, 0777, true);
for ($j = 1; $j <= $iRowD; $j++) {
$docid = $resultdocs[$j]['APP_DOC_UID'];
$resultdetalledoc = executeQuery("select con_value archivo, substring(con_value, length(con_value) - locate('.',reverse(con_value)) + 2 ,
locate('.',reverse(con_value)) - 1 ) extension
From content where con_id = '$docid' and con_category = 'APP_DOC_FILENAME' limit 1");
$nombrearchivo = $resultdetalledoc[1]['archivo'];
$extension = $resultdetalledoc[1]['extension'];
$docidnuevo = G::generateUniqueID();
$resultusuario = executeQuery("select usr_uid from app_delegation where app_uid = '$appidnuevo' limit 1") ;
$gerenteUID = $resultusuario[1]['usr_uid'];
$source = 'c:/Program Files/ProcessMaker/processmaker/shared/sites/workflow/files/'.$appidpadre.'/'.$docid.'_1.'.$extension;
$destination = 'c:/Program Files/ProcessMaker/processmaker/shared/sites/workflow/files/'.$appidnuevo.'/'.$docidnuevo.'_1.'.$extension;
//print $source;
//print $destination;
copy($source, $destination) ;
@@RESULT = executeQuery("INSERT INTO CONTENT
SELECT 'APP_DOC_TITLE','1','$docidnuevo','es',''
UNION
SELECT 'APP_DOC_COMMENT','1','$docidnuevo','es',''
UNION
SELECT 'APP_DOC_FILENAME','1','$docidnuevo','es','$nombrearchivo'
UNION
SELECT 'APP_DOC_TITLE','','$docidnuevo','es',''
UNION
SELECT 'APP_DOC_COMMENT','','$docidnuevo','es',''");
@@RESULT = executeQuery("INSERT INTO app_document
SELECT '$docidnuevo',1,'$appidnuevo',$j, 'iddocumento', '$gerenteUID', 'INPUT', now(), $j,'','','INPUT','ACTIVE', Null ");
}
}
Did I forget something, or some table?
I have a question, i am not filling the field DOC_UID, what do this supposed to be? What is the difference between APP_DOC_UID and DOC_UID?