[Fusionforge-commits] FusionForge branch master updated. 6.0.4-789-g5de1f79

Franck Villaume nerville at libremir.placard.fr.eu.org
Wed Aug 24 18:25:57 CEST 2016


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  5de1f79e01a1f5031acd1962bed0a2cc0259c6de (commit)
      from  52e8ac54f2e285f0fa6bbc030baa69e397039fa7 (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=5de1f79e01a1f5031acd1962bed0a2cc0259c6de

commit 5de1f79e01a1f5031acd1962bed0a2cc0259c6de
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Aug 24 18:25:50 2016 +0200

    tracker: more fix on clone + partial workflow cloning support

diff --git a/src/common/tracker/ArtifactType.class.php b/src/common/tracker/ArtifactType.class.php
index 11dc710..1615bdb 100644
--- a/src/common/tracker/ArtifactType.class.php
+++ b/src/common/tracker/ArtifactType.class.php
@@ -677,7 +677,8 @@ class ArtifactType extends FFError {
 			$this->setError(_('Clone Tracker Error').' '.$at->getErrorMessage());
 			return false;
 		}
-		$efs = $at->getExtraFields();
+		// do not filter and get disabled fields as well
+		$efs = $at->getExtraFields(array(), true);
 
 		// get current getExtraFields if any
 		$current_efs = $this->getExtraFields();
@@ -698,7 +699,7 @@ class ArtifactType extends FFError {
 					$current_ef_todelete->delete(true,true);
 				}
 			}
-			if (!$nef->create(util_unconvert_htmlspecialchars($ef['field_name']), $ef['field_type'], $ef['attribute1'], $ef['attribute2'], $ef['is_required'], $ef['alias'], $ef['show100'], $ef['show100label'], $ef['description'], $ef['pattern'], 100)) {
+			if (!$nef->create(util_unconvert_htmlspecialchars($ef['field_name']), $ef['field_type'], $ef['attribute1'], $ef['attribute2'], $ef['is_required'], $ef['alias'], $ef['show100'], $ef['show100label'], $ef['description'], $ef['pattern'], 100, 0, $ef['is_hidden_on_submit'], $ef['is_disabled'])) {
 				$this->setError(_('Error Creating New Extra Field')._(':').' '.$nef->getErrorMessage());
 				db_rollback();
 				return false;
@@ -710,36 +711,33 @@ class ArtifactType extends FFError {
 			//
 			$resel = db_query_params('SELECT * FROM artifact_extra_field_elements WHERE extra_field_id=$1',
 						array($ef['extra_field_id']));
+
+			//by default extrafield status is created with default values: 'Open' & 'Closed'
+			if ($nef->getType() == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
+				$existingElements = $nef->getAvailableValues();
+				foreach($existingElements as $existingElement) {
+					$existingElement = new ArtifactExtraFieldElement($nef, $existingElement);
+					$existingElement->delete();
+				}	
+			}
 			while ($el = db_fetch_array($resel)) {
 				//new element
 				$nel = new ArtifactExtraFieldElement($nef);
-				if ($nef->getType() == ARTIFACT_EXTRAFIELDTYPE_STATUS && ($el['element_name'] == 'Open' || $el['element_name'] == 'Closed')) {
-					//by default extrafield status is created with default values: 'Open' & 'Closed'
-				} else {
-					if (!$nel->create(util_unconvert_htmlspecialchars($el['element_name']), $el['status_id'])) {
-						db_rollback();
-						$this->setError(_('Error Creating New Extra Field Element')._(':').' '.$nel->getErrorMessage());
-						return false;
-					}
+				if (!$nel->create(util_unconvert_htmlspecialchars($el['element_name']), $el['status_id'])) {
+					db_rollback();
+					$this->setError(_('Error Creating New Extra Field Element')._(':').' '.$nel->getErrorMessage());
+					return false;
 				}
 				$newEFElIds[$ef['extra_field_id']][$el['element_id']] = $nel->getID();
 			}
 		}
+
 		foreach ($newEFIds as $oldEFId=>$newEFId) {
-			$oef = new ArtifactExtraField($this,$oldEFId);
+			$oef = new ArtifactExtraField($at, $oldEFId);
 			$nef = new ArtifactExtraField($this,$newEFId);
+			// update Dependency between extrafield
 			if ($oef->getParent() != 100) {
-				$nef->update($nef->getName(),
-							$nef->getAttribute1(),
-							$nef->getAttribute2(),
-							$nef->isRequired(),
-							$nef->getAlias(),
-							$nef->getShow100(),
-							$nef->getShow100label(),
-							$nef->getDescription(),
-							$nef->getPattern(),
-							$newEFIds[$oef->getParent()]);
-				if ($nef->isError()) {
+				if (!$nef->update($nef->getName(), $nef->getAttribute1(), $nef->getAttribute2(), $nef->isRequired(), $nef->getAlias(), $nef->getShow100(), $nef->getShow100label(), $nef->getDescription(), $nef->getPattern(), $newEFIds[$oef->getParent()], $nef->isAutoAssign(), $nef->is_hidden_on_submit(), $nef->is_disabled())) {
 					db_rollback();
 					$this->setError(_('Error Updating New Extra Field Parent')._(':').' '.$nef->getErrorMessage());
 					return false;
@@ -771,6 +769,20 @@ class ArtifactType extends FFError {
 					}
 				}
 			}
+			// update workflow if any
+			if ($nef->getType() == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
+				// update the allowed init values
+				$oatw = new ArtifactWorkflow($at, $oldEFId);
+				$natw = new ArtifactWorkflow($this, $newEFId);
+				// template allowed init values
+				$oaivs = $oatw->getNextNodes('100');
+				$naivs = array();
+				foreach ($oaivs as $oaiv) {
+					$naivs[] = $newEFElIds[$oldEFId][$oaiv];
+				}
+				$natw->saveNextNodes('100', $naivs);
+				//TODO implement the rest of the workflow...
+			}
 		}
 
 		db_commit();

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

Summary of changes:
 src/common/tracker/ArtifactType.class.php | 56 +++++++++++++++++++------------
 1 file changed, 34 insertions(+), 22 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list