PM-2973: classic, despues de derivar no actualiza la data de la grilla

This commit is contained in:
Paula V. Quispe
2015-06-16 15:46:41 -04:00
parent 581c029a64
commit 310aaa3a3d
3 changed files with 31 additions and 8 deletions

View File

@@ -70,7 +70,7 @@ class Consolidated
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function postDerivate ($app_uid, $app_number, $del_index, $usr_uid)
public function postDerivate ($app_uid, $app_number, $del_index, $usr_uid, $fieldName='', $fieldValue='')
{
G::LoadClass("library");
G::LoadClass("wsBase");
@@ -82,6 +82,19 @@ class Consolidated
if (!isset($Fields["DEL_INIT_DATE"])) {
$oCase->setDelInitDate($app_uid, $del_index);
$aFields = $oCase->loadCase($app_uid, $del_index);
//Update data grid
$aData = $aFields['APP_DATA'];
foreach ($aData as $k => $dataField) {
if(is_array($dataField)){
$pos = count($dataField);
if(isset($aData[$k][$pos][$fieldName])){
$aData[$k][$pos][$fieldName] = $fieldValue;
}
}
}
$aFields['APP_DATA'] = $aData;
$oCase->updateCase($app_uid, $aFields);
//End update
}
$res = $ws->derivateCase($usr_uid, $app_uid, $del_index, true);

View File

@@ -136,19 +136,21 @@ class Consolidated extends Api
* @param string $app_uid {@min 1} {@max 32}
* @param string $app_number
* @param string $del_index
* @param string $field_grid
* @param string $field_grid_val
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url POST /derivate/:app_uid/:app_number/:del_index
* @url POST /derivate/:app_uid/:app_number/:del_index/:field_grid/:field_grid_val
*/
public function doPostDerivate($app_uid, $app_number, $del_index)
public function doPostDerivate($app_uid, $app_number, $del_index, $field_grid, $field_grid_val)
{
try {
$usr_uid = $this->getUserId();
$consolidated = new \ProcessMaker\BusinessModel\Consolidated();
return $consolidated->postDerivate($app_uid, $app_number, $del_index, $usr_uid);
return $consolidated->postDerivate($app_uid, $app_number, $del_index, $usr_uid,$field_grid, $field_grid_val);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}

View File

@@ -1,6 +1,7 @@
var grdNumRows = 0; //
var grdRowLabel = []; //
var fieldGridGral = '';
var fieldGridGralVal = '';
@@ -409,9 +410,16 @@ Ext.onReady(function () {
var selectedRow = Ext.getCmp(gridId).getSelectionModel().getSelections();
var maxLenght = selectedRow.length;
for (var i in selectedRow) {
rowGrid = selectedRow[i].data
for (fieldGrid in rowGrid){
if(fieldGrid != 'APP_UID' && fieldGrid != 'APP_NUMBER' && fieldGrid != 'APP_TITLE' && fieldGrid != 'DEL_INDEX' ){
fieldGridGral = fieldGrid;
fieldGridGralVal = rowGrid[fieldGrid];
}
}
if (selectedRow[i].data) {
//alert (derivateRequestAjax(selectedRow[i].data["company"]));
ajaxDerivationRequest(selectedRow[i].data["APP_UID"], selectedRow[i].data["DEL_INDEX"], maxLenght, selectedRow[i].data["APP_NUMBER"]);
ajaxDerivationRequest(selectedRow[i].data["APP_UID"], selectedRow[i].data["DEL_INDEX"], maxLenght, selectedRow[i].data["APP_NUMBER"],fieldGridGral, fieldGridGralVal);
}
}
}
@@ -1298,14 +1306,14 @@ function generateGrid(proUid, tasUid, dynUid)
});
}
function ajaxDerivationRequest(appUid, delIndex, maxLenght, appNumber){
function ajaxDerivationRequest(appUid, delIndex, maxLenght, appNumber,fieldGridGral, fieldGridGralVal){
Ext.Ajax.request({
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + credentials.access_token
},
url: urlProxy + 'derivate/' + appUid + '/' + appNumber + '/' + delIndex,
url: urlProxy + 'derivate/' + appUid + '/' + appNumber + '/' + delIndex + '/' + fieldGridGral + '/' + fieldGridGralVal,
success: function(response) {
var dataResponse;
var fullResponseText = response.responseText;