Esempio n. 1
0
         $actor = "System";
     } else {
         $actor = OW_Utility::instance()->get_user_name($row->userid);
     }
     echo "<td>{$actor}</td>";
     echo "<td>{$workflow_name}</td>";
     echo "<td>{$workflow_service->get_step_name($row)}</td>";
     echo "<td>" . OW_Utility::instance()->format_date_for_display($row->create_datetime, "-", "datetime") . "</td>";
     echo "<td>" . OW_Utility::instance()->format_date_for_display($ow_process_flow->get_sign_off_date($row), "-", "datetime") . "</td>";
     echo "<td>{$ow_process_flow->get_sign_off_status($row)}</td>";
     echo "<td class='comments column-comments'>\n\t\t\t\t\t\t\t\t\t\t<div class='post-com-count-wrapper'>\n\t\t\t\t\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t\t\t\t\t<a href='#' actionid={$row->ID} class='post-com-count post-com-count-approved' real='history'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class='comment-count-approved'>{$ow_process_flow->get_sign_off_comment_count($row)}</span>\n\t\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class='loading' style='display:none'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>\n\t\t\t\t\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t  </td>";
     echo "</tr>";
 }
 if ($row->assign_actor_id == -1) {
     //review step
     $review_rows = $ow_history_service->get_review_action_by_history_id($row->ID, "update_datetime");
     if ($review_rows) {
         foreach ($review_rows as $review_row) {
             echo "<tr>";
             echo "<th scope='row' class='check-column'><input type='checkbox' name='linkcheck[]' value='1'></th>";
             echo "<td><a href='post.php?post={$row->post_id}&action=edit'><strong>{$row->post_title}</strong></a></td>";
             if ($review_row->actor_id == 0) {
                 $actor = "System";
             } else {
                 $actor = OW_Utility::instance()->get_user_name($review_row->actor_id);
             }
             echo "<td>{$actor}</td>";
             echo "<td>{$workflow_name}</td>";
             echo "<td>{$workflow_service->get_step_name($row)}</td>";
             echo "<td>" . OW_Utility::instance()->format_date_for_display($row->create_datetime, "-", "datetime") . "</td>";
             $signoff_date = $review_row->update_datetime;
 public function review_step_more_50($review_data, $action_history_id)
 {
     $current_assigned_reviews = 0;
     $current_rejected_reviews = 0;
     $current_approved_reviews = 0;
     // get the review action details from fc_action for the given history_id
     $ow_history_service = new OW_History_Service();
     $total_reviews = $ow_history_service->get_review_action_by_history_id($action_history_id);
     if ($total_reviews) {
         foreach ($total_reviews as $review) {
             if ($review->review_status == 'complete') {
                 $current_approved_reviews++;
             }
             if ($review->review_status == 'unable') {
                 $current_rejected_reviews++;
             }
             if ($review->review_status == 'assignment') {
                 $current_assigned_reviews++;
             }
         }
     }
     $total_reviews = $current_assigned_reviews + $current_rejected_reviews + $current_approved_reviews;
     $need = floor($total_reviews / 2) + 1;
     //more than 50%
     if ($current_approved_reviews >= $need && isset($review_data["complete"]) && $review_data["complete"]) {
         // looks like we have more than 50% approved, lets complete this step.
         $new_action_history_id = $this->save_review_action($review_data["complete"], $action_history_id, "complete");
         // change review status on remaining/not completed tasks as "no_action"
         if (isset($review_data["assignment"]) && $review_data["assignment"]) {
             $this->change_review_status_to_no_action($review_data["assignment"], $action_history_id);
         }
         return $new_action_history_id;
         // since we found our condition
     }
     if ($current_rejected_reviews >= $need && isset($review_data["unable"]) && $review_data["unable"]) {
         // looks like we have more than 50% rejected, we need to go to failure path.
         $new_action_history_id = $this->save_review_action($review_data["unable"], $action_history_id, "unable");
         // change review status on remaining/not completed tasks as "no_action"
         if (isset($review_data["assignment"]) && $review_data["assignment"]) {
             $this->change_review_status_to_no_action($review_data["assignment"], $action_history_id);
         }
         return $new_action_history_id;
         // since we found our condition
     }
     /*
      * in case, we have equal number of approved and rejected reviews (2 approved and 2 rejected),
      * and to make a decision we need more than 2 (more than 50%)
      * and we have no more assignments left,
      * we should take the failure path
      */
     if ($current_rejected_reviews == $current_approved_reviews && !isset($review_data["assignment"])) {
         $new_action_history_id = $this->save_review_action($review_data["unable"], $action_history_id, "unable");
         return $new_action_history_id;
         // since we found our condition
     }
 }