mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 17:05:46 +00:00
various minor corrections of sql statements
improves compatibility with postgres
This commit is contained in:
parent
a2fbb7cca0
commit
fd5bfe246f
|
@ -2920,7 +2920,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
$timeline = array();
|
||||
|
||||
$lc=$this->getLatestContent();
|
||||
$queryStr = "SELECT `revisiondate`, `version` FROM `tblDocumentContent` WHERE `document` = " . $this->_id . " AND `version` = " . $lc->getVersion();
|
||||
$queryStr = "SELECT `revisiondate`, `version` FROM `tblDocumentContent` WHERE `document` = " . $this->_id . " AND `version` = " . $lc->getVersion();
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && $resArr == false)
|
||||
return false;
|
||||
|
@ -3325,9 +3325,11 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
*
|
||||
* @return array latest record from tblDocumentStatusLog
|
||||
*/
|
||||
function getStatus() { /* {{{ */
|
||||
function getStatus($limit=1) { /* {{{ */
|
||||
$db = $this->_document->_dms->getDB();
|
||||
|
||||
if (!is_numeric($limit)) return false;
|
||||
|
||||
// Retrieve the current overall status of the content represented by
|
||||
// this object.
|
||||
if (!isset($this->_status)) {
|
||||
|
@ -3339,7 +3341,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
"LEFT JOIN `tblDocumentStatusLog` USING (`statusID`) ".
|
||||
"WHERE `tblDocumentStatus`.`documentID` = '". $this->_document->getID() ."' ".
|
||||
"AND `tblDocumentStatus`.`version` = '". $this->_version ."' ".
|
||||
"ORDER BY `tblDocumentStatusLog`.`statusLogID` DESC LIMIT 1";
|
||||
"ORDER BY `tblDocumentStatusLog`.`statusLogID` DESC LIMIT ".(int) $limit;
|
||||
|
||||
$res = $db->getResultArray($queryStr);
|
||||
if (is_bool($res) && !$res)
|
||||
|
@ -5418,7 +5420,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
|
||||
if (!$this->_workflowState) {
|
||||
$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);
|
||||
if (is_bool($recs) && !$recs)
|
||||
return false;
|
||||
|
@ -5482,7 +5484,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
|
||||
if (!isset($this->_workflow)) {
|
||||
$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.`state` IS NOT NULL"
|
||||
." ORDER BY `date` DESC LIMIT 1";
|
||||
|
@ -5974,8 +5976,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
* the next state will be reached if one of the transitions
|
||||
* leading to the given state can be processed.
|
||||
*/
|
||||
if($nextstate->getPreCondFunc() == '') {
|
||||
$workflow = $this->_workflow['workflow'];
|
||||
if($nextstate->getPreCondFunc() == '') {
|
||||
$workflow = $this->_workflow['workflow'];
|
||||
$transitions = $workflow->getPreviousTransitions($nextstate);
|
||||
foreach($transitions as $transition) {
|
||||
// echo "transition ".$transition->getID()." led to state ".$nextstate->getName()."<br />";
|
||||
|
|
Loading…
Reference in New Issue
Block a user