[Fusionforge-commits] FusionForge branch master updated. v6.0.5-1899-g79c527b

Franck Villaume nerville at libremir.placard.fr.eu.org
Sat Jun 3 17:24:21 CEST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  79c527bcd34fd64bb77668cb3d5ddaee75cbea92 (commit)
      from  f66503ce34fc3eb191d460347fc399657036d882 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=79c527bcd34fd64bb77668cb3d5ddaee75cbea92

commit 79c527bcd34fd64bb77668cb3d5ddaee75cbea92
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sat Jun 3 17:23:58 2017 +0200

    more error check

diff --git a/src/common/tracker/actions/ajax.php b/src/common/tracker/actions/ajax.php
index f3c2b31..4735a49 100644
--- a/src/common/tracker/actions/ajax.php
+++ b/src/common/tracker/actions/ajax.php
@@ -226,24 +226,28 @@ function get_formulas_results($group, $atid, $extra_fields=array(), $status='',
 	}
 	$ret['fields'] = $result;
 	return json_encode($ret);
+	exit();
 }
 
 function add_parent($child_id, $parent_id) {
 	$ret = array('message' => '');
 	$artifact = artifact_get_object($child_id);
-	$at = $artifact->getArtifactType();
-	$child = new ArtifactHtml($at, $child_id);
-	if (!$child->setParent($parent_id)) {
-		$ret['message'] = $child->getErrorMessage();
-		return json_encode($ret);
-		exit();
+	if ($artifact && is_object($artifact) && !$artifact->isError()) {
+		$at = $artifact->getArtifactType();
+		$child = new ArtifactHtml($at, $child_id);
+		if (!$child->setParent($parent_id)) {
+			$ret['message'] = $child->getErrorMessage();
+		} else {
+			$ret['parent_id'] = $parent_id;
+			$ef_parent_arr= $at->getExtraFields(array(ARTIFACT_EXTRAFIELDTYPE_PARENT));
+			$ef_parent = array_shift($ef_parent_arr);
+			$ret['parent_efid'] = $ef_parent['extra_field_id'];
+			$ret['parent_link'] = _artifactid2url($parent_id, 'title');
+			$ret['parent'] = $child->showParent();
+		}
+	} else {
+		$ret['message'] = _('Unable to get artifact');
 	}
-	$ret['parent_id'] = $parent_id;
-	$ef_parent_arr= $at->getExtraFields(array(ARTIFACT_EXTRAFIELDTYPE_PARENT));
-	$ef_parent = array_shift($ef_parent_arr);
-	$ret['parent_efid'] = $ef_parent['extra_field_id'];
-	$ret['parent_link'] = _artifactid2url($parent_id, 'title');
-	$ret['parent'] = $child->showParent();
 	return json_encode($ret);
 	exit();
 }
@@ -251,17 +255,20 @@ function add_parent($child_id, $parent_id) {
 function add_child($parent_id, $child_id) {
 	$ret = array('message' => '');
 	$artifact = artifact_get_object($child_id);
-	$at = $artifact->getArtifactType();
-	$child = new ArtifactHtml($at, $child_id);
-	if (!$child->setParent($parent_id)) {
-		$ret['message'] = $child->getErrorMessage();
-		return json_encode($ret);
-		exit();
+	if ($artifact && is_object($artifact) && !$artifact->isError()) {
+		$at = $artifact->getArtifactType();
+		$child = new ArtifactHtml($at, $child_id);
+		if (!$child->setParent($parent_id)) {
+			$ret['message'] = $child->getErrorMessage();
+		} else {
+			$artifact = artifact_get_object($parent_id);
+			$at = $artifact->getArtifactType();
+			$parent= new ArtifactHtml($at, $parent_id);
+			$ret['children'] = $parent->showChildren();
+		}
+	} else {
+		$ret['message'] = _('Unable to get artifact');
 	}
-	$artifact = artifact_get_object($parent_id);
-	$at = $artifact->getArtifactType();
-	$parent= new ArtifactHtml($at, $parent_id);
-	$ret['children'] = $parent->showChildren();
 	return json_encode($ret);
 	exit();
 }
@@ -273,8 +280,6 @@ function remove_parent($child_id, $parent_id) {
 	$child = new ArtifactHtml($at, $child_id);
 	if (!$child->resetParent()) {
 		$ret['message'] = $child->getErrorMessage();
-		return json_encode($ret);
-		exit();
 	}
 	return json_encode($ret);
 	exit();

-----------------------------------------------------------------------

Summary of changes:
 src/common/tracker/actions/ajax.php | 53 ++++++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list