mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-12 12:41:30 +00:00
various minor corrections of sql statements
improves compatibility with postgres
This commit is contained in:
parent
a2fbb7cca0
commit
fd5bfe246f
|
@ -3325,9 +3325,11 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
*
|
*
|
||||||
* @return array latest record from tblDocumentStatusLog
|
* @return array latest record from tblDocumentStatusLog
|
||||||
*/
|
*/
|
||||||
function getStatus() { /* {{{ */
|
function getStatus($limit=1) { /* {{{ */
|
||||||
$db = $this->_document->_dms->getDB();
|
$db = $this->_document->_dms->getDB();
|
||||||
|
|
||||||
|
if (!is_numeric($limit)) return false;
|
||||||
|
|
||||||
// Retrieve the current overall status of the content represented by
|
// Retrieve the current overall status of the content represented by
|
||||||
// this object.
|
// this object.
|
||||||
if (!isset($this->_status)) {
|
if (!isset($this->_status)) {
|
||||||
|
@ -3339,7 +3341,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
"LEFT JOIN `tblDocumentStatusLog` USING (`statusID`) ".
|
"LEFT JOIN `tblDocumentStatusLog` USING (`statusID`) ".
|
||||||
"WHERE `tblDocumentStatus`.`documentID` = '". $this->_document->getID() ."' ".
|
"WHERE `tblDocumentStatus`.`documentID` = '". $this->_document->getID() ."' ".
|
||||||
"AND `tblDocumentStatus`.`version` = '". $this->_version ."' ".
|
"AND `tblDocumentStatus`.`version` = '". $this->_version ."' ".
|
||||||
"ORDER BY `tblDocumentStatusLog`.`statusLogID` DESC LIMIT 1";
|
"ORDER BY `tblDocumentStatusLog`.`statusLogID` DESC LIMIT ".(int) $limit;
|
||||||
|
|
||||||
$res = $db->getResultArray($queryStr);
|
$res = $db->getResultArray($queryStr);
|
||||||
if (is_bool($res) && !$res)
|
if (is_bool($res) && !$res)
|
||||||
|
@ -5418,7 +5420,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
|
|
||||||
if (!$this->_workflowState) {
|
if (!$this->_workflowState) {
|
||||||
$queryStr=
|
$queryStr=
|
||||||
"SELECT b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflowStates` b ON a.`state` = b.`id` WHERE `a`.`id`=". $this->_workflow->getID();
|
"SELECT b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflowStates` b ON a.`state` = b.id WHERE `a`.`id`=". $this->_workflow['id'];
|
||||||
$recs = $db->getResultArray($queryStr);
|
$recs = $db->getResultArray($queryStr);
|
||||||
if (is_bool($recs) && !$recs)
|
if (is_bool($recs) && !$recs)
|
||||||
return false;
|
return false;
|
||||||
|
@ -5482,7 +5484,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
|
|
||||||
if (!isset($this->_workflow)) {
|
if (!isset($this->_workflow)) {
|
||||||
$queryStr=
|
$queryStr=
|
||||||
"SELECT a.`id` as `wdcid`, a.`parent`, b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflows` b ON a.`workflow` = b.id WHERE a.`version`='".$this->_version
|
"SELECT a.`id` as `wdcid`, a.`parent`, b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflows` b ON a.`workflow` = b.`id` WHERE a.`version`='".$this->_version
|
||||||
."' AND a.`document` = '". $this->_document->getID() ."' "
|
."' AND a.`document` = '". $this->_document->getID() ."' "
|
||||||
." AND a.`state` IS NOT NULL"
|
." AND a.`state` IS NOT NULL"
|
||||||
." ORDER BY `date` DESC LIMIT 1";
|
." ORDER BY `date` DESC LIMIT 1";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user