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 f32411210c99bca44152f838255daa869395da8e (commit)
via 7ff32c34926f38e376e7270bcf94d89f7c0f7fc4 (commit)
from 918087b8fea1646ac65493e02ea0e807c9c78e17 (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=f32411210c99bca44152f838255daa869395da8e
commit f32411210c99bca44152f838255daa869395da8e
Author: Franck Villaume <[email protected]>
Date: Mon May 1 11:44:44 2017 +0200
forge cli: support extrafields in artifactImport & trackerImport
diff --git a/src/bin/forge b/src/bin/forge
index c880c69..b50ecff 100755
--- a/src/bin/forge
+++ b/src/bin/forge
@@ -219,7 +219,16 @@ class CliActions {
}
}
$artifactDump['votes'] = $artf->getVotes();
- $artifactDump['extra_field_data'] =
$artf->getExtraFieldDataText();
+ $extra_field_data = $artf->getExtraFieldDataText();
+ $extra_field_element_ids = $artf->getExtraFieldData();
+ if (is_array($extra_field_element_ids)) {
+ foreach ($extra_field_element_ids as $key =>
$extra_field_element_id) {
+ if (isset($extra_field_data[$key])) {
+
$extra_field_data[$key]['element_id'] = $extra_field_element_id;
+ }
+ }
+ }
+ $artifactDump['extra_field_data'] = $extra_field_data;
} else {
$artifactDump['error'][] = _('Unable to get artifact
id')._(': ').$aid;
}
@@ -239,16 +248,22 @@ class CliActions {
if ($at && is_object($at) && !$at->isError()) {
db_begin();
$artf = new Artifact($at);
- $summary = $stream['data_array']['summary'];
- $details = $stream['data_array']['details'];
$assigned_to =
$this->getMappingId($stream['data_array']['assigned_to'], 'user');
- $priority = $stream['data_array']['priority'];
$extra_fields = array();
+ if (isset($stream['extra_field_data']) &&
is_array($stream['extra_field_data'])) {
+ foreach ($stream['extra_field_data'] as $key =>
$extra_field_data) {
+ if
(isset($extra_field_data['element_id'])) {
+ $efid =
$this->getMappingId($key, 'extrafield');
+ $elid =
$this->getMappingId($extra_field_data['element_id'], 'extrafield_element');
+ $extra_fields[$efid] = $elid;
+ }
+ }
+ }
$importData['user'] =
$this->getMappingId($stream['data_array']['submitted_by'], 'user');
$importData['nopermcheck'] = true;
$importData['nonotice'] = true;
$importData['time'] =
$stream['data_array']['open_date'];
- if (!$artf->create($summary, $details, $assigned_to,
$priority, $extra_fields, $importData)) {
+ if (!$artf->create($stream['data_array']['summary'],
$stream['data_array']['details'], $assigned_to,
$stream['data_array']['priority'], $extra_fields, $importData)) {
echo $artf->getErrorMessage()."\n";
db_rollback();
return false;
@@ -387,14 +402,9 @@ class CliActions {
if ($group && is_object($group) && !$group->isError() &&
$group->usesTracker()) {
db_begin();
$at = new ArtifactType($group);
- $name = $stream['setup']['name'];
- $description = $stream['setup']['description'];
- $email_all = $stream['setup']['email_all_updates'];
- $email_address = $stream['setup']['email_address'];
$due_period =
$stream['setup']['due_period']/(60*60*24); //in days
- $submit_instructions =
$stream['setup']['submit_instructions'];
- $browse_instructions =
$stream['setup']['browse_instructions'];
- if (!$at->create($name, $description, $email_all,
$email_address, $due_period, 0, $submit_instructions, $browse_instructions)) {
+ if (!$at->create($stream['setup']['name'],
$stream['setup']['description'], $stream['setup']['email_all_updates'],
$stream['setup']['email_address'],
+ $due_period, 0,
$stream['setup']['submit_instructions'],
$stream['setup']['browse_instructions'])) {
echo $at->getErrorMessage()."\n";
db_rollback();
return false;
@@ -411,6 +421,27 @@ class CliActions {
return false;
}
$importRefMapping['extrafield'][$extra_field['extra_field_id']] = $ef->getID();
+ if
(isset($extra_field['available_values']) &&
is_array($extra_field['available_values'])) {
+ $clean_status = true;
+ foreach
($extra_field['available_values'] as $available_value) {
+ $efe = new
ArtifactExtraFieldElement($ef);
+ //by default extrafield
status is created with default values: 'Open' & 'Closed'
+ if ($clean_status &&
$ef->getType() == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
+
$existingElements = $ef->getAvailableValues();
+
foreach($existingElements as $existingElement) {
+
$existingElement = new ArtifactExtraFieldElement($ef, $existingElement);
+
$existingElement->delete();
+ }
+ $clean_status =
false;
+ }
+ if
(!$efe->create($available_value['element_name'], $available_value['status_id'],
$available_value['auto_assign_to'], $available_value['is_default'])) {
+ echo
$efe->getErrorMessage()."\n";
+ db_rollback();
+ return false;
+ }
+
$importRefMapping['extrafield_element'][$available_value['element_id']] =
$efe->getID();
+ }
+ }
}
}
db_commit();
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=7ff32c34926f38e376e7270bcf94d89f7c0f7fc4
commit 7ff32c34926f38e376e7270bcf94d89f7c0f7fc4
Author: Franck Villaume <[email protected]>
Date: Mon May 1 11:44:02 2017 +0200
space & missing translation
diff --git a/src/common/tracker/Artifact.class.php
b/src/common/tracker/Artifact.class.php
index c223156..c957df7 100644
--- a/src/common/tracker/Artifact.class.php
+++ b/src/common/tracker/Artifact.class.php
@@ -1682,12 +1682,12 @@ class Artifact extends FFObject {
$ef = $this->ArtifactType->getExtraFields();
while ($arr = db_fetch_array($res)) {
$type=$ef[$arr['extra_field_id']]['field_type'];
- if (($type == ARTIFACT_EXTRAFIELDTYPE_CHECKBOX)
|| ($type==ARTIFACT_EXTRAFIELDTYPE_MULTISELECT)) {
+ if (($type == ARTIFACT_EXTRAFIELDTYPE_CHECKBOX)
|| ($type == ARTIFACT_EXTRAFIELDTYPE_MULTISELECT)) {
//accumulate a sub-array of values in
cases where you may have multiple rows
if
(!array_key_exists($arr['extra_field_id'], $this->extra_field_data) ||
!is_array($this->extra_field_data[$arr['extra_field_id']])) {
$this->extra_field_data[$arr['extra_field_id']] = array();
}
-
$this->extra_field_data[$arr['extra_field_id']][]=$arr['field_data'];
+
$this->extra_field_data[$arr['extra_field_id']][] = $arr['field_data'];
} else {
$this->extra_field_data[$arr['extra_field_id']] = $arr['field_data'];
}
diff --git a/src/common/tracker/ArtifactType.class.php
b/src/common/tracker/ArtifactType.class.php
index 9a465f4..d892460 100644
--- a/src/common/tracker/ArtifactType.class.php
+++ b/src/common/tracker/ArtifactType.class.php
@@ -223,7 +223,7 @@ class ArtifactType extends FFError {
}
if (!$name || !$description || !$due_period) {
- $this->setError(_('ArtifactType: Name, Description, Due
Period, and Status Timeout are required'));
+ $this->setError(_('ArtifactType')._(': ')._('Name,
Description, Due Period, and Status Timeout are required'));
return false;
}
@@ -270,7 +270,7 @@ class ArtifactType extends FFError {
$id = db_insertid($res, 'artifact_group_list',
'group_artifact_id');
if (!$res || !$id) {
- $this->setError('ArtifactType: '.db_error());
+ $this->setError(_('ArtifactType')._(': ').db_error());
db_rollback();
return false;
} else {
@@ -301,7 +301,7 @@ class ArtifactType extends FFError {
array($artifact_type_id,
$this->Group->getID()));
if (!$res || db_numrows($res) < 1) {
- $this->setError('ArtifactType: Invalid ArtifactTypeID');
+ $this->setError(_('ArtifactType')._(': ')._('Invalid
ArtifactTypeID'));
return false;
}
$this->data_array = db_fetch_array($res);
@@ -529,12 +529,12 @@ class ArtifactType extends FFError {
$res = db_query_params('SELECT status_id FROM
artifact_extra_field_elements WHERE element_id=$1',
array($element_id));
if (!$res) {
- $this->setError('Error Remapping
Status: '.db_error());
+ $this->setError(_('Error Remapping
Status')._(': ').db_error());
return false;
}
$status_id = db_result($res, 0, 'status_id');
if ($status_id < 1 || $status_id > 4) {
- $this->setError('INVALID STATUS REMAP:
'.$status_id.' FROM SELECTED ELEMENT: '.$element_id);
+ $this->setError(sprintf(_('INVALID
STATUS REMAP: %d FROM SELECTED ELEMENT: %d'), $status_id, $element_id));
return false;
}
} else {
@@ -542,7 +542,7 @@ class ArtifactType extends FFError {
$res = db_query_params('SELECT status_id FROM
artifact_extra_field_elements WHERE extra_field_id=$1 ORDER BY element_id ASC
LIMIT 1 OFFSET 0',
array($csfield));
if (db_numrows($res) == 0) { // No values
available
- $this->setError('Error Remapping
Status');
+ $this->setError(_('Error Remapping
Status'));
return false;
}
$status_id = db_result($res, 0, 'status_id');
-----------------------------------------------------------------------
Summary of changes:
src/bin/forge | 55 ++++++++++++++++++++++++-------
src/common/tracker/Artifact.class.php | 4 +--
src/common/tracker/ArtifactType.class.php | 12 +++----
3 files changed, 51 insertions(+), 20 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits