PMCORE-4133

This commit is contained in:
Julio Cesar Laura Avendaño
2023-01-27 14:26:35 +00:00
parent d616dcfff1
commit 5ecc8752e5
10 changed files with 98 additions and 56 deletions

View File

@@ -670,25 +670,25 @@ class AppFolder extends BaseAppFolder
switch ($row4['OUT_DOC_GENERATE']) {
case "PDF":
$downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand();
$downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand() . "&p=1";
$downloadLink1 = "";
$downloadLabel = ".pdf";
$downloadLabel1 = "";
break;
case "DOC":
$downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=doc" . "&random=" . rand();
$downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=doc" . "&random=" . rand() . "&p=1";
$downloadLink1 = "";
$downloadLabel = ".doc";
$downloadLabel1 = "";
break;
case "BOTH":
$downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand();
$downloadLink1 = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=doc" . "&random=" . rand();
$downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand() . "&p=1";
$downloadLink1 = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=doc" . "&random=" . rand() . "&p=1";
$downloadLabel = ".pdf";
$downloadLabel1 = ".doc";
break;
case "NOFILE":
$downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
$downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion . "&p=1";
$downloadLink1 = "";
$downloadLabel = G::LoadTranslation("ID_DOWNLOAD");
$downloadLabel1 = "";
@@ -709,56 +709,23 @@ class AppFolder extends BaseAppFolder
$row4 = array ();
$versioningEnabled = false;
}
$downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
$downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion . "&p=1";
$downloadLink1 = "";
$downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' );
$downloadLabel1 = "";
} else {
$row4 = array ();
$versioningEnabled = false;
$downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
$downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion . "&p=1";
$downloadLink1 = "";
$downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' );
$downloadLabel1 = "";
}
if (! empty( $row1["APP_DOC_PLUGIN"] )) {
$pluginRegistry = PluginRegistry::loadSingleton();
$pluginName = $row1["APP_DOC_PLUGIN"];
$fieldValue = "";
if (file_exists( PATH_PLUGINS . $pluginName . ".php" )) {
$pluginDetail = $pluginRegistry->getPluginDetails( $pluginName . ".php" );
if ($pluginDetail) {
if ($pluginDetail->isEnabled()) {
require_once (PATH_PLUGINS . $pluginName . ".php");
$pluginNameClass = $pluginName . "Plugin";
$objPluginClass = new $pluginNameClass( $pluginName );
if (isset( $objPluginClass->sMethodGetUrlDownload ) && ! empty( $objPluginClass->sMethodGetUrlDownload )) {
if (file_exists( PATH_PLUGINS . $pluginName . PATH_SEP . "class." . $pluginName . ".php" )) {
require_once (PATH_PLUGINS . $pluginName . PATH_SEP . "class." . $pluginName . ".php");
$pluginNameClass = $pluginName . "Class";
$objClass = new $pluginNameClass();
if (method_exists( $objClass, $objPluginClass->sMethodGetUrlDownload )) {
eval( "\$url = \$objClass->" . $objPluginClass->sMethodGetUrlDownload . "(\"" . $row1["APP_DOC_UID"] . "\");" );
$downloadLink = $url;
$fieldValue = $row1["APP_DOC_PLUGIN"];
}
}
}
}
}
}
$row1["APP_DOC_PLUGIN"] = $fieldValue;
}
break;
default:
$row4 = array ();
$versioningEnabled = false;
$downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
$downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion . "&p=1";
$downloadLink1 = "";
$downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' );
$downloadLabel1 = "";

View File

@@ -227,7 +227,7 @@ class AppNotes extends BaseAppNotes
// Get the files related to the specific case note
if ($noteId !== 0) {
$attachFileLinks = $this->getAttachedFilesFromTheCaseNote($noteId);
$attachFileLinks = $this->getAttachedFilesFromTheCaseNote($noteId, $appUid);
}
if (!empty($attachFileLinks)) {
@@ -282,15 +282,16 @@ class AppNotes extends BaseAppNotes
/**
* Get attached files from a specific case note
* @param int $docId
* @param string $appUid
* @return array
*/
public function getAttachedFilesFromTheCaseNote(int $docId): array
public function getAttachedFilesFromTheCaseNote(int $docId, string $appUid): array
{
$attachFileLinks = [];
$url = System::getServerMainPath();
$result = Documents::getFiles($docId);
$result = Documents::getFiles($docId, $appUid);
foreach ($result as $item) {
$href = $url . "/cases/casesShowCaseNotes?a={$item['APP_DOC_UID']}&v={$item['DOC_VERSION']}";
$href = $url . str_replace('../', '/', $item['LINK']);
$attachFileLinks[] = "<a href='{$href}'>{$item['APP_DOC_FILENAME']}</a>";
}