BUG 000 PM tables fixes on data editing & report table data population
This commit is contained in:
@@ -86,7 +86,7 @@ class HttpProxyController {
|
|||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$result->success = false;
|
$result->success = false;
|
||||||
$result->msg = $e->getMessage();
|
$result->message = $result->msg = $e->getMessage();
|
||||||
switch(get_class($e)) {
|
switch(get_class($e)) {
|
||||||
case 'Exception': $error = "SYSTEM ERROR"; break;
|
case 'Exception': $error = "SYSTEM ERROR"; break;
|
||||||
case 'PMException': $error = "PROCESSMAKER ERROR"; break;
|
case 'PMException': $error = "PROCESSMAKER ERROR"; break;
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ class PmTable
|
|||||||
|
|
||||||
switch ($dbsUid) {
|
switch ($dbsUid) {
|
||||||
case 'workflow': case 'wf': case '0': case '':
|
case 'workflow': case 'wf': case '0': case '':
|
||||||
|
$this->dataSource = 'workflow';
|
||||||
$this->dbConfig->adapter= DB_ADAPTER;
|
$this->dbConfig->adapter= DB_ADAPTER;
|
||||||
$this->dbConfig->host = DB_HOST;
|
$this->dbConfig->host = DB_HOST;
|
||||||
$this->dbConfig->name = DB_NAME;
|
$this->dbConfig->name = DB_NAME;
|
||||||
@@ -89,6 +90,7 @@ class PmTable
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'rp': case 'report':
|
case 'rp': case 'report':
|
||||||
|
$this->dataSource = 'rp';
|
||||||
$this->dbConfig->adapter= DB_ADAPTER;
|
$this->dbConfig->adapter= DB_ADAPTER;
|
||||||
$this->dbConfig->host = DB_REPORT_HOST;
|
$this->dbConfig->host = DB_REPORT_HOST;
|
||||||
$this->dbConfig->name = DB_REPORT_NAME;
|
$this->dbConfig->name = DB_REPORT_NAME;
|
||||||
@@ -112,6 +114,11 @@ class PmTable
|
|||||||
$this->dbConfig->port = $dbSource->getDbsPort();
|
$this->dbConfig->port = $dbSource->getDbsPort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDataSource()
|
||||||
|
{
|
||||||
|
return $this->dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get Data base config object
|
* get Data base config object
|
||||||
@@ -396,41 +403,6 @@ class PmTable
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Populate the report table with all case data
|
|
||||||
* @param string $sType
|
|
||||||
* @param string $sProcessUid
|
|
||||||
* @param string $sGrid
|
|
||||||
* @return number
|
|
||||||
*/
|
|
||||||
public function populateReportTable($sType = 'NORMAL', $sProcessUid = '', $sGrid = '')
|
|
||||||
{
|
|
||||||
require_once "classes/model/Application.php";
|
|
||||||
|
|
||||||
$con = Propel::getConnection($sConnection);
|
|
||||||
$stmt = $con->createStatement();
|
|
||||||
if ($sType == 'GRID') {
|
|
||||||
$aAux = explode('-', $sGrid);
|
|
||||||
$sGrid = $aAux[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
//select cases for this Process, ordered by APP_NUMBER
|
|
||||||
$criteria = new Criteria('workflow');
|
|
||||||
$criteria->add(ApplicationPeer::PRO_UID, $sProcessUid);
|
|
||||||
$criteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
|
|
||||||
$dataset = ApplicationPeer::doSelectRS($criteria);
|
|
||||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
|
|
||||||
while ($dataset->next()) {
|
|
||||||
$row = $dataset->getRow();
|
|
||||||
$aData = unserialize($aRow['APP_DATA']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ require_once 'classes/model/om/BaseAdditionalTables.php';
|
|||||||
*/
|
*/
|
||||||
class AdditionalTables extends BaseAdditionalTables {
|
class AdditionalTables extends BaseAdditionalTables {
|
||||||
|
|
||||||
|
public $fields = array();
|
||||||
|
public $primaryKeys = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function load
|
* Function load
|
||||||
* access public
|
* access public
|
||||||
@@ -29,37 +32,12 @@ class AdditionalTables extends BaseAdditionalTables {
|
|||||||
$oAdditionalTables = AdditionalTablesPeer::retrieveByPK($sUID);
|
$oAdditionalTables = AdditionalTablesPeer::retrieveByPK($sUID);
|
||||||
if (!is_null($oAdditionalTables)) {
|
if (!is_null($oAdditionalTables)) {
|
||||||
$aFields = $oAdditionalTables->toArray(BasePeer::TYPE_FIELDNAME);
|
$aFields = $oAdditionalTables->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
if ($bFields) {
|
|
||||||
require_once 'classes/model/Fields.php';
|
|
||||||
$oCriteria = new Criteria('workflow');
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_UID);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_INDEX);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_NAME);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_DESCRIPTION);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_TYPE);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_SIZE);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_NULL);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_AUTO_INCREMENT);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_KEY);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_FOREIGN_KEY);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_FOREIGN_KEY_TABLE);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_DYN_NAME);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_DYN_UID);
|
|
||||||
$oCriteria->addSelectColumn(FieldsPeer::FLD_FILTER);
|
|
||||||
$oCriteria->add(FieldsPeer::ADD_TAB_UID, $sUID);
|
|
||||||
$oCriteria->addAscendingOrderByColumn(FieldsPeer::FLD_INDEX);
|
|
||||||
$oDataset = FieldsPeer::doSelectRS($oCriteria);
|
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$oDataset->next();
|
|
||||||
$aFields['FIELDS'] = array();
|
|
||||||
$i = 1;
|
|
||||||
while ($aRow = $oDataset->getRow()) {
|
|
||||||
$aFields['FIELDS'][$i] = $aRow;
|
|
||||||
$oDataset->next();
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
|
if ($bFields) {
|
||||||
|
$aFields['FIELDS'] = $this->getFields();
|
||||||
|
}
|
||||||
|
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -71,6 +49,53 @@ class AdditionalTables extends BaseAdditionalTables {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFields()
|
||||||
|
{
|
||||||
|
if (count($this->fields) > 0) {
|
||||||
|
return $this->fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once 'classes/model/Fields.php';
|
||||||
|
$oCriteria = new Criteria('workflow');
|
||||||
|
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_UID);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_INDEX);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_NAME);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_DESCRIPTION);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_TYPE);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_SIZE);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_NULL);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_AUTO_INCREMENT);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_KEY);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_FOREIGN_KEY);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_FOREIGN_KEY_TABLE);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_DYN_NAME);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_DYN_UID);
|
||||||
|
$oCriteria->addSelectColumn(FieldsPeer::FLD_FILTER);
|
||||||
|
$oCriteria->add(FieldsPeer::ADD_TAB_UID, $this->getAddTabUid());
|
||||||
|
$oCriteria->addAscendingOrderByColumn(FieldsPeer::FLD_INDEX);
|
||||||
|
|
||||||
|
$oDataset = FieldsPeer::doSelectRS($oCriteria);
|
||||||
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
while ($oDataset->next()) {
|
||||||
|
$this->fields[] = $oDataset->getRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPrimaryKeys()
|
||||||
|
{
|
||||||
|
$this->primaryKeys = array();
|
||||||
|
foreach ($this->fields as $field) {
|
||||||
|
if ($field['FLD_KEY'] == '1') {
|
||||||
|
$this->primaryKeys[] = $field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->primaryKeys;
|
||||||
|
}
|
||||||
|
|
||||||
public function loadByName($name) {
|
public function loadByName($name) {
|
||||||
try {
|
try {
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
@@ -496,10 +521,73 @@ class AdditionalTables extends BaseAdditionalTables {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populate the report table with all case data
|
||||||
|
* @param string $sType
|
||||||
|
* @param string $sProcessUid
|
||||||
|
* @param string $sGrid
|
||||||
|
* @return number
|
||||||
|
*/
|
||||||
|
public function populateReportTable($tableName, $sConnection = 'rp', $type = 'NORMAL', $processUid = '', $gridKey = '')
|
||||||
|
{
|
||||||
|
require_once "classes/model/Application.php";
|
||||||
|
|
||||||
|
$this->className = $this->getPHPName($tableName);
|
||||||
|
$this->classPeerName = $this->className . 'Peer';
|
||||||
|
|
||||||
|
if (!file_exists (PATH_WORKSPACE . 'classes/' . $this->className . '.php') ) {
|
||||||
|
throw new Exception("ERROR: {$this->className} class file doesn't exit!");
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php';
|
||||||
|
|
||||||
|
//select cases for this Process, ordered by APP_NUMBER
|
||||||
|
$con = Propel::getConnection($sConnection);
|
||||||
|
$stmt = $con->createStatement();
|
||||||
|
$criteria = new Criteria('workflow');
|
||||||
|
$criteria->add(ApplicationPeer::PRO_UID, $processUid);
|
||||||
|
$criteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
|
||||||
|
$dataset = ApplicationPeer::doSelectRS($criteria);
|
||||||
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
while ($dataset->next()) {
|
||||||
|
$row = $dataset->getRow();
|
||||||
|
//remove old applications references
|
||||||
|
$deleteSql = "DELETE FROM $tableName WHERE APP_UID = '".$row['APP_UID']."'";
|
||||||
|
$rs = $stmt->executeQuery($deleteSql);
|
||||||
|
// getting the case data
|
||||||
|
$caseFields = array_change_key_case(unserialize($row['APP_DATA']), CASE_UPPER);
|
||||||
|
|
||||||
|
if ($type == 'GRID') {
|
||||||
|
list($gridName, $gridUid) = explode('-', $gridKey);
|
||||||
|
$gridName = strtoupper($gridName);
|
||||||
|
foreach ($caseFields[$gridName] as $i => $gridRow) {
|
||||||
|
$gridRow = array_change_key_case($gridRow, CASE_UPPER);
|
||||||
|
|
||||||
|
eval('$obj = new ' .$this->className. '();');
|
||||||
|
$obj->fromArray($caseFields, BasePeer::TYPE_FIELDNAME);
|
||||||
|
$obj->setAppUid($row['APP_UID']);
|
||||||
|
$obj->setAppNumber($row['APP_NUMBER']);
|
||||||
|
$obj->fromArray($gridRow, BasePeer::TYPE_FIELDNAME);
|
||||||
|
$obj->setRow($i);
|
||||||
|
$obj->save();
|
||||||
|
eval('$obj = new ' .$this->className. '();');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
eval('$obj = new ' .$this->className. '();');
|
||||||
|
$obj->fromArray($caseFields, BasePeer::TYPE_FIELDNAME);
|
||||||
|
$obj->setAppUid($row['APP_UID']);
|
||||||
|
$obj->setAppNumber($row['APP_NUMBER']);
|
||||||
|
$obj->save();
|
||||||
|
$obj = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate Report Table
|
* Populate Report Table
|
||||||
*/
|
*/
|
||||||
public function populateReportTable($sTableName, $sConnection = 'rp', $sType = 'NORMAL', $aFields = array(), $sProcessUid = '', $sGrid = '')
|
public function populateReportTable2($sTableName, $sConnection = 'rp', $sType = 'NORMAL', $aFields = array(), $sProcessUid = '', $sGrid = '')
|
||||||
{
|
{
|
||||||
|
|
||||||
require_once "classes/model/Application.php";
|
require_once "classes/model/Application.php";
|
||||||
|
|||||||
@@ -279,9 +279,9 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$oFields->create($field);
|
$oFields->create($field);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ($isReportTable) {
|
if ($isReportTable) {
|
||||||
// $oAdditionalTables->populateReportTable($data['REP_TAB_NAME'], $data['REP_TAB_CONNECTION'], $data['REP_TAB_TYPE'], $fieldsList, $data['PRO_UID'], $data['REP_TAB_GRID']);
|
$oAdditionalTables->populateReportTable($data['REP_TAB_NAME'], $pmTable->getDataSource(), $data['REP_TAB_TYPE'], $data['PRO_UID'], $data['REP_TAB_GRID']);
|
||||||
// }
|
}
|
||||||
|
|
||||||
$result->success = true;
|
$result->success = true;
|
||||||
$result->msg = $buildResult;
|
$result->msg = $buildResult;
|
||||||
@@ -351,24 +351,19 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$start = isset($httpData->start) ? $httpData->start : 0;
|
$start = isset($httpData->start) ? $httpData->start : 0;
|
||||||
$limit = isset($httpData->limit) ? $httpData->limit : $limit_size;
|
$limit = isset($httpData->limit) ? $httpData->limit : $limit_size;
|
||||||
|
|
||||||
$oAdditionalTables = new AdditionalTables();
|
$additionalTables = new AdditionalTables();
|
||||||
$table = $oAdditionalTables->load($httpData->id, true);
|
$table = $additionalTables->load($httpData->id, true);
|
||||||
$result = $oAdditionalTables->getAllData($httpData->id, $start, $limit);
|
$result = $additionalTables->getAllData($httpData->id, $start, $limit);
|
||||||
|
|
||||||
$keys = array();
|
$primaryKeys = $additionalTables->getPrimaryKeys();
|
||||||
foreach ($table['FIELDS'] as $field) {
|
|
||||||
if ($field['FLD_KEY'] == '1') {
|
|
||||||
$keys[] = $field['FLD_NAME'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($result['rows'] as $i => $row) {
|
foreach ($result['rows'] as $i => $row) {
|
||||||
$indexes = array();
|
$primaryKeysValues = array();
|
||||||
foreach ($keys as $key) {
|
foreach ($primaryKeys as $key) {
|
||||||
$indexes[] = $row[$key];
|
$primaryKeysValues[] = isset($row[$key['FLD_NAME']]) ? $row[$key['FLD_NAME']] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$result['rows'][$i]['__index__'] = implode('-', $indexes);
|
$result['rows'][$i]['__index__'] = md5(implode('-', $primaryKeysValues));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -376,83 +371,75 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* create pm tables record
|
* create pm tables record
|
||||||
* @param string $httpData->id
|
* @param string $httpData->rows
|
||||||
* @param string $httpData->start
|
|
||||||
* @param string $httpData->limit
|
|
||||||
*/
|
*/
|
||||||
public function dataCreate($httpData)
|
public function dataCreate($httpData)
|
||||||
{
|
{
|
||||||
$rows = G::json_decode(stripslashes($httpData->rows));
|
$rows = G::json_decode(stripslashes($httpData->rows));
|
||||||
|
|
||||||
require_once 'classes/model/AdditionalTables.php';
|
require_once 'classes/model/AdditionalTables.php';
|
||||||
$oAdditionalTables = new AdditionalTables();
|
$additionalTables = new AdditionalTables();
|
||||||
$table = $oAdditionalTables->load($httpData->id, true);
|
$table = $additionalTables->load($httpData->id, true);
|
||||||
|
$primaryKeys = $additionalTables->getPrimaryKeys();
|
||||||
|
|
||||||
$this->className = $table['ADD_TAB_CLASS_NAME'];
|
$this->className = $table['ADD_TAB_CLASS_NAME'];
|
||||||
$this->classPeerName = $this->className . 'Peer';
|
$this->classPeerName = $this->className . 'Peer';
|
||||||
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
|
$row = (array) $rows;
|
||||||
|
$toSave = false;
|
||||||
|
|
||||||
if (!file_exists ($sPath . $this->className . '.php') ) {
|
if (!file_exists (PATH_WORKSPACE . 'classes/' . $this->className . '.php') ) {
|
||||||
throw new Exception("ERROR: $className class file doesn't exit!");
|
throw new Exception("ERROR: {$this->className} class file doesn't exit!");
|
||||||
}
|
}
|
||||||
|
|
||||||
//require_once $sPath . $this->className . '.php';
|
require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php';
|
||||||
require_once 'classes/' . $this->className . '.php';
|
eval('$obj = new ' .$this->className. '();');
|
||||||
$toSave = false;
|
|
||||||
|
if (count($row) > 0) {
|
||||||
if (is_array($rows)) { //multiple
|
try {
|
||||||
$c = $cs = 0;
|
eval('$con = Propel::getConnection('.$this->classPeerName.'::DATABASE_NAME);');
|
||||||
foreach ($rows as $i => $row) {
|
$con->begin();
|
||||||
$fieldsCount = 0;
|
$obj->fromArray($row, BasePeer::TYPE_FIELDNAME);
|
||||||
eval('$obj = new ' .$this->className. '();');
|
|
||||||
foreach ($row as $key => $value) {
|
if ($obj->validate()) {
|
||||||
$action = 'set' . AdditionalTables::getPHPName($key);
|
$obj->save();
|
||||||
$obj->$action($value);
|
|
||||||
$fieldsCount++;
|
|
||||||
$toSave = true;
|
$toSave = true;
|
||||||
}
|
|
||||||
if ($fieldsCount != 0) {
|
$primaryKeysValues = array();
|
||||||
$c++;
|
foreach ($primaryKeys as $primaryKey) {
|
||||||
if ($obj->save() > 0) {
|
$method = 'get' . AdditionalTables::getPHPName($primaryKey['FLD_NAME']);
|
||||||
$cs++;
|
$primaryKeysValues[] = $obj->$method();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($toSave) {
|
|
||||||
$result->success = $cs == $c ? true: false;
|
|
||||||
$result->message = 'Saved #' . $c . ' records successfully';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$result->success = false;
|
|
||||||
$result->message = 'Nothing to do';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { //single
|
|
||||||
eval('$obj = new ' .$this->className. '();');
|
|
||||||
foreach ($rows as $key => $value) {
|
|
||||||
$action = 'set' . AdditionalTables::getPHPName($key);
|
|
||||||
$obj->$action($value);
|
|
||||||
$toSave = true;
|
|
||||||
}
|
|
||||||
if ($toSave) {
|
|
||||||
if ($obj->save() > 0) {
|
|
||||||
$rows->__index__ = 5;
|
|
||||||
$result->success = true;
|
|
||||||
$result->message = 'Record saved successfully';
|
|
||||||
$result->data = (array) $rows;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
$result->success = false;
|
foreach($obj->getValidationFailures() as $objValidationFailure) {
|
||||||
$result->message = 'Error Updating records';
|
$msg .= $objValidationFailure->getMessage() . "\n";
|
||||||
|
}
|
||||||
|
throw new PropelException($msg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception $e) {
|
||||||
|
$con->rollback();
|
||||||
|
throw new Exception($e->getMessage());
|
||||||
}
|
}
|
||||||
else {
|
$index = md5(implode('-', $primaryKeysValues));
|
||||||
$result->success = true;
|
}
|
||||||
$result->data = array('__index__'=>1132);
|
else {
|
||||||
$result->message = 'Nothing to do';
|
$toSave = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($toSave) {
|
||||||
|
$result->success = true;
|
||||||
|
$result->message = 'Record saved successfully';
|
||||||
|
$result->rows = $obj->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
|
$result->rows['__index__'] = $index;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$result->success = false;
|
||||||
|
$result->rows = array();
|
||||||
|
$result->message = 'nothing to do';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1056,7 +1043,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$gridIndex->field_key = 1;
|
$gridIndex->field_key = 1;
|
||||||
$gridIndex->field_null = 0;
|
$gridIndex->field_null = 0;
|
||||||
$gridIndex->field_filter = false;
|
$gridIndex->field_filter = false;
|
||||||
$application->field_autoincrement = false;
|
$gridIndex->field_autoincrement = false;
|
||||||
array_push($defaultColumns, $gridIndex);
|
array_push($defaultColumns, $gridIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,27 +72,35 @@ Ext.onReady(function(){
|
|||||||
|
|
||||||
_fields.push({name: _idProperty});
|
_fields.push({name: _idProperty});
|
||||||
|
|
||||||
if (tableDef.FIELDS.length !== 0) {
|
for (i=0;i<tableDef.FIELDS.length; i++) {
|
||||||
for (i in tableDef.FIELDS) {
|
column = {
|
||||||
_columns.push({
|
id: tableDef.FIELDS[i].FLD_NAME,
|
||||||
id: tableDef.FIELDS[i].FLD_NAME,
|
header: tableDef.FIELDS[i].FLD_DESCRIPTION,
|
||||||
header: tableDef.FIELDS[i].FLD_DESCRIPTION,
|
dataIndex: tableDef.FIELDS[i].FLD_NAME,
|
||||||
dataIndex: tableDef.FIELDS[i].FLD_NAME,
|
width: 40
|
||||||
width: 40,
|
};
|
||||||
editor:{
|
if (tableDef.FIELDS[i].FLD_AUTO_INCREMENT != 1) {
|
||||||
xtype: 'textfield',
|
column.editor = {
|
||||||
allowBlank: true
|
xtype: 'textfield',
|
||||||
}
|
allowBlank: true
|
||||||
});
|
|
||||||
|
|
||||||
_fields.push({name: tableDef.FIELDS[i].FLD_NAME});
|
|
||||||
|
|
||||||
if(_idProperty == '' && tableDef.FIELDS[i].FLD_KEY) {
|
|
||||||
_idProperty = tableDef.FIELDS[i].FLD_NAME;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
column.editor = {
|
||||||
|
xtype: 'displayfield',
|
||||||
|
style: 'font-size:11px; padding-left:7px'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_columns.push(column);
|
||||||
|
|
||||||
|
_fields.push({name: tableDef.FIELDS[i].FLD_NAME});
|
||||||
|
|
||||||
|
if(_idProperty == '' && tableDef.FIELDS[i].FLD_KEY) {
|
||||||
|
_idProperty = tableDef.FIELDS[i].FLD_NAME;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
smodel = new Ext.grid.CheckboxSelectionModel({
|
smodel = new Ext.grid.CheckboxSelectionModel({
|
||||||
listeners:{
|
listeners:{
|
||||||
selectionchange: function(sm){
|
selectionchange: function(sm){
|
||||||
@@ -125,7 +133,7 @@ Ext.onReady(function(){
|
|||||||
afteredit: {
|
afteredit: {
|
||||||
fn:function(rowEditor, obj, data, rowIndex ){
|
fn:function(rowEditor, obj, data, rowIndex ){
|
||||||
if (data.phantom === true) {
|
if (data.phantom === true) {
|
||||||
store.reload(); // only if it is an insert
|
//store.reload(); // only if it is an insert
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,6 +141,24 @@ Ext.onReady(function(){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ext.data.DataProxy.addListener('write', function(proxy, action, result, res, rs) {
|
||||||
|
PMExt.notify(_('ID_UPDATE'), res.raw.message)
|
||||||
|
});
|
||||||
|
|
||||||
|
// all exception events
|
||||||
|
Ext.data.DataProxy.addListener('exception', function(proxy, type, action, options, res) {
|
||||||
|
try{
|
||||||
|
response = Ext.util.JSON.decode(res.responseText);
|
||||||
|
|
||||||
|
if(response.message != 'nothing to do') {
|
||||||
|
PMExt.notify(_('ID_ERROR'), response.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
PMExt.notify(_('ID_ERROR'), res.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var proxy = new Ext.data.HttpProxy({
|
var proxy = new Ext.data.HttpProxy({
|
||||||
//url: '../pmTablesProxy/getData?id=' + tableDef.ADD_TAB_UID
|
//url: '../pmTablesProxy/getData?id=' + tableDef.ADD_TAB_UID
|
||||||
api: {
|
api: {
|
||||||
@@ -152,7 +178,7 @@ Ext.onReady(function(){
|
|||||||
|
|
||||||
var reader = new Ext.data.JsonReader({
|
var reader = new Ext.data.JsonReader({
|
||||||
root : 'rows',
|
root : 'rows',
|
||||||
idProperty : 'id',
|
idProperty : '__index__',
|
||||||
fields : _fields,
|
fields : _fields,
|
||||||
idProperty : _idProperty,
|
idProperty : _idProperty,
|
||||||
totalProperty: 'count'
|
totalProperty: 'count'
|
||||||
@@ -284,6 +310,9 @@ DoNothing = function(){};
|
|||||||
var props = function(){};
|
var props = function(){};
|
||||||
|
|
||||||
NewPMTableRow = function(){
|
NewPMTableRow = function(){
|
||||||
|
if (editor.editing) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
var PMRow = infoGrid.getStore().recordType;
|
var PMRow = infoGrid.getStore().recordType;
|
||||||
//var meta = mapPMFieldType(records[i].data['FIELD_UID']);
|
//var meta = mapPMFieldType(records[i].data['FIELD_UID']);
|
||||||
|
|
||||||
|
|||||||
@@ -970,7 +970,7 @@ function loadTableRowsFromArray(records)
|
|||||||
var PMRow = assignedGrid.getStore().recordType;
|
var PMRow = assignedGrid.getStore().recordType;
|
||||||
if (records.length == 0) return;
|
if (records.length == 0) return;
|
||||||
|
|
||||||
for(i in records) {
|
for (i=0;i<records.length; i++) {
|
||||||
var row = new PMRow({
|
var row = new PMRow({
|
||||||
uid : records[i].FLD_UID,
|
uid : records[i].FLD_UID,
|
||||||
field_uid : records[i].FLD_DYN_UID,
|
field_uid : records[i].FLD_DYN_UID,
|
||||||
|
|||||||
@@ -267,8 +267,7 @@ Ext.onReady(function(){
|
|||||||
// use shorthand alias defined above
|
// use shorthand alias defined above
|
||||||
editor: {
|
editor: {
|
||||||
xtype: 'displayfield',
|
xtype: 'displayfield',
|
||||||
readOnly: true,
|
style: 'font-size:11px; padding-left:7px'
|
||||||
style: 'font-size:11px; font-weight:bold; padding-left:4px'
|
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
id: 'field_name',
|
id: 'field_name',
|
||||||
@@ -323,7 +322,7 @@ Ext.onReady(function(){
|
|||||||
id: 'field_size',
|
id: 'field_size',
|
||||||
header: _("ID_SIZE"),
|
header: _("ID_SIZE"),
|
||||||
dataIndex: 'field_size',
|
dataIndex: 'field_size',
|
||||||
width: 70,
|
width: 50,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
editor: new fm.NumberField({
|
editor: new fm.NumberField({
|
||||||
allowBlank: true
|
allowBlank: true
|
||||||
@@ -333,15 +332,13 @@ Ext.onReady(function(){
|
|||||||
header: _('ID_AUTO_INCREMENT'),
|
header: _('ID_AUTO_INCREMENT'),
|
||||||
dataIndex: 'field_autoincrement',
|
dataIndex: 'field_autoincrement',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 50,
|
width: 100,
|
||||||
trueText: 'Yes',
|
trueText: 'Yes',
|
||||||
falseText: 'No',
|
falseText: 'No',
|
||||||
editor: {
|
editor: {
|
||||||
xtype: 'checkbox'
|
xtype: 'checkbox'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
//if permissions plugin is enabled
|
//if permissions plugin is enabled
|
||||||
@@ -644,6 +641,18 @@ Ext.onReady(function(){
|
|||||||
comboGridsList.setValue(this.getAt(i).data.FIELD_UID);
|
comboGridsList.setValue(this.getAt(i).data.FIELD_UID);
|
||||||
comboGridsList.setRawValue(this.getAt(i).data.FIELD_NAME);
|
comboGridsList.setRawValue(this.getAt(i).data.FIELD_NAME);
|
||||||
comboGridsList.setDisabled(true);
|
comboGridsList.setDisabled(true);
|
||||||
|
|
||||||
|
var available = Ext.getCmp('availableGrid');
|
||||||
|
available.store.load({
|
||||||
|
params: {
|
||||||
|
action: "getDynafields",
|
||||||
|
PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(),
|
||||||
|
TYPE: 'GRID',
|
||||||
|
GRID_UID: Ext.getCmp('REP_TAB_GRID').getValue(),
|
||||||
|
start: 0,
|
||||||
|
limit: pageSize
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Ext.Msg.alert( _('ID_ERROR'), 'Grid doesn\'t exist!');
|
Ext.Msg.alert( _('ID_ERROR'), 'Grid doesn\'t exist!');
|
||||||
}
|
}
|
||||||
@@ -724,9 +733,10 @@ Ext.onReady(function(){
|
|||||||
|
|
||||||
// loading available fields
|
// loading available fields
|
||||||
//loadAvFieldsFromArray(avFieldsList);
|
//loadAvFieldsFromArray(avFieldsList);
|
||||||
if (TABLE.ADD_TAB_TYPE == 'GRID')
|
//if (TABLE.ADD_TAB_TYPE == 'GRID')
|
||||||
loadFieldsGrids();
|
//loadFieldsGrids();
|
||||||
else
|
//else
|
||||||
|
if (TABLE.ADD_TAB_TYPE == 'NORMAL')
|
||||||
loadFieldNormal();
|
loadFieldNormal();
|
||||||
|
|
||||||
// loading table fields
|
// loading table fields
|
||||||
@@ -1075,7 +1085,7 @@ loadFieldNormal = function(){
|
|||||||
loadFieldsGrids = function(){
|
loadFieldsGrids = function(){
|
||||||
var available = Ext.getCmp('availableGrid');
|
var available = Ext.getCmp('availableGrid');
|
||||||
available.store.removeAll();
|
available.store.removeAll();
|
||||||
|
|
||||||
available.store.load({
|
available.store.load({
|
||||||
params: {
|
params: {
|
||||||
action: "getDynafields",
|
action: "getDynafields",
|
||||||
@@ -1227,7 +1237,7 @@ function loadTableRowsFromArray(records)
|
|||||||
var PMRow = assignedGrid.getStore().recordType;
|
var PMRow = assignedGrid.getStore().recordType;
|
||||||
if (records.length == 0) return;
|
if (records.length == 0) return;
|
||||||
|
|
||||||
for(i in records) {
|
for (i=0;i<records.length; i++) {
|
||||||
var row = new PMRow({
|
var row = new PMRow({
|
||||||
uid : records[i].FLD_UID,
|
uid : records[i].FLD_UID,
|
||||||
field_uid : records[i].FLD_DYN_UID,
|
field_uid : records[i].FLD_DYN_UID,
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ $startingTime = array_sum(explode(' ',microtime()));
|
|||||||
G::LoadSystem('form');
|
G::LoadSystem('form');
|
||||||
G::LoadSystem('menu');
|
G::LoadSystem('menu');
|
||||||
G::LoadSystem("xmlMenu");
|
G::LoadSystem("xmlMenu");
|
||||||
//G::LoadSystem('dvEditor');
|
G::LoadSystem('dvEditor');
|
||||||
//G::LoadSystem('table');
|
//G::LoadSystem('table');
|
||||||
G::LoadSystem('controller');
|
G::LoadSystem('controller');
|
||||||
G::LoadSystem('httpProxyController');
|
G::LoadSystem('httpProxyController');
|
||||||
|
|||||||
Reference in New Issue
Block a user