Commit d7dcd41f0b1e41aa014caa9d16970467d4b19143

Authored by jonathan_byrne
1 parent 3fdad60f

KTS-2706

"Fatal error with in the workflow move document action. Fatal error: Call to undefined function: getpatharray() in /srv/www/html/3.4.3/plugins/ktcore/KTWorkflowTriggers.inc.php on line 513"

Fixed. User is now taken to root folder.

Committed By: Jonathan Byrne
Reviewed By: Kevin Fourie


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.4.5-Release-Branch@7709 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktcore/KTWorkflowTriggers.inc.php
@@ -493,8 +493,18 @@ class CopyActionTrigger extends KTWorkflowTrigger { @@ -493,8 +493,18 @@ class CopyActionTrigger extends KTWorkflowTrigger {
493 $aOptions['result_url'] = KTUtil::addQueryStringSelf($qs); 493 $aOptions['result_url'] = KTUtil::addQueryStringSelf($qs);
494 $aOptions['show_documents'] = false; 494 $aOptions['show_documents'] = false;
495 495
496 - $fFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId', KTUtil::arrayGet($this->aConfig, 'folder_id', 1)); 496 + $fFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId', KTUtil::arrayGet($this->aConfig, 'folder_id', 1));
497 497
  498 + $oFolder = Folder::get($fFolderId);
  499 + $aBreadcrumbs = array();
  500 + if(PEAR::isError($oFolder))
  501 + {
  502 + $iRoot = 1;
  503 + $oFolder = Folder::get($iRoot);
  504 + $fFolderId = 1;
  505 +
  506 + }
  507 +
498 $collection->setOptions($aOptions); 508 $collection->setOptions($aOptions);
499 $collection->setQueryObject(new BrowseQuery($fFolderId, $this->oUser)); 509 $collection->setQueryObject(new BrowseQuery($fFolderId, $this->oUser));
500 $collection->setColumnOptions('ktcore.columns.singleselection', array( 510 $collection->setColumnOptions('ktcore.columns.singleselection', array(
@@ -508,24 +518,25 @@ class CopyActionTrigger extends KTWorkflowTrigger { @@ -508,24 +518,25 @@ class CopyActionTrigger extends KTWorkflowTrigger {
508 'folder_link' => $aOptions['result_url'], 518 'folder_link' => $aOptions['result_url'],
509 )); 519 ));
510 520
511 - $oFolder = Folder::get($fFolderId);  
512 - $aBreadcrumbs = array();  
513 - $folder_path_names = $oFolder->getPathArray();  
514 - $folder_path_ids = explode(',', $oFolder->getParentFolderIds());  
515 - $folder_path_ids[] = $oFolder->getId();  
516 - if ($folder_path_ids[0] == 0) {  
517 - array_shift($folder_path_ids);  
518 - array_shift($folder_path_names);  
519 - }  
520 -  
521 - foreach (range(0, count($folder_path_ids) - 1) as $index) {  
522 - $id = $folder_path_ids[$index];  
523 - $qsFrag2 = $qsFrag;  
524 - $qsFrag2[] = sprintf('fFolderId=%d', $id);  
525 - $qs2 = implode('&',$qsFrag2);  
526 - $url = KTUtil::addQueryStringSelf($qs2);  
527 - $aBreadcrumbs[] = sprintf('<a href="%s">%s</a>', $url, htmlentities($folder_path_names[$index], ENT_NOQUOTES, 'UTF-8'));  
528 - } 521 +
  522 +
  523 + $folder_path_names = $oFolder->getPathArray();
  524 + $folder_path_ids = explode(',', $oFolder->getParentFolderIds());
  525 + $folder_path_ids[] = $oFolder->getId();
  526 +
  527 + if ($folder_path_ids[0] == 0 || $folder_path_ids[0] == null) {
  528 + array_shift($folder_path_ids);
  529 + array_shift($folder_path_names);
  530 + }
  531 + foreach (range(0, count($folder_path_ids) - 1) as $index) {
  532 + $id = $folder_path_ids[$index];
  533 +
  534 + $qsFrag2 = $qsFrag;
  535 + $qsFrag2[] = sprintf('fFolderId=%d', $id);
  536 + $qs2 = implode('&',$qsFrag2);
  537 + $url = KTUtil::addQueryStringSelf($qs2);
  538 + $aBreadcrumbs[] = sprintf('<a href="%s">%s</a>', $url, htmlentities($folder_path_names[$index], ENT_NOQUOTES, 'UTF-8'));
  539 + }
529 540
530 $sBreadcrumbs = implode(' &raquo; ', $aBreadcrumbs); 541 $sBreadcrumbs = implode(' &raquo; ', $aBreadcrumbs);
531 542