PMCORE-1049
This commit is contained in:
@@ -909,6 +909,8 @@ class PmDynaformTest extends TestCase
|
||||
|
||||
$sqlOriginal3 = 'DUMMY';
|
||||
|
||||
$sqlOriginal4 = 'SELECT U.USR_UID, U.USR_USERNAME FROM PMT_CODES C INNER JOIN USERS U ON U.USR_USERNAME = C.USR_USERNAME';
|
||||
|
||||
// Instance the class PmDynaform
|
||||
$pmDynaform = new PmDynaform([]);
|
||||
|
||||
@@ -924,6 +926,10 @@ class PmDynaformTest extends TestCase
|
||||
// Test another string, shoul be return the same value
|
||||
$sqlParsed3 = $pmDynaform->sqlParse($sqlOriginal3);
|
||||
$this->assertEquals($sqlOriginal3, $sqlParsed3);
|
||||
|
||||
// Test bug PMCORE-1049
|
||||
$sqlParsed4 = $pmDynaform->sqlParse($sqlOriginal4);
|
||||
$this->assertNotFalse(strpos($sqlParsed4, 'C.USR_USERNAME'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1023,8 +1023,17 @@ class PmDynaform
|
||||
. " JOIN "
|
||||
. $dt[$key]["table"]
|
||||
. ($dt[$key]["table"] == $dt[$key]["alias"] ? "" : " " . $dt[$key]["alias"]) . " "
|
||||
. $dt[$key]["ref_type"] . " "
|
||||
. rtrim($dt[$key]["ref_clause"], " INNER");
|
||||
. $dt[$key]["ref_type"] . " ";
|
||||
|
||||
// Get the last 6 chars of the string
|
||||
$tempString = mb_substr($dt[$key]["ref_clause"], -6);
|
||||
|
||||
// If the last section is a "INNER" statement we need to remove it
|
||||
if (strcasecmp($tempString, " INNER") === 0) {
|
||||
$from .= mb_substr($dt[$key]["ref_clause"], 0, mb_strlen($dt[$key]["ref_clause"]) - 6);
|
||||
} else {
|
||||
$from .= $dt[$key]["ref_clause"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user