[Fusionforge-commits] FusionForge branch master updated. 6.0.4-783-ga268198

Franck Villaume nerville at libremir.placard.fr.eu.org
Tue Aug 23 16:06:52 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  a2681980d83655758299d8ecb61e09a18fb5dbb0 (commit)
      from  3cea2fe1d0bc5b6a3ab6a1f11198a6fc55b41003 (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=a2681980d83655758299d8ecb61e09a18fb5dbb0

commit a2681980d83655758299d8ecb61e09a18fb5dbb0
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Tue Aug 23 16:06:47 2016 +0200

    docman: fix template in relation with public/private status per documentgroup

diff --git a/src/common/docman/DocumentGroup.class.php b/src/common/docman/DocumentGroup.class.php
index ede80f2..b3e2a64 100644
--- a/src/common/docman/DocumentGroup.class.php
+++ b/src/common/docman/DocumentGroup.class.php
@@ -130,7 +130,7 @@ class DocumentGroup extends FFError {
 	 * @return	boolean	true on success / false on failure.
 	 * @access	public
 	 */
-	function create($name, $parent_doc_group = 0, $state = 1, $createtimestamp = null) {
+	function create($name, $parent_doc_group = 0, $state = 1, $createtimestamp = null, $forcecreate = false) {
 		//
 		//	data validation
 		//
@@ -159,14 +159,16 @@ class DocumentGroup extends FFError {
 			}
 		}
 
-		$res = db_query_params('SELECT * FROM doc_groups WHERE groupname=$1 AND parent_doc_group=$2 AND group_id=$3',
-					array($name,
-						$parent_doc_group,
-						$this->Group->getID())
-					);
-		if ($res && db_numrows($res) > 0) {
-			$this->setError(_('Folder name already exists'));
-			return false;
+		if (!$forcecreate) {
+			$res = db_query_params('SELECT * FROM doc_groups WHERE groupname=$1 AND parent_doc_group=$2 AND group_id=$3',
+						array($name,
+							$parent_doc_group,
+							$this->Group->getID())
+						);
+			if ($res && db_numrows($res) > 0) {
+				$this->setError(_('Folder name already exists'));
+				return false;
+			}
 		}
 
 		$createtimestamp = (($createtimestamp) ? $createtimestamp : time());
diff --git a/src/common/include/Group.class.php b/src/common/include/Group.class.php
index 5c0e4f6..a8dfdb7 100644
--- a/src/common/include/Group.class.php
+++ b/src/common/include/Group.class.php
@@ -2598,19 +2598,19 @@ class Group extends FFError {
 					// First pass: create all docgroups
 					$id_mappings['docman_docgroup'][0] = 0;
 					foreach ($olddgf->getDocumentGroups(array(1, 5)) as $o) {
-						$ndgf = new DocumentGroup($this);
+						$ndg = new DocumentGroup($this);
 						// .trash is a reserved directory
-						if ($o->getName() != '.trash' && $o->getParentID() == 0) {
-							$ndgf->create($this->replaceTemplateStrings($o->getName()));
-							$id_mappings['docman_docgroup'][$o->getID()] = $ndgf->getID();
+						if ($o->getName() != '.trash') {
+							$status = $ndg->create($this->replaceTemplateStrings($o->getName()), 0, 1, null, true);
+							$id_mappings['docman_docgroup'][$o->getID()] = $ndg->getID();
 						}
 					}
 					// Second pass: restore hierarchy links & stateid
 					foreach ($olddgf->getDocumentGroups(array(1, 5)) as $o) {
 						$ndgf = new DocumentGroup($this);
-						if ($o->getName() != '.trash' && $o->getParentID() == 0) {
+						if ($o->getName() != '.trash') {
 							$ndgf->fetchData($id_mappings['docman_docgroup'][$o->getID()]);
-							$ndgf->update($ndgf->getName(), $id_mappings['docman_docgroup'][$o->getParentID()], $id_mappings['docman_docgroup'][$o->getState()]);
+							$ndgf->update($ndgf->getName(), $id_mappings['docman_docgroup'][$o->getParentID()], 0, $o->getState());
 						}
 					}
 				}

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

Summary of changes:
 src/common/docman/DocumentGroup.class.php | 20 +++++++++++---------
 src/common/include/Group.class.php        | 12 ++++++------
 2 files changed, 17 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list