From 79820e7e1fd47b3cb5e32e472c9909c69926afe3 Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 15 Sep 2011 13:07:27 -0400 Subject: [PATCH] BUG 0000 PMtables hardcoded labels created --- gulliver/system/class.g.php | 8 +++++++- workflow/engine/controllers/pmTablesProxy.php | 19 +++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 8b87c6a9b..649122e28 100755 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -2182,9 +2182,15 @@ $output = $outputHeader.$output; * @parameter array data // erik: associative array within data input to replace for formatted string i.e "any messsage {replaced_label} that contains a replace label" * @return string */ - function LoadTranslation( $msgID , $lang = SYS_LANG, $data = null) + function LoadTranslation($msgID, $lang = SYS_LANG, $data = null) { global $translation; + + // if the second parameter $lang is an array does mean it was especified to use as data + if (is_array($lang)) { + $data = $lang; + $lang = SYS_LANG; + } if ( isset ( $translation[$msgID] ) ){ $translationString = preg_replace("[\n|\r|\n\r]", ' ', $translation[$msgID]); diff --git a/workflow/engine/controllers/pmTablesProxy.php b/workflow/engine/controllers/pmTablesProxy.php index 9c491900f..01099163a 100755 --- a/workflow/engine/controllers/pmTablesProxy.php +++ b/workflow/engine/controllers/pmTablesProxy.php @@ -199,7 +199,6 @@ class pmTablesProxy extends HttpProxyController 'INDEX', 'INSERT', 'OPEN', 'REVOKE', 'ROLLBACK', 'SELECT', 'SYNONYM', 'TABLE', 'UPDATE', 'VIEW', 'APP_UID', 'ROW', 'PMTABLE' ); - //$reservedWords = array_merge($reservedWords, array_change_key_case($reservedWords, CASE_LOWER)); // verify if exists. if ($data['REP_TAB_UID'] == '' || (isset($httpData->forceUid) && $httpData->forceUid)) { //new report table @@ -210,11 +209,11 @@ class pmTablesProxy extends HttpProxyController /** validations **/ if (is_array($oAdditionalTables->loadByName($data['REP_TAB_NAME']))) { - throw new Exception('The table "' . $data['REP_TAB_NAME'] . '" already exits.'); + throw new Exception(G::loadTranslation('ID_PMTABLE_ALREADY_EXISTS', array($data['REP_TAB_NAME']))); } if (in_array(strtoupper($data['REP_TAB_NAME']), $reservedWords) ) { - throw new Exception('Could not create the table with the name "' . $data['REP_TAB_NAME'] . '" because it is a reserved word.'); + throw new Exception(G::loadTranslation('ID_PMTABLE_INVALID_NAME', array($data['REP_TAB_NAME']))); } } @@ -402,7 +401,7 @@ class pmTablesProxy extends HttpProxyController $toSave = false; if (!file_exists (PATH_WORKSPACE . 'classes/' . $this->className . '.php') ) { - throw new Exception("ERROR: {$this->className} class file doesn't exit!"); + throw new Exception(G::loadTranslation('ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className)); } require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php'; @@ -466,7 +465,7 @@ class pmTablesProxy extends HttpProxyController $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; if (!file_exists ($sPath . $this->className . '.php') ) { - throw new Exception("ERROR: $className class file doesn't exit!"); + throw new Exception(G::loadTranslation('ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className)); } require_once $sPath . $this->className . '.php'; @@ -500,7 +499,7 @@ class pmTablesProxy extends HttpProxyController $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; if (!file_exists ($sPath . $this->className . '.php') ) { - throw new Exception("ERROR: $className class file doesn't exit!"); + throw new Exception(G::loadTranslation('ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className)); } require_once $sPath . $this->className . '.php'; @@ -655,7 +654,7 @@ class pmTablesProxy extends HttpProxyController //save the file if ($_FILES['form']['error']['FILENAME'] !== 0) { - throw new Exception('Problem while uploading file'); + throw new Exception(G::loadTranslation('ID_PMTABLE_UPLOADING_FILE_PROBLEM')); } $oAdditionalTables = new AdditionalTables(); @@ -670,7 +669,7 @@ class pmTablesProxy extends HttpProxyController $fileContent = file_get_contents($PUBLIC_ROOT_PATH.$filename); if(strpos($fileContent, '-----== ProcessMaker Open Source Private Tables ==-----') === false) { - throw new Exception('Invalid File, Import abort'); + throw new Exception('ID_PMTABLE_INVALID_FILE'); } $fp = fopen($PUBLIC_ROOT_PATH.$filename, "rb"); @@ -813,12 +812,12 @@ class pmTablesProxy extends HttpProxyController if ($errors == '') { $result->success = true; - $msg = 'File Imported "'.$filename.'" Successfully'; + $msg = G::loadTranslation('ID_PMTABLE_IMPORT_SUCCESS', array($filename)); } else { $result->success = false; $result->errorType = 'warning'; - $msg = 'File Imported "'.$filename.'" but with errors' . "\n\n" . $errors; + $msg = G::loadTranslation('ID_PMTABLE_IMPORT_WITH_ERRORS', array($filename)) . "\n\n"; } $result->message = $msg;