Exemplo n.º 1
0
 /** 
  * Patch for reports by The Answer (17-10-2k8)
  * 
  * 
  * @name reportsPatch
  *
  * param 
  * @return void
  */
 function reportsPatch()
 {
     require_once 'classes/model/AppDelegation.php';
     $oCriteria = new Criteria('workflow');
     $del = DBAdapter::getStringDelimiter();
     $oCriteria->addSelectColumn(AppDelegationPeer::APP_UID);
     $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
     $oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID);
     $oCriteria->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
     $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
     $oCriteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
     $oCriteria->addSelectColumn(AppDelegationPeer::DEL_DURATION);
     $oDataset = AppDelegationPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $oAppDelegation = new AppDelegation();
         $aData['APP_UID'] = $aRow['APP_UID'];
         $aData['DEL_INDEX'] = $aRow['DEL_INDEX'];
         $aData['DEL_DELEGATE_DATE'] = $aRow['DEL_DELEGATE_DATE'];
         if ($aRow['DEL_INIT_DATE'] == NULL) {
             $aData['DEL_INIT_DATE'] = $aRow['DEL_DELEGATE_DATE'];
         } else {
             $aData['DEL_INIT_DATE'] = $aRow['DEL_INIT_DATE'];
         }
         //$aData['DEL_FINISH_DATE']=$aRow['DEL_FINISH_DATE'];
         if ($aRow['DEL_DURATION'] != 0) {
             G::LoadClass('dates');
             $oDates = new dates();
             $aData['DEL_DURATION'] = $oDates->calculateDuration($aData['DEL_INIT_DATE'], $aRow['DEL_FINISH_DATE'], null, null, $aRow['TAS_UID']);
         }
         $oAppDelegation->update($aData);
         $oDataset->next();
     }
     return;
 }
Exemplo n.º 2
0
    public function reassignCase($sApplicationUID, $iDelegation, $sUserUID, $newUserUID, $sType = 'REASSIGN')

    {

        $this->CloseCurrentDelegation($sApplicationUID, $iDelegation);

        $oAppDelegation = new AppDelegation();

        $aFieldsDel = $oAppDelegation->Load($sApplicationUID, $iDelegation);

        $iIndex = $oAppDelegation->createAppDelegation(

                $aFieldsDel['PRO_UID'], $aFieldsDel['APP_UID'], $aFieldsDel['TAS_UID'], $aFieldsDel['USR_UID'], $aFieldsDel['DEL_THREAD']

        );

        $aData = array();

        $aData['APP_UID'] = $aFieldsDel['APP_UID'];

        $aData['DEL_INDEX'] = $iIndex;

        $aData['DEL_PREVIOUS'] = $aFieldsDel['DEL_PREVIOUS'];

        $aData['DEL_TYPE'] = $aFieldsDel['DEL_TYPE'];

        $aData['DEL_PRIORITY'] = $aFieldsDel['DEL_PRIORITY'];

        $aData['DEL_DELEGATE_DATE'] = $aFieldsDel['DEL_DELEGATE_DATE'];

        $aData['USR_UID'] = $newUserUID;

        $aData['DEL_INIT_DATE'] = null;

        $aData['DEL_FINISH_DATE'] = null;

        $oAppDelegation->update($aData);

        $oAppThread = new AppThread();

        $oAppThread->update(

                array(

                    'APP_UID' => $sApplicationUID,

                    'APP_THREAD_INDEX' => $aFieldsDel['DEL_THREAD'],

                    'DEL_INDEX' => $iIndex)

        );



        //Save in APP_DELAY

        $oApplication = new Application();

        $aFields = $oApplication->Load($sApplicationUID);

        $aData['PRO_UID'] = $aFieldsDel['PRO_UID'];

        $aData['APP_UID'] = $sApplicationUID;

        $aData['APP_THREAD_INDEX'] = $aFieldsDel['DEL_THREAD'];

        $aData['APP_DEL_INDEX'] = $iDelegation;

        $aData['APP_TYPE'] = ($sType != '' ? $sType : 'REASSIGN');

        $aData['APP_STATUS'] = $aFields['APP_STATUS'];

        $aData['APP_DELEGATION_USER'] = $sUserUID;

        $aData['APP_ENABLE_ACTION_USER'] = $sUserUID;

        $aData['APP_ENABLE_ACTION_DATE'] = date('Y-m-d H:i:s');

        $oAppDelay = new AppDelay();

        $oAppDelay->create($aData);



        //update searchindex

        if ($this->appSolr != null) {

            $this->appSolr->updateApplicationSearchIndex($sApplicationUID);

        }



        /*----------------------------------********---------------------------------*/

        $this->getExecuteTriggerProcess($sApplicationUID, 'REASSIGNED');

        return true;

    }