Ejemplo n.º 1
0
 /**
  * Method used to print a confirmation prompt with the current details
  * of the given issue. The $command parameter can be used to determine what type of
  * confirmation to show to the user.
  *
  * @access  public
  * @param   resource $rpc_conn The connection resource
  * @param   array $auth Array of authentication information (email, password)
  * @param   integer $issue_id The issue ID
  * @param   string $args The arguments passed to this script
  */
 function promptConfirmation($rpc_conn, $auth, $issue_id, $args)
 {
     // this is needed to prevent multiple confirmations from being shown to the user
     $GLOBALS['_displayed_confirmation'] = true;
     // get summary, customer status and assignment of issue, then show confirmation prompt to user
     $msg = new XML_RPC_Message("getSimpleIssueDetails", array(new XML_RPC_Value($auth[0], 'string'), new XML_RPC_Value($auth[1], 'string'), new XML_RPC_Value($issue_id, "int")));
     $result = $rpc_conn->send($msg);
     if ($result->faultCode()) {
         Command_Line::quit($result->faultString());
     } else {
         switch ($args[2]) {
             case 'convert-note':
             case 'cn':
                 $note_details = Command_Line::getNote($rpc_conn, $auth, $issue_id, $args[3]);
                 $msg = "These are the current details for issue #{$issue_id}, note #" . $args[3] . ":\n" . "   Date: " . $note_details["not_created_date"] . "\n" . "   From: " . $note_details["not_from"] . "\n" . "  Title: " . $note_details["not_title"] . "\n" . "Are you sure you want to convert this note into a " . $args[4] . "?";
                 break;
             default:
                 $details = XML_RPC_decode($result->value());
                 $msg = "These are the current details for issue #{$issue_id}:\n" . "         Summary: " . $details['summary'] . "\n";
                 if (@(!empty($details['customer']))) {
                     $msg .= "        Customer: " . $details['customer'] . "\n";
                 }
                 $msg .= "          Status: " . $details['status'] . "\n" . "      Assignment: " . $details["assignments"] . "\n" . "  Auth. Repliers: " . $details["authorized_names"] . "\n" . "Are you sure you want to change this issue?";
         }
         $ret = Misc::prompt($msg, 'y');
         if (strtolower($ret) != 'y') {
             exit;
         }
     }
 }