if ($data['REP_TAB_UID'] == '') { //new $aFields[] = array('sType' => $column->field_type, 'iSize' => $column->field_size, 'sFieldName' => $column->field_name, 'bNull' => isset($column->field_null) ? $column->field_null : 1, 'bAI' => 0, 'bPrimaryKey' => isset($column->field_key) ? $column->field_key : 0); } else { //editing $field['FLD_UID'] = $fieldUid; $aFields[$fieldUid] = $field; } } if ($data['REP_TAB_UID'] == '') { //create a new report table $oAdditionalTables->createTable($data['REP_TAB_NAME'], $data['REP_TAB_CONNECTION'], $aFields); } else { //editing //print_R($aFields); $oAdditionalTables->updateTable($data['REP_TAB_NAME'], $data['REP_TAB_CONNECTION'], $aFields, $oldFields); } $oAdditionalTables->createPropelClasses($data['REP_TAB_NAME'], $repTabClassName, $fieldsList, $addTabUid); $oAdditionalTables->populateReportTable($data['REP_TAB_NAME'], $data['REP_TAB_CONNECTION'], $data['REP_TAB_TYPE'], $fieldsList, $data['PRO_UID'], $data['REP_TAB_GRID']); $result->success = true; } catch (Exception $e) { $result->success = false; $result->msg = $e->getMessage(); $result->trace = $e->getTraceAsString(); } echo G::json_encode($result); break; case 'delete': require_once 'classes/model/AdditionalTables.php'; G::LoadClass('reportTables'); $rows = G::json_decode($_REQUEST['rows']);