[Fusionforge-commits] FusionForge branch master updated. 6.0.4-1225-g0319344

Franck Villaume nerville at libremir.placard.fr.eu.org
Wed Dec 7 07:01:38 CET 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  031934441b35c26ed15c8d3032be826274384cdd (commit)
       via  1472c7ed133a17f446ad376fc8edcf0474ba733c (commit)
       via  4a272d33e4c1289e026b0a503eec42554287f8bc (commit)
       via  b31d13efed23a225a8daf5551cdd12ac81ea3892 (commit)
       via  99c008840e744966de77af01572780d6c9789e5a (commit)
       via  bc30c6cb09b3bf551a6926434aae11c899ace6db (commit)
      from  4e47578f10c2ecf74b73b6efa6f7f5de58974bb2 (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=031934441b35c26ed15c8d3032be826274384cdd

commit 031934441b35c26ed15c8d3032be826274384cdd
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Dec 7 06:59:58 2016 +0100

    docman review: implement complete function

diff --git a/src/common/docman/DocumentReview.class.php b/src/common/docman/DocumentReview.class.php
index 58d64d9..cbecad0 100644
--- a/src/common/docman/DocumentReview.class.php
+++ b/src/common/docman/DocumentReview.class.php
@@ -95,13 +95,19 @@ class DocumentReview extends FFError {
 		return $this->data_array['enddate'];
 	}
 
+	function getStartdate() {
+		return $this->data_array['startdate'];
+	}
+
 	function getUsers($statusid = array(), $type = false) {
-		$qpa = db_construct_qpa(false, 'SELECT * FROM doc_review_users WHERE revid = $1', array($this->getID()));
+		$qpa = db_construct_qpa(false, 'SELECT revid, userid, typeid, doc_review_users.statusid, updatedate, doc_review_users_status.name as statusname
+						FROM doc_review_users, doc_review_users_status
+						WHERE doc_review_users.statusid = doc_review_users_status.statusid AND revid = $1', array($this->getID()));
 		if ($statusid && is_array($statusid)) {
-			$qpa = db_construct_qpa($qpa, ' AND statusid = ANY ($1)', array(db_int_array_to_any_clause($statusid)));
+			$qpa = db_construct_qpa($qpa, ' AND doc_review_users.statusid = ANY ($1)', array(db_int_array_to_any_clause($statusid)));
 		}
 		if ($type) {
-			$qpa = db_construct_qpa($qpa, ' AND typeid = $1', array($type));
+			$qpa = db_construct_qpa($qpa, ' AND doc_review_users.typeid = $1', array($type));
 		}
 		$res = db_query_qpa($qpa);
 		$users = array();
@@ -147,7 +153,7 @@ class DocumentReview extends FFError {
 
 	function getVersion() {
 		if (isset($this->version) && $this->version) {
-			return $this-version;
+			return $this->version;
 		}
 		$res = db_query_params('SELECT version FROM doc_data_version, doc_review_version WHERE doc_data_version.serial_id = doc_review_version.serialid AND doc_review_version.revid = $1',
 					array($this->getID()));
@@ -155,7 +161,7 @@ class DocumentReview extends FFError {
 			$this->version = db_result($res, 0, 0);
 			return $this->version;
 		} else {
-			return $this->setError(db_error());
+			return db_error();
 		}
 	}
 
@@ -168,17 +174,21 @@ class DocumentReview extends FFError {
 			$this->serialid = db_result($res, 0, 0);
 			return $this->serialid;
 		} else {
-			return $this->setError(db_error());
+			return db_error();
 		}
 	}
 
-
 	function getDeleteAction() {
 		global $HTML;
 		return util_make_link('#', $HTML->getRemovePic(_('Permanently delete this review'), 'delreview'), array('id' => 'review_action_delete', 'onclick' => 'javascript:controllerListFile.deleteReview({review: '.$this->getID().'})'), true);
 	}
 
-	function getEditAction() {
+	function getReadAction() {
+		global $HTML;
+		return util_make_link('#', $HTML->getEditFilePic(_('View this review'), 'viewreview'), array('id' => 'review_action_view', 'onclick' => 'javascript:controllerListFile.viewReview({review: '.$this->getID().'})'), true);
+	}
+
+	function getEditAction($edit = true) {
 		global $HTML;
 		$enddate = strftime(_('%Y-%m-%d'), $this->getEnddate());
 		$users = $this->getUsers(array(1, 2));
@@ -191,13 +201,25 @@ class DocumentReview extends FFError {
 				$optionalUsers[] = $user['userid'];
 			}
 		}
-		return util_make_link('#', $HTML->getConfigurePic(_('Edit this review'), 'editreview'),
+		if ($edit) {
+			return util_make_link('#', $HTML->getConfigurePic(_('Edit this review'), 'editreview'),
 					array('id' => 'review_action_edit', 'onclick' => 'javascript:controllerListFile.toggleEditReviewView({review: '.$this->getID().', title: \''.addslashes($this->getTitle()).'\',
 																		description: \''.addslashes($this->getDescription()).'\',
 																		endreviewdate: \''.util_html_encode($enddate).'\',
 																		serialid: '.$this->getSerialID().',
 																		mandatoryusers: '.json_encode($mandatoryUsers).',
 																		optionalusers: '.json_encode($optionalUsers).',})'), true);
+		} else {
+			return util_make_link('#', $HTML->getClosedTicketPic(_('Complete this review'), 'completereview'),
+					array('id' => 'review_action_complete', 'onclick' => 'javascript:controllerListFile.toggleEditReviewView({review: '.$this->getID().', title: \''.addslashes($this->getTitle()).'\',
+																		description: \''.addslashes($this->getDescription()).'\',
+																		endreviewdate: \''.util_html_encode($enddate).'\',
+																		serialid: '.$this->getSerialID().',
+																		mandatoryusers: '.json_encode($mandatoryUsers).',
+																		optionalusers: '.json_encode($optionalUsers).',
+																		complete: 1})'), true);
+
+		}
 	}
 
 	function getReminderAction() {
@@ -206,8 +228,7 @@ class DocumentReview extends FFError {
 	}
 
 	function getCompleteAction() {
-		global $HTML;
-		return util_make_link('#', $HTML->getClosedTicketPic(_('Complete this review'), 'completereview'), array('id' => 'review_action_complete', 'onclick' => 'javascript:controllerListFile.toggleCompleteReviewView({review: '.$this->getID().'})'), true);
+		return $this->getEditAction(false);
 	}
 
 	function getCommentAction() {
@@ -215,6 +236,18 @@ class DocumentReview extends FFError {
 		return util_make_link('#', $HTML->getEditFilePic(_('Comment the review'), 'remindercomment'), array('id' => 'review_action_comment', 'onclick' => 'javascript:controllerListFile.toggleCommentReviewView({review: '.$this->getID().'})'), true);
 	}
 
+	function showCompleteFormHTML() {
+		global $HTML;
+		$return = $HTML->listTableTop();
+		$cells = array();
+		$cells[] = array(_('Close the review')._(':'), 'style' => 'width: 30%;');
+		$cells[][] = html_e('input', array('type' => 'checkbox', 'name' => 'review-completedchecked', 'value' => 1));
+		$return .= $HTML->multiTableRow(array(), $cells);
+		$return .= $HTML->listTableBottom();
+		$return .= html_ac(html_ap() -1);
+		return $return;
+	}
+
 	function showCreateFormHTML() {
 		global $HTML;
 		$dvf = new DocumentVersionFactory($this->Document);
@@ -256,11 +289,15 @@ class DocumentReview extends FFError {
 			$cells[][] = _('Add optional reviewers')._(':');
 			$cells[][] = html_e('p', array(), html_build_multiple_select_box_from_arrays($userIDArray, $userNameArray, 'review-select-optional-users[]', array(), 8, false, 'none', false, array('id' => 'review-select-optional-users')));
 			$return .= $HTML->multiTableRow(array(), $cells);
+			$cells = array();
 			$return .= $HTML->listTableBottom();
 			$return .= $HTML->addRequiredFieldsInfoBox();
 			$return .= html_e('input', array('type' => 'hidden', 'id' => 'new_review', 'name' => 'new_review', 'value' => 0));
 			$return .= html_e('input', array('type' => 'hidden', 'id' => 'review_id', 'name' => 'review_id', 'value' => 0));
+			$return .= html_e('input', array('type' => 'hidden', 'id' => 'review_complete', 'name' => 'review_complete', 'value' => 0));
 			$return .= html_ac(html_ap() -1);
+			$return .= html_e('div', array('id' => 'editfile-userstatusreview'), '', false);
+			$return .= html_e('div', array('id' => 'editfile-completedreview'), '', false);
 			$javascript = 'jQuery("#datepicker_end_review_date").datepicker({dateFormat: "'.$date_format_js.'"});';
 			$return .= html_e('script', array( 'type'=>'text/javascript'), '//<![CDATA['."\n".$javascript."\n".'//]]>');
 		} else {
@@ -269,6 +306,31 @@ class DocumentReview extends FFError {
 		return $return;
 	}
 
+	function showUsersStatusHTML() {
+		global $HTML;
+		$mandatoryUsers = $this->getMandatoryUsers();
+		$optionalUsers = $this->getOptionalUsers();
+		$return = $HTML->listTableTop(array(_('Reviewer Name'), _('M/O'), _('Status')));
+		foreach ($mandatoryUsers as $mandatoryUser) {
+			$cells = array();
+			$userObject = user_get_object($mandatoryUser['userid']);
+			$cells[][] = util_display_user($userObject->getUnixName(), $userObject->getID(), $userObject->getRealName());
+			$cells[][] = _('mandatory');
+			$cells[][] = $mandatoryUser['statusname'];
+			$return .= $HTML->multiTableRow(array(), $cells);
+		}
+		foreach ($optionalUsers as $optionalUser) {
+			$cells = array();
+			$userObject = user_get_object($optionalUser['userid']);
+			$cells[][] = util_display_user($userObject->getUnixName(), $userObject->getID(), $userObject->getRealName());
+			$cells[][] = _('mandatory');
+			$cells[][] = $optionalUser['statusname'];
+			$return .= $HTML->multiTableRow(array(), $cells);
+		}
+		$return .= $HTML->listTableBottom();
+		return $return;
+	}
+
 	function create($reviewversionserialid, $reviewtitle, $reviewdescription, $reviewenddate, $reviewmandatoryusers, $reviewoptionalusers = array()) {
 		if (!is_int($reviewversionserialid) && $reviewversionserialid < 1) {
 			$this->setError(_('Missing Version ID to create review'));
@@ -391,9 +453,9 @@ class DocumentReview extends FFError {
 	function getProgressbar() {
 		$doneMandatoryUsers = array();
 		$mandatoryUsers = $this->getMandatoryUsers();
-		foreach ($mandatoryUsers as $mandarotyUser) {
-			if ($mandarotyUser['statusid'] == 2) {
-				$doneMandatoryUsers[] = $mandarotyUser;
+		foreach ($mandatoryUsers as $mandatoryUser) {
+			if ($mandatoryUser['statusid'] == 2) {
+				$doneMandatoryUsers[] = $mandatoryUser;
 			}
 		}
 		$percentDoneMandatoryUsers = ((count($doneMandatoryUsers) / count($mandatoryUsers)) * 100).'%';
@@ -409,7 +471,7 @@ class DocumentReview extends FFError {
 		} else {
 			$percentDoneOptionalUsers = _('n/a');
 		}
-		return html_e('span', array('title' => _('% of mandotary users with status done - % of optional users with status done')), $percentDoneMandatoryUsers.' - '.$percentDoneOptionalUsers);
+		return html_e('span', array('title' => _('% of mandatory users with status done - % of optional users with status done')), $percentDoneMandatoryUsers.' - '.$percentDoneOptionalUsers);
 	}
 
 	function delete() {
@@ -458,9 +520,9 @@ class DocumentReview extends FFError {
 				db_query_params('UPDATE doc_review_version SET serialid = $1 WHERE revid = $2', array($reviewversionserialid, $this->getID()));
 			}
 			$mandatoryUsers = $this->getMandatoryUsers();
-			$mandarotyUserIDs = array();
+			$mandatoryUserIDs = array();
 			foreach ($mandatoryUsers as $mandatoryUser) {
-				$mandarotyUserIDs[] = $mandatoryUser['userid'];
+				$mandatoryUserIDs[] = $mandatoryUser['userid'];
 			}
 			$optionalUsers = $this->getOptionalUsers();
 			$optionalUserIDs = array();
@@ -468,9 +530,8 @@ class DocumentReview extends FFError {
 				$optionalUserIDs[] = $optionalUser['userid'];
 			}
 			foreach ($reviewmandatoryusers as $reviewmandatoryuser) {
-				if (in_array($reviewmandatoryuser, $mandarotyUserIDs)) {
-					unset($mandarotyUserIDs[array_search($reviewmandatoryuser, $mandarotyUserIDs)]);
-					var_dump($mandarotyUserIDs);
+				if (in_array($reviewmandatoryuser, $mandatoryUserIDs)) {
+					unset($mandatoryUserIDs[array_search($reviewmandatoryuser, $mandatoryUserIDs)]);
 				} elseif (in_array($reviewmandatoryuser, $optionalUserIDs)) {
 					db_query_params('UPDATE doc_review_users SET typeid = $1 WHERE userid = $2 AND revid = $3', array(1, $reviewmandatoryuser, $this->getID()));
 					unset($optionalUserIDs[array_search($reviewmandatoryuser, $optionalUserIDs)]);
@@ -479,16 +540,16 @@ class DocumentReview extends FFError {
 				}
 			}
 			foreach ($reviewoptionalusers as $reviewoptionaluser) {
-				if (in_array($reviewoptionaluser, $mandarotyUserIDs)) {
+				if (in_array($reviewoptionaluser, $mandatoryUserIDs)) {
 					db_query_params('UPDATE doc_review_users SET typeid = $1 WHERE userid = $2 AND revid = $3', array(2, $reviewoptionaluser, $this->getID()));
-					unset($mandarotyUserIDs[array_search($reviewoptionaluser, $mandarotyUserIDs)]);
+					unset($mandatoryUserIDs[array_search($reviewoptionaluser, $mandatoryUserIDs)]);
 				} elseif (in_array($reviewoptionaluser, $optionalUserIDs)) {
 					unset($optionalUserIDs[array_search($reviewoptionaluser, $optionalUserIDs)]);
 				} else {
 					db_query_params('INSERT INTO doc_review_users (revid, userid, typeid, statusid) VALUES ($1, $2, $3, $4)', array($this->getID(), $reviewoptionaluser, 2, 1));
 				}
 			}
-			foreach ($mandarotyUserIDs as $mandarotyUserID) {
+			foreach ($mandatoryUserIDs as $mandarotyUserID) {
 				db_query_params('DELETE from doc_review_users WHERE userid = $1 AND revid = $2', array($mandarotyUserID, $this->getID()));
 			}
 			foreach ($optionalUserIDs as $optionalUserID) {
@@ -502,22 +563,16 @@ class DocumentReview extends FFError {
 		return false;
 	}
 
-	function getNbComments() {
-		$res = db_query_params('SELECT COUNT(commentid) FROM doc_review_comments WHERE revid = $1', array($this->getID()));
+	function close($reviewversionserialid, $reviewtitle, $reviewdescription) {
+		$res = db_query_params('UPDATE doc_review SET (enddate, title, description, statusid) = ($1, $2, $3, $4) WHERE revid = $5',
+					array(time(), $reviewtitle, $reviewdescription, 2, $this->getID()));
 		if ($res) {
-			return db_result($res, 0, 0);
-		}
-		return null;
-	}
-
-	function getComments() {
-		return array();
-	}
-
-	function isCompleted() {
-		if ($this->getStatusID() == 2) {
+			if ($reviewversionserialid != $this->getSerialID()) {
+				db_query_params('UPDATE doc_review_version SET serialid = $1 WHERE revid = $2', array($reviewversionserialid, $this->getID()));
+			}
 			return true;
 		} else {
+			$this->setError(db_error());
 			return false;
 		}
 	}
diff --git a/src/common/docman/DocumentReviewFactory.class.php b/src/common/docman/DocumentReviewFactory.class.php
index b825b43..a56906f 100644
--- a/src/common/docman/DocumentReviewFactory.class.php
+++ b/src/common/docman/DocumentReviewFactory.class.php
@@ -21,6 +21,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+require_once $gfcommon.'docman/DocumentReview.class.php';
+require_once $gfcommon.'docman/DocumentReviewCommentFactory.class.php';
+
 class DocumentReviewFactory extends FFError {
 	/**
 	 * The Document object.
@@ -71,7 +74,7 @@ class DocumentReviewFactory extends FFError {
 		$return = '';
 		$this->getReviews($serialids);
 		if ($this->getReviewsCounter() > 0) {
-			$titleArr = array('ID', _('Version'), _('Title'), _('Created By'), _('Status'), _('End date'), _('Progress'), _('Comments'), _('Actions'));
+			$titleArr = array('ID', _('Version'), _('Title'), _('Created By'), _('Status'), _('Start date'), _('End date'), _('Progress'), _('Comments'), _('Actions'));
 			$classth = array('', '', '', '', '', 'unsortable');
 			$return .= $HTML->listTableTop($titleArr, array(), 'full sortable', 'sortable_docman_listreview', $classth);
 			foreach ($this->reviews as $thereview) {
@@ -82,27 +85,30 @@ class DocumentReviewFactory extends FFError {
 				$cells[] = array($dr->getTitle(), 'title' => $dr->getDescription());
 				$cells[][] = $dr->getCreateByRealNameLink();
 				$cells[][] = $dr->getStatusIcon();
+				$cells[][] = strftime(_('%Y-%m-%d'), $dr->getStartdate());
 				$overdue = '';
-				if (time() > $dr->getEnddate()) {
+				if (($dr->getStatusID() != 2) && (time() > $dr->getEnddate())) {
 					$overdue = $HTML->getErrorPic(_('Review overdue'), 'overdue');
 				}
 				$cells[][] = strftime(_('%Y-%m-%d'), $dr->getEnddate()).$overdue;
 				$cells[][] = $dr->getProgressbar();
-				$cells[][] = $dr->getNbComments();
+				$drcf = new DocumentReviewCommentFactory($dr);
+				$cells[][] = $drcf->getNbComments();
 				$actions = '';
 				$user = session_get_user();
 				$users = $dr->getUsers(array(1, 2));
-				if ($user->getID() == $dr->getCreatedBy()) {
-					$actions .= $dr->getReminderAction().$dr->getEditAction();
-					if ($dr->isCompleted()) {
-						$actions .= $dr->getCompleteAction();
+				if ($dr->getStatusID() != 2) {
+					if ($user->getID() == $dr->getCreatedBy()) {
+						$actions .= $dr->getReminderAction().$dr->getEditAction().$dr->getCompleteAction();
 					}
-				}
-				if (($dr->getStatusID() == 1) && (($user->getID() == $dr->getCreatedBy()) || in_array($user->getID(), $users))) {
-					$actions .= $dr->getCommentAction();
-				}
-				if ($user->getID() == $dr->getCreatedBy()) {
-					$actions .= $dr->getDeleteAction();
+					if (($dr->getStatusID() == 1) && (($user->getID() == $dr->getCreatedBy()) || in_array($user->getID(), $users))) {
+						$actions .= $dr->getCommentAction();
+					}
+					if ($user->getID() == $dr->getCreatedBy()) {
+						$actions .= $dr->getDeleteAction();
+					}
+				} else {
+					$actionns .= $dr->getReadAction();
 				}
 
 				$cells[][] = $actions;
diff --git a/src/common/docman/actions/editfile.php b/src/common/docman/actions/editfile.php
index 3265421..2e65a04 100644
--- a/src/common/docman/actions/editfile.php
+++ b/src/common/docman/actions/editfile.php
@@ -194,6 +194,7 @@ switch ($subaction) {
 		$reviewoptionalusers = getArrayFromRequest('review-select-optional-users', array());
 		$new_review = getIntFromRequest('new_review');
 		$reviewid = getIntFromRequest('review_id');
+		$reviewcompletedchecked = getIntFromRequest('review-completedchecked');
 		if ($reviewversionserialid) {
 			if ($new_review) {
 				$dr = new DocumentReview($d);
@@ -204,10 +205,18 @@ switch ($subaction) {
 				}
 			} else {
 				$dr = new DocumentReview($d, $reviewid);
-				if ($dr->update($reviewversionserialid, $reviewtitle, $reviewdescription, $reviewenddate, $reviewmandatoryusers, $reviewoptionalusers)) {
-					$feedback = _('Review updated');
+				if ($reviewcompletedchecked) {
+					if ($dr->close($reviewversionserialid, $reviewtitle, $reviewdescription)) {
+						$feedback = _('Review closed successfully');
+					} else {
+						$error_msg = $dr->getErrorMessage();
+					}
 				} else {
-					$error_msg = $dr->getErrorMessage();
+					if ($dr->update($reviewversionserialid, $reviewtitle, $reviewdescription, $reviewenddate, $reviewmandatoryusers, $reviewoptionalusers)) {
+						$feedback = _('Review updated');
+					} else {
+						$error_msg = $dr->getErrorMessage();
+					}
 				}
 			}
 		} else {
diff --git a/src/www/docman/scripts/DocManController.js b/src/www/docman/scripts/DocManController.js
index ea482da..1bba43d 100644
--- a/src/www/docman/scripts/DocManController.js
+++ b/src/www/docman/scripts/DocManController.js
@@ -530,6 +530,8 @@ DocManListFileController.prototype =
 		jQuery('#review-select-optional-users').val('');
 		jQuery('#review-select-mandatory-users').gentleSelect({columns: 3, itemWidth: 150});
 		jQuery('#review-select-optional-users').gentleSelect({columns: 3, itemWidth: 150});
+		jQuery('#editfile-userstatusreview').empty();
+		jQuery('#editfile-completedreview').empty();
 		if (jQuery('#editfile-createreview').is(':visible')) {
 			jQuery('#editfile-createreview').hide();
 			jQuery('#new_review').val(0);
@@ -545,6 +547,9 @@ DocManListFileController.prototype =
 			jQuery('#editfile-createreview').hide();
 			jQuery('#new_review').val(0);
 			jQuery('#review_id').val(0);
+			jQuery('#review_complete').val(0);
+			jQuery('#editfile-userstatusreview').empty();
+			jQuery('#editfile-completedreview').empty();
 		} else {
 			jQuery('#review_id').val(this.review.review);
 			jQuery('#review-title').val(this.review.title);
@@ -552,10 +557,24 @@ DocManListFileController.prototype =
 			jQuery('#datepicker_end_review_date').val(this.review.endreviewdate);
 			jQuery('#review-serialid').val(this.review.serialid);
 			jQuery('[class^=gentle]').remove();
-			jQuery('#review-select-mandatory-users').val(this.review.mandatoryusers);
-			jQuery('#review-select-optional-users').val(this.review.optionalusers);
-			jQuery('#review-select-mandatory-users').gentleSelect({columns: 3, itemWidth: 150});
-			jQuery('#review-select-optional-users').gentleSelect({columns: 3, itemWidth: 150});
+			if (this.review.complete) {
+				jQuery('#review_complete').val(1);
+				jQuery.getJSON(this.docparams.docManURL + '/?group_id=' + this.docparams.groupId + '&action=getdocreviewcompleteform&docid='+this.docparams.id+'&revid='+this.review.review , jQuery.proxy(function(data){
+					if (typeof data.html != 'undefined') {
+						jQuery('#editfile-completedreview').prepend(data.html);
+					}
+				}, this.review));
+			} else {
+				jQuery('#review-select-mandatory-users').val(this.review.mandatoryusers);
+				jQuery('#review-select-optional-users').val(this.review.optionalusers);
+				jQuery('#review-select-mandatory-users').gentleSelect({columns: 3, itemWidth: 150});
+				jQuery('#review-select-optional-users').gentleSelect({columns: 3, itemWidth: 150});
+			}
+			jQuery.getJSON(this.docparams.docManURL + '/?group_id=' + this.docparams.groupId + '&action=getdocreviewuserstatus&docid='+this.docparams.id+'&revid='+this.review.review , jQuery.proxy(function(data){
+				if (typeof data.html != 'undefined') {
+					jQuery('#editfile-userstatusreview').prepend(data.html);
+				}
+			}, this.review));
 			jQuery('#new_review').val(0);
 			jQuery('#editfile-createreview').show();
 		}

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=1472c7ed133a17f446ad376fc8edcf0474ba733c

commit 1472c7ed133a17f446ad376fc8edcf0474ba733c
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Dec 7 06:59:25 2016 +0100

    fix PHP syntax

diff --git a/src/common/tracker/Artifact.class.php b/src/common/tracker/Artifact.class.php
index 75b5999..c2c458d 100644
--- a/src/common/tracker/Artifact.class.php
+++ b/src/common/tracker/Artifact.class.php
@@ -67,22 +67,21 @@ $ARTIFACT_OBJ = array();
  * @param	array|bool	$data		The result array, if it's passed in
  * @return	Artifact	Artifact object
  */
-function &artifact_get_object($artifact_id, $data=false) {
+function &artifact_get_object($artifact_id, $data = false) {
 	global $ARTIFACT_OBJ;
 	if (!isset($ARTIFACT_OBJ["_".$artifact_id."_"])) {
 		if ($data) {
 			//the db result handle was passed in
 		} else {
-			$res = db_query_params ('SELECT * FROM artifact_vw WHERE artifact_id=$1',
-						array ($artifact_id)) ;
-			if (db_numrows($res) <1) {
-				$ARTIFACT_OBJ["_".$artifact_id."_"]=false;
-				return false;
+			$res = db_query_params('SELECT * FROM artifact_vw WHERE artifact_id=$1', array($artifact_id));
+			if (db_numrows($res) < 1) {
+				$ARTIFACT_OBJ["_".$artifact_id."_"] = false;
+				return $ARTIFACT_OBJ["_".$artifact_id."_"];
 			}
 			$data = db_fetch_array($res);
 		}
 		$ArtifactType =& artifactType_get_object($data["group_artifact_id"]);
-		$ARTIFACT_OBJ["_".$artifact_id."_"]= new Artifact($ArtifactType, $data);
+		$ARTIFACT_OBJ["_".$artifact_id."_"] = new Artifact($ArtifactType, $data);
 	}
 	return $ARTIFACT_OBJ["_".$artifact_id."_"];
 }

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=4a272d33e4c1289e026b0a503eec42554287f8bc

commit 4a272d33e4c1289e026b0a503eec42554287f8bc
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Dec 7 06:58:49 2016 +0100

    remove useless code, use permalink

diff --git a/src/common/docman/actions/notifyusers.php b/src/common/docman/actions/notifyusers.php
index 4c9caab..37eba78 100644
--- a/src/common/docman/actions/notifyusers.php
+++ b/src/common/docman/actions/notifyusers.php
@@ -2,7 +2,7 @@
 /**
  * FusionForge Documentation Manager
  *
- * Copyright 2015, Franck Villaume - TrivialDev
+ * Copyright 2015-2016, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -76,8 +76,8 @@ $body = _('Project')._(': ').$d->Group->getPublicName()."\n";
 $body .= _('Document Folder')._(': ').$d->getDocGroupName()."\n";
 $body .= _('Document Title')._(': ').$d->getName()."\n";
 $body .= _('Document Filename')._(': ').$d->getFileName()."\n";
-$body .= _('Direct Link')._(': ').util_make_url('/docman/?group_id='.$d->Group->getID().'&view=listfile&dirid='.$d->getDocGroupID().'&filedetailid='.$d->getID())."\n";
-$body .= _('Notification Comments')._(':')."\n";
+$body .= _('Direct Link')._(': ').$d->getPermalink()."\n";
+$body .= _('Notification Comment')._(':')."\n";
 $body .= $details;
 $sendEmails = 0;
 foreach ($emailsArr as $key => $toEmail) {
@@ -86,7 +86,4 @@ foreach ($emailsArr as $key => $toEmail) {
 }
 
 $feedback = sprintf(ngettext('%s user notified.', '%s users notified.', $sendEmails), $sendEmails);
-if (count($emailsErrArr)) {
-	$warning_msg = sprintf(ngettext('%s email rejected due to wrong syntax.', '%s emails rejected due to wrong syntax.', count($emailsErrArr)), count($emailsErrArr));
-}
 session_redirect($urlparam);

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=b31d13efed23a225a8daf5551cdd12ac81ea3892

commit b31d13efed23a225a8daf5551cdd12ac81ea3892
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Dec 7 06:58:15 2016 +0100

    fix multiselect release box

diff --git a/src/common/tracker/include/ArtifactTypeHtml.class.php b/src/common/tracker/include/ArtifactTypeHtml.class.php
index bd2aacc..89fe421 100644
--- a/src/common/tracker/include/ArtifactTypeHtml.class.php
+++ b/src/common/tracker/include/ArtifactTypeHtml.class.php
@@ -837,7 +837,7 @@ class ArtifactTypeHtml extends ArtifactType {
 				}
 			}
 		}
-		$size = min( count($releasesArray)+1, 15);
+		$size = min( count($releasesArray) + count($optGroup) + 1, 15);
 		$keys = array_keys($releasesArray);
 		$vals = array_values($releasesArray);
 		return html_build_multiple_select_box_from_arrays ($keys,$vals,'extra_fields['.$extra_field_id.'][]',$checked,$size, $show_100,$text_100,$allowed, $attrs, $releasesAttrs, array(), $optGroup);

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=99c008840e744966de77af01572780d6c9789e5a

commit 99c008840e744966de77af01572780d6c9789e5a
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Dec 7 06:57:36 2016 +0100

    fix HTML syntax

diff --git a/src/www/include/html.php b/src/www/include/html.php
index 4988013..8f1d45c 100644
--- a/src/www/include/html.php
+++ b/src/www/include/html.php
@@ -932,6 +932,9 @@ function html_build_multiple_select_box_from_arrays(
 			$return .= html_e('option', $opt_attrs, $texts[$i], false);
 		}
 	}
+	if ($groupOpen) {
+		$return .= html_ac(html_ap() -1);
+	}
 	$return .= html_ac(html_ap() -1);
 	return $return;
 }

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=bc30c6cb09b3bf551a6926434aae11c899ace6db

commit bc30c6cb09b3bf551a6926434aae11c899ace6db
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Dec 7 06:57:13 2016 +0100

    use permalink

diff --git a/src/common/docman/Document.class.php b/src/common/docman/Document.class.php
index 88d652d..d0c2373 100644
--- a/src/common/docman/Document.class.php
+++ b/src/common/docman/Document.class.php
@@ -1016,7 +1016,7 @@ class Document extends FFObject {
 			$body .= _('Submitter')._(': ').$this->getCreatorRealName()." (".$this->getCreatorUserName().") \n";
 			$body .= "\n\n-------------------------------------------------------\n".
 				_('For more info, visit:').
-				"\n\n" . util_make_url('/docman/?group_id='.$this->Group->getID().'&view=listfile&dirid='.$this->getDocGroupID().'&filedetailid='.$this->getID());
+				"\n\n" . util_make_url($this->getPermalink());
 
 			$BCCarray = explode(',',$BCC);
 			foreach ($BCCarray as $dest_email) {
@@ -1043,7 +1043,7 @@ class Document extends FFObject {
 
 		$subject="[" . forge_get_config('forge_name') ."] ".util_unconvert_htmlspecialchars($doc_name);
 		$body = "\n"._('A new document has been uploaded and waiting to be approved by you')._(': ').
-		"\n".util_make_url('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$this->getDocGroupID().'&filedetailid='.$this->getID()).
+		"\n".util_make_url($this->getPermalink()).
 		"\n"._('by').(': ').$name."\n";
 
 		$sanitizer = new TextSanitizer();

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

Summary of changes:
 src/common/docman/Document.class.php               |   4 +-
 src/common/docman/DocumentReview.class.php         | 127 +++++++++++++++------
 src/common/docman/DocumentReviewFactory.class.php  |  32 +++---
 src/common/docman/actions/editfile.php             |  15 ++-
 src/common/docman/actions/notifyusers.php          |   9 +-
 src/common/tracker/Artifact.class.php              |  13 +--
 .../tracker/include/ArtifactTypeHtml.class.php     |   2 +-
 src/www/docman/scripts/DocManController.js         |  27 ++++-
 src/www/include/html.php                           |   3 +
 9 files changed, 160 insertions(+), 72 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list