From 6522c3d3e8332061652bc9f84138221a9c2ffae6 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 15 Sep 2016 21:44:21 +0200 Subject: [PATCH] fix getting workflow states, more debug msg --- utils/xmlimport.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/utils/xmlimport.php b/utils/xmlimport.php index 047c3001e..064be034a 100644 --- a/utils/xmlimport.php +++ b/utils/xmlimport.php @@ -90,6 +90,7 @@ function insert_user($user) { /* {{{ */ $user['attributes']['pwdexpiration']); if(!$newUser) { $logger->err("Could not add user"); + $logger->debug($dms->getDB()->getErrorMsg()); return false; } else { $logger->info("Added user '".$user['attributes']['login']."'"); @@ -166,6 +167,7 @@ function insert_attributedefinition($attrdef) { /* {{{ */ if(in_array('attributedefinitions', $sections)) { if(!$newAttrdef = $dms->addAttributeDefinition($attrdef['attributes']['name'], $attrdef['objecttype'], $attrdef['attributes']['type'], $attrdef['attributes']['multiple'], $attrdef['attributes']['minvalues'], $attrdef['attributes']['maxvalues'], $attrdef['attributes']['valueset'], $attrdef['attributes']['regex'])) { $logger->err("Could not add attribute definition"); + $logger->debug($dms->getDB()->getErrorMsg()); return false; } else { $logger->info("Added attribute definition '".$attrdef['attributes']['name']."'"); @@ -190,6 +192,7 @@ function insert_documentcategory($documentcat) { /* {{{ */ if(in_array('documentcategories', $sections)) { if(!$newCategory = $dms->addDocumentCategory($documentcat['attributes']['name'])) { $logger->err("Error: could not add document category"); + $logger->debug($dms->getDB()->getErrorMsg()); return false; } else { $logger->info("Added document category '".$documentcat['attributes']['name']."'"); @@ -221,6 +224,7 @@ function insert_keywordcategory($keywordcat) { /* {{{ */ if(in_array('keywordcategories', $sections)) { if(!$newCategory = $dms->addKeywordCategory($owner, $keywordcat['attributes']['name'])) { $logger->err("Could not add keyword category"); + $logger->debug($dms->getDB()->getErrorMsg()); return false; } else { $logger->info("Added keyword category '".$keywordcat['attributes']['name']."'"); @@ -228,6 +232,7 @@ function insert_keywordcategory($keywordcat) { /* {{{ */ foreach($keywordcat['keywords'] as $keyword) { if(!$newCategory->addKeywordList($keyword['attributes']['name'])) { $logger->err("Could not add keyword to keyword category"); + $logger->debug($dms->getDB()->getErrorMsg()); return false; } } @@ -256,6 +261,7 @@ function insert_workflow($workflow) { /* {{{ */ } if(!$newWorkflow = $dms->addWorkflow($workflow['attributes']['name'], $initstate)) { $logger->err("Could not add workflow"); + $logger->debug($dms->getDB()->getErrorMsg()); return false; } else { $logger->info("Added workflow '".$workflow['attributes']['name']."'"); @@ -264,14 +270,17 @@ function insert_workflow($workflow) { /* {{{ */ foreach($workflow['transitions'] as $transition) { if(!$state = $dms->getWorkflowState($objmap['workflowstates'][(int) $transition['attributes']['startstate']])) { $logger->err("Could not add workflow because start state of transition is missing"); + $logger->debug($dms->getDB()->getErrorMsg()); return false; } if(!$nextstate = $dms->getWorkflowState($objmap['workflowstates'][(int) $transition['attributes']['nextstate']])) { $logger->err("Could not add workflow because end state of transition is missing"); + $logger->debug($dms->getDB()->getErrorMsg()); return false; } if(!$action = $dms->getWorkflowAction($objmap['workflowactions'][(int) $transition['attributes']['action']])) { $logger->err("Could not add workflow because end state of transition is missing"); + $logger->debug($dms->getDB()->getErrorMsg()); return false; } $tusers = array(); @@ -279,6 +288,7 @@ function insert_workflow($workflow) { /* {{{ */ foreach($transition['users'] as $tuserid) { if(!$tusers[] = $dms->getUser($objmap['users'][(int) $tuserid])) { $logger->err("Could not add workflow because user of transition is missing"); + $logger->debug($dms->getDB()->getErrorMsg()); return false; } } @@ -442,7 +452,7 @@ function insert_document($document) { /* {{{ */ $logger->warning("Workflow ".$initversion['workflow']['id']." cannot be mapped"); } if(array_key_exists((int) $initversion['workflow']['state'], $objmap['workflowstates'])) { - $workflowstate = $dms->getWorkflow($objmap['workflowstates'][(int) $initversion['workflow']['state']]); + $workflowstate = $dms->getWorkflowState($objmap['workflowstates'][(int) $initversion['workflow']['state']]); if(!$workflowstate) { $logger->warning("Workflowstate ".$initversion['workflow']['state']." cannot be mapped"); } @@ -593,7 +603,7 @@ function insert_document($document) { /* {{{ */ $logger->warning("Workflow ".$version['workflow']['id']." cannot be mapped"); } if(array_key_exists((int) $version['workflow']['state'], $objmap['workflowstates'])) { - $workflowstate = $dms->getWorkflow($objmap['workflowstates'][(int) $version['workflow']['state']]); + $workflowstate = $dms->getWorkflowState($objmap['workflowstates'][(int) $version['workflow']['state']]); if(!$workflowstate) { $logger->warning("Workflowstate ".$version['workflow']['state']." cannot be mapped"); } @@ -640,6 +650,7 @@ function insert_document($document) { /* {{{ */ ))) { unlink($filename); $logger->err("Could not add version '".$version['version']."' of document '".$document['attributes']['name']."'"); + $logger->debug($dms->getDB()->getErrorMsg()); return false; } @@ -783,6 +794,7 @@ function insert_folder($folder) { /* {{{ */ if(!$newFolder = $parent->addSubFolder($folder['attributes']['name'], $folder['attributes']['comment'], $owner, $folder['attributes']['sequence'], $attributes)) { $logger->err("Could not add folder"); + $logger->debug($dms->getDB()->getErrorMsg()); return false; } else { $logger->info("Added folder '".$folder['attributes']['name']."'"); @@ -857,6 +869,7 @@ function resolve_links() { /* {{{ */ } if(!$doc->addDocumentLink($target->getID(), $owner->getID(), $doclink['attributes']['public'])) { $logger->err("Could not add document link from ".$doc->getID()." to ".$target->getID()); + $logger->debug($dms->getDB()->getErrorMsg()); } } else { $logger->warning("Target document not found in database");