Merged in marcoAntonioNina/processmaker/GI-208 (pull request #3422)
GI-208-B
This commit is contained in:
@@ -411,7 +411,6 @@ class AppDocumentDrive
|
|||||||
$emails = !empty($emails) ? explode('|', $emails) : array();
|
$emails = !empty($emails) ? explode('|', $emails) : array();
|
||||||
$result = null;
|
$result = null;
|
||||||
foreach ($emails as $index => $email) {
|
foreach ($emails as $index => $email) {
|
||||||
$result = null;
|
|
||||||
if (!empty($email)) {
|
if (!empty($email)) {
|
||||||
if ($index == 0 && $fields['SYNC_WITH_DRIVE'] == 'UNSYNCHRONIZED') {
|
if ($index == 0 && $fields['SYNC_WITH_DRIVE'] == 'UNSYNCHRONIZED') {
|
||||||
if ($log) {
|
if ($log) {
|
||||||
@@ -461,7 +460,6 @@ class AppDocumentDrive
|
|||||||
$fields['SYNC_WITH_DRIVE'] = 'NO_EXIST_FILE_PM';
|
$fields['SYNC_WITH_DRIVE'] = 'NO_EXIST_FILE_PM';
|
||||||
if ($log) {
|
if ($log) {
|
||||||
eprintln('File no exists:' . $name , 'red');
|
eprintln('File no exists:' . $name , 'red');
|
||||||
//eprintln($realPath , 'red');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$appDoc->update($fields);
|
$appDoc->update($fields);
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ if (! $sw_file_exists) {
|
|||||||
$res['message'] = $oAppDocument->Fields['APP_DOC_FILENAME'];
|
$res['message'] = $oAppDocument->Fields['APP_DOC_FILENAME'];
|
||||||
print G::json_encode( $res );
|
print G::json_encode( $res );
|
||||||
} else {
|
} else {
|
||||||
|
$nameFile = $oAppDocument->Fields['APP_DOC_FILENAME'];
|
||||||
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
||||||
$downloadStatus = false;
|
$downloadStatus = false;
|
||||||
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||||
@@ -116,14 +117,20 @@ if (! $sw_file_exists) {
|
|||||||
$fieldDrive = $oAppDocument->getAppDocDriveDownload();
|
$fieldDrive = $oAppDocument->getAppDocDriveDownload();
|
||||||
$drive->loadUser($_SESSION['USER_LOGGED']);
|
$drive->loadUser($_SESSION['USER_LOGGED']);
|
||||||
$uidDrive = $drive->changeUrlDrive($oAppDocument->Fields, $oAppDocument->getAppDocType());
|
$uidDrive = $drive->changeUrlDrive($oAppDocument->Fields, $oAppDocument->getAppDocType());
|
||||||
$result = $drive->download($uidDrive);
|
$fileContent = $drive->download($uidDrive);
|
||||||
//verify download
|
if ($fileContent !== null) {
|
||||||
file_put_contents($oAppDocument->Fields['APP_DOC_FILENAME'], $result);
|
$downloadStatus = true;
|
||||||
$downloadStatus = true;
|
header('Content-Description: File Transfer');
|
||||||
|
header('Content-Disposition: attachment; filename='.$nameFile);
|
||||||
|
header('Content-Transfer-Encoding: binary');
|
||||||
|
header('Set-Cookie: fileLoading=true');
|
||||||
|
echo $fileContent;
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$downloadStatus) {
|
if (!$downloadStatus) {
|
||||||
G::streamFile( $realPath, $bDownload, $oAppDocument->Fields['APP_DOC_FILENAME'] ); //download
|
G::streamFile( $realPath, $bDownload, $nameFile ); //download
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ if (! $sw_file_exists) {
|
|||||||
$res['message'] = $info['basename'] . $ver . '.' . $ext;
|
$res['message'] = $info['basename'] . $ver . '.' . $ext;
|
||||||
print G::json_encode( $res );
|
print G::json_encode( $res );
|
||||||
} else {
|
} else {
|
||||||
|
$nameFile = $info['basename'] . $ver . '.' . $ext;
|
||||||
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
||||||
$downloadStatus = false;
|
$downloadStatus = false;
|
||||||
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||||
@@ -119,14 +120,20 @@ if (! $sw_file_exists) {
|
|||||||
$drive->loadUser($_SESSION['USER_LOGGED']);
|
$drive->loadUser($_SESSION['USER_LOGGED']);
|
||||||
$type = $ext == 'doc' ? 'OUTPUT_DOC' : 'OUTPUT_PDF';
|
$type = $ext == 'doc' ? 'OUTPUT_DOC' : 'OUTPUT_PDF';
|
||||||
$uidDrive = $drive->changeUrlDrive($oAppDocument->Fields, $type);
|
$uidDrive = $drive->changeUrlDrive($oAppDocument->Fields, $type);
|
||||||
$result = $drive->download($uidDrive);
|
$fileContent = $drive->download($uidDrive);
|
||||||
//verify download file
|
if ($fileContent !== null) {
|
||||||
file_put_contents($info['basename'] . $ver . '.' . $ext , $result);
|
$downloadStatus = true;
|
||||||
$downloadStatus = true;
|
header('Content-Description: File Transfer');
|
||||||
|
header('Content-Disposition: attachment; filename='.$nameFile);
|
||||||
|
header('Content-Transfer-Encoding: binary');
|
||||||
|
header('Set-Cookie: fileLoading=true');
|
||||||
|
echo $fileContent;
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$downloadStatus) {
|
if (!$downloadStatus) {
|
||||||
G::streamFile( $realPath, $download, $info['basename'] . $ver . '.' . $ext ); //download
|
G::streamFile( $realPath, $download, $nameFile); //download
|
||||||
}
|
}
|
||||||
|
|
||||||
//die($realPath);
|
//die($realPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user