BUG 000 PM tables fixes on data editing & report table data population
This commit is contained in:
@@ -80,6 +80,7 @@ class PmTable
|
||||
|
||||
switch ($dbsUid) {
|
||||
case 'workflow': case 'wf': case '0': case '':
|
||||
$this->dataSource = 'workflow';
|
||||
$this->dbConfig->adapter= DB_ADAPTER;
|
||||
$this->dbConfig->host = DB_HOST;
|
||||
$this->dbConfig->name = DB_NAME;
|
||||
@@ -89,6 +90,7 @@ class PmTable
|
||||
break;
|
||||
|
||||
case 'rp': case 'report':
|
||||
$this->dataSource = 'rp';
|
||||
$this->dbConfig->adapter= DB_ADAPTER;
|
||||
$this->dbConfig->host = DB_REPORT_HOST;
|
||||
$this->dbConfig->name = DB_REPORT_NAME;
|
||||
@@ -112,6 +114,11 @@ class PmTable
|
||||
$this->dbConfig->port = $dbSource->getDbsPort();
|
||||
}
|
||||
}
|
||||
|
||||
public function getDataSource()
|
||||
{
|
||||
return $this->dataSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
public $fields = array();
|
||||
public $primaryKeys = array();
|
||||
|
||||
/**
|
||||
* Function load
|
||||
* access public
|
||||
@@ -29,37 +32,12 @@ class AdditionalTables extends BaseAdditionalTables {
|
||||
$oAdditionalTables = AdditionalTablesPeer::retrieveByPK($sUID);
|
||||
if (!is_null($oAdditionalTables)) {
|
||||
$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);
|
||||
|
||||
if ($bFields) {
|
||||
$aFields['FIELDS'] = $this->getFields();
|
||||
}
|
||||
|
||||
return $aFields;
|
||||
}
|
||||
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) {
|
||||
try {
|
||||
$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
|
||||
*/
|
||||
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";
|
||||
|
||||
@@ -279,9 +279,9 @@ class pmTablesProxy extends HttpProxyController
|
||||
$oFields->create($field);
|
||||
}
|
||||
|
||||
// if ($isReportTable) {
|
||||
// $oAdditionalTables->populateReportTable($data['REP_TAB_NAME'], $data['REP_TAB_CONNECTION'], $data['REP_TAB_TYPE'], $fieldsList, $data['PRO_UID'], $data['REP_TAB_GRID']);
|
||||
// }
|
||||
if ($isReportTable) {
|
||||
$oAdditionalTables->populateReportTable($data['REP_TAB_NAME'], $pmTable->getDataSource(), $data['REP_TAB_TYPE'], $data['PRO_UID'], $data['REP_TAB_GRID']);
|
||||
}
|
||||
|
||||
$result->success = true;
|
||||
$result->msg = $buildResult;
|
||||
@@ -351,24 +351,19 @@ class pmTablesProxy extends HttpProxyController
|
||||
$start = isset($httpData->start) ? $httpData->start : 0;
|
||||
$limit = isset($httpData->limit) ? $httpData->limit : $limit_size;
|
||||
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$table = $oAdditionalTables->load($httpData->id, true);
|
||||
$result = $oAdditionalTables->getAllData($httpData->id, $start, $limit);
|
||||
$additionalTables = new AdditionalTables();
|
||||
$table = $additionalTables->load($httpData->id, true);
|
||||
$result = $additionalTables->getAllData($httpData->id, $start, $limit);
|
||||
|
||||
$keys = array();
|
||||
foreach ($table['FIELDS'] as $field) {
|
||||
if ($field['FLD_KEY'] == '1') {
|
||||
$keys[] = $field['FLD_NAME'];
|
||||
}
|
||||
}
|
||||
$primaryKeys = $additionalTables->getPrimaryKeys();
|
||||
|
||||
foreach ($result['rows'] as $i => $row) {
|
||||
$indexes = array();
|
||||
foreach ($keys as $key) {
|
||||
$indexes[] = $row[$key];
|
||||
$primaryKeysValues = array();
|
||||
foreach ($primaryKeys as $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;
|
||||
@@ -376,83 +371,75 @@ class pmTablesProxy extends HttpProxyController
|
||||
|
||||
/**
|
||||
* create pm tables record
|
||||
* @param string $httpData->id
|
||||
* @param string $httpData->start
|
||||
* @param string $httpData->limit
|
||||
* @param string $httpData->rows
|
||||
*/
|
||||
public function dataCreate($httpData)
|
||||
{
|
||||
$rows = G::json_decode(stripslashes($httpData->rows));
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$table = $oAdditionalTables->load($httpData->id, true);
|
||||
$additionalTables = new AdditionalTables();
|
||||
$table = $additionalTables->load($httpData->id, true);
|
||||
$primaryKeys = $additionalTables->getPrimaryKeys();
|
||||
|
||||
$this->className = $table['ADD_TAB_CLASS_NAME'];
|
||||
$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') ) {
|
||||
throw new Exception("ERROR: $className class file doesn't exit!");
|
||||
if (!file_exists (PATH_WORKSPACE . 'classes/' . $this->className . '.php') ) {
|
||||
throw new Exception("ERROR: {$this->className} class file doesn't exit!");
|
||||
}
|
||||
|
||||
//require_once $sPath . $this->className . '.php';
|
||||
require_once 'classes/' . $this->className . '.php';
|
||||
$toSave = false;
|
||||
|
||||
if (is_array($rows)) { //multiple
|
||||
$c = $cs = 0;
|
||||
foreach ($rows as $i => $row) {
|
||||
$fieldsCount = 0;
|
||||
eval('$obj = new ' .$this->className. '();');
|
||||
foreach ($row as $key => $value) {
|
||||
$action = 'set' . AdditionalTables::getPHPName($key);
|
||||
$obj->$action($value);
|
||||
$fieldsCount++;
|
||||
require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php';
|
||||
eval('$obj = new ' .$this->className. '();');
|
||||
|
||||
if (count($row) > 0) {
|
||||
try {
|
||||
eval('$con = Propel::getConnection('.$this->classPeerName.'::DATABASE_NAME);');
|
||||
$con->begin();
|
||||
$obj->fromArray($row, BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
if ($obj->validate()) {
|
||||
$obj->save();
|
||||
$toSave = true;
|
||||
}
|
||||
if ($fieldsCount != 0) {
|
||||
$c++;
|
||||
if ($obj->save() > 0) {
|
||||
$cs++;
|
||||
|
||||
$primaryKeysValues = array();
|
||||
foreach ($primaryKeys as $primaryKey) {
|
||||
$method = 'get' . AdditionalTables::getPHPName($primaryKey['FLD_NAME']);
|
||||
$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 {
|
||||
$result->success = false;
|
||||
$result->message = 'Error Updating records';
|
||||
foreach($obj->getValidationFailures() as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "\n";
|
||||
}
|
||||
throw new PropelException($msg);
|
||||
}
|
||||
}
|
||||
catch(Exception $e) {
|
||||
$con->rollback();
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
else {
|
||||
$result->success = true;
|
||||
$result->data = array('__index__'=>1132);
|
||||
$result->message = 'Nothing to do';
|
||||
}
|
||||
$index = md5(implode('-', $primaryKeysValues));
|
||||
}
|
||||
else {
|
||||
$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;
|
||||
}
|
||||
|
||||
@@ -1056,7 +1043,7 @@ class pmTablesProxy extends HttpProxyController
|
||||
$gridIndex->field_key = 1;
|
||||
$gridIndex->field_null = 0;
|
||||
$gridIndex->field_filter = false;
|
||||
$application->field_autoincrement = false;
|
||||
$gridIndex->field_autoincrement = false;
|
||||
array_push($defaultColumns, $gridIndex);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,27 +72,35 @@ Ext.onReady(function(){
|
||||
|
||||
_fields.push({name: _idProperty});
|
||||
|
||||
if (tableDef.FIELDS.length !== 0) {
|
||||
for (i in tableDef.FIELDS) {
|
||||
_columns.push({
|
||||
id: tableDef.FIELDS[i].FLD_NAME,
|
||||
header: tableDef.FIELDS[i].FLD_DESCRIPTION,
|
||||
dataIndex: tableDef.FIELDS[i].FLD_NAME,
|
||||
width: 40,
|
||||
editor:{
|
||||
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;
|
||||
for (i=0;i<tableDef.FIELDS.length; i++) {
|
||||
column = {
|
||||
id: tableDef.FIELDS[i].FLD_NAME,
|
||||
header: tableDef.FIELDS[i].FLD_DESCRIPTION,
|
||||
dataIndex: tableDef.FIELDS[i].FLD_NAME,
|
||||
width: 40
|
||||
};
|
||||
if (tableDef.FIELDS[i].FLD_AUTO_INCREMENT != 1) {
|
||||
column.editor = {
|
||||
xtype: 'textfield',
|
||||
allowBlank: true
|
||||
}
|
||||
}
|
||||
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({
|
||||
listeners:{
|
||||
selectionchange: function(sm){
|
||||
@@ -125,7 +133,7 @@ Ext.onReady(function(){
|
||||
afteredit: {
|
||||
fn:function(rowEditor, obj, data, rowIndex ){
|
||||
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({
|
||||
//url: '../pmTablesProxy/getData?id=' + tableDef.ADD_TAB_UID
|
||||
api: {
|
||||
@@ -152,7 +178,7 @@ Ext.onReady(function(){
|
||||
|
||||
var reader = new Ext.data.JsonReader({
|
||||
root : 'rows',
|
||||
idProperty : 'id',
|
||||
idProperty : '__index__',
|
||||
fields : _fields,
|
||||
idProperty : _idProperty,
|
||||
totalProperty: 'count'
|
||||
@@ -284,6 +310,9 @@ DoNothing = function(){};
|
||||
var props = function(){};
|
||||
|
||||
NewPMTableRow = function(){
|
||||
if (editor.editing) {
|
||||
return false;
|
||||
}
|
||||
var PMRow = infoGrid.getStore().recordType;
|
||||
//var meta = mapPMFieldType(records[i].data['FIELD_UID']);
|
||||
|
||||
|
||||
@@ -970,7 +970,7 @@ function loadTableRowsFromArray(records)
|
||||
var PMRow = assignedGrid.getStore().recordType;
|
||||
if (records.length == 0) return;
|
||||
|
||||
for(i in records) {
|
||||
for (i=0;i<records.length; i++) {
|
||||
var row = new PMRow({
|
||||
uid : records[i].FLD_UID,
|
||||
field_uid : records[i].FLD_DYN_UID,
|
||||
|
||||
@@ -267,8 +267,7 @@ Ext.onReady(function(){
|
||||
// use shorthand alias defined above
|
||||
editor: {
|
||||
xtype: 'displayfield',
|
||||
readOnly: true,
|
||||
style: 'font-size:11px; font-weight:bold; padding-left:4px'
|
||||
style: 'font-size:11px; padding-left:7px'
|
||||
}
|
||||
}, {
|
||||
id: 'field_name',
|
||||
@@ -323,7 +322,7 @@ Ext.onReady(function(){
|
||||
id: 'field_size',
|
||||
header: _("ID_SIZE"),
|
||||
dataIndex: 'field_size',
|
||||
width: 70,
|
||||
width: 50,
|
||||
align: 'right',
|
||||
editor: new fm.NumberField({
|
||||
allowBlank: true
|
||||
@@ -333,15 +332,13 @@ Ext.onReady(function(){
|
||||
header: _('ID_AUTO_INCREMENT'),
|
||||
dataIndex: 'field_autoincrement',
|
||||
align: 'center',
|
||||
width: 50,
|
||||
width: 100,
|
||||
trueText: 'Yes',
|
||||
falseText: 'No',
|
||||
editor: {
|
||||
xtype: 'checkbox'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
];
|
||||
|
||||
//if permissions plugin is enabled
|
||||
@@ -644,6 +641,18 @@ Ext.onReady(function(){
|
||||
comboGridsList.setValue(this.getAt(i).data.FIELD_UID);
|
||||
comboGridsList.setRawValue(this.getAt(i).data.FIELD_NAME);
|
||||
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 {
|
||||
Ext.Msg.alert( _('ID_ERROR'), 'Grid doesn\'t exist!');
|
||||
}
|
||||
@@ -724,9 +733,10 @@ Ext.onReady(function(){
|
||||
|
||||
// loading available fields
|
||||
//loadAvFieldsFromArray(avFieldsList);
|
||||
if (TABLE.ADD_TAB_TYPE == 'GRID')
|
||||
loadFieldsGrids();
|
||||
else
|
||||
//if (TABLE.ADD_TAB_TYPE == 'GRID')
|
||||
//loadFieldsGrids();
|
||||
//else
|
||||
if (TABLE.ADD_TAB_TYPE == 'NORMAL')
|
||||
loadFieldNormal();
|
||||
|
||||
// loading table fields
|
||||
@@ -1075,7 +1085,7 @@ loadFieldNormal = function(){
|
||||
loadFieldsGrids = function(){
|
||||
var available = Ext.getCmp('availableGrid');
|
||||
available.store.removeAll();
|
||||
|
||||
|
||||
available.store.load({
|
||||
params: {
|
||||
action: "getDynafields",
|
||||
@@ -1227,7 +1237,7 @@ function loadTableRowsFromArray(records)
|
||||
var PMRow = assignedGrid.getStore().recordType;
|
||||
if (records.length == 0) return;
|
||||
|
||||
for(i in records) {
|
||||
for (i=0;i<records.length; i++) {
|
||||
var row = new PMRow({
|
||||
uid : records[i].FLD_UID,
|
||||
field_uid : records[i].FLD_DYN_UID,
|
||||
|
||||
Reference in New Issue
Block a user