CODE STYLE workflow/engine/methods/reportTables/
FILES: edit.php main.php reportTables_Ajax.php reportTables_Delete.php reportTables_Edit.php reportTables_Save.php
This commit is contained in:
@@ -1,80 +1,75 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$id = isset($_GET['id']) ? $_GET['id'] : false;
|
$id = isset( $_GET['id'] ) ? $_GET['id'] : false;
|
||||||
$table = false;
|
$table = false;
|
||||||
$oHeadPublisher =& headPublisher::getSingleton();
|
$oHeadPublisher = & headPublisher::getSingleton();
|
||||||
|
|
||||||
$oHeadPublisher->addExtJsScript('reportTables/edit', true );
|
$oHeadPublisher->addExtJsScript( 'reportTables/edit', true );
|
||||||
$oHeadPublisher->assign('ADD_TAB_UID', $id);
|
$oHeadPublisher->assign( 'ADD_TAB_UID', $id );
|
||||||
|
|
||||||
if ($id) { // if is a edit request
|
if ($id) { // if is a edit request
|
||||||
require_once 'classes/model/AdditionalTables.php';
|
require_once 'classes/model/AdditionalTables.php';
|
||||||
require_once 'classes/model/Fields.php';
|
require_once 'classes/model/Fields.php';
|
||||||
G::LoadClass('xmlfield_InputPM');
|
G::LoadClass( 'xmlfield_InputPM' );
|
||||||
|
|
||||||
$additionalTables = new AdditionalTables();
|
$additionalTables = new AdditionalTables();
|
||||||
$table = $additionalTables->load($id, true);
|
$table = $additionalTables->load( $id, true );
|
||||||
$tableFields = array();
|
$tableFields = array ();
|
||||||
$fieldsList = array();
|
$fieldsList = array ();
|
||||||
|
|
||||||
// list the case fields
|
// list the case fields
|
||||||
foreach ($table['FIELDS'] as $i=>$field) {
|
foreach ($table['FIELDS'] as $i => $field) {
|
||||||
/*if ($field['FLD_NAME'] == 'APP_UID' || $field['FLD_NAME'] == 'APP_NUMBER' || $field['FLD_NAME'] == 'ROW') {
|
/*if ($field['FLD_NAME'] == 'APP_UID' || $field['FLD_NAME'] == 'APP_NUMBER' || $field['FLD_NAME'] == 'ROW') {
|
||||||
unset($table['FIELDS'][$i]);
|
unset($table['FIELDS'][$i]);
|
||||||
continue;
|
continue;
|
||||||
}*/
|
}*/
|
||||||
array_push($tableFields, $field['FLD_DYN_NAME']);
|
array_push( $tableFields, $field['FLD_DYN_NAME'] );
|
||||||
}
|
|
||||||
|
|
||||||
//list dynaform fields
|
|
||||||
if ($table['ADD_TAB_TYPE'] == 'NORMAL') {
|
|
||||||
$fields = getDynaformsVars($table['PRO_UID'], false);
|
|
||||||
foreach ($fields as $field) {
|
|
||||||
//select to not assigned fields for available grid
|
|
||||||
if (!in_array($field['sName'], $tableFields)) {
|
|
||||||
$fieldsList[] = array(
|
|
||||||
'FIELD_UID' => $field['sName'] . '-' . $field['sType'],
|
|
||||||
'FIELD_NAME' => $field['sName']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
list($gridName, $gridId) = explode('-', $table['ADD_TAB_GRID']);
|
|
||||||
|
|
||||||
$G_FORM = new Form($table['PRO_UID'] . '/' . $gridId, PATH_DYNAFORM, SYS_LANG, false);
|
|
||||||
$gridFields = $G_FORM->getVars(false);
|
|
||||||
|
|
||||||
foreach ($gridFields as $gfield) {
|
|
||||||
if (!in_array($gfield['sName'], $tableFields)) {
|
|
||||||
$fieldsList[] = array(
|
|
||||||
'FIELD_UID' => $gfield['sName'] . '-' . $gfield['sType'],
|
|
||||||
'FIELD_NAME' => $gfield['sName']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$oHeadPublisher->assign('avFieldsList', $fieldsList);
|
//list dynaform fields
|
||||||
|
if ($table['ADD_TAB_TYPE'] == 'NORMAL') {
|
||||||
|
$fields = getDynaformsVars( $table['PRO_UID'], false );
|
||||||
|
foreach ($fields as $field) {
|
||||||
|
//select to not assigned fields for available grid
|
||||||
|
if (! in_array( $field['sName'], $tableFields )) {
|
||||||
|
$fieldsList[] = array ('FIELD_UID' => $field['sName'] . '-' . $field['sType'],'FIELD_NAME' => $field['sName']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
list ($gridName, $gridId) = explode( '-', $table['ADD_TAB_GRID'] );
|
||||||
|
|
||||||
|
$G_FORM = new Form( $table['PRO_UID'] . '/' . $gridId, PATH_DYNAFORM, SYS_LANG, false );
|
||||||
|
$gridFields = $G_FORM->getVars( false );
|
||||||
|
|
||||||
|
foreach ($gridFields as $gfield) {
|
||||||
|
if (! in_array( $gfield['sName'], $tableFields )) {
|
||||||
|
$fieldsList[] = array ('FIELD_UID' => $gfield['sName'] . '-' . $gfield['sType'],'FIELD_NAME' => $gfield['sName']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$oHeadPublisher->assign( 'avFieldsList', $fieldsList );
|
||||||
}
|
}
|
||||||
|
|
||||||
$repTabPluginPermissions = false;
|
$repTabPluginPermissions = false;
|
||||||
global $G_TMP_MENU;
|
global $G_TMP_MENU;
|
||||||
$oMenu = new Menu();
|
$oMenu = new Menu();
|
||||||
$oMenu->load('setup');
|
$oMenu->load( 'setup' );
|
||||||
|
|
||||||
foreach( $oMenu->Options as $i=>$option) {
|
foreach ($oMenu->Options as $i => $option) {
|
||||||
if ($oMenu->Types[$i] == 'private' && $oMenu->Id[$i] == 'PLUGIN_REPTAB_PERMISSIONS') {
|
if ($oMenu->Types[$i] == 'private' && $oMenu->Id[$i] == 'PLUGIN_REPTAB_PERMISSIONS') {
|
||||||
$repTabPluginPermissions = array();
|
$repTabPluginPermissions = array ();
|
||||||
$repTabPluginPermissions['label'] = $oMenu->Labels[$i];
|
$repTabPluginPermissions['label'] = $oMenu->Labels[$i];
|
||||||
$repTabPluginPermissions['fn'] = $oMenu->Options[$i];
|
$repTabPluginPermissions['fn'] = $oMenu->Options[$i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oHeadPublisher->assign('_plugin_permissions', $repTabPluginPermissions);
|
$oHeadPublisher->assign( '_plugin_permissions', $repTabPluginPermissions );
|
||||||
|
|
||||||
$oHeadPublisher->assign('PRO_UID', isset($_GET['PRO_UID'])? $_GET['PRO_UID'] : false);
|
$oHeadPublisher->assign( 'PRO_UID', isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : false );
|
||||||
$oHeadPublisher->assign('TABLE', $table);
|
$oHeadPublisher->assign( 'TABLE', $table );
|
||||||
|
|
||||||
|
G::RenderPage( 'publish', 'extJs' );
|
||||||
G::RenderPage('publish', 'extJs');
|
|
||||||
|
|||||||
@@ -12,48 +12,47 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $RBAC;
|
global $RBAC;
|
||||||
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
|
$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' );
|
||||||
$G_PUBLISH = new Publisher;
|
$G_PUBLISH = new Publisher();
|
||||||
|
|
||||||
G::LoadClass('configuration');
|
G::LoadClass( 'configuration' );
|
||||||
$c = new Configurations();
|
$c = new Configurations();
|
||||||
$configPage = $c->getConfiguration('additionalTablesList', 'pageSize','',$_SESSION['USER_LOGGED']);
|
$configPage = $c->getConfiguration( 'additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
|
||||||
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
|
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
|
||||||
|
|
||||||
$oHeadPublisher =& headPublisher::getSingleton();
|
$oHeadPublisher = & headPublisher::getSingleton();
|
||||||
|
|
||||||
$repTabPluginPermissions = false;
|
$repTabPluginPermissions = false;
|
||||||
global $G_TMP_MENU;
|
global $G_TMP_MENU;
|
||||||
$oMenu = new Menu();
|
$oMenu = new Menu();
|
||||||
$oMenu->load('setup');
|
$oMenu->load( 'setup' );
|
||||||
|
|
||||||
$simpleREportsPlugin = false;
|
$simpleREportsPlugin = false;
|
||||||
foreach( $oMenu->Options as $i=>$option) {
|
foreach ($oMenu->Options as $i => $option) {
|
||||||
if ($oMenu->Types[$i] == 'private' && $oMenu->Id[$i] == 'PLUGIN_REPTAB_PERMISSIONS') {
|
if ($oMenu->Types[$i] == 'private' && $oMenu->Id[$i] == 'PLUGIN_REPTAB_PERMISSIONS') {
|
||||||
$simpleREportsPlugin = array();
|
$simpleREportsPlugin = array ();
|
||||||
$simpleREportsPlugin['label'] = $oMenu->Labels[$i];
|
$simpleREportsPlugin['label'] = $oMenu->Labels[$i];
|
||||||
$simpleREportsPlugin['fn'] = $oMenu->Options[$i];
|
$simpleREportsPlugin['fn'] = $oMenu->Options[$i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oHeadPublisher->assign('_PLUGIN_SIMPLEREPORTS', $simpleREportsPlugin);
|
$oHeadPublisher->assign( '_PLUGIN_SIMPLEREPORTS', $simpleREportsPlugin );
|
||||||
|
|
||||||
$oHeadPublisher->addExtJsScript('reportTables/main', true); //adding a javascript file .js
|
$oHeadPublisher->addExtJsScript( 'reportTables/main', true ); //adding a javascript file .js
|
||||||
$oHeadPublisher->addContent('reportTables/main'); //adding a html file .html.
|
$oHeadPublisher->addContent( 'reportTables/main' ); //adding a html file .html.
|
||||||
$oHeadPublisher->assign('FORMATS',$c->getFormats());
|
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
|
||||||
$oHeadPublisher->assign('CONFIG', $Config);
|
$oHeadPublisher->assign( 'CONFIG', $Config );
|
||||||
$oHeadPublisher->assign('PRO_UID', isset($_GET['PRO_UID'])? $_GET['PRO_UID'] : false);
|
$oHeadPublisher->assign( 'PRO_UID', isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : false );
|
||||||
G::RenderPage('publish', 'extJs');
|
G::RenderPage( 'publish', 'extJs' );
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -12,26 +12,26 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
|
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1)
|
||||||
G::LoadClass('reportTables');
|
return $RBAC_Response;
|
||||||
try{
|
G::LoadClass( 'reportTables' );
|
||||||
|
try {
|
||||||
$oReportTables = new ReportTables();
|
$oReportTables = new ReportTables();
|
||||||
$oReportTables->deleteReportTable($_POST['REP_TAB_UID']);
|
$oReportTables->deleteReportTable( $_POST['REP_TAB_UID'] );
|
||||||
$result->success = true;
|
$result->success = true;
|
||||||
$result->msg = G::LoadTranslation('ID_REPORTTABLE_REMOVED');
|
$result->msg = G::LoadTranslation( 'ID_REPORTTABLE_REMOVED' );
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$result->success = false;
|
$result->success = false;
|
||||||
$result->msg = $e->getMessage();
|
$result->msg = $e->getMessage();
|
||||||
}
|
}
|
||||||
print G::json_encode($result);
|
print G::json_encode( $result );
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -12,53 +12,50 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
|
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1)
|
||||||
G::LoadClass('reportTables');
|
return $RBAC_Response;
|
||||||
G::LoadClass('xmlfield_InputPM');
|
G::LoadClass( 'reportTables' );
|
||||||
$aFields['FIELDS'] = array();
|
G::LoadClass( 'xmlfield_InputPM' );
|
||||||
if (isset($_GET['REP_TAB_UID']))
|
$aFields['FIELDS'] = array ();
|
||||||
{
|
if (isset( $_GET['REP_TAB_UID'] )) {
|
||||||
$oReportTable = new ReportTable();
|
$oReportTable = new ReportTable();
|
||||||
$aFields = $oReportTable->load($_GET['REP_TAB_UID']);
|
$aFields = $oReportTable->load( $_GET['REP_TAB_UID'] );
|
||||||
$aTheFields = getDynaformsVars($aFields['PRO_UID'], false);
|
$aTheFields = getDynaformsVars( $aFields['PRO_UID'], false );
|
||||||
$oReportTables = new ReportTables();
|
$oReportTables = new ReportTables();
|
||||||
$aVars = $oReportTables->getTableVars($_GET['REP_TAB_UID']);
|
$aVars = $oReportTables->getTableVars( $_GET['REP_TAB_UID'] );
|
||||||
$aFields['FIELDS'] = array();
|
$aFields['FIELDS'] = array ();
|
||||||
foreach ($aTheFields as $aField) {
|
foreach ($aTheFields as $aField) {
|
||||||
if (in_array($aField['sName'], $aVars)) {
|
if (in_array( $aField['sName'], $aVars )) {
|
||||||
$aFields['FIELDS'][] = $aField['sName'] . '-' . $aField['sType'];
|
$aFields['FIELDS'][] = $aField['sName'] . '-' . $aField['sType'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
$aFields['PRO_UID'] = $_GET['PRO_UID'];
|
||||||
|
$aFields['FIELDS'] = array ();
|
||||||
|
$aTheFields = getDynaformsVars( $aFields['PRO_UID'], false );
|
||||||
}
|
}
|
||||||
else
|
$aProcessFields[] = array ('FIELD_UID' => 'char','FIELD_NAME' => 'char'
|
||||||
{
|
);
|
||||||
$aFields['PRO_UID'] = $_GET['PRO_UID'];
|
$aTheFields = getDynaformsVars( $aFields['PRO_UID'], false );
|
||||||
$aFields['FIELDS'] = array();
|
|
||||||
$aTheFields = getDynaformsVars($aFields['PRO_UID'], false);
|
|
||||||
}
|
|
||||||
$aProcessFields[] = array('FIELD_UID' => 'char',
|
|
||||||
'FIELD_NAME' => 'char');
|
|
||||||
$aTheFields = getDynaformsVars($aFields['PRO_UID'], false);
|
|
||||||
foreach ($aTheFields as $aField) {
|
foreach ($aTheFields as $aField) {
|
||||||
$aProcessFields[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sType'],
|
$aProcessFields[] = array ('FIELD_UID' => $aField['sName'] . '-' . $aField['sType'],'FIELD_NAME' => $aField['sName']
|
||||||
'FIELD_NAME' => $aField['sName']);
|
);
|
||||||
}
|
}
|
||||||
$aProcessGridFields[] = array('FIELD_UID' => 'char',
|
$aProcessGridFields[] = array ('FIELD_UID' => 'char','FIELD_NAME' => 'char'
|
||||||
'FIELD_NAME' => 'char');
|
);
|
||||||
$aTheFields = getGridsVars($aFields['PRO_UID']);
|
$aTheFields = getGridsVars( $aFields['PRO_UID'] );
|
||||||
foreach ($aTheFields as $aField) {
|
foreach ($aTheFields as $aField) {
|
||||||
$aProcessGridFields[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sXmlForm'],
|
$aProcessGridFields[] = array ('FIELD_UID' => $aField['sName'] . '-' . $aField['sXmlForm'],'FIELD_NAME' => $aField['sName']
|
||||||
'FIELD_NAME' => $aField['sName']);
|
);
|
||||||
}
|
}
|
||||||
global $_DBArray;
|
global $_DBArray;
|
||||||
$_DBArray['processFields'] = $aProcessFields;
|
$_DBArray['processFields'] = $aProcessFields;
|
||||||
@@ -67,6 +64,6 @@ $_SESSION['_DBArray'] = $_DBArray;
|
|||||||
|
|
||||||
$aFields['LANG'] = SYS_LANG;
|
$aFields['LANG'] = SYS_LANG;
|
||||||
$G_PUBLISH = new Publisher();
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'reportTables/reportTables_Edit', '', $aFields, '../reportTables/reportTables_Save');
|
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'reportTables/reportTables_Edit', '', $aFields, '../reportTables/reportTables_Save' );
|
||||||
G::RenderPage('publish', 'blank');
|
G::RenderPage( 'publish', 'blank' );
|
||||||
?>
|
?>
|
||||||
@@ -12,92 +12,88 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
|
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1)
|
||||||
|
return $RBAC_Response;
|
||||||
|
|
||||||
G::LoadClass('reportTables');
|
G::LoadClass( 'reportTables' );
|
||||||
|
|
||||||
if(isset($_POST['form']))
|
if (isset( $_POST['form'] ))
|
||||||
$values = $_POST['form']; //For Old processmap
|
$values = $_POST['form']; //For Old processmap
|
||||||
else
|
else {
|
||||||
{
|
$values = $_POST; //For extjs,since we are not using form
|
||||||
$values = $_POST; //For extjs,since we are not using form
|
$values['FIELDS'] = explode( ',', $_POST['FIELDS'] );
|
||||||
$values['FIELDS'] = explode(',',$_POST['FIELDS']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$oReportTable = new ReportTable();
|
$oReportTable = new ReportTable();
|
||||||
if (!isset($values['REP_TAB_CONNECTION'])) {
|
if (! isset( $values['REP_TAB_CONNECTION'] )) {
|
||||||
$values['REP_TAB_CONNECTION'] = 'report';
|
$values['REP_TAB_CONNECTION'] = 'report';
|
||||||
}
|
}
|
||||||
if ($values['REP_TAB_UID'] != '') {
|
if ($values['REP_TAB_UID'] != '') {
|
||||||
$aReportTable = $oReportTable->load($values['REP_TAB_UID']);
|
$aReportTable = $oReportTable->load( $values['REP_TAB_UID'] );
|
||||||
$sOldTableName = $aReportTable['REP_TAB_NAME'];
|
$sOldTableName = $aReportTable['REP_TAB_NAME'];
|
||||||
$sOldConnection = $aReportTable['REP_TAB_CONNECTION'];
|
$sOldConnection = $aReportTable['REP_TAB_CONNECTION'];
|
||||||
}
|
} else {
|
||||||
else {
|
$sOldTableName = $values['REP_TAB_NAME'];
|
||||||
$sOldTableName = $values['REP_TAB_NAME'];
|
$sOldConnection = $values['REP_TAB_CONNECTION'];
|
||||||
$sOldConnection = $values['REP_TAB_CONNECTION'];
|
$oReportTable->create( $values );
|
||||||
$oReportTable->create($values);
|
$values['REP_TAB_UID'] = $oReportTable->getRepTabUid();
|
||||||
$values['REP_TAB_UID'] = $oReportTable->getRepTabUid();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$oReportTable->update($values);
|
$oReportTable->update( $values );
|
||||||
$oReportVar = new ReportVar();
|
$oReportVar = new ReportVar();
|
||||||
$oReportTables = new ReportTables();
|
$oReportTables = new ReportTables();
|
||||||
$oReportTables->deleteAllReportVars($values['REP_TAB_UID']);
|
$oReportTables->deleteAllReportVars( $values['REP_TAB_UID'] );
|
||||||
$aFields = array();
|
$aFields = array ();
|
||||||
if ($values['REP_TAB_TYPE'] == 'GRID') {
|
if ($values['REP_TAB_TYPE'] == 'GRID') {
|
||||||
$aAux = explode('-', $values['REP_TAB_GRID']);
|
$aAux = explode( '-', $values['REP_TAB_GRID'] );
|
||||||
global $G_FORM;
|
global $G_FORM;
|
||||||
$G_FORM = new Form($values['PRO_UID'] . '/' . $aAux[1], PATH_DYNAFORM, SYS_LANG, false);
|
$G_FORM = new Form( $values['PRO_UID'] . '/' . $aAux[1], PATH_DYNAFORM, SYS_LANG, false );
|
||||||
$aAux = $G_FORM->getVars(false);
|
$aAux = $G_FORM->getVars( false );
|
||||||
foreach ($aAux as $aField) {
|
foreach ($aAux as $aField) {
|
||||||
$values['FIELDS'][] = $aField['sName'] . '-' . $aField['sType'];
|
$values['FIELDS'][] = $aField['sName'] . '-' . $aField['sType'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($values['FIELDS'] as $sField) {
|
foreach ($values['FIELDS'] as $sField) {
|
||||||
$aField = explode('-', $sField);
|
$aField = explode( '-', $sField );
|
||||||
switch ($aField[1]) {
|
switch ($aField[1]) {
|
||||||
case 'currency':
|
case 'currency':
|
||||||
case 'percentage':
|
case 'percentage':
|
||||||
$sType = 'number';
|
$sType = 'number';
|
||||||
break;
|
break;
|
||||||
case 'text':
|
case 'text':
|
||||||
case 'password':
|
case 'password':
|
||||||
case 'dropdown':
|
case 'dropdown':
|
||||||
case 'yesno':
|
case 'yesno':
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
case 'radiogroup':
|
case 'radiogroup':
|
||||||
case 'hidden':
|
case 'hidden':
|
||||||
$sType = 'char';
|
$sType = 'char';
|
||||||
break;
|
break;
|
||||||
case 'textarea':
|
case 'textarea':
|
||||||
$sType = 'text';
|
$sType = 'text';
|
||||||
break;
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
$sType = 'date';
|
$sType = 'date';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$sType = 'char';
|
$sType = 'char';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$oReportVar->create(array('REP_TAB_UID' => $values['REP_TAB_UID'],
|
$oReportVar->create( array ('REP_TAB_UID' => $values['REP_TAB_UID'],'PRO_UID' => $values['PRO_UID'],'REP_VAR_NAME' => $aField[0],'REP_VAR_TYPE' => $sType
|
||||||
'PRO_UID' => $values['PRO_UID'],
|
) );
|
||||||
'REP_VAR_NAME' => $aField[0],
|
$aFields[] = array ('sFieldName' => $aField[0],'sType' => $sType
|
||||||
'REP_VAR_TYPE' => $sType));
|
);
|
||||||
$aFields[] = array('sFieldName' => $aField[0], 'sType' => $sType);
|
|
||||||
}
|
}
|
||||||
$oReportTables->dropTable($sOldTableName, $sOldConnection);
|
$oReportTables->dropTable( $sOldTableName, $sOldConnection );
|
||||||
$oReportTables->createTable($values['REP_TAB_NAME'], $values['REP_TAB_CONNECTION'], $values['REP_TAB_TYPE'], $aFields);
|
$oReportTables->createTable( $values['REP_TAB_NAME'], $values['REP_TAB_CONNECTION'], $values['REP_TAB_TYPE'], $aFields );
|
||||||
$oReportTables->populateTable($values['REP_TAB_NAME'], $values['REP_TAB_CONNECTION'], $values['REP_TAB_TYPE'], $aFields, $values['PRO_UID'], $values['REP_TAB_GRID']);
|
$oReportTables->populateTable( $values['REP_TAB_NAME'], $values['REP_TAB_CONNECTION'], $values['REP_TAB_TYPE'], $aFields, $values['PRO_UID'], $values['REP_TAB_GRID'] );
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user