BUG 7402 "ACTUALIZACION DE PMTABLES EN BASE DE DATOS" Solved!
- verification & validation for column name defined twice or more added - fixed IE compaitbility for variable named length (use it cause problems in IE) - fixed slashed added on json value posted on a ajax request, soldev adding stripslashed on server side
This commit is contained in:
@@ -334,7 +334,7 @@ class pmTablesProxy extends HttpProxyController
|
||||
public function delete($httpData)
|
||||
{
|
||||
G::LoadClass('reportTables');
|
||||
$rows = G::json_decode($httpData->rows);
|
||||
$rows = G::json_decode(stripslashes($httpData->rows));
|
||||
$rp = new reportTables();
|
||||
$at = new AdditionalTables();
|
||||
|
||||
@@ -403,7 +403,7 @@ class pmTablesProxy extends HttpProxyController
|
||||
*/
|
||||
public function dataCreate($httpData)
|
||||
{
|
||||
$rows = G::json_decode($httpData->rows);
|
||||
$rows = G::json_decode(stripslashes($httpData->rows));
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
@@ -495,7 +495,7 @@ class pmTablesProxy extends HttpProxyController
|
||||
|
||||
require_once $sPath . $this->className . '.php';
|
||||
|
||||
$rows = G::json_decode($httpData->rows);
|
||||
$rows = G::json_decode(stripslashes($httpData->rows));
|
||||
|
||||
if (is_array($rows)) {
|
||||
foreach($rows as $row) {
|
||||
@@ -791,8 +791,8 @@ class pmTablesProxy extends HttpProxyController
|
||||
{
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
|
||||
$tablesToExport = json_decode(stripslashes($httpData->rows));
|
||||
|
||||
$tablesToExport = G::json_decode(stripslashes($httpData->rows));
|
||||
|
||||
try{
|
||||
G::LoadCLass('net');
|
||||
$net = new NET(G::getIpAddress());
|
||||
|
||||
@@ -291,13 +291,13 @@ NewPMTableRow = function(){
|
||||
}
|
||||
|
||||
var row = new PMRow(new props);
|
||||
length = infoGrid.getStore().data.length;
|
||||
len = infoGrid.getStore().data.length;
|
||||
|
||||
editor.stopEditing();
|
||||
store.insert(length, row);
|
||||
store.insert(len, row);
|
||||
infoGrid.getView().refresh();
|
||||
infoGrid.getSelectionModel().selectRow(length);
|
||||
editor.startEditing(length);
|
||||
infoGrid.getSelectionModel().selectRow(len);
|
||||
editor.startEditing(len);
|
||||
};
|
||||
|
||||
//Load PM Table Edition Row Form
|
||||
|
||||
@@ -280,10 +280,12 @@ Ext.onReady(function(){
|
||||
},
|
||||
afteredit: function(roweditor, rowIndex) {
|
||||
row = assignedGrid.getSelectionModel().getSelected();
|
||||
//if a column was set as PK so can't be null
|
||||
if (row.get('field_key') == true) {
|
||||
row.data.field_null = false;
|
||||
row.commit();
|
||||
|
||||
}
|
||||
row.commit();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -616,44 +618,50 @@ function createReportTable()
|
||||
|
||||
//validate columns count
|
||||
if(allRows.getCount() == 0) {
|
||||
PMExt.error(_('ID_ERROR'), 'Set columns for this Report Table please.');
|
||||
PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT7'));
|
||||
return false;
|
||||
}
|
||||
var fieldsNames = new Array();
|
||||
|
||||
for (var r=0; r < allRows.getCount(); r++) {
|
||||
row = allRows.getAt(r);
|
||||
for (var i = 0; i < allRows.getCount(); i++) {
|
||||
row = allRows.getAt(i);
|
||||
|
||||
if (in_array(row.data['field_name'], fieldsNames)) {
|
||||
PMExt.error(_('ID_ERROR'),_('ID_PMTABLES_ALERT1') + ' <b>' + row.data['field_name']+'</b>');
|
||||
return false;
|
||||
}
|
||||
|
||||
// validate that fieldname is not empty
|
||||
if(row.data['field_name'].trim() == '') {
|
||||
PMExt.error(_('ID_ERROR'), 'Field Name for all columns is required.');
|
||||
PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT2'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(row.data['field_label'].trim() == '') {
|
||||
PMExt.error(_('ID_ERROR'), 'Field Label for all columns is required.');
|
||||
PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT3'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (row.data['field_type'] == '') {
|
||||
PMExt.error(_('ID_ERROR'), 'Set a field type for <b>'+row.data['field_name']+'</b> please.');
|
||||
PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT4') + ' <b>'+row.data['field_name']+'</b>');
|
||||
return false;
|
||||
}
|
||||
|
||||
// validate field size for varchar & int column types
|
||||
if ((row.data['field_type'] == 'VARCHAR' || row.data['field_type'] == 'INT') && row.data['field_size'] == '') {
|
||||
PMExt.error(_('ID_ERROR'), 'Set a field size for '+row.data['field_name']+' ('+row.data['field_type']+') please.');
|
||||
PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT5')+' '+row.data['field_name']+' ('+row.data['field_type']+').');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (row.data['field_key']) {
|
||||
hasSomePrimaryKey = true;
|
||||
}
|
||||
|
||||
fieldsNames.push(row.data['field_name']);
|
||||
columns.push(row.data);
|
||||
}
|
||||
|
||||
if (!hasSomePrimaryKey) {
|
||||
PMExt.error(_('ID_ERROR'), 'You need set one column at least as Primary Key.');
|
||||
PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT6'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -912,3 +920,11 @@ function loadTableRowsFromArray(records)
|
||||
store.add(row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function in_array(needle, haystack) {
|
||||
for(var i in haystack) {
|
||||
if(haystack[i] == needle) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -892,27 +892,33 @@ function createReportTable()
|
||||
|
||||
//validate columns count
|
||||
if(allRows.getCount() == 0) {
|
||||
PMExt.error(_('ID_ERROR'), 'Set columns for this Report Table please.');
|
||||
PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT7'));
|
||||
return false;
|
||||
}
|
||||
var fieldsNames = new Array();
|
||||
|
||||
for (var r=0; r < allRows.getCount(); r++) {
|
||||
row = allRows.getAt(r);
|
||||
|
||||
if (in_array(row.data['field_name'], fieldsNames)) {
|
||||
PMExt.error(_('ID_ERROR'),_('ID_PMTABLES_ALERT1') + ' <b>' + row.data['field_name']+'</b>');
|
||||
return false;
|
||||
}
|
||||
|
||||
// validate that fieldname is not empty
|
||||
if(row.data['field_name'].trim() == '') {
|
||||
PMExt.error(_('ID_ERROR'), 'Field Name for "'+row.data['field_dyn']+'" is required.');
|
||||
PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT2'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(row.data['field_label'].trim() == '') {
|
||||
PMExt.error(_('ID_ERROR'), 'Field Label for all columns is required.');
|
||||
PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT3'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// validate field size for varchar & int column types
|
||||
if ((row.data['field_type'] == 'VARCHAR' || row.data['field_type'] == 'INT') && row.data['field_size'] == '') {
|
||||
PMExt.error(_('ID_ERROR'), 'Set a field size for '+row.data['field_name']+' ('+row.data['field_type']+') please.');
|
||||
PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT5')+' '+row.data['field_name']+' ('+row.data['field_type']+').');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1305,4 +1311,11 @@ function verifyTableLimit()
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function in_array(needle, haystack) {
|
||||
for(var i in haystack) {
|
||||
if(haystack[i] == needle) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user