Exemple #1
0
 /**
  * Write the values into the database.
  */
 function updateDatabase($form, $myvalues)
 {
     try {
         $is_okay = TRUE;
         $orderIENs = $this->getSelectedOrderIENs($myvalues);
         $reasonCode = $myvalues['cancelreason'];
         $cancelcomment = $myvalues['cancelcomment'];
         die('TODO CANCEL THESE IENS >>>>' . print_r($orderIENs, TRUE) . '<br>For reason="' . $reasonCode . '"' . '<br>comment="' . $cancelcomment . '"' . '<br>Hit the back button to test again');
         $oContext = \raptor\Context::getInstance();
         $userinfo = $oContext->getUserInfo();
         $mdwsDao = $oContext->getMdwsClient();
         $results = MdwsUtils::cancelRadiologyOrder($mdwsDao, $reasonCode, $orderIENs);
         $cancelled_iens = $results['cancelled_iens'];
         $failed_iens = $results['failed_iens'];
         if (count($cancelled_iens) > 0) {
             //Record the fact that this user canceled some orders
             error_log('The user ' . print_r($userinfo, TRUE) . ' cancelled the following orders: ' . print_r($cancelled_iens, TRUE));
         }
         if (count($failed_iens) > 0) {
             //We keep going but show them what failed.
             $is_okay = FALSE;
             $errmsg = 'Failed to cancel the following orders: ' . implode(', ', $failed_iens);
             drupal_set_message($errmsg);
             error_log('The user ' . print_r($userinfo, TRUE) . ' ' . $errmsg);
         }
         return $is_okay;
     } catch (\Exception $ex) {
         drupal_set_message('Failed to commit cancel selections because ' . $ex->getMessage());
         return FALSE;
     }
 }
Exemple #2
0
 /**
  * Perform the change
  */
 function updateDatabase($form, $myvalues)
 {
     //Try to cancel the record now
     $nSiteID = $this->m_oContext->getSiteID();
     $nIEN = $myvalues['tid'];
     $nUID = $this->m_oContext->getUID();
     $sCWFS = $this->m_oTT->getTicketWorkflowState($nSiteID . '-' . $nIEN);
     $updated_dt = date("Y-m-d H:i:s", time());
     $is_okay = TRUE;
     $orderIEN = $nIEN;
     $reasonCode = $myvalues['reason'];
     $cancelcomment = $myvalues['notes_tx'];
     try {
         $oContext = \raptor\Context::getInstance();
         $userinfo = $oContext->getUserInfo();
         //Write a suspend record locally
         //TODO
         //Now cancel the record in VISTA
         $mdwsDao = $oContext->getMdwsClient();
         MdwsUtils::cancelRadiologyOrder($mdwsDao, $reasonCode, $orderIEN);
     } catch (\Exception $ex) {
         $msg = 'Failed to cancel Radiology Order because ' . $ex->getMessage();
         drupal_set_message($msg, 'error');
         error_log($msg . '\\n\\tParams were reasoncode=[' . $reasonCode . '] and IEN=[' . $orderIEN . ']');
         throw $ex;
     }
     //Write success message
     drupal_set_message('Cancelled Order ' . $myvalues['tid'] . ' (' . $myvalues['procName'] . ')');
     return $is_okay;
 }