[Fusionforge-commits] FusionForge branch 6.0 updated. 4def49e docman: fix update when same file already exists in folder.

Franck Villaume nerville at libremir.placard.fr.eu.org
Sun Jun 7 16:59:31 CEST 2015


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, 6.0 has been updated
       via  4def49ee10e65a0195f39e33376f1b0440c7282b (commit)
      from  746150c04ac76b999dd7cb753ce5cedc0fcbe00f (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 -----------------------------------------------------------------
commit 4def49ee10e65a0195f39e33376f1b0440c7282b
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jun 7 16:42:00 2015 +0200

    docman: fix update when same file already exists in folder.

diff --git a/src/common/docman/Document.class.php b/src/common/docman/Document.class.php
index 9aad002..a7c5ffc 100644
--- a/src/common/docman/Document.class.php
+++ b/src/common/docman/Document.class.php
@@ -818,6 +818,12 @@ class Document extends Error {
 			return false;
 		}
 
+		$dg = new DocumentGroup($this->getGroup(), $doc_group);
+		if ($dg->hasDocument($filename)) {
+			$this->setError(_('Document already published in this folder').' '.$dg->getPath());
+			return false;
+		}
+
 		db_begin();
 		$colArr = array('title', 'description', 'stateid', 'doc_group', 'filetype', 'filename', 'updatedate', 'locked', 'locked_by');
 		$valArr = array(htmlspecialchars($title), htmlspecialchars($description), $stateid, $doc_group, $filetype, $filename, time(), 0, NULL);

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

Summary of changes:
 src/common/docman/Document.class.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/common/docman/Document.class.php b/src/common/docman/Document.class.php
index 9aad002..a7c5ffc 100644
--- a/src/common/docman/Document.class.php
+++ b/src/common/docman/Document.class.php
@@ -818,6 +818,12 @@ class Document extends Error {
 			return false;
 		}
 
+		$dg = new DocumentGroup($this->getGroup(), $doc_group);
+		if ($dg->hasDocument($filename)) {
+			$this->setError(_('Document already published in this folder').' '.$dg->getPath());
+			return false;
+		}
+
 		db_begin();
 		$colArr = array('title', 'description', 'stateid', 'doc_group', 'filetype', 'filename', 'updatedate', 'locked', 'locked_by');
 		$valArr = array(htmlspecialchars($title), htmlspecialchars($description), $stateid, $doc_group, $filetype, $filename, time(), 0, NULL);


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list