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 1dadcf1b8511a64a515578f524cda966f5458044 (commit)
from 156563ab58f152c62cb8297c66e7e180a37353bc (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=1dadcf1b8511a64a515578f524cda966f5458044
commit 1dadcf1b8511a64a515578f524cda966f5458044
Author: Franck Villaume <[email protected]>
Date: Thu Jan 12 19:24:39 2017 +0100
fix inject documents & folders when users are not injected
diff --git a/src/utils/inject-ctf-project-forklift-format.php
b/src/utils/inject-ctf-project-forklift-format.php
index 046bc93..867069c 100755
--- a/src/utils/inject-ctf-project-forklift-format.php
+++ b/src/utils/inject-ctf-project-forklift-format.php
@@ -1,7 +1,7 @@
#! /usr/bin/php -f
<?php
/**
- * Copyright 2016, Franck Villaume - TrivialDev
+ * Copyright 2016,2017, Franck Villaume - TrivialDev
* Copyright 2016, Stéphane-Eymeric Bredthauer - TrivialDev
* http://fusionforge.org
*
@@ -929,8 +929,12 @@ function inject_document(&$g, $document, $folderId,
$project_path) {
$versionComment = substr($versionComment, 0,
MAXSIZE__DOCUMENT_VCOMMENT);
echo 'New document comment:
'.$versionComment."\n";
}
- $createUserObject =
user_get_object_by_name($ff_ctf_mapping['user'][$createdByUsername]);
- $importData = array('nonotice' => 1, 'nocheck' => 1,
'user' => $createUserObject->getID(), 'time' => strtotime($createdate));
+ $createUserID =
get_user_id_by_name($ff_ctf_mapping['user'][$createdByUsername]);
+ if ($createUserID == false) {
+ echo 'Creator User do not exist: use default
admin user'."\n";
+ $createUserID = $adminUser->getID();
+ }
+ $importData = array('nonotice' => 1, 'nocheck' => 1,
'user' => $createUserID, 'time' => strtotime($createdate));
if ($first_version) {
if ($d->create($filename, $filetype, $filedata,
$folderId, $document_title, $document_description, 1, $versionComment,
$importData)) {
$resxid = db_query_params('insert into
ctf_mapping (xid, ffobject, ffid) values ($1, $2, $3)',
@@ -958,12 +962,16 @@ function inject_document(&$g, $document, $folderId,
$project_path) {
}
if (!$first_version && (strlen($lockByUsername) > 0)) {
if (isset($ff_ctf_mapping['user'][$lockByUsername])) {
- $ffUserObject =
user_get_object($ff_ctf_mapping['user'][$lockByUsername]);
- if ($d->setReservedBy(1, $ffUserObject->getID())) {
- echo 'document reserved'."\n";
- } else {
- echo 'Error: unable to reserved document:
'.$d->getErrorMessage()."\n";
- $d->clearError();
+ $ffUserID =
get_user_id_by_name($ff_ctf_mapping['user'][$lockByUsername]);
+ if ($ffUserID != false) {
+ if ($d->setReservedBy(1, $ffUserID)) {
+ echo 'document reserved'."\n";
+ } else {
+ echo 'Error: unable to reserved
document: '.$d->getErrorMessage()."\n";
+ $d->clearError();
+ }
+ } else {
+ echo 'Warning! cannot set reservation. username
not existing.'."\n";
}
} else {
echo 'Warning! cannot set reservation. username not
existing.'."\n";
@@ -1768,7 +1776,7 @@ function inject_field(&$t, $field, &$default_values,
$project_path, $tracker_xid
}
if ($continue) {
- // suppression des valeurs Open et Closed
+ // delete default Open and Closed
if ($field_type == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
$statusFieldValues = $f->getAvailableValues();
$id = get_element_id_by_name($statusFieldValues,'Open');
-----------------------------------------------------------------------
Summary of changes:
src/utils/inject-ctf-project-forklift-format.php | 28 +++++++++++++++---------
1 file changed, 18 insertions(+), 10 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits