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  a9989f5345b01908069a5671170cce92ffebdb48 (commit)
      from  a80cbbcdcc319d5d730902a3d7c1d16e22da94a5 (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=a9989f5345b01908069a5671170cce92ffebdb48

commit a9989f5345b01908069a5671170cce92ffebdb48
Author: Franck Villaume <franck.villa...@trivialdev.com>
Date:   Sun May 2 23:02:55 2021 +0200

    fix bug when restore a folder and subfolder

diff --git a/src/common/docman/Document.class.php 
b/src/common/docman/Document.class.php
index 47ee1ab..ad8ba8a 100644
--- a/src/common/docman/Document.class.php
+++ b/src/common/docman/Document.class.php
@@ -7,7 +7,7 @@
  * Copyright 2009, Roland Mas
  * Copyright 2010-2011, Franck Villaume - Capgemini
  * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
- * Copyright 2011-2017, Franck Villaume - TrivialDev
+ * Copyright 2011-2017,2021, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -336,7 +336,7 @@ class Document extends FFObject {
         */
        function getDescription() {
                $result = util_gen_cross_ref($this->data_array['description'], 
$this->Group->getID());
-               return nl2br($result);;
+               return nl2br($result);
        }
 
        /**
@@ -959,12 +959,10 @@ class Document extends FFObject {
                                return false;
                        }
                }
-               if (isset($kwords)) {
-                       if(!$dv->updateDataWords($version, $kwords)) {
-                               $this->setOnUpdateError(_('Error updating 
document version')._(': ').$dv->getErrorMessage());
-                               db_rollback();
-                               return false;
-                       }
+               if (isset($kwords) && !$dv->updateDataWords($version, $kwords)) 
{
+                       $this->setOnUpdateError(_('Error updating document 
version')._(': ').$dv->getErrorMessage());
+                       db_rollback();
+                       return false;
                }
 
                if (filesize($data)) {
diff --git a/src/common/docman/DocumentFactory.class.php 
b/src/common/docman/DocumentFactory.class.php
index 71f431c..349dcaf 100644
--- a/src/common/docman/DocumentFactory.class.php
+++ b/src/common/docman/DocumentFactory.class.php
@@ -7,7 +7,7 @@
  * Copyright 2009, Roland Mas
  * Copyright 2010-2011, Franck Villaume - Capgemini
  * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
- * Copyright 2012-2017, Franck Villaume - TrivialDev
+ * Copyright 2012-2017,2021, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -315,8 +315,9 @@ class DocumentFactory extends FFError {
                }
 
                foreach ($keys as $key) {
-                       if (!array_key_exists($key, $this->Documents))  
continue;               // Should not happen
-
+                       if (!array_key_exists($key, $this->Documents)) {
+                               continue; // Should not happen
+                       }
                        $count = count($this->Documents[$key]);
                        for ($i=0; $i < $count; $i++) {
                                $doc =& $this->Documents[$key][$i];
diff --git a/src/common/docman/DocumentGroup.class.php 
b/src/common/docman/DocumentGroup.class.php
index fefda98..cc8ee47 100644
--- a/src/common/docman/DocumentGroup.class.php
+++ b/src/common/docman/DocumentGroup.class.php
@@ -7,7 +7,7 @@
  * Copyright 2009, Roland Mas
  * Copyright 2010, Franck Villaume - Capgemini
  * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
- * Copyright 2012-2017, Franck Villaume - TrivialDev
+ * Copyright 2012-2017,2021, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -686,10 +686,8 @@ class DocumentGroup extends FFError {
                                return false;
                        }
                        //need to check if user has access to this path. If 
not, return false.
-                       if ($parentDg->getState() != 1) {
-                               if (!forge_check_perm('docman', 
$this->Group->getID(), 'approve')) {
-                                       return false;
-                               }
+                       if ($parentDg->getState() != 1 && 
!forge_check_perm('docman', $this->Group->getID(), 'approve')) {
+                               return false;
                        }
                        $returnPath = $parentDg->getPath($url);
                        if (!$returnPath) {
@@ -734,7 +732,7 @@ class DocumentGroup extends FFError {
                        if ($dgf->isError()) {
                                exit_error($dgf->getErrorMessage(), 'docman');
                        }
-                       $stateidArr = array(1, 3, 4, 5);
+                       $stateidArr = array(1, 2, 3, 4, 5);
                        $nested_groups =& $dgf->getNested($stateidArr);
 
                        $df->setStateID($stateidArr);
@@ -752,13 +750,13 @@ class DocumentGroup extends FFError {
                        $localdocgroup_arr = array();
                        $localdocgroup_arr[] = $this->getID();
                        if (is_array($nested_groups[$this->getID()])) {
-                               foreach ($nested_groups[$this->getID()] as $dg) 
{
-                                       if (!$dg->setStateID($stateid)) {
+                               foreach ($nested_groups[$this->getID()] as 
$ndg) {
+                                       if (!$ndg->setStateID($stateid)) {
                                                return false;
                                        }
-                                       $localdocgroup_arr[] = $dg->getID();
+                                       $localdocgroup_arr[] = $ndg->getID();
                                        $localdf = new 
DocumentFactory($this->Group);
-                                       $localdf->setDocGroupID($dg->getID());
+                                       $localdf->setDocGroupID($ndg->getID());
                                        $d_arr =& $localdf->getDocuments();
                                        if (is_array($d_arr)) {
                                                foreach ($d_arr as $doc) {
@@ -1068,8 +1066,3 @@ class DocumentGroup extends FFError {
                return true;
        }
 }
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
diff --git a/src/common/docman/DocumentManager.class.php 
b/src/common/docman/DocumentManager.class.php
index 307caca..be1243d 100644
--- a/src/common/docman/DocumentManager.class.php
+++ b/src/common/docman/DocumentManager.class.php
@@ -2,7 +2,7 @@
 /**
  * FusionForge Documentation Manager
  *
- * Copyright 2011-2014,2016-2017, Franck Villaume - TrivialDev
+ * Copyright 2011-2014,2016-2017,2021, Franck Villaume - TrivialDev
  * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
  * Copyright 2013, French Ministry of National Education
  * http://fusionforge.org
@@ -435,7 +435,7 @@ class DocumentManager extends FFError {
                for ($i = 0; $i < count($sections); $i++) {
                        $results[$sections[$i]] = 0;
                        $union = 0;
-                       if (count($sections) >= 1 && $i != count($sections) -1) 
{
+                       if (!empty($sections) && $i != count($sections) - 1) {
                                $union = 1;
                        }
                        $qpa = db_construct_qpa($qpa, 'SELECT count(*) FROM 
activity_vw WHERE activity_date BETWEEN $1 AND $2
diff --git a/src/common/docman/actions/editdocgroup.php 
b/src/common/docman/actions/editdocgroup.php
index 503dae3..02007ec 100644
--- a/src/common/docman/actions/editdocgroup.php
+++ b/src/common/docman/actions/editdocgroup.php
@@ -5,7 +5,7 @@
  * Copyright 2000, Quentin Cregan/Sourceforge
  * Copyright 2002-2003, Tim Perdue/GForge, LLC
  * Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2013-2014,2016 Franck Villaume - TrivialDev
+ * Copyright 2013-2014,2016,2021, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -61,11 +61,9 @@ if (!$dg->update($groupname, $parent_dirid, 1, $stateid)) {
 }
 
 $dm = new DocumentManager($g);
-if ($dg->getState() == 2 && ($currentParentID == $dm->getTrashID())) {
-       if (!$dg->setStateID('1', true)) {
-               $error_msg = $dg->getErrorMessage();
-               session_redirect($urlredirect);
-       }
+if (($stateid == 1 || $stateid == 5) && ($currentParentID == 
$dm->getTrashID()) && !$dg->setStateID($stateid, true)) {
+       $error_msg = $dg->getErrorMessage();
+       session_redirect($urlredirect);
 }
 
 $feedback = sprintf(_('Documents folder %s updated successfully'), 
$dg->getName());

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

Summary of changes:
 src/common/docman/Document.class.php        | 14 ++++++--------
 src/common/docman/DocumentFactory.class.php |  7 ++++---
 src/common/docman/DocumentGroup.class.php   | 23 ++++++++---------------
 src/common/docman/DocumentManager.class.php |  4 ++--
 src/common/docman/actions/editdocgroup.php  | 10 ++++------
 5 files changed, 24 insertions(+), 34 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
Fusionforge-commits@lists.fusionforge.org
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to