BUG 7836 "Import PMtablles issue" FIXED
- there wasn't a properly sql string creation on Propel engine it was fixed now
This commit is contained in:
@@ -432,67 +432,72 @@ class pmTablesProxy extends HttpProxyController
|
||||
$rows = G::json_decode(stripslashes($httpData->rows));
|
||||
}
|
||||
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$additionalTables = new AdditionalTables();
|
||||
$table = $additionalTables->load($httpData->id, true);
|
||||
$primaryKeys = $additionalTables->getPrimaryKeys();
|
||||
try {
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$additionalTables = new AdditionalTables();
|
||||
$table = $additionalTables->load($httpData->id, true);
|
||||
$primaryKeys = $additionalTables->getPrimaryKeys();
|
||||
|
||||
$this->className = $table['ADD_TAB_CLASS_NAME'];
|
||||
$this->classPeerName = $this->className . 'Peer';
|
||||
$row = (array) $rows;
|
||||
$this->className = $table['ADD_TAB_CLASS_NAME'];
|
||||
$this->classPeerName = $this->className . 'Peer';
|
||||
$row = (array) $rows;
|
||||
|
||||
$row = array_merge(array_change_key_case($row, CASE_LOWER), array_change_key_case($row, CASE_UPPER));
|
||||
$toSave = false;
|
||||
$row = array_merge(array_change_key_case($row, CASE_LOWER), array_change_key_case($row, CASE_UPPER));
|
||||
$toSave = false;
|
||||
|
||||
if (!file_exists (PATH_WORKSPACE . 'classes/' . $this->className . '.php') ) {
|
||||
throw new Exception('Create::' . G::loadTranslation('ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className));
|
||||
}
|
||||
|
||||
require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php';
|
||||
eval('$obj = new ' .$this->className. '();');
|
||||
|
||||
if (count($row) > 0) {
|
||||
eval('$con = Propel::getConnection('.$this->classPeerName.'::DATABASE_NAME);');
|
||||
$obj->fromArray($row, BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
if ($obj->validate()) {
|
||||
$obj->save();
|
||||
$toSave = true;
|
||||
|
||||
$primaryKeysValues = array();
|
||||
foreach ($primaryKeys as $primaryKey) {
|
||||
$method = 'get' . AdditionalTables::getPHPName($primaryKey['FLD_NAME']);
|
||||
$primaryKeysValues[] = $obj->$method();
|
||||
}
|
||||
if (!file_exists (PATH_WORKSPACE . 'classes/' . $this->className . '.php') ) {
|
||||
throw new Exception('Create::' . G::loadTranslation('ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className));
|
||||
}
|
||||
else {
|
||||
$msg = '';
|
||||
foreach($obj->getValidationFailures() as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "\n";
|
||||
|
||||
require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php';
|
||||
eval('$obj = new ' .$this->className. '();');
|
||||
|
||||
if (count($row) > 0) {
|
||||
eval('$con = Propel::getConnection('.$this->classPeerName.'::DATABASE_NAME);');
|
||||
$obj->fromArray($row, BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
if ($obj->validate()) {
|
||||
$obj->save();
|
||||
$toSave = true;
|
||||
|
||||
$primaryKeysValues = array();
|
||||
foreach ($primaryKeys as $primaryKey) {
|
||||
$method = 'get' . AdditionalTables::getPHPName($primaryKey['FLD_NAME']);
|
||||
$primaryKeysValues[] = $obj->$method();
|
||||
}
|
||||
}
|
||||
throw new PropelException($msg);
|
||||
else {
|
||||
$msg = '';
|
||||
foreach($obj->getValidationFailures() as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "\n";
|
||||
}
|
||||
throw new Exception('Error trying insert into "'.$table['ADD_TAB_NAME'] ."\"\n". $msg);
|
||||
}
|
||||
|
||||
$index = G::encrypt(implode('-', $primaryKeysValues), 'pmtable');
|
||||
}
|
||||
else {
|
||||
$toSave = false;
|
||||
}
|
||||
|
||||
$index = G::encrypt(implode('-', $primaryKeysValues), 'pmtable');
|
||||
}
|
||||
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 = '$$';
|
||||
}
|
||||
}
|
||||
|
||||
if ($toSave) {
|
||||
$result->success = true;
|
||||
$result->message = 'Record saved successfully';
|
||||
$result->rows = $obj->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$result->rows['__index__'] = $index;
|
||||
}
|
||||
else {
|
||||
catch (Exception $e) {
|
||||
$result->success = false;
|
||||
$result->rows = array();
|
||||
$result->message = 'nothing to do';
|
||||
$result->rows = array();
|
||||
$result->message = $e->getMessage();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -882,6 +887,9 @@ class pmTablesProxy extends HttpProxyController
|
||||
$data->id = $table['ADD_TAB_UID'];
|
||||
$data->rows = base64_encode(serialize($row));
|
||||
$res = $this->dataCreate($data , 'base64');
|
||||
if (!$res->success) {
|
||||
$errors .= $res->message;
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////
|
||||
|
||||
@@ -161,7 +161,7 @@ Ext.onReady(function(){
|
||||
break;
|
||||
default:
|
||||
editButton.disable();
|
||||
deleteButton.disable();
|
||||
//deleteButton.disable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -185,20 +185,18 @@ Ext.onReady(function(){
|
||||
}
|
||||
|
||||
Ext.data.DataProxy.addListener('write', function(proxy, action, result, res, rs) {
|
||||
PMExt.notify(_('ID_UPDATE'), res.raw.message)
|
||||
//PMExt.notify(_('ID_UPDATE'), res.raw.message)
|
||||
});
|
||||
|
||||
// all exception events
|
||||
Ext.data.DataProxy.addListener('exception', function(proxy, type, action, options, res) {
|
||||
if (res.raw.success) {
|
||||
if(res.raw.message != 'nothing to do') {
|
||||
PMExt.notify(_('ID_INFO'), response.raw.message);
|
||||
}
|
||||
}
|
||||
else {
|
||||
PMExt.error(_('ID_ERROR'), res.raw.message);
|
||||
infoGrid.store.reload();
|
||||
response = Ext.util.JSON.decode(res.responseText);
|
||||
if(response.message == '$$') {
|
||||
return false;
|
||||
}
|
||||
|
||||
PMExt.error(_('ID_ERROR'), response.message);
|
||||
infoGrid.store.reload();
|
||||
});
|
||||
|
||||
var proxy = new Ext.data.HttpProxy({
|
||||
|
||||
@@ -217,10 +217,7 @@ Ext.onReady(function(){
|
||||
editButton.enable();
|
||||
deleteButton.enable();
|
||||
exportButton.enable();
|
||||
row = sm.getSelected();
|
||||
if (row.data.NUM_ROWS > 0) {
|
||||
dataButton.enable();
|
||||
}
|
||||
dataButton.enable();
|
||||
break;
|
||||
default:
|
||||
editButton.disable();
|
||||
@@ -420,12 +417,20 @@ DeletePMTable = function() {
|
||||
Ext.Msg.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_DELETE_PM_TABLE'),
|
||||
function(btn, text) {
|
||||
if (btn == "yes") {
|
||||
Ext.Msg.show({
|
||||
title : '',
|
||||
msg : 'Removing selectd table(s), please wait!',
|
||||
wait:true,
|
||||
waitConfig: {interval:500}
|
||||
});
|
||||
|
||||
Ext.Ajax.request ({
|
||||
url: 'pmTablesProxy/delete',
|
||||
params: {
|
||||
rows: Ext.util.JSON.encode(selections)
|
||||
},
|
||||
success: function(resp){
|
||||
Ext.MessageBox.hide();
|
||||
result = Ext.util.JSON.decode(resp.responseText);
|
||||
Ext.getCmp('infoGrid').getStore().reload();
|
||||
if (result.success) {
|
||||
@@ -435,6 +440,7 @@ DeletePMTable = function() {
|
||||
}
|
||||
},
|
||||
failure: function(obj, resp){
|
||||
Ext.MessageBox.hide();
|
||||
Ext.getCmp('infoGrid').getStore().reload();
|
||||
Ext.Msg.alert( _('ID_ERROR'), resp.result.message);
|
||||
}
|
||||
@@ -603,7 +609,12 @@ PMTableData = function()
|
||||
xtype:"iframepanel",
|
||||
defaultSrc : 'pmTables/data?id='+row.get('ADD_TAB_UID')+'&type='+row.get('TYPE'),
|
||||
loadMask:{msg: _('ID_LOADING')}
|
||||
}]
|
||||
}],
|
||||
listeners: {
|
||||
close: function() {
|
||||
store.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
win.show();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user