示例#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.
  *
  * @param   RemoteApi $client 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
  */
 public static function promptConfirmation($client, $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
     $details = $client->getSimpleIssueDetails($auth[0], $auth[1], $issue_id);
     switch ($args[2]) {
         case 'convert-note':
         case 'cn':
             $note_details = self::getNote($client, $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:
             $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 = CLI_Misc::prompt($msg, 'y');
     if (strtolower($ret) != 'y') {
         exit;
     }
 }