[Fusionforge-commits] FusionForge branch master updated. 6.0.4-1024-g724c4f9

Franck Villaume nerville at libremir.placard.fr.eu.org
Wed Oct 12 20:28:58 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  724c4f9785d7749bd23decc18308ee87dd033d5b (commit)
       via  320333e95ba85337e99664af8bc3581ee5d9d803 (commit)
      from  f5df0edb16a0cfe6ed8b2dd2370dd60b31cedeee (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=724c4f9785d7749bd23decc18308ee87dd033d5b

commit 724c4f9785d7749bd23decc18308ee87dd033d5b
Merge: f5df0ed 320333e
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Oct 12 20:26:35 2016 +0200

    Merge remote-tracking branch 'bredt/master'


https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=320333e95ba85337e99664af8bc3581ee5d9d803

commit 320333e95ba85337e99664af8bc3581ee5d9d803
Author: Stéphane-Eymeric Bredthauer <sebredthauer at gmail.com>
Date:   Wed Oct 12 17:15:20 2016 +0200

    Tracker: Import improvement

diff --git a/src/common/tracker/Artifact.class.php b/src/common/tracker/Artifact.class.php
index 130ab47..990c4f6 100644
--- a/src/common/tracker/Artifact.class.php
+++ b/src/common/tracker/Artifact.class.php
@@ -181,7 +181,7 @@ class Artifact extends FFError {
 	 * @param	int	$priority	The artifacts priority.
 	 * @param	array	$extra_fields	Array of extra fields like: array(15=>'foobar',22=>'1');
 	 * @param	array	$importData	Array of data to change submitter and time of submit like:
-	 *						array('user' => 127, 'time' => 1234556789)
+	 *						array('user' => 127, 'time' => 1234556789, 'nopermcheck' => true, 'nonotice' => true)
 	 * @return	bool	id on success / false on failure.
 	 */
 	function create($summary, $details, $assigned_to=100, $priority=3, $extra_fields=array(), $importData = array()) {
@@ -189,6 +189,12 @@ class Artifact extends FFError {
 		//	make sure this person has permission to add artifacts
 		//
 
+		if (isset($importData['nonotice']) && $importData['nonotice']) {
+			$sendNotice = false;
+		} else {
+			$sendNotice = true;
+		}
+
 		//
 		//	get the user_id
 		//
@@ -282,7 +288,9 @@ class Artifact extends FFError {
 			//
 			//	now send an email if appropriate
 			//
-			$this->mailFollowupEx(0, 1);
+			if ($sendNotice) {
+				$this->mailFollowupEx(0, 1);
+			}
 			db_commit();
 
 			return $artifact_id;
@@ -759,7 +767,7 @@ class Artifact extends FFError {
 	 * @param	bool	$by		Email $string address of message creator.
 	 * @param	bool	$send_followup	Whether $bool to email out a followup.
 	 * @param	array	$importData	Array of data to change submitter and time of submit like:
-	 *						array('user' => 127, 'time' => 1234556789)
+	 *						array('user' => 127, 'time' => 1234556789, 'nopermcheck' => true, 'nonotice' => true)
 	 *
 	 * @return	bool	success.
 	 */
@@ -773,6 +781,12 @@ class Artifact extends FFError {
 			return false;
 		}
 
+		if (isset($importData['nonotice']) && $importData['nonotice']) {
+			$sendNotice = false;
+		} else {
+			$sendNotice = true;
+		}
+
 		if(array_key_exists('user', $importData)){
 				$user_id = $importData['user'];
 				$user = user_get_object($user_id);
@@ -814,7 +828,7 @@ class Artifact extends FFError {
 
 		$this->updateLastModifiedDate($importData);
 
-		if ($send_followup) {
+		if ($send_followup && $sendNotice) {
 			$this->mailFollowupEx($time, 2, false);
 		}
 		return $res;
@@ -826,7 +840,7 @@ class Artifact extends FFError {
 	 * @param	string	$field_name	The name of the field in the database being modified.
 	 * @param	string	$old_value	The former value of this field.
 	 * @param	array	$importData	Array of data to change submitter and time of submit like:
-	 *						array('user' => 127, 'time' => 1234556789)
+	 *						array('user' => 127, 'time' => 1234556789, 'nopermcheck' => true, 'nonotice' => true)
 	 * @access	private
 	 * @return	boolean	success.
 	 */
@@ -898,7 +912,7 @@ class Artifact extends FFError {
 	 * @param	array	$extra_fields		Array of extra fields like: array(15=>'foobar',22=>'1');
 	 * @param	string  $description		The description.
 	 * @param	array	$importData	Array of data to change submitter and time of submit like:
-	 *						array('user' => 127, 'time' => 1234556789)
+	 *						array('user' => 127, 'time' => 1234556789, 'nopermcheck' => true, 'nonotice' => true)
 	 * @return	boolean	success.
 	 */
 	function update($priority,$status_id,
@@ -908,15 +922,21 @@ class Artifact extends FFError {
 		if (array_key_exists('user', $importData)){
 			$user = $importData['user'];
 		}
-		if (empty($importData)) {
-			$isAnImport = false;
+		if (isset($importData['nopermcheck']) && $importData['nopermcheck']) {
+			$permCheck = false;
+		} else {
+			$permCheck = true;
+		}
+
+		if (isset($importData['nonotice']) && $importData['nonotice']) {
+			$sendNotice = false;
 		} else {
-			$isAnImport = true;
+			$sendNotice = true;
 		}
 		/*
 			Field-level permission checking
 		*/
-		if (!$isAnImport) {
+		if ($permCheck) {
 			if (!forge_check_perm ('tracker', $this->ArtifactType->getID(), 'manager')) {
 				// Non-managers cannot modify these fields
 				$priority=$this->getPriority();
@@ -980,7 +1000,7 @@ class Artifact extends FFError {
 		}
 
 		// Check that assigned_to is a tech for the tracker
-		if ($assigned_to != 100 && !$isAnImport) {
+		if ($assigned_to != 100 && $permCheck) {
 			if (!forge_check_perm_for_user ($assigned_to, 'tracker', $this->ArtifactType->getID(), 'tech')) {
 				$this->setError(_("Invalid assigned person: must be a technician"));
 				return false;
@@ -1010,7 +1030,7 @@ class Artifact extends FFError {
 				return false;
 			}
 			//	do they have perms for new ArtifactType?
-			if (!forge_check_perm ('tracker', $newArtifactType->getID(), 'manager') && !$isAnImport) {
+			if (!forge_check_perm ('tracker', $newArtifactType->getID(), 'manager') && $permCheck) {
 				$this->setPermissionDeniedError();
 				db_rollback();
 				return false;
@@ -1097,7 +1117,7 @@ class Artifact extends FFError {
 			}
 
 			// Check that assigned_to is a tech in the new tracker
-			if ($assigned_to != 100 && !$isAnImport) {
+			if ($assigned_to != 100 && $permCheck) {
 				if (!forge_check_perm ('tracker', $newArtifactType->getID(), 'tech')) {
 					$assigned_to = 100;
 				}
@@ -1224,7 +1244,7 @@ class Artifact extends FFError {
 		}
 
 		if ($update || $send_message){
-			if (!empty($changes)) {
+			if (!empty($changes) && $sendNotice) {
 				// Send the email with changes
 				$this->mailFollowupEx($time, 2, false, $changes);
 			}
@@ -1307,10 +1327,10 @@ class Artifact extends FFError {
 				skip it and continue to next item
 
 */
-		if (empty($importData)) {
-			$isAnImport = false;
+		if (isset($importData['nopermcheck']) && $importData['nopermcheck']) {
+			$permCheck = false;
 		} else {
-			$isAnImport = true;
+			$permCheck = true;
 		}
 		$update = false;
 
@@ -1326,7 +1346,7 @@ class Artifact extends FFError {
 
 		// If there is a status field, then check against the workflow.
 		// Unless if we change type.
-		if ((!isset($changes['Type']) || !$changes['Type']) && !$isAnImport) {
+		if ((!isset($changes['Type']) || !$changes['Type']) && $permCheck) {
 			for ($i=0; $i<count($efk); $i++) {
 				$efid=$efk[$i];
 				$type=$ef[$efid]['field_type'];
@@ -1364,7 +1384,7 @@ class Artifact extends FFError {
 			$type=$ef[$efid]['field_type'];
 
 			// check required fields
-			if (($ef[$efid]['is_required'] || in_array($efid, $rf)) && !$isAnImport) {
+			if (($ef[$efid]['is_required'] || in_array($efid, $rf)) && $permCheck) {
 				if (!array_key_exists($efid, $extra_fields)) {
 					if ($type == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
 						$this->setError(_('Status Custom Field Must Be Set'));
@@ -1404,7 +1424,7 @@ class Artifact extends FFError {
 					$type == ARTIFACT_EXTRAFIELDTYPE_MULTISELECT ||
 					$type == ARTIFACT_EXTRAFIELDTYPE_RADIO ||
 					$type == ARTIFACT_EXTRAFIELDTYPE_CHECKBOX)
-					&& !$isAnImport) {
+					&& $permCheck) {
 				$allowed = false;
 				if (!is_null($ef[$efid]['parent']) && !empty($ef[$efid]['parent']) && $ef[$efid]['parent']!='100') {
 					$aefParentId = $ef[$efid]['parent'];
@@ -1442,7 +1462,7 @@ class Artifact extends FFError {
 					!empty($ef[$efid]['pattern']) &&
 					!empty($extra_fields[$efid]) &&
 					!preg_match('/'.$ef[$efid]['pattern'].'/', $extra_fields[$efid]) &&
-					!$isAnImport) {
+					$permCheck) {
 				$this->setError(sprintf(_("Field %s doesn't match the pattern."), $ef[$efid]['field_name']));
 				return false;
 			}
@@ -1493,7 +1513,7 @@ class Artifact extends FFError {
 							$changes["extra_fields"][$efid] = 1;
 						}
 
-						$this->addHistory($field_name, $this->ArtifactType->getElementName(array_reverse($old_values)));
+						$this->addHistory($field_name, $this->ArtifactType->getElementName(array_reverse($old_values)),$importData);
 						$update = true;
 
 						db_query_params ('DELETE FROM artifact_extra_field_data WHERE	artifact_id=$1 AND extra_field_id=$2',
@@ -1517,9 +1537,9 @@ class Artifact extends FFError {
 
 					// Adding history with previous value.
 					if (($type == ARTIFACT_EXTRAFIELDTYPE_SELECT) || ($type == ARTIFACT_EXTRAFIELDTYPE_RADIO) || ($type == ARTIFACT_EXTRAFIELDTYPE_STATUS)) {
-						$this->addHistory($field_name,$this->ArtifactType->getElementName(db_result($resd,0,'field_data')));
+						$this->addHistory($field_name,$this->ArtifactType->getElementName(db_result($resd,0,'field_data')),$importData);
 					} else {
-						$this->addHistory($field_name, db_result($resd,0,'field_data'));
+						$this->addHistory($field_name, db_result($resd,0,'field_data'),$importData);
 					}
 					$update = true;
 				}

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

Summary of changes:
 src/common/tracker/Artifact.class.php | 68 ++++++++++++++++++++++-------------
 1 file changed, 44 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list