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  95e7add065e5e8fc83e996bae5876c597d80b476 (commit)
      from  ccdff7430caab06df402a5da49edc1373d406909 (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=95e7add065e5e8fc83e996bae5876c597d80b476

commit 95e7add065e5e8fc83e996bae5876c597d80b476
Author: Franck Villaume <[email protected]>
Date:   Mon Apr 17 18:32:51 2017 +0200

    forge cli: documentImport, support review comment

diff --git a/src/bin/forge b/src/bin/forge
index 422b879..6a2bdb6 100755
--- a/src/bin/forge
+++ b/src/bin/forge
@@ -418,6 +418,15 @@ class CliActions {
                                                echo 
$dr->getErrorMessage()."\n";
                                                db_rollback();
                                                return false;
+                                       } else {
+                                               foreach($review['comments'] as 
$comment) {
+                                                       $nc = new 
DocumentReviewComment($dr);
+                                                       if 
(!$nc->create($comment['data_array']['userid'], $dr->getID(), 
$comment['data_array']['rcomment'], $comment['data_array']['createdate'])) {
+                                                               echo 
$nc->getErrorMessage()."\n";
+                                                               db_rollback();
+                                                               return false;
+                                                       }
+                                               }
                                        }
                                }
                        }
diff --git a/src/common/docman/DocumentReviewComment.class.php 
b/src/common/docman/DocumentReviewComment.class.php
index 3ad45e1..be55fc2 100644
--- a/src/common/docman/DocumentReviewComment.class.php
+++ b/src/common/docman/DocumentReviewComment.class.php
@@ -125,6 +125,16 @@ class DocumentReviewComment extends FFError {
                }
        }
 
+       function getAttachmentID() {
+               $attachid = null;
+               $res = db_query_params('SELECT attachid FROM 
doc_review_attachments WHERE commentid = $1', array($this->getID()));
+               if ($res && (db_numrows($res) > 0)) {
+                       $attachArr = db_fetch_array($res);
+                       $attachid = $attachArr['attachid'];
+               }
+               return $attachid;
+       }
+
        function create($userid, $reviewid, $rcomment, $createdate) {
                db_begin();
                $res = db_query_params('INSERT INTO doc_review_comments (revid, 
userid, rcomment, createdate) VALUES ($1, $2, $3, $4)',
diff --git a/src/common/docman/DocumentReviewCommentFactory.class.php 
b/src/common/docman/DocumentReviewCommentFactory.class.php
index 6568bc5..597b9d8 100644
--- a/src/common/docman/DocumentReviewCommentFactory.class.php
+++ b/src/common/docman/DocumentReviewCommentFactory.class.php
@@ -22,6 +22,7 @@
  */
 
 require_once $gfcommon.'docman/DocumentReviewComment.class.php';
+require_once $gfcommon.'docman/DocumentReviewCommentAttachment.class.php';
 
 class DocumentReviewCommentFactory extends FFError {
        /**
@@ -57,8 +58,17 @@ class DocumentReviewCommentFactory extends FFError {
                $commentsArr = array();
                $res = db_query_params('SELECT commentid FROM 
doc_review_comments WHERE revid = $1 ORDER BY createdate DESC', 
array($this->DocumentReview->getID()));
                if ($res && (db_numrows($res) > 0)) {
+                       $i = 0;
                        while ($arr = db_fetch_array($res)) {
-                               $commentsArr[] = new 
DocumentReviewComment($this->DocumentReview, $arr['commentid']);
+                               $commentsArr[$i] = new 
DocumentReviewComment($this->DocumentReview, $arr['commentid']);
+                               $attachid = $commentsArr[$i]->getAttachmentID();
+                               if ($attachid) {
+                                       $drca = new 
DocumentReviewCommentAttachment($attachid);
+                                       $commentsArr[$i]->storageref = 
$drca->getFilePath();
+                               } else {
+                                       $commentsArr[$i]->storageref = null;
+                               }
+                               $i++;
                        }
                }
                return $commentsArr;

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

Summary of changes:
 src/bin/forge                                            |  9 +++++++++
 src/common/docman/DocumentReviewComment.class.php        | 10 ++++++++++
 src/common/docman/DocumentReviewCommentFactory.class.php | 12 +++++++++++-
 3 files changed, 30 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to