BUG 10036 "No esta rezalizando un buen conteo de la..." SOLVED
- To delete an OutputDocument in DESIGNER, not removed APP_DOCUMENT (this is correct, then you may have already created cases, which already have records) - When a user has permissions PM_ALLCASES can not see all documents - An register in APP_DOCUMENT of type OUTPUT without their registration in OUTPUT_DOCUMENT, now is completed - A user with PM_ALLCASES can now see documents * Available from version ProcessMaker-2.0.46
This commit is contained in:
@@ -266,10 +266,10 @@ class AppFolder extends BaseAppFolder
|
||||
|
||||
public function getFolderContent ($folderID, $docIdFilter = array(), $keyword = null, $searchType = null, $limit = 0, $start = 0, $user = '', $onlyActive = false)
|
||||
{
|
||||
require_once ("classes/model/AppDocument.php");
|
||||
require_once ("classes/model/InputDocument.php");
|
||||
require_once ("classes/model/OutputDocument.php");
|
||||
require_once ("classes/model/Users.php");
|
||||
//require_once ("classes/model/AppDocument.php");
|
||||
//require_once ("classes/model/InputDocument.php");
|
||||
//require_once ("classes/model/OutputDocument.php");
|
||||
//require_once ("classes/model/Users.php");
|
||||
|
||||
G::LoadClass( 'case' );
|
||||
$oCase = new Cases();
|
||||
@@ -316,6 +316,7 @@ class AppFolder extends BaseAppFolder
|
||||
}
|
||||
$oCriteria->add( AppDocumentPeer::APP_UID, $data, CRITERIA::IN );
|
||||
}
|
||||
|
||||
if ($onlyActive) {
|
||||
$oCriteria->add( AppDocumentPeer::APP_DOC_STATUS, 'ACTIVE' );
|
||||
}
|
||||
@@ -352,27 +353,31 @@ class AppFolder extends BaseAppFolder
|
||||
$oAppDocument = new AppDocument();
|
||||
$lastVersion = $oAppDocument->getLastAppDocVersion( $row['APP_DOC_UID'], $row['APP_UID'] );
|
||||
//$filesResult [] = $completeInfo;
|
||||
|
||||
if ($completeInfo['APP_DOC_STATUS'] != "DELETED") {
|
||||
if ((in_array( $row['APP_DOC_UID'], $completeInfo['INPUT_DOCUMENTS'] )) || (in_array( $row['APP_DOC_UID'], $completeInfo['OUTPUT_DOCUMENTS'] )) || (in_array( $completeInfo['USR_UID'], array ($_SESSION['USER_LOGGED'],'-1') ))) {
|
||||
if (in_array($row["APP_DOC_UID"], $completeInfo["INPUT_DOCUMENTS"]) || in_array($row["APP_DOC_UID"], $completeInfo["OUTPUT_DOCUMENTS"]) || in_array($completeInfo["USR_UID"], array($_SESSION["USER_LOGGED"], "-1")) || $user == "") {
|
||||
if (count( $docIdFilter ) > 0) {
|
||||
if (in_array( $row['APP_DOC_UID'], $docIdFilter )) {
|
||||
$response['documents'][] = $completeInfo;
|
||||
}
|
||||
} elseif ($lastVersion == $row['DOC_VERSION']) {
|
||||
} else {
|
||||
if ($lastVersion == $row["DOC_VERSION"]) {
|
||||
//Only Last Document version
|
||||
if ($searchType == "ALL") {
|
||||
//If search in name of docs is active then filter
|
||||
if ((stripos( $completeInfo['APP_DOC_FILENAME'], $keyword ) !== false) || (stripos( $completeInfo['APP_DOC_TAGS'], $keyword ) !== false)) {
|
||||
$response['documents'][] = $completeInfo;
|
||||
if (stripos($completeInfo["APP_DOC_FILENAME"], $keyword) !== false || stripos($completeInfo["APP_DOC_TAGS"], $keyword) !== false) {
|
||||
$response["documents"][] = $completeInfo;
|
||||
}
|
||||
} else {
|
||||
//No search filter active
|
||||
$response['documents'][] = $completeInfo;
|
||||
$response["documents"][] = $completeInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rs->next();
|
||||
}
|
||||
|
||||
@@ -383,10 +388,11 @@ class AppFolder extends BaseAppFolder
|
||||
|
||||
public function getCompleteDocumentInfo ($appUid, $appDocUid, $docVersion, $docUid, $usrId)
|
||||
{
|
||||
require_once ("classes/model/AppDocument.php");
|
||||
require_once ("classes/model/InputDocument.php");
|
||||
require_once ("classes/model/OutputDocument.php");
|
||||
require_once ("classes/model/Users.php");
|
||||
//require_once ("classes/model/AppDocument.php");
|
||||
//require_once ("classes/model/InputDocument.php");
|
||||
//require_once ("classes/model/OutputDocument.php");
|
||||
//require_once ("classes/model/Users.php");
|
||||
|
||||
//**** start get Doc Info
|
||||
$oApp = new Application();
|
||||
$oAppDocument = new AppDocument();
|
||||
@@ -410,8 +416,55 @@ class AppFolder extends BaseAppFolder
|
||||
switch ($row1['APP_DOC_TYPE']) {
|
||||
case "OUTPUT":
|
||||
$oOutputDocument = new OutputDocument();
|
||||
|
||||
$row4 = array();
|
||||
$swOutDocExists = 0;
|
||||
|
||||
if ($oOutputDocument->OutputExists($docUid)) {
|
||||
$row4 = $oOutputDocument->load($docUid);
|
||||
$swOutDocExists = 1;
|
||||
}
|
||||
|
||||
if ($swOutDocExists == 0) {
|
||||
$swpdf = 0;
|
||||
$swdoc = 0;
|
||||
|
||||
$info = pathinfo($oAppDocument->getAppDocFilename());
|
||||
|
||||
$version = (!empty($docVersion))? "_" . $docVersion : "_1";
|
||||
$outDocPath = PATH_DOCUMENT . $row1["APP_UID"] . PATH_SEP . "outdocs" . PATH_SEP;
|
||||
|
||||
if (file_exists($outDocPath . $appDocUid . $version . ".pdf") ||
|
||||
file_exists($outDocPath . $info["basename"] . $version . ".pdf") ||
|
||||
file_exists($outDocPath . $info["basename"] . ".pdf")
|
||||
) {
|
||||
$swpdf = 1;
|
||||
}
|
||||
|
||||
if (file_exists($outDocPath . $appDocUid . $version . ".doc") ||
|
||||
file_exists($outDocPath . $info["basename"] . $version . ".doc") ||
|
||||
file_exists($outDocPath . $info["basename"] . ".doc")
|
||||
) {
|
||||
$swdoc = 1;
|
||||
}
|
||||
|
||||
if ($swpdf == 1 && $swdoc == 1) {
|
||||
$row4["OUT_DOC_GENERATE"] = "BOTH";
|
||||
} else {
|
||||
if ($swpdf == 1) {
|
||||
$row4["OUT_DOC_GENERATE"] = "PDF";
|
||||
} else {
|
||||
if ($swdoc == 1) {
|
||||
$row4["OUT_DOC_GENERATE"] = "DOC";
|
||||
} else {
|
||||
$row4["OUT_DOC_GENERATE"] = "NOFILE";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$versioningEnabled = false; //$row4['OUT_DOC_VERSIONING']; //Only enabled for Input or Attached documents. Need to study the best way for Output docs.
|
||||
|
||||
switch ($row4['OUT_DOC_GENERATE']) {
|
||||
case "PDF":
|
||||
$downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand();
|
||||
@@ -431,8 +484,17 @@ class AppFolder extends BaseAppFolder
|
||||
$downloadLabel = ".pdf";
|
||||
$downloadLabel1 = ".doc";
|
||||
break;
|
||||
case "NOFILE":
|
||||
$downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
|
||||
$downloadLink1 = "";
|
||||
$downloadLabel = G::LoadTranslation("ID_DOWNLOAD");
|
||||
$downloadLabel1 = "";
|
||||
break;
|
||||
}
|
||||
|
||||
if ($swOutDocExists == 0) {
|
||||
$row4 = array();
|
||||
}
|
||||
break;
|
||||
case "INPUT":
|
||||
$oInputDocument = new InputDocument();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
if (! isset ($_REQUEST ['action'])) {
|
||||
$res ['success'] = false;
|
||||
$res ['message'] = 'You may request an action';
|
||||
@@ -133,8 +132,9 @@ function sendJsonResultGeneric($response, $callback)
|
||||
|
||||
function expandNode()
|
||||
{
|
||||
//require_once ("classes/model/AppFolder.php");
|
||||
|
||||
extract(getExtJSParams());
|
||||
require_once ("classes/model/AppFolder.php");
|
||||
|
||||
$oPMFolder = new AppFolder();
|
||||
|
||||
@@ -143,15 +143,19 @@ function expandNode()
|
||||
if ($_POST ['node']=="") {
|
||||
$_POST ['node'] ="/";
|
||||
}
|
||||
|
||||
if ($_POST ['node']=="root") {
|
||||
$_POST ['node'] ="/";
|
||||
}
|
||||
|
||||
if (!(isset($_POST['sendWhat']))) {
|
||||
$_POST['sendWhat']="both";
|
||||
}
|
||||
|
||||
if (isset($_POST['renderTree'])) {
|
||||
$limit = 1000000;
|
||||
}
|
||||
|
||||
$totalItems=0;
|
||||
$totalFolders=0;
|
||||
$totalDocuments=0;
|
||||
@@ -167,6 +171,7 @@ function expandNode()
|
||||
$totalFolders=$folderListObj['totalFoldersCount'];
|
||||
$totalItems+=count($folderList);
|
||||
}
|
||||
|
||||
if (($_POST['sendWhat'] == "files") || ($_POST['sendWhat'] == "both")) {
|
||||
global $RBAC;
|
||||
|
||||
@@ -190,6 +195,7 @@ function expandNode()
|
||||
|
||||
$processListTree = array();
|
||||
$tempTree = array();
|
||||
|
||||
if (isset($folderList) && sizeof($folderList)>0) {
|
||||
//$tempTree=array();
|
||||
foreach ($folderList as $key => $obj) {
|
||||
@@ -268,6 +274,7 @@ function expandNode()
|
||||
//$processListTree [] = array();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($folderContent)) {
|
||||
foreach ($folderContent as $key => $obj) {
|
||||
$tempTree ['text'] = $obj['APP_DOC_FILENAME'];
|
||||
@@ -380,6 +387,19 @@ function expandNode()
|
||||
$processListTree [] = $tempTree;
|
||||
}
|
||||
} else {
|
||||
if ($obj["APP_DOC_TYPE"] == "OUTPUT" &&
|
||||
$tempTree["type"] == G::LoadTranslation("MIME_DES_FILE") &&
|
||||
preg_match("/^.+&ext=(.+)&.+$/", $tempTree["downloadLink"], $arrayMatch)
|
||||
) {
|
||||
$ext = $arrayMatch[1];
|
||||
$mimeInformation = getMime($obj["APP_DOC_FILENAME"] . ".$ext");
|
||||
|
||||
$tempTree["text"] = $obj["APP_DOC_FILENAME"] . ".$ext";
|
||||
$tempTree["name"] = $obj["APP_DOC_FILENAME"] . ".$ext";
|
||||
$tempTree["type"] = $mimeInformation["description"];
|
||||
$tempTree["icon"] = $mimeInformation["icon"];
|
||||
}
|
||||
|
||||
$processListTree [] = $tempTree;
|
||||
}
|
||||
$tempTree=array();
|
||||
|
||||
Reference in New Issue
Block a user