Merged in gproly/processmaker/HOR-846 (pull request #4159)

HOR-846
This commit is contained in:
Julio Cesar Laura Avendaño
2016-04-27 19:18:40 -04:00
2 changed files with 13 additions and 4 deletions

View File

@@ -148,7 +148,7 @@ class pmDynaform
public function jsonr(&$json) public function jsonr(&$json)
{ {
if(empty($json)){ if (empty($json)) {
return; return;
} }
foreach ($json as $key => &$value) { foreach ($json as $key => &$value) {
@@ -422,18 +422,22 @@ class pmDynaform
$oCriteria->add(AppDocumentPeer::APP_DOC_FIELDNAME, $json->name); $oCriteria->add(AppDocumentPeer::APP_DOC_FIELDNAME, $json->name);
$oCriteria->add(ContentPeer::CON_CATEGORY, 'APP_DOC_FILENAME'); $oCriteria->add(ContentPeer::CON_CATEGORY, 'APP_DOC_FILENAME');
$oCriteria->add(ContentPeer::CON_LANG, $this->lang); $oCriteria->add(ContentPeer::CON_LANG, $this->lang);
$oCriteria->addDescendingOrderByColumn(AppDocumentPeer::APP_DOC_CREATE_DATE);
$oCriteria->setLimit(1);
$rs = AppDocumentPeer::doSelectRS($oCriteria); $rs = AppDocumentPeer::doSelectRS($oCriteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$links = array(); $links = array();
$labelsFromDb = array(); $labelsFromDb = array();
$appDocUids = array();
while ($rs->next()) { while ($rs->next()) {
$row = $rs->getRow(); $row = $rs->getRow();
$linkDownload = "../cases/cases_ShowDocument?a=" . $row["APP_DOC_UID"] . "&v=" . $row["DOC_VERSION"]; $links[] = "../cases/cases_ShowDocument?a=" . $row["APP_DOC_UID"] . "&v=" . $row["DOC_VERSION"];
array_push($links, $linkDownload); $labelsFromDb[] = $row["CON_VALUE"];
array_push($labelsFromDb, $row["CON_VALUE"]); $appDocUids[] = $row["APP_DOC_UID"];
} }
$json->data = new stdClass(); $json->data = new stdClass();
$json->data->value = $links; $json->data->value = $links;
$json->data->app_doc_uid = $appDocUids;
if (sizeof($labelsFromDb)) { if (sizeof($labelsFromDb)) {
$json->data->label = G::json_encode($labelsFromDb); $json->data->label = G::json_encode($labelsFromDb);

View File

@@ -396,6 +396,11 @@ try {
G::uploadFile( $arrayFileTmpName[$i], $sPathName, $sFileName ); G::uploadFile( $arrayFileTmpName[$i], $sPathName, $sFileName );
//set variable for APP_DOC_UID
$aData["APP_DATA"][$oAppDocument->getAppDocFieldname()] = G::json_encode([$oAppDocument->getAppDocUid()]);
$aData["APP_DATA"][$oAppDocument->getAppDocFieldname() . "_label"] = G::json_encode([$oAppDocument->getAppDocFilename()]);
$oCase->updateCase($_SESSION['APPLICATION'], $aData);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document //Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = &PMPluginRegistry::getSingleton(); $oPluginRegistry = &PMPluginRegistry::getSingleton();