Commit 90117fd4e3e69b78731025348b45604bb9e5675c

Authored by kevin_fourie
1 parent c0e0a141

Merged in from DEV trunk...

KTS-2507
" Workflow Transitions reset after adding new transition to existing workflow."

Fixed
When adding a new transition the old data should remain intact.

Committed By: Jonathan Byrne
Reviewed By: Kevin Fourie

KTS-2524
"Create document indexer shutdown script"
Implemented. Also did a few other small fixes...

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

KTS-2524
"Create document indexer shutdown script"
Implemented. 

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

KTS-2520
"Fatal Error when deleting a state in a workflow and selecting a replacement state."
Fixed typo. KTWorkflowTransitions should have been KTWorkflowTransition.

Committed By: Kevin Fourie
Reviewed By: Jonathan Byrne



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@7430 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/workflow/workflowutil.inc.php
... ... @@ -831,7 +831,7 @@ class KTWorkflowUtil {
831 831 if (PEAR::isError($res)) { return $res; }
832 832  
833 833 Document::clearAllCaches();
834   - KTWorkflowTransitions::clearAllCaches();
  834 + KTWorkflowTransition::clearAllCaches();
835 835 }
836 836 }
837 837  
... ...
plugins/ktcore/admin/workflowsv2.php
... ... @@ -625,7 +625,7 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher {
625 625  
626 626 $to = (array) KTUtil::arrayGet($_REQUEST, 'fTo');
627 627 $from = (array) KTUtil::arrayGet($_REQUEST, 'fFrom');
628   -
  628 +
629 629 // we do not trust any of this data.
630 630 $states = KTWorkflowState::getByWorkflow($this->oWorkflow);
631 631 $states = KTUtil::keyArray($states);
... ... @@ -656,8 +656,16 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher {
656 656 $source_state_ids[] = $oState->getId();
657 657 }
658 658 }
659   -
660   - $res = KTWorkflowAdminUtil::saveTransitionSources($oTransition, $source_state_ids);
  659 +
  660 + $aFromTransitionID = array_keys($_REQUEST['fFrom']);
  661 + //run through all transitions to change
  662 + foreach ($aFromTransitionID as $iCurrentId)
  663 + {
  664 + if($oTransition->getId() == $iCurrentId)
  665 + {
  666 + $res = KTWorkflowAdminUtil::saveTransitionSources($oTransition, $source_state_ids);
  667 + }
  668 + }
661 669 if (PEAR::isError($res)) {
662 670 $this->errorRedirectTo('basic', sprintf(_kt("Failed to set transition origins: %s"), $res->getMessage()));
663 671 }
... ...
search2/indexing/indexerCore.inc.php
... ... @@ -32,13 +32,13 @@ class QueryResultItem
32 32 protected $status;
33 33 protected $folderId;
34 34  
35   -
36 35 public function __construct($document_id, $rank=null, $title=null, $text=null)
37 36 {
38   - $this->document_id=$document_id;
  37 + $this->document_id=(int) $document_id;
39 38 $this->rank= $rank;
40 39 $this->title=$title;
41 40 $this->text = $text;
  41 + $this->live = true;
42 42 $this->loadDocumentInfo();
43 43 }
44 44  
... ... @@ -57,14 +57,13 @@ class QueryResultItem
57 57 return true; // should not be reached
58 58 }
59 59  
60   - private function loadDocumentInfo()
  60 + public function loadDocumentInfo()
61 61 {
62 62 $sql = "SELECT
63   - f.folder_id, f.full_path, f.name, dcv.size as filesize, dcv.major_version,
  63 + d.folder_id, f.full_path, f.name, dcv.size as filesize, dcv.major_version,
64 64 dcv.minor_version, dcv.filename, cou.name as checkoutuser, w.human_name as workflow, ws.human_name as workflowstate,
65 65 mt.mimetypes as mimetype, md.mime_doc as mimedoc, d.checkedout, mbu.name as modifiedbyuser, d.modified,
66 66 cbu.name as createdbyuser, ou.name as owneruser, d.immutable, d.status_id, d.created
67   -
68 67 FROM
69 68 documents d
70 69 INNER JOIN document_metadata_version dmv ON d.metadata_version_id = dmv.id
... ... @@ -78,7 +77,6 @@ class QueryResultItem
78 77 LEFT JOIN users mbu ON d.modified_user_id=mbu.id
79 78 LEFT JOIN users cbu ON d.creator_id=cbu.id
80 79 LEFT JOIN users ou ON d.owner_id=ou.id
81   -
82 80 WHERE
83 81 d.id=$this->document_id";
84 82  
... ... @@ -87,10 +85,9 @@ class QueryResultItem
87 85 if (PEAR::isError($result) || empty($result))
88 86 {
89 87 $this->live = false;
90   - return;
  88 + throw new Exception('QueryResultItem::loadDocumentInfo failed');
91 89 }
92 90  
93   - $this->live = true;
94 91 if (is_null($result['name']))
95 92 {
96 93 $this->fullpath = '(orphaned)';
... ... @@ -137,7 +134,7 @@ class QueryResultItem
137 134 case 'Title': return (string) $this->title;
138 135 case 'FullPath': return (string) $this->fullpath;
139 136 case 'IsLive': return (bool) $this->live;
140   - case 'Filesize': return (int) $this->filesize;
  137 + case 'Filesize': return $this->filesize;
141 138 case 'Version': return (string) $this->version;
142 139 case 'Filename': return (int)$this->filename;
143 140 case 'FolderId': return (int)$this->folderId;
... ... @@ -180,7 +177,13 @@ class QueryResultItem
180 177 case 'Status':
181 178 return $this->status;
182 179 case 'CanBeReadByUser':
183   - return (bool) $this->live && (Permission::userHasDocumentReadPermission($this->Document) || Permission::adminIsInAdminMode());
  180 + if (!$this->live)
  181 + return false;
  182 + if (Permission::userHasDocumentReadPermission($this->Document))
  183 + return true;
  184 + if (Permission::adminIsInAdminMode())
  185 + return true;
  186 + return false;
184 187 default:
185 188 throw new Exception("Unknown property '$property' to get on MatchResult");
186 189 }
... ... @@ -1170,6 +1173,15 @@ abstract class Indexer
1170 1173 }
1171 1174  
1172 1175 /**
  1176 + * Shuts down the indexer
  1177 + *
  1178 + */
  1179 + public function shutdown()
  1180 + {
  1181 + // do nothing generally
  1182 + }
  1183 +
  1184 + /**
1173 1185 * Returns the name of the indexer.
1174 1186 *
1175 1187 * @return string
... ...
search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php
... ... @@ -115,6 +115,16 @@ class JavaXMLRPCLuceneIndexer extends Indexer
115 115 }
116 116  
117 117 /**
  118 + * Shut down the java server
  119 + *
  120 + */
  121 + public function shutdown()
  122 + {
  123 + $this->lucene->shutdown();
  124 + }
  125 +
  126 +
  127 + /**
118 128 * Enter description here...
119 129 *
120 130 * @param string $query
... ...