Esempio n. 1
0
         $result = $appNotes->postNewNote($_POST['APP_UID'], $_SESSION['USER_LOGGED'], $noteContent, $_POST['NOTIFY_PAUSE']);
     }
     // End save
     $unpauseDate = $_POST['unpausedate'] . ' ' . $_REQUEST['unpauseTime'];
     $oCase = new Cases();
     if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) {
         $APP_UID = $_POST['APP_UID'];
         $DEL_INDEX = $_POST['DEL_INDEX'];
     } elseif (isset($_POST['sApplicationUID']) && isset($_POST['iIndex'])) {
         $APP_UID = $_POST['sApplicationUID'];
         $DEL_INDEX = $_POST['iIndex'];
     } else {
         $APP_UID = $_SESSION['APPLICATION'];
         $DEL_INDEX = $_SESSION['INDEX'];
     }
     $oCase->pauseCase($APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'], $unpauseDate);
     break;
 case 'unpauseCase':
     $sApplicationUID = isset($_POST['sApplicationUID']) ? $_POST['sApplicationUID'] : $_SESSION['APPLICATION'];
     $iIndex = isset($_POST['sApplicationUID']) ? $_POST['iIndex'] : $_SESSION['INDEX'];
     $oCase = new Cases();
     $oCase->unpauseCase($sApplicationUID, $iIndex, $_SESSION['USER_LOGGED']);
     break;
 case 'deleteCase':
     $oCase = new Cases();
     $sApplicationUID = isset($_POST['sApplicationUID']) ? $_POST['sApplicationUID'] : $_SESSION['APPLICATION'];
     $oCase->removeCase($sApplicationUID);
     break;
 case 'view_reassignCase':
     G::LoadClass('groups');
     G::LoadClass('tasks');
Esempio n. 2
0
    /**

     * Pause case

     *

     * @param string caseUid : ID of the case.

     * @param int delIndex : Delegation index of the case.

     * @param string userUid : The unique ID of the user who will pause the case.

     * @param string unpauseDate : Optional parameter. The date in the format "yyyy-mm-dd" indicating when to unpause

     * the case.

     * @return $result will return an object

     */

    public function pauseCase ($caseUid, $delIndex, $userUid, $unpauseDate = null)

    {

        $g = new G();



        try {

            $g->sessionVarSave();



            $_SESSION["APPLICATION"] = $caseUid;

            $_SESSION["INDEX"] = $delIndex;

            $_SESSION["USER_LOGGED"] = $userUid;



            if (empty( $caseUid )) {

                $result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " caseUid" );



                $g->sessionVarRestore();



                return $result;

            }



            if (empty( $delIndex )) {

                $result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " delIndex" );



                $g->sessionVarRestore();



                return $result;

            }

            if (empty( $userUid )) {

                $result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " userUid" );



                $g->sessionVarRestore();



                return $result;

            }

            if( strlen($unpauseDate) >=10 ){

                if (! preg_match( "/^\d{4}-\d{2}-\d{2}| \d{2}:\d{2}:\d{2}$/", $unpauseDate )) {

                    $result = new wsResponse( 100, G::LoadTranslation( "ID_INVALID_DATA" ) . " $unpauseDate" );



                    $g->sessionVarRestore();



                    return $result;

                }

            }  else {

            	$unpauseDate = null;

            }

            $case = new Cases();

            $case->pauseCase( $caseUid, $delIndex, $userUid, $unpauseDate );



            //Response

            $res = new wsResponse( 0, G::LoadTranslation( "ID_COMMAND_EXECUTED_SUCCESSFULLY" ) );



            $result = array ("status_code" => $res->status_code,"message" => $res->message,"timestamp" => $res->timestamp

            );



            $g->sessionVarRestore();

            return $result;

        } catch (Exception $e) {

            $result = new wsResponse(100, $e->getMessage());



            $g->sessionVarRestore();



            return $result;

        }

    }
