Various settings in the Suggest
This commit is contained in:
@@ -709,4 +709,16 @@ class database extends database_base {
|
|||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determining the existence of a table
|
||||||
|
*/
|
||||||
|
function tableExists ($table, $db) {
|
||||||
|
$sql = "SELECT * FROM sysobjects WHERE name='" . $table . "' AND type='u'";
|
||||||
|
$bExists = true;
|
||||||
|
$oConnection = mssql_connect(DB_HOST, DB_USER, DB_PASS);
|
||||||
|
mssql_select_db(DB_NAME);
|
||||||
|
$oDataset = mssql_query($sql) || ($bExists = false);
|
||||||
|
return $bExists;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -714,4 +714,17 @@ class database extends database_base {
|
|||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determining the existence of a table
|
||||||
|
*/
|
||||||
|
function tableExists ($table, $db) {
|
||||||
|
$tables = mysql_list_tables ($db);
|
||||||
|
while (list ($temp) = @mysql_fetch_array ($tables)) {
|
||||||
|
if ($temp == $table) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,6 @@ class XmlForm_Field {
|
|||||||
return 1;
|
return 1;
|
||||||
if ($this->sql === '')
|
if ($this->sql === '')
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (! $this->sqlConnection)
|
if (! $this->sqlConnection)
|
||||||
$this->sqlConnection = 'workflow';
|
$this->sqlConnection = 'workflow';
|
||||||
|
|
||||||
@@ -995,6 +994,8 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek
|
|||||||
{
|
{
|
||||||
|
|
||||||
//echo $this->sqlConnection;
|
//echo $this->sqlConnection;
|
||||||
|
if (! $this->sqlConnection)
|
||||||
|
$this->sqlConnection = 'workflow';
|
||||||
|
|
||||||
//NOTE: string functions must be in G class
|
//NOTE: string functions must be in G class
|
||||||
if ($this->strTo === 'UPPER')
|
if ($this->strTo === 'UPPER')
|
||||||
|
|||||||
@@ -155,15 +155,25 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
|
|||||||
if( $type == 'suggest' && isset($Fields['PME_SQLCONNECTION']) && $Fields['PME_SQLCONNECTION']!='') {
|
if( $type == 'suggest' && isset($Fields['PME_SQLCONNECTION']) && $Fields['PME_SQLCONNECTION']!='') {
|
||||||
//define the dbArray with the table fields
|
//define the dbArray with the table fields
|
||||||
//g::pr($Fields);
|
//g::pr($Fields);
|
||||||
$con = Propel::getConnection($Fields['PME_SQLCONNECTION']);
|
|
||||||
$rs = $con->executeQuery("SHOW COLUMNS FROM USERS");
|
$tableExists = true;
|
||||||
$result = Array();
|
$sDataBase = 'database_' . strtolower(DB_ADAPTER);
|
||||||
$i=0;
|
if(G::LoadSystemExist($sDataBase)){
|
||||||
while ($rs->next()) {
|
G::LoadSystem($sDataBase);
|
||||||
$result[$i++] = $rs->getRow();
|
$oDataBase = new database();
|
||||||
}
|
$tableExists = $oDataBase->tableExists('USERS', $Fields['PME_SQLCONNECTION']);
|
||||||
//g::pr($result);
|
}
|
||||||
|
if($tableExists) {
|
||||||
|
$con = Propel::getConnection($Fields['PME_SQLCONNECTION']);
|
||||||
|
$rs = $con->executeQuery("SHOW COLUMNS FROM USERS");
|
||||||
|
$result = Array();
|
||||||
|
$i=0;
|
||||||
|
while ($rs->next()) {
|
||||||
|
$result[$i++] = $rs->getRow();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
//g::pr($result);
|
||||||
|
|
||||||
|
|
||||||
if( isset($Fields['PME_HINT']) ) {
|
if( isset($Fields['PME_HINT']) ) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
|
|||||||
$_POST['form']['PME_SAVELABEL'] = 0;
|
$_POST['form']['PME_SAVELABEL'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['form']['PME_SAVELABEL'])){
|
if (isset($_POST['form']['PME_SAVELABEL']) && isset($_POST['form']['PME_CODE'])){
|
||||||
$pmeCode = $_POST['form']['PME_CODE'];
|
$pmeCode = $_POST['form']['PME_CODE'];
|
||||||
$pmeCode = str_replace("'", "''", $pmeCode);
|
$pmeCode = str_replace("'", "''", $pmeCode);
|
||||||
$pmeCode = str_replace('"', '""', $pmeCode);
|
$pmeCode = str_replace('"', '""', $pmeCode);
|
||||||
|
|||||||
Reference in New Issue
Block a user