@@ -22,6 +22,9 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | class Docman_ApprovalTableItemDao extends DataAccessObject { |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param integer $item_id |
|
| 27 | + */ |
|
| 25 | 28 | public function getTableByItemId($item_id, $fields='*') { |
| 26 | 29 | $sql = 'SELECT '.$fields. |
| 27 | 30 | ' FROM plugin_docman_approval'. |
@@ -57,6 +60,11 @@ discard block |
||
| 57 | 60 | return $groupBy; |
| 58 | 61 | } |
| 59 | 62 | |
| 63 | + /** |
|
| 64 | + * @param boolean $status |
|
| 65 | + * @param string $fields |
|
| 66 | + * @param string $where |
|
| 67 | + */ |
|
| 60 | 68 | function getTableWithStatus($status, $fields, $where, $join='', $orderBy='', $limit='') { |
| 61 | 69 | $groupBy = ''; |
| 62 | 70 | if($status) { |
@@ -75,6 +83,9 @@ discard block |
||
| 75 | 83 | return $this->retrieve($sql); |
| 76 | 84 | } |
| 77 | 85 | |
| 86 | + /** |
|
| 87 | + * @param string $field |
|
| 88 | + */ |
|
| 78 | 89 | function createTable($field, $id, $userId, $description, $date, $status, $notification) { |
| 79 | 90 | $sql = 'INSERT INTO plugin_docman_approval'. |
| 80 | 91 | '('.$field.', table_owner, date, description, status, notification)'. |
@@ -149,6 +160,9 @@ discard block |
||
| 149 | 160 | } |
| 150 | 161 | } |
| 151 | 162 | |
| 163 | + /** |
|
| 164 | + * @param string $sql |
|
| 165 | + */ |
|
| 152 | 166 | function _createAndReturnId($sql) { |
| 153 | 167 | $inserted = $this->update($sql); |
| 154 | 168 | if ($inserted) { |
@@ -79,6 +79,9 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * Action |
| 82 | + * @param PFUser $reviewer |
|
| 83 | + * @param boolean $isLastReviewer |
|
| 84 | + * @param boolean $withComments |
|
| 82 | 85 | */ |
| 83 | 86 | function reviewerApprove($reviewer, $isLastReviewer, $withComments) { |
| 84 | 87 | if($isLastReviewer) { |
@@ -96,6 +99,7 @@ discard block |
||
| 96 | 99 | |
| 97 | 100 | /** |
| 98 | 101 | * Action |
| 102 | + * @param PFUser $reviewer |
|
| 99 | 103 | */ |
| 100 | 104 | function reviewerReject($reviewer) { |
| 101 | 105 | $this->sendNotifRejected($reviewer); |
@@ -104,6 +108,8 @@ discard block |
||
| 104 | 108 | |
| 105 | 109 | /** |
| 106 | 110 | * Action |
| 111 | + * @param PFUser $reviewer |
|
| 112 | + * @param boolean $isLastReviewer |
|
| 107 | 113 | */ |
| 108 | 114 | function reviewerDecline($reviewer, $isLastReviewer) { |
| 109 | 115 | $this->sendNotifReviewDeclined($reviewer); |
@@ -115,6 +121,7 @@ discard block |
||
| 115 | 121 | |
| 116 | 122 | /** |
| 117 | 123 | * Action |
| 124 | + * @param PFUser $reviewer |
|
| 118 | 125 | */ |
| 119 | 126 | function reviewerComment($reviewer) { |
| 120 | 127 | $this->sendNotifReviewCommented($reviewer); |
@@ -210,6 +217,7 @@ discard block |
||
| 210 | 217 | /** |
| 211 | 218 | * Update item status according to parameters. |
| 212 | 219 | * Not in use today. |
| 220 | + * @param integer $status |
|
| 213 | 221 | */ |
| 214 | 222 | function changeItemStatus($reviewer, $status) { |
| 215 | 223 | // TBD |
@@ -521,6 +529,9 @@ discard block |
||
| 521 | 529 | return $this->table; |
| 522 | 530 | } |
| 523 | 531 | |
| 532 | + /** |
|
| 533 | + * @param PFUser $owner |
|
| 534 | + */ |
|
| 524 | 535 | function setOwner(&$owner) { |
| 525 | 536 | $this->owner = $owner; |
| 526 | 537 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @param Docman_ApprovalTable $table Approval table |
| 100 | 100 | * |
| 101 | - * @return Boolean |
|
| 101 | + * @return null|boolean |
|
| 102 | 102 | */ |
| 103 | 103 | private function notifyNextReviewer(Docman_ApprovalTable $table) { |
| 104 | 104 | $dao = new Docman_ApprovalTableReviewerDao(CodendiDataAccess::instance()); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @param Docman_ApprovalTable $table Approval table |
| 122 | 122 | * @param Integer $reviewerId Id of the reviewer |
| 123 | 123 | * |
| 124 | - * @return Boolean |
|
| 124 | + * @return null|boolean |
|
| 125 | 125 | */ |
| 126 | 126 | private function notifyIndividual(Docman_ApprovalTable $table, $reviewerId) { |
| 127 | 127 | $hp = Codendi_HTMLPurifier::instance(); |
@@ -191,7 +191,6 @@ discard block |
||
| 191 | 191 | /** |
| 192 | 192 | * Retrieve url to access a given docman item |
| 193 | 193 | * |
| 194 | - * @param Docman_Item $table The approval table that its reminder notification will be sent |
|
| 195 | 194 | * |
| 196 | 195 | * @return String |
| 197 | 196 | */ |
@@ -51,6 +51,9 @@ |
||
| 51 | 51 | return $this->rank; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | + /** |
|
| 55 | + * @param integer|null $v |
|
| 56 | + */ |
|
| 54 | 57 | function setReviewDate($v) { |
| 55 | 58 | $this->reviewDate = $v; |
| 56 | 59 | } |
@@ -76,6 +76,9 @@ discard block |
||
| 76 | 76 | return parent::prepareRanking($userId, $tableId, $rank, 'reviewer_id', 'table_id'); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | + /** |
|
| 80 | + * @param integer $userId |
|
| 81 | + */ |
|
| 79 | 82 | function addUser($tableId, $userId) { |
| 80 | 83 | $newRank = $this->prepareUserRanking($tableId, $userId, 'end'); |
| 81 | 84 | $sql = sprintf('INSERT INTO plugin_docman_approval_user'. |
@@ -146,6 +149,11 @@ discard block |
||
| 146 | 149 | return $this->_copyReviewers($srcTableId, $dstTableId, 'NULL', 0, "''", 'NULL'); |
| 147 | 150 | } |
| 148 | 151 | |
| 152 | + /** |
|
| 153 | + * @param string $date |
|
| 154 | + * @param string $comment |
|
| 155 | + * @param string $version |
|
| 156 | + */ |
|
| 149 | 157 | function _copyReviewers($srcTableId, $dstTableId, $date, $state, $comment, $version) { |
| 150 | 158 | $sql = 'INSERT INTO plugin_docman_approval_user'. |
| 151 | 159 | '(table_id, reviewer_id, rank, date, state, comment, version) '. |
@@ -158,6 +166,9 @@ discard block |
||
| 158 | 166 | return $this->update($sql); |
| 159 | 167 | } |
| 160 | 168 | |
| 169 | + /** |
|
| 170 | + * @param integer $state |
|
| 171 | + */ |
|
| 161 | 172 | function getAllReviewsForUserByState($userId, $state) { |
| 162 | 173 | // Item |
| 163 | 174 | $sql_item = 'SELECT u.table_id, i.item_id, i.group_id, t.date, i.title, g.group_name'. |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | /** |
| 238 | 238 | * Add members of the given ugroup to the reviewer list. |
| 239 | 239 | * |
| 240 | - * @return true if at least one user was added to the list. |
|
| 240 | + * @return boolean if at least one user was added to the list. |
|
| 241 | 241 | */ |
| 242 | 242 | function addUgroup($ugroupId) { |
| 243 | 243 | $nbUserAdded = 0; |
@@ -316,6 +316,7 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | /** |
| 318 | 318 | * |
| 319 | + * @param integer $newTableId |
|
| 319 | 320 | */ |
| 320 | 321 | function newTableCopy($newTableId) { |
| 321 | 322 | $dao = $this->_getDao(); |
@@ -324,6 +325,7 @@ discard block |
||
| 324 | 325 | |
| 325 | 326 | /** |
| 326 | 327 | * |
| 328 | + * @param integer $newTableId |
|
| 327 | 329 | */ |
| 328 | 330 | function newTableReset($newTableId) { |
| 329 | 331 | $dao = $this->_getDao(); |
@@ -105,6 +105,8 @@ |
||
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | 107 | * Did user access the wiki since the given version was published. |
| 108 | + * @param integer $groupId |
|
| 109 | + * @param integer $versionId |
|
| 108 | 110 | */ |
| 109 | 111 | function userAccessedSince($userId, $pageName, $groupId, $versionId) { |
| 110 | 112 | $sql = 'SELECT NULL'. |
@@ -45,6 +45,7 @@ discard block |
||
| 45 | 45 | * If there is no approval table linked to the item, pick-up the last |
| 46 | 46 | * version id of the wiki page. |
| 47 | 47 | * If there is no version for the given wiki page, default to 0. |
| 48 | + * @param Docman_Wiki $item |
|
| 48 | 49 | */ |
| 49 | 50 | function __construct($item, $versionNumber=null) { |
| 50 | 51 | parent::__construct($item); |
@@ -106,6 +107,9 @@ discard block |
||
| 106 | 107 | return $this->getTableFromVersion($this->item->getId(), $this->wikiVersionId); |
| 107 | 108 | } |
| 108 | 109 | |
| 110 | + /** |
|
| 111 | + * @param integer $version |
|
| 112 | + */ |
|
| 109 | 113 | function getTableFromVersion($itemId, $version) { |
| 110 | 114 | $table = null; |
| 111 | 115 | if($version !== null) { |
@@ -76,6 +76,9 @@ discard block |
||
| 76 | 76 | return $ret_id; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | + /** |
|
| 80 | + * @param string $field |
|
| 81 | + */ |
|
| 79 | 82 | private function _raiseMetadataChangeEvent(&$user, &$item, $group_id, $old, $new, $field) { |
| 80 | 83 | $logEventParam = array('group_id' => $group_id, |
| 81 | 84 | 'item' => &$item, |
@@ -1173,8 +1176,8 @@ discard block |
||
| 1173 | 1176 | * The force parameter must be set to true if you want to bypass permissions checking (@see permission_add_ugroup). |
| 1174 | 1177 | * Pretty difficult to know if a user can update the permissions which does not exist for a new item... |
| 1175 | 1178 | * |
| 1176 | - * @param $group_id integer The id of the project |
|
| 1177 | - * @param $item_id integer The id of the item |
|
| 1179 | + * @param integer $group_id integer The id of the project |
|
| 1180 | + * @param integer $item_id integer The id of the item |
|
| 1178 | 1181 | * @param $permission_definition array The definission of the permission (pretty name, relations between perms, internal name, ...) |
| 1179 | 1182 | * @param $old_permissions array The permissions before |
| 1180 | 1183 | * @param &$done_permissions array The permissions after |
@@ -1862,6 +1865,7 @@ discard block |
||
| 1862 | 1865 | |
| 1863 | 1866 | /** |
| 1864 | 1867 | * @access private |
| 1868 | + * @param Docman_ApprovalTableReviewerFactory $atrf |
|
| 1865 | 1869 | */ |
| 1866 | 1870 | function _approval_update_add_users($atrf, $usUserList, $sUgroups) { |
| 1867 | 1871 | $noError = true; |
@@ -1929,6 +1933,7 @@ discard block |
||
| 1929 | 1933 | |
| 1930 | 1934 | /** |
| 1931 | 1935 | * @access private |
| 1936 | + * @param Docman_ApprovalTableReviewerFactory $atrf |
|
| 1932 | 1937 | */ |
| 1933 | 1938 | function _approval_update_del_users($atrf, $selectedUsers) { |
| 1934 | 1939 | $deletedUsers = 0; |
@@ -1947,6 +1952,7 @@ discard block |
||
| 1947 | 1952 | |
| 1948 | 1953 | /** |
| 1949 | 1954 | * @access private |
| 1955 | + * @param Docman_ApprovalTableReviewerFactory $atrf |
|
| 1950 | 1956 | */ |
| 1951 | 1957 | function _approval_update_notify_users($atrf, $selectedUsers) { |
| 1952 | 1958 | $notifiedUsers = 0; |
@@ -1972,6 +1978,7 @@ discard block |
||
| 1972 | 1978 | |
| 1973 | 1979 | /** |
| 1974 | 1980 | * @access private |
| 1981 | + * @param Docman_ApprovalTableReviewerFactory $atrf |
|
| 1975 | 1982 | */ |
| 1976 | 1983 | function _approval_update_notif_resend($atrf) { |
| 1977 | 1984 | $res = $atrf->notifyReviewers(); |