Esempio n. 3
0
 function pauseCase()
 {
     try {
         $unpauseDate = $_REQUEST['unpauseDate'];
         $oCase = new Cases();
         if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) {
             $APP_UID = $_POST['APP_UID'];
             $DEL_INDEX = $_POST['DEL_INDEX'];
         } else {
             if (isset($_POST['sApplicationUID']) && isset($_POST['iIndex'])) {
                 $APP_UID = $_POST['sApplicationUID'];
                 $DEL_INDEX = $_POST['iIndex'];
             } else {
                 $APP_UID = $_SESSION['APPLICATION'];
                 $DEL_INDEX = $_SESSION['INDEX'];
             }
         }
         $oCase->pauseCase($APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'], $unpauseDate);
         $app = new Application();
         $caseData = $app->load($APP_UID);
         $data['APP_NUMBER'] = $caseData['APP_NUMBER'];
         $data['UNPAUSE_DATE'] = $unpauseDate;
         $result->success = true;
         $result->msg = G::LoadTranslation('ID_CASE_PAUSED_SUCCESSFULLY', SYS_LANG, $data);
     } catch (Exception $e) {
         $result->success = false;
         $result->msg = $e->getMessage();
     }
     echo G::json_encode($result);
 }
Esempio n. 4
0
 public function pauseCase()
 {
     try {
         $unpauseDate = $_REQUEST['unpauseDate'] . ' ' . $_REQUEST['unpauseTime'];
         $oCase = new Cases();
         if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) {
             $APP_UID = $_POST['APP_UID'];
             $DEL_INDEX = $_POST['DEL_INDEX'];
         } elseif (isset($_POST['sApplicationUID']) && isset($_POST['iIndex'])) {
             $APP_UID = $_POST['sApplicationUID'];
             $DEL_INDEX = $_POST['iIndex'];
         } else {
             $APP_UID = $_SESSION['APPLICATION'];
             $DEL_INDEX = $_SESSION['INDEX'];
         }
         // Save the note pause reason
         if ($_REQUEST['NOTE_REASON'] != '') {
             require_once "classes/model/AppNotes.php";
             $appNotes = new AppNotes();
             $noteContent = addslashes($_REQUEST['NOTE_REASON']);
             $appNotes->postNewNote($APP_UID, $_SESSION['USER_LOGGED'], $noteContent, $_REQUEST['NOTIFY_PAUSE']);
         }
         // End save
         $oCase->pauseCase($APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'], $unpauseDate);
         $app = new Application();
         $caseData = $app->load($APP_UID);
         $data['APP_NUMBER'] = $caseData['APP_NUMBER'];
         $data['UNPAUSE_DATE'] = $unpauseDate;
         $result->success = true;
         $result->msg = G::LoadTranslation('ID_CASE_PAUSED_SUCCESSFULLY', SYS_LANG, $data);
     } catch (Exception $e) {
         $result->success = false;
         $result->msg = $e->getMessage();
     }
     echo G::json_encode($result);
 }
Esempio n. 5
0
/**
 * @method
 *
 * Pauses a specified case.
 *
 * @name pauseCase
 * @label Pause Case
 * @link  http://wiki.processmaker.com/index.php/ProcessMaker_Functions#pauseCase.28.29
 *
 * @param string(32) | $sApplicationUID= "" | ID of the case | The unique ID of the case. The UID of the current case can be found in the system variable @@APPLICATION.
 * @param string(32) | $iDelegation = 0| Delegation index of the case | The delegation index of the current task in the case.
 * @param string(32) | $sUserUID = ""| ID user | The unique ID of the user who will pause the case.
 * @param string(32) | $sUnpauseDate = null  | Date | Optional parameter. The date in the format 'yyyy-mm-dd' indicating when to unpause the case.
 * @return None  | $none | None | None
 *
 */
function pauseCase($sApplicationUID = '', $iDelegation = 0, $sUserUID = '', $sUnpauseDate = null)
{
    //var_dump($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate);die(':|');
    try {
        if ($sApplicationUID == '') {
            throw new Exception('The application UID cannot be empty!');
        }
        if ($iDelegation == 0) {
            throw new Exception('The delegation index cannot be 0!');
        }
        if ($sUserUID == '') {
            throw new Exception('The user UID cannot be empty!');
        }
        G::LoadClass('case');
        $oCase = new Cases();
        $oCase->pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate);
    } catch (Exception $oException) {
        throw $oException;
    }
}