Merge pull request #1371 from hector-cortez/BUG-0000

BUG 0000 Adjustment for the standardization of code. CODE_STYLE
This commit is contained in:
julceslauhub
2013-03-05 13:29:00 -08:00
7 changed files with 1815 additions and 1837 deletions

View File

@@ -24,7 +24,6 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/* require_once ("classes/model/Application.php");
require_once ("classes/model/AppCacheView.php");
require_once ("classes/model/AppDelay.php");
@@ -70,6 +69,7 @@ G::LoadClass("pmScript");
*/
class Cases
{
private $appSolr = null;
public function __construct()
@@ -86,6 +86,7 @@ class Cases
* @param string $sUIDUser
* @return boolean
*/
public function canStartCase($sUIDUser = '', $processUid = '')
{
$c = new Criteria();
@@ -139,6 +140,7 @@ class Cases
* @param string $sUIDUser
* @return $rows
*/
public function getStartCases($sUIDUser = '')
{
$rows[] = array('uid' => 'char', 'value' => 'char');
@@ -239,6 +241,7 @@ class Cases
* @param string $sUIDUser
* @return $rows
*/
public function getStartCasesPerType($sUIDUser = '', $typeView = null)
{
$rows[] = array('uid' => 'char', 'value' => 'char');
@@ -370,6 +373,7 @@ class Cases
* @param string $sUIDUser
* @return $rows
*/
public function getSelfServiceTasks($sUIDUser = '')
{
$rows[] = array('uid' => '', 'value' => '');
@@ -500,6 +504,7 @@ class Cases
* @param integer $iDelIndex > 0 //get the Delegation fields
* @return Fields
*/
public function loadCase($sAppUid, $iDelIndex = 0)
{
try {
@@ -586,6 +591,7 @@ class Cases
* @param string $caseNumber
* @return $aCases
*/
public function loadCaseByNumber($sCaseNumber)
{
//('SELECT * FROM APP_DELEGATION WHERE APP_PROC_CODE="'.$sCaseNumber.'" ');
@@ -626,6 +632,7 @@ class Cases
* @param string $sLabel
* @return $appLabel
*/
public function refreshCaseLabel($sAppUid, $aAppData, $sLabel)
{
$getAppLabel = "getApp$sLabel";
@@ -663,6 +670,7 @@ class Cases
* @param array $aAppData
* @return $res
*/
public function refreshCaseTitleAndDescription($sAppUid, $aAppData)
{
$res['APP_TITLE'] = null;
@@ -734,6 +742,7 @@ class Cases
* @param array $aAppData
* @return $res
*/
public function newRefreshCaseTitleAndDescription($sAppUid, $fields, $aAppData)
{
$res = array();
@@ -911,6 +920,7 @@ class Cases
* @param integer $iDelIndex > 0 //get the Delegation fields
* @return Fields
*/
public function updateCase($sAppUid, $Fields = array())
{
try {
@@ -953,7 +963,6 @@ class Cases
}
}
//End Save History
//we are removing the app_title and app_description from this array,
//because they already be updated in newRefreshCaseTitleAndDescription function
if (isset($Fields['APP_TITLE'])) {
@@ -1022,6 +1031,7 @@ class Cases
* @param string $sAppUid
* @return Fields
*/
public function removeCase($sAppUid)
{
try {
@@ -1123,6 +1133,7 @@ class Cases
* @param string $iDelIndex
* @return Fields
*/
public function setDelInitDate($sAppUid, $iDelIndex)
{
try {
@@ -1147,6 +1158,7 @@ class Cases
* @param string $usrId
* @return Fields
*/
public function setCatchUser($sAppUid, $iDelIndex, $usrId)
{
try {
@@ -1171,6 +1183,7 @@ class Cases
* @param string $sAppUid
* @return $row (number of APP_DELEGATION rows)
*/
public function GetOpenThreads($sAppUid)
{
try {
@@ -1196,6 +1209,7 @@ class Cases
* @param string $iDelIndex
* @return $aThreads
*/
public function getSiblingThreads($sAppUid, $iDelIndex)
{
try {
@@ -1241,6 +1255,7 @@ class Cases
* @param string $sCurrentTask
* @return $aThreads
*/
public function getOpenSiblingThreads($sNextTask, $sAppUid, $iDelIndex, $sCurrentTask)
{
try {
@@ -1379,6 +1394,7 @@ class Cases
* @param string $sTasUid $nextDel['TAS_UID']
* @return $row[0]
*/
public function CountTotalPreviousTasks($sTasUid)
{
try {
@@ -1403,6 +1419,7 @@ class Cases
* @param string $sTasUid
* @return $pendingDel
*/
public function getOpenNullDelegations($sAppUid, $sTasUid)
{
$pendingDel = array();
@@ -1462,6 +1479,7 @@ class Cases
* @param string $sTasUid $nextDel['TAS_UID']
* @return true or false
*/
public function isRouteOpen($sAppUid, $sTasUid)
{
try {
@@ -1543,29 +1561,12 @@ class Cases
* @return void
*/
public function newAppDelegation(
$sProUid,
$sAppUid,
$sTasUid,
$sUsrUid,
$sPrevious,
$iPriority,
$sDelType,
$iAppThreadIndex = 1,
$nextDel = null
) {
public function newAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sPrevious, $iPriority, $sDelType, $iAppThreadIndex = 1, $nextDel = null)
{
try {
$appDel = new AppDelegation();
$result = $appDel->createAppDelegation(
$sProUid,
$sAppUid,
$sTasUid,
$sUsrUid,
$iAppThreadIndex,
$iPriority,
false,
$sPrevious,
$nextDel
$sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iPriority, false, $sPrevious, $nextDel
);
//update searchindex
if ($this->appSolr != null) {
@@ -1587,6 +1588,7 @@ class Cases
* @param string $iAppThreadIndex,
* @return true
*/
public function updateAppDelegation($sAppUid, $iDelIndex, $iAppThreadIndex)
{
try {
@@ -1613,6 +1615,7 @@ class Cases
* @param string $sAppUid
* @return $aDelegations
*/
public function GetAllDelegations($sAppUid)
{
//('SELECT * FROM APP_DELEGATION WHERE APP_UID="'.$currentDelegation['APP_UID'].'" ');
@@ -1642,6 +1645,7 @@ class Cases
* @param string $sAppUid
* @return $aThreads
*/
public function GetAllThreads($sAppUid)
{
//('SELECT * FROM APP_DELEGATION WHERE APP_UID="'.$currentDelegation['APP_UID'].'" ');
@@ -1705,6 +1709,7 @@ class Cases
* @param string $iAppThreadIndex,
* @return true
*/
public function closeAppThread($sAppUid, $iAppThreadIndex)
{
try {
@@ -1728,6 +1733,7 @@ class Cases
* @param string $sAppUid
* @return void
*/
public function closeAllThreads($sAppUid)
{
try {
@@ -1765,6 +1771,7 @@ class Cases
* @param string $iAppParent
* @return $iAppThreadIndex $iNewDelIndex, $iAppThreadIndex );
*/
public function newAppThread($sAppUid, $iNewDelIndex, $iAppParent)
{
try {
@@ -1787,6 +1794,7 @@ class Cases
* @param string $sAppUid
* @return
*/
public function closeAllDelegations($sAppUid)
{
try {
@@ -1823,6 +1831,7 @@ class Cases
* @param string $iDelIndex
* @return Fields
*/
public function CloseCurrentDelegation($sAppUid, $iDelIndex)
{
try {
@@ -1845,7 +1854,6 @@ class Cases
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
}
}
} catch (exception $e) {
throw ($e);
}
@@ -1860,6 +1868,7 @@ class Cases
* @param string $iDelIndex
* @return Fields
*/
public function ReactivateCurrentDelegation($sAppUid, $iDelegation)
{
try {
@@ -1895,6 +1904,7 @@ class Cases
* @param string $sUsrUid
* @return Fields
*/
public function startCase($sTasUid, $sUsrUid, $isSubprocess = false)
{
if ($sTasUid != '') {
@@ -1985,6 +1995,7 @@ class Cases
* @param integer $iPosition
* @return array
*/
public function getNextStep($sProUid = '', $sAppUid = '', $iDelIndex = 0, $iPosition = 0)
{
G::LoadClass('pmScript');
@@ -2099,6 +2110,7 @@ class Cases
* @param integer $iPosition
* @return array
*/
public function getPreviousStep($sProUid = '', $sAppUid = '', $iDelIndex = 0, $iPosition = 0)
{
//Note: Depreciated, delete in the future
@@ -2202,6 +2214,7 @@ class Cases
* @param integer $sType
* @return $aNextStep
*/
public function getNextSupervisorStep($sProcessUID, $iPosition, $sType = 'DYNAFORM')
{
$iPosition += 1;
@@ -2236,6 +2249,7 @@ class Cases
* @param integer $sType
* @return $aNextStep
*/
public function getPreviousSupervisorStep($sProcessUID, $iPosition, $sType = 'DYNAFORM')
{
$iPosition -= 1;
@@ -2272,6 +2286,7 @@ class Cases
* @param string $sAppUid
* @return array
*/
public function getTransferHistoryCriteria($sAppUid)
{
$c = new Criteria('workflow');
@@ -2290,16 +2305,10 @@ class Cases
$oDataBase = new database();
$c->addAsColumn('USR_NAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME"));
$c->addAsColumn(
'DEL_FINISH_DATE',
$oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL",
"'-'",
AppDelegationPeer::DEL_FINISH_DATE )
'DEL_FINISH_DATE', $oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL", "'-'", AppDelegationPeer::DEL_FINISH_DATE)
);
$c->addAsColumn(
'APP_TYPE',
$oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL",
"'IN_PROGRESS'",
AppDelayPeer::APP_TYPE )
'APP_TYPE', $oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL", "'IN_PROGRESS'", AppDelayPeer::APP_TYPE)
);
}
$c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
@@ -2342,6 +2351,7 @@ class Cases
* @return array ( 'where' => Criteria, 'group' => Criteria )
* @return array
*/
public function prepareCriteriaForToDo($sUIDUserLogged)
{
// NEW QUERY
@@ -2359,8 +2369,7 @@ class Cases
$c->addSelectColumn(AppCacheViewPeer::DEL_INIT_DATE);
//$c->addSelectColumn(AppCacheViewPeer::DEL_TASK_DUE_DATE );
$c->addAsColumn(
'DEL_TASK_DUE_DATE',
" IF (" . AppCacheViewPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\'color:red\';>', " .
'DEL_TASK_DUE_DATE', " IF (" . AppCacheViewPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\'color:red\';>', " .
AppCacheViewPeer::DEL_TASK_DUE_DATE . ", '</span>'), " . AppCacheViewPeer::DEL_TASK_DUE_DATE . ") "
);
$c->addSelectColumn(AppCacheViewPeer::DEL_FINISH_DATE);
@@ -2403,12 +2412,8 @@ class Cases
* @param string $aAdditionalFilter
* @return array
*/
public function getConditionCasesList(
$sTypeList = 'all',
$sUIDUserLogged = '',
$ClearSession = true,
$aAdditionalFilter = null
) {
public function getConditionCasesList($sTypeList = 'all', $sUIDUserLogged = '', $ClearSession = true, $aAdditionalFilter = null)
{
$c = new Criteria('workflow');
$c->clearSelectColumns();
$c->addSelectColumn(ApplicationPeer::APP_UID);
@@ -2419,8 +2424,7 @@ class Cases
$c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY);
//$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
$c->addAsColumn(
'DEL_TASK_DUE_DATE',
" IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\'color:red\';>', " .
'DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\'color:red\';>', " .
AppDelegationPeer::DEL_TASK_DUE_DATE . ", '</span>'), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") "
);
@@ -2442,8 +2446,7 @@ class Cases
$c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE');
//$c->addAsColumn('APP_DEL_PREVIOUS_USER', 'APP_LAST_USER.USR_USERNAME');
$c->addAsColumn(
'APP_DEL_PREVIOUS_USER',
"CONCAT(APP_LAST_USER.USR_LASTNAME,
'APP_DEL_PREVIOUS_USER', "CONCAT(APP_LAST_USER.USR_LASTNAME,
' ',
APP_LAST_USER.USR_FIRSTNAME)"
);
@@ -2670,8 +2673,7 @@ class Cases
$c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY);
$c->addAsColumn(
'DEL_TASK_DUE_DATE',
" IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(),
'DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(),
CONCAT('<span style=\'color:red\';>', " . AppDelegationPeer::DEL_TASK_DUE_DATE .
", '</span>'), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") "
);
@@ -2826,6 +2828,7 @@ class Cases
* @Author Erik Amaru Ortiz <erik@colosa.com>
* @return array
*/
public function loadCaseInCurrentDelegation($APP_UID, $titles = false)
{
$c = new Criteria('workflow');
@@ -2836,8 +2839,7 @@ class Cases
$c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY);
//$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
$c->addAsColumn(
'DEL_TASK_DUE_DATE',
" IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(),
'DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(),
" . AppDelegationPeer::DEL_TASK_DUE_DATE . " ,
" . AppDelegationPeer::DEL_TASK_DUE_DATE . ") "
);
@@ -2856,8 +2858,7 @@ class Cases
}
//$c->addAsColumn('APP_DEL_PREVIOUS_USER', 'APP_LAST_USER.USR_USERNAME');
$c->addAsColumn(
'APP_DEL_PREVIOUS_USER',
"CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)");
'APP_DEL_PREVIOUS_USER', "CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)");
if ($titles) {
$c->addAlias("APP_TITLE", 'CONTENT');
@@ -2939,8 +2940,7 @@ class Cases
$c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY);
//$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
$c->addAsColumn(
'DEL_TASK_DUE_DATE',
" IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), " . AppDelegationPeer::DEL_TASK_DUE_DATE . " ,
'DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), " . AppDelegationPeer::DEL_TASK_DUE_DATE . " ,
" . AppDelegationPeer::DEL_TASK_DUE_DATE . ") "
);
@@ -2956,8 +2956,7 @@ class Cases
$c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE');
//$c->addAsColumn('APP_DEL_PREVIOUS_USER', 'APP_LAST_USER.USR_USERNAME');
$c->addAsColumn(
'APP_DEL_PREVIOUS_USER',
"CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)");
'APP_DEL_PREVIOUS_USER', "CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)");
$c->addAlias("APP_TITLE", 'CONTENT');
$c->addAlias("PRO_TITLE", 'CONTENT');
@@ -3063,6 +3062,7 @@ class Cases
* @param string $usrLogged
* @return void
*/
public function UnpauseRoutedCasesWithPauseFlagEnabled($usrLogged)
{
$c = new Criteria();
@@ -3104,6 +3104,7 @@ class Cases
* @param integer $iApplicationNumber
* @return string
*/
public function getApplicationUIDByNumber($iApplicationNumber)
{
$oCriteria = new Criteria();
@@ -3123,6 +3124,7 @@ class Cases
* @param string $sUserUID
* @return integer
*/
public function getCurrentDelegation($sApplicationUID = '', $sUserUID = '')
{
$oCriteria = new Criteria();
@@ -3155,6 +3157,7 @@ class Cases
* @param string $sTriggerType
* @return integer
*/
public function loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType)
{
$aTriggers = array();
@@ -3206,6 +3209,7 @@ class Cases
* @param array $aFields
* @return integer
*/
public function executeTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType, $aFields = array())
{
$aTriggers = $this->loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType);
@@ -3236,6 +3240,7 @@ class Cases
* @param string $triggers
* @return integer
*/
public function getTriggerNames($triggers)
{
$triggers_info = Array();
@@ -3280,15 +3285,12 @@ class Cases
* @param string $sAppDocuUID
* @return object
*/
public function getInputDocumentsCriteria($sApplicationUID, $iDelegation, $sDocumentUID, $sAppDocuUID = '')
{
try {
$deletePermission = $this->getAllObjectsFrom(
$_SESSION['PROCESS'],
$sApplicationUID,
$_SESSION['TASK'],
$_SESSION['USER_LOGGED'],
$ACTION = 'DELETE'
$_SESSION['PROCESS'], $sApplicationUID, $_SESSION['TASK'], $_SESSION['USER_LOGGED'], $ACTION = 'DELETE'
);
$listing = false;
$oPluginRegistry = & PMPluginRegistry::getSingleton();
@@ -3411,6 +3413,7 @@ class Cases
* @param string $sApplicationUID
* @return object
*/
public function getInputDocumentsCriteriaToRevise($sApplicationUID)
{
try {
@@ -3488,22 +3491,8 @@ class Cases
* @param string $fileTmpName File temporal name ($_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"] or null)
* @return string Return application document ID
*/
public function addInputDocument(
$inputDocumentUid,
$appDocUid,
$docVersion,
$appDocType,
$appDocComment,
$inputDocumentAction,
$applicationUid,
$delIndex,
$taskUid,
$userUid,
$option,
$file,
$fileError = 0,
$fileTmpName = null
) {
public function addInputDocument($inputDocumentUid, $appDocUid, $docVersion, $appDocType, $appDocComment, $inputDocumentAction, $applicationUid, $delIndex, $taskUid, $userUid, $option, $file, $fileError = 0, $fileTmpName = null)
{
$appDocFileName = null;
$sw = 0;
@@ -3669,6 +3658,7 @@ class Cases
* @param string $sApplicationUID
* @return object
*/
public function getOutputDocumentsCriteriaToRevise($sApplicationUID)
{
try {
@@ -3729,6 +3719,7 @@ class Cases
* @param string $PRO_UID
* @return object
*/
public function getCriteriaProcessCases($status, $PRO_UID)
{
$c = new Criteria('workflow');
@@ -3747,6 +3738,7 @@ class Cases
* @param string $sUnpauseDate
* @return object
*/
public function pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate = null)
{
$this->CloseCurrentDelegation($sApplicationUID, $iDelegation);
@@ -3797,6 +3789,7 @@ class Cases
* @param string $sUserUID
* @return object
*/
public function unpauseCase($sApplicationUID, $iDelegation, $sUserUID)
{
//get information about current $iDelegation row
@@ -3876,6 +3869,7 @@ class Cases
* @param string $user_logged
* @return void
*/
public function cancelCase($sApplicationUID, $iIndex, $user_logged)
{
$this->getExecuteTriggerProcess($sApplicationUID, 'CANCELED');
@@ -3952,6 +3946,7 @@ class Cases
* @param string $user_logged
* @return void
*/
public function reactivateCase($sApplicationUID, $iIndex, $user_logged)
{
$oApplication = new Application();
@@ -4008,17 +4003,14 @@ class Cases
* @param string $sType
* @return true
*/
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']
$aFieldsDel['PRO_UID'], $aFieldsDel['APP_UID'], $aFieldsDel['TAS_UID'], $aFieldsDel['USR_UID'], $aFieldsDel['DEL_THREAD']
);
$aData = array();
$aData['APP_UID'] = $aFieldsDel['APP_UID'];
@@ -4070,6 +4062,7 @@ class Cases
* @param string $APP_UID
* @return object
*/
public function getAllDynaformsStepsToRevise($APP_UID)
{
$aCase = $this->loadCase($APP_UID);
@@ -4094,6 +4087,7 @@ class Cases
* @param string $APP_UID
* @return object
*/
public function getAllInputsStepsToRevise($APP_UID)
{
$aCase = $this->loadCase($APP_UID);
@@ -4118,6 +4112,7 @@ class Cases
* @param string $APP_UID
* @return object
*/
public function getAllUploadedDocumentsCriteria($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID)
{
//verifica si existe la tabla OBJECT_PERMISSION
@@ -4264,9 +4259,7 @@ class Cases
$oCriteria->add(
$oCriteria->getNewCriterion(
AppDocumentPeer::APP_DOC_UID,
$aObjectPermissions['INPUT_DOCUMENTS'],
Criteria::IN
AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], Criteria::IN
)->
addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, array($sUserUID, '-1'), Criteria::IN)));
@@ -4342,9 +4335,7 @@ class Cases
$oCriteria->add(
$oCriteria->getNewCriterion(
AppDocumentPeer::APP_DOC_UID,
$aObjectPermissions['INPUT_DOCUMENTS'],
Criteria::IN
AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], Criteria::IN
)->
addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, array($sUserUID, '-1'), Criteria::IN)));
@@ -4426,6 +4417,7 @@ class Cases
* @param string $sUserUID
* @return object
*/
public function getAllGeneratedDocumentsCriteria($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID)
{
//verifica si la tabla OBJECT_PERMISSION
@@ -4478,8 +4470,7 @@ class Cases
//$oCriteria->add(AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['OUTPUT_DOCUMENTS'], Criteria::IN);
$oCriteria->add(
$oCriteria->getNewCriterion(
AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['OUTPUT_DOCUMENTS'],
Criteria::IN)->addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, $sUserUID, Criteria::EQUAL))
AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['OUTPUT_DOCUMENTS'], Criteria::IN)->addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, $sUserUID, Criteria::EQUAL))
);
$aConditions = array();
@@ -4661,6 +4652,7 @@ class Cases
* @param string $sUserUID
* @return object
*/
public function getallDynaformsCriteria($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID)
{
//check OBJECT_PERMISSION table
@@ -4774,6 +4766,7 @@ class Cases
* @param string $sFrom
* @return void
*/
public function sendNotifications($sCurrentTask, $aTasks, $aFields, $sApplicationUID, $iDelegation, $sFrom = "")
{
try {
@@ -5058,8 +5051,7 @@ class Cases
$MAIN_OBJECTS['VIEW']['INPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['INPUT_DOCUMENTS']
);
$RESULT_OBJECTS['OUTPUT_DOCUMENTS'] = array_merge_recursive(
G::arrayDiff($MAIN_OBJECTS['VIEW']['OUTPUT_DOCUMENTS'],$MAIN_OBJECTS['BLOCK']['OUTPUT_DOCUMENTS']),
G::arrayDiff($MAIN_OBJECTS['DELETE']['OUTPUT_DOCUMENTS'],$MAIN_OBJECTS['BLOCK']['OUTPUT_DOCUMENTS'])
G::arrayDiff($MAIN_OBJECTS['VIEW']['OUTPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['OUTPUT_DOCUMENTS']), G::arrayDiff($MAIN_OBJECTS['DELETE']['OUTPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['OUTPUT_DOCUMENTS'])
);
$RESULT_OBJECTS['CASES_NOTES'] = G::arrayDiff(
$MAIN_OBJECTS['VIEW']['CASES_NOTES'], $MAIN_OBJECTS['BLOCK']['CASES_NOTES']
@@ -5314,7 +5306,8 @@ class Cases
}
$oDataset->next();
}
if ($obj_type == 'INPUT') { // For supervisor documents
if ($obj_type == 'INPUT') {
// For supervisor documents
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_TYPE);
@@ -5362,6 +5355,7 @@ class Cases
* @param $case, $pin
* @return Array
*/
public function verifyCaseTracker($case, $pin)
{
//CASE INSENSITIVE pin
@@ -5439,6 +5433,7 @@ class Cases
* @param string $PRO_UID
* @return string
*/
public function caseTrackerPermissions($PRO_UID)
{
$newCaseTracker = new CaseTracker();
@@ -5463,6 +5458,7 @@ class Cases
* @param
* @return object
*/
public function verifyTable()
{
$oCriteria = new Criteria('workflow');
@@ -5489,6 +5485,7 @@ class Cases
* @param string $sDocUID
* @return object
*/
public function getAllUploadedDocumentsCriteriaTracker($sProcessUID, $sApplicationUID, $sDocUID)
{
$oAppDocument = new AppDocument();
@@ -5610,6 +5607,7 @@ class Cases
* @param string $sDocUID
* @return object
*/
public function getAllGeneratedDocumentsCriteriaTracker($sProcessUID, $sApplicationUID, $sDocUID)
{
$oAppDocument = new AppDocument();
@@ -5687,6 +5685,7 @@ class Cases
* @param string sApplicationUID
* @return object
*/
public function getHistoryMessagesTracker($sApplicationUID)
{
$oAppDocument = new AppDocument();
@@ -5751,6 +5750,7 @@ class Cases
* @param string Msg_UID
* @return array
*/
public function getHistoryMessagesTrackerExt($sApplicationUID)
{
G::LoadClass('ArrayPeer');
@@ -5803,6 +5803,7 @@ class Cases
* @param string Msg_UID
* @return array
*/
public function getHistoryMessagesTrackerView($sApplicationUID, $Msg_UID)
{
$oAppDocument = new AppDocument();
@@ -5825,6 +5826,7 @@ class Cases
* @param object OBJ_TYPE
* @return array
*/
public function getAllObjectsFromProcess($PRO_UID, $OBJ_TYPE = '%')
{
$RESULT = Array();
@@ -5869,14 +5871,9 @@ class Cases
* @param array $aNewData
* @return void
*/
public function executeTriggersAfterExternal(
$sProcess,
$sTask,
$sApplication,
$iIndex,
$iStepPosition,
$aNewData = array()
) {
public function executeTriggersAfterExternal($sProcess, $sTask, $sApplication, $iIndex, $iStepPosition, $aNewData = array())
{
//load the variables
$Fields = $this->loadCase($sApplication);
$Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants());
@@ -5908,6 +5905,7 @@ class Cases
* @param string $sURL
* @return void
*/
public function thisIsTheCurrentUser($sApplicationUID, $iIndex, $sUserUID, $sAction = '', $sURL = '')
{
$c = new Criteria('workflow');
@@ -6011,19 +6009,8 @@ class Cases
* @return object
*/
public function getAdvancedSearch (
$sCase,
$sProcess,
$sTask,
$sCurrentUser,
$sSentby,
$sLastModFrom,
$sLastModTo,
$sStatus,
$permisse,
$userlogged,
$aSupervisor
) {
public function getAdvancedSearch($sCase, $sProcess, $sTask, $sCurrentUser, $sSentby, $sLastModFrom, $sLastModTo, $sStatus, $permisse, $userlogged, $aSupervisor)
{
$sTypeList = '';
$sUIDUserLogged = '';
@@ -6035,8 +6022,7 @@ class Cases
$c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY);
//$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
$c->addAsColumn(
'DEL_TASK_DUE_DATE',
" IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\'color:red\';>', " .
'DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\'color:red\';>', " .
AppDelegationPeer::DEL_TASK_DUE_DATE . ", '</span>'), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") ");
$c->addSelectColumn(AppDelegationPeer::DEL_INDEX);
$c->addSelectColumn(AppDelegationPeer::TAS_UID);
@@ -6050,8 +6036,7 @@ class Cases
$c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE');
//$c->addAsColumn('APP_DEL_PREVIOUS_USER', 'APP_LAST_USER.USR_USERNAME');
$c->addAsColumn(
'APP_DEL_PREVIOUS_USER',
"CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)"
'APP_DEL_PREVIOUS_USER', "CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)"
);
$c->addAlias("APP_TITLE", 'CONTENT');
@@ -6120,10 +6105,8 @@ class Cases
}
if ($sLastModFrom != '0000-00-00' && $sLastModTo != '0000-00-00' && $sLastModFrom != '' && $sLastModTo != '') {
$c->add(
$c->getNewCriterion(ApplicationPeer::APP_UPDATE_DATE, $sLastModFrom . ' 00:00:00',
Criteria::GREATER_EQUAL)->
addAnd($c->getNewCriterion(ApplicationPeer::APP_UPDATE_DATE, $sLastModTo . ' 23:59:59',
Criteria::LESS_EQUAL))
$c->getNewCriterion(ApplicationPeer::APP_UPDATE_DATE, $sLastModFrom . ' 00:00:00', Criteria::GREATER_EQUAL)->
addAnd($c->getNewCriterion(ApplicationPeer::APP_UPDATE_DATE, $sLastModTo . ' 23:59:59', Criteria::LESS_EQUAL))
);
}
if ($sStatus != '') {
@@ -6209,6 +6192,7 @@ class Cases
* @param string $sUIDUserLogged
* @return int
*/
public function userParticipatedInCase($sAppUid, $sUIDUserLogged)
{
$c = new Criteria('workflow');
@@ -6232,6 +6216,7 @@ class Cases
* @param string $sApplicationUID
* @return integer
*/
public function getCurrentDelegationCase($sApplicationUID = '')
{
$oSession = new DBSession(new DBConnection());
@@ -6292,7 +6277,6 @@ class Cases
foreach ($siblingThreadData as $thread => $threadData) {
$this->closeAppThread($aData['APP_UID'], $threadData['DEL_INDEX']); //Close Sibling AppThreads
$this->CloseCurrentDelegation($aData['APP_UID'], $threadData['DEL_INDEX']); //Close Sibling AppDelegations
//update searchindex
if ($this->appSolr != null) {
$this->appSolr->updateApplicationSearchIndex($aData['APP_UID']);
@@ -6308,6 +6292,7 @@ class Cases
* @param string $sAppParent
* @return $aThreads
*/
public function GetAllOpenDelegation($aData)
{
try {
@@ -6331,7 +6316,6 @@ class Cases
}
}
public function getUsersToReassign($TAS_UID, $USR_UID)
{
G::LoadClass('groups');
@@ -6405,6 +6389,7 @@ class Cases
* @param string $sAppUid
* @return array (criteria+array)
*/
public function getUsersParticipatedInCase($sAppUid)
{
$c = new Criteria('workflow');

View File

@@ -1,4 +1,5 @@
<?php
/**
* class.configuration.php
*
@@ -39,7 +40,6 @@
* @author David S. Callizaya S.
* @copyright 2007 COLOSA
*/
require_once 'classes/model/Configuration.php';
/**
@@ -52,7 +52,8 @@ require_once 'classes/model/Configuration.php';
*/
class Configurations // extends Configuration
{
var $aConfig = array ();
public $aConfig = array();
private $Configuration = null;
private $UserConfig = null;
@@ -61,7 +62,7 @@ class Configurations // extends Configuration
*
* @return void
*/
function Configurations ()
public function Configurations()
{
$this->Configuration = new Configuration();
}
@@ -73,17 +74,17 @@ class Configurations // extends Configuration
* @param array &$cloneObject Array duplicate
* @return void
*/
function arrayClone (&$object, &$cloneObject)
public function arrayClone(&$object, &$cloneObject)
{
if (is_array($object)) {
foreach ($object as $k => $v) {
$cloneObject[$k] = NULL;
$cloneObject[$k] = null;
$this->arrayClone($object[$k], $cloneObject[$k]);
}
} else {
if (is_object( $object )) {
} else {
$cloneObject = NULL;
$cloneObject = null;
}
}
}
@@ -95,35 +96,40 @@ class Configurations // extends Configuration
* @param array &$from
* @return void
*/
function configObject (&$object, &$from)
public function configObject(&$object, &$from)
{
if (! (is_object( $object ) || is_array( $object )))
if (!(is_object($object) || is_array($object))) {
return;
}
if (! isset( $from ))
if (!isset($from)) {
$from = &$this->aConfig;
}
foreach ($from as $k => $v) {
if (isset($v) && array_key_exists($k, $object)) {
if (is_object( $v ))
if (is_object($v)) {
throw new Exception('Object is not permited inside configuration array.');
}
if (is_object($object)) {
if (is_array( $v ))
if (is_array($v)) {
$this->configObject($object->{$k}, $v);
else
} else {
$object->{$k} = $v;
}
} else {
if (is_array($object)) {
if (is_array( $v ))
if (is_array($v)) {
$this->configObject($object[$k], $v);
else
} else {
$object[$k] = $v;
}
}
}
}
}
}
/**
* loadConfig
@@ -136,7 +142,7 @@ class Configurations // extends Configuration
* @param string $app
* @return void
*/
function loadConfig (&$object, $cfg, $obj = '', $pro = '', $usr = '', $app = '')
public function loadConfig(&$object, $cfg, $obj = '', $pro = '', $usr = '', $app = '')
{
$this->load($cfg, $obj, $pro, $usr, $app);
$this->configObject($object, $this->aConfig);
@@ -152,21 +158,24 @@ class Configurations // extends Configuration
* @param string $app
* @return void
*/
function load ($cfg, $obj = '', $pro = '', $usr = '', $app = '')
public function load($cfg, $obj = '', $pro = '', $usr = '', $app = '')
{
$this->Fields = array();
try {
$this->Fields = $this->Configuration->load($cfg, $obj, $pro, $usr, $app);
} catch (Exception $e) {
} // the configuration does not exist
if (isset( $this->Fields['CFG_VALUE'] ))
if (isset($this->Fields['CFG_VALUE'])) {
$this->aConfig = unserialize($this->Fields['CFG_VALUE']);
}
if (! is_array( $this->aConfig ))
if (!is_array($this->aConfig)) {
$this->aConfig = Array();
}
return $this->aConfig;
}
@@ -178,7 +187,7 @@ class Configurations // extends Configuration
* @param array &$from
* @return void
*/
function saveConfig ($cfg, $obj, $pro = '', $usr = '', $app = '')
public function saveConfig($cfg, $obj, $pro = '', $usr = '', $app = '')
{
$aFields = array('CFG_UID' => $cfg, 'OBJ_UID' => $obj, 'PRO_UID' => $pro, 'USR_UID' => $usr, 'APP_UID' => $app, 'CFG_VALUE' => serialize($this->aConfig)
);
@@ -197,7 +206,7 @@ class Configurations // extends Configuration
* @param array &$from
* @return void
*/
function saveObject (&$object, $cfg, $obj, $pro = '', $usr = '', $app = '')
public function saveObject(&$object, $cfg, $obj, $pro = '', $usr = '', $app = '')
{
$aFields = array('CFG_UID' => $cfg, 'OBJ_UID' => $obj, 'PRO_UID' => $pro, 'USR_UID' => $usr, 'APP_UID' => $app, 'CFG_VALUE' => serialize(array(&$object
))
@@ -221,23 +230,25 @@ class Configurations // extends Configuration
* @param string $app
* @return void
*/
function loadObject ($cfg, $obj, $pro = '', $usr = '', $app = '')
public function loadObject($cfg, $obj, $pro = '', $usr = '', $app = '')
{
$objectContainer = array ((object) array ()
);
$objectContainer = array((object) array());
$this->Fields = array();
if ($this->Configuration->exists( $cfg, $obj, $pro, $usr, $app ))
if ($this->Configuration->exists($cfg, $obj, $pro, $usr, $app)) {
$this->Fields = $this->Configuration->load($cfg, $obj, $pro, $usr, $app);
else
} else {
return $objectContainer[0];
}
if (isset( $this->Fields['CFG_VALUE'] ))
if (isset($this->Fields['CFG_VALUE'])) {
$objectContainer = unserialize($this->Fields['CFG_VALUE']);
if (! is_array( $objectContainer ) || sizeof( $objectContainer ) != 1)
}
if (!is_array($objectContainer) || sizeof($objectContainer) != 1) {
return (object) array();
else
} else {
return $objectContainer[0];
}
}
/**
* getConfiguration
@@ -249,7 +260,7 @@ class Configurations // extends Configuration
* @param string $app
* @return void
*/
function getConfiguration ($cfg, $obj, $pro = '', $usr = '', $app = '')
public function getConfiguration($cfg, $obj, $pro = '', $usr = '', $app = '')
{
try {
$oCfg = ConfigurationPeer::retrieveByPK($cfg, $obj, $pro, $usr, $app);
@@ -279,12 +290,12 @@ class Configurations // extends Configuration
* @param string $lastname
* @return string User Name Well-Formatted
*/
function usersNameFormat ($username, $firstname, $lastname)
public function usersNameFormat($username, $firstname, $lastname)
{
try {
if (! isset( $this->UserConfig ))
if (!isset($this->UserConfig)) {
$this->UserConfig = $this->getConfiguration('ENVIRONMENT_SETTINGS', '');
}
if (isset($this->UserConfig['format'])) {
$aux = '';
$aux = str_replace('@userName', $username, $this->UserConfig['format']);
@@ -349,10 +360,11 @@ class Configurations // extends Configuration
* @param object &$to
* @return void
*/
function setConfig ($route, &$object, &$to)
public function setConfig($route, &$object, &$to)
{
if (! isset( $to ))
if (!isset($to)) {
$to = &$this->aConfig;
}
$routes = explode(',', $route);
foreach ($routes as $r) {
$ro = explode('/', $r);
@@ -362,51 +374,57 @@ class Configurations // extends Configuration
if ($ro[0] === '*') {
foreach ($object as $k => $v) {
if (is_object($object)) {
if (! isset( $to[$k] ))
if (!isset($to[$k])) {
$to[$k] = array();
}
$this->setConfig(implode('/', $rou), $object->{$k}, $to[$k]);
} else {
if (is_array($object)) {
if (! isset( $to[$k] ))
if (!isset($to[$k])) {
$to[$k] = array();
}
$this->setConfig(implode('/', $rou), $object[$k], $to[$k]);
}
}
}
} else {
if (is_object($object)) {
if (! isset( $to[$ro[0]] ))
if (!isset($to[$ro[0]])) {
$to[$ro[0]] = array();
}
$this->setConfig(implode('/', $rou), $object->{$ro[0]}, $to[$ro[0]]);
} else {
if (is_array($object)) {
if (! isset( $to[$ro[0]] ))
if (!isset($to[$ro[0]])) {
$to[$ro[0]] = array();
}
$this->setConfig(implode('/', $rou), $object[$ro[0]], $to[$ro[0]]);
} else {
$to = $object;
}
}
}
} else {
if ($ro[0] === '*') {
foreach ($object as $k => $v) {
if (is_object($object)) {
if (! isset( $to[$k] ))
if (!isset($to[$k])) {
$to[$k] = array();
}
$to[$k] = $object->{$k};
} else {
if (is_array($object)) {
if (! isset( $to[$k] ))
if (!isset($to[$k])) {
$to[$k] = array();
}
$to[$k] = $object[$k];
}
}
}
} else {
if (! isset( $to[$r] ))
if (!isset($to[$r])) {
$to[$r] = array();
}
if (is_object($object)) {
$to[$r] = $object->{$r};
} elseif (is_array($object)) {
@@ -419,7 +437,7 @@ class Configurations // extends Configuration
}
}
function getDateFormats()
public function getDateFormats()
{
$arrayFormat = array();
@@ -442,28 +460,22 @@ class Configurations // extends Configuration
return $arrayFormat;
}
function getUserNameFormats ()
public function getUserNameFormats()
{
$formats[] = Array('id' => '@firstName @lastName', //the id , don't translate
'name' => G::loadTranslation('ID_USERNAME_FORMAT_1') //label displayed, can be translated
);
$formats[] = Array ('id' => '@firstName @lastName (@userName)','name' => G::loadTranslation( 'ID_USERNAME_FORMAT_2' )
);
$formats[] = Array ('id' => '@userName','name' => G::loadTranslation( 'ID_USERNAME_FORMAT_3' )
);
$formats[] = Array ('id' => '@userName (@firstName @lastName)','name' => G::loadTranslation( 'ID_USERNAME_FORMAT_4' )
);
$formats[] = Array ('id' => '@lastName @firstName','name' => G::loadTranslation( 'ID_USERNAME_FORMAT_5' )
);
$formats[] = Array ('id' => '@lastName, @firstName','name' => G::loadTranslation( 'ID_USERNAME_FORMAT_6' )
);
$formats[] = Array ('id' => '@lastName, @firstName (@userName)','name' => G::loadTranslation( 'ID_USERNAME_FORMAT_7' )
);
$formats[] = Array('id' => '@firstName @lastName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_2'));
$formats[] = Array('id' => '@userName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_3'));
$formats[] = Array('id' => '@userName (@firstName @lastName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_4'));
$formats[] = Array('id' => '@lastName @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_5'));
$formats[] = Array('id' => '@lastName, @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_6'));
$formats[] = Array('id' => '@lastName, @firstName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_7'));
return $formats;
}
function getSystemDate ($dateTime)
public function getSystemDate($dateTime)
{
$oConf = new Configurations();
$oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
@@ -484,22 +496,26 @@ class Configurations // extends Configuration
return $dateTime;
}
function getEnvSetting ($key = null, $data = null)
public function getEnvSetting($key = null, $data = null)
{
$this->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
if (isset($key)) {
if (isset($this->aConfig[$key])) {
if (isset( $data ) && is_array( $data ))
foreach ($data as $k => $v)
if (isset($data) && is_array($data)) {
foreach ($data as $k => $v) {
$this->aConfig[$key] = str_replace('@' . $k, $v, $this->aConfig[$key]);
}
}
return $this->aConfig[$key];
} else
} else {
return '';
} else
}
} else {
return $this->aConfig;
}
}
/**
* Gets the default fields and configuration for the cases list

View File

@@ -33,8 +33,8 @@
*/
class ToolBar extends form
{
var $type = 'toolbar';
var $align = 'left';
public $type = 'toolbar';
public $align = 'left';
}
/**
@@ -44,11 +44,12 @@ class ToolBar extends form
*/
class XmlForm_Field_ToolBar extends XmlForm_Field
{
var $xmlfile = '';
var $type = 'toolbar';
var $toolBar;
var $home = '';
var $withoutLabel = true;
public $xmlfile = '';
public $type = 'toolbar';
public $toolBar;
public $home = '';
public $withoutLabel = true;
/**
* Constructor of the class XmlForm_Field_ToolBar
@@ -59,7 +60,7 @@ class XmlForm_Field_ToolBar extends XmlForm_Field
* @param string $owner
* @return void
*/
function XmlForm_Field_ToolBar ($xmlNode, $lang = 'en', $home = '', $owner)
public function XmlForm_Field_ToolBar($xmlNode, $lang = 'en', $home = '', $owner = ' ')
{
parent::XmlForm_Field($xmlNode, $lang, $home, $owner);
$this->home = $home;
@@ -71,7 +72,7 @@ class XmlForm_Field_ToolBar extends XmlForm_Field
* @param string $value
* @return string
*/
function render ($value)
public function render($value)
{
$this->toolBar = new toolBar($this->xmlfile, $this->home);
$template = PATH_CORE . 'templates/' . $this->type . '.html';
@@ -90,23 +91,24 @@ class XmlForm_Field_ToolBar extends XmlForm_Field
*/
class XmlForm_Field_toolButton extends XmlForm_Field
{
var $file = '';
var $fileAlt = '';
var $url = '';
var $urlAlt = '';
var $home = 'public_html';
public $file = '';
public $fileAlt = '';
public $url = '';
public $urlAlt = '';
public $home = 'public_html';
/* types of buttons:
* image
* text
* image/text
* text/image
*/
var $buttonType = 'image';
var $withoutLabel = false;
var $buttonStyle = '';
public $buttonType = 'image';
public $withoutLabel = false;
public $buttonStyle = '';
/* $hoverMethod : back | switch */
var $hoverMethod = 'back';
var $class;
public $hoverMethod = 'back';
public $class;
/**
* Prints the components of the toolBar
@@ -114,20 +116,24 @@ class XmlForm_Field_toolButton extends XmlForm_Field
* @param string $value
* @return string
*/
function render ($value)
public function render($value)
{
$url = $this->file;
if ($this->home === "methods")
if ($this->home === "methods") {
$url = G::encryptlink(SYS_URI . $url);
if ($this->home === "public_html")
}
if ($this->home === "public_html") {
$url = '/' . $url;
}
$urlAlt = $this->fileAlt;
if ($this->fileAlt !== '') {
if ($this->home === "methods")
if ($this->home === "methods") {
$urlAlt = G::encryptlink(SYS_URI . $urlAlt);
if ($this->home === "public_html")
}
if ($this->home === "public_html") {
$urlAlt = '/' . $urlAlt;
}
}
$this->url = $url;
$this->urlAlt = $urlAlt;
switch ($this->buttonType) {
@@ -183,9 +189,8 @@ class XmlForm_Field_toolButton extends XmlForm_Field
<div class="' . $this->class . '" title="' . strip_tags($this->label) . '" style="height:25px;margin-bottom:3px"></div>
</a>';
return $html;
}
return '<a class="toolButton" ' . (($this->buttonStyle) ? ' style="' . $this->buttonStyle . '"' : '') . (($this->onclick) ? ' onclick="' . htmlentities($this->onclick, ENT_QUOTES, 'utf-8') . '"' : '') . '>' . $html . '</a>';
}
}
?>

View File

@@ -1,10 +1,10 @@
<?php
/**
* class.webdav.php
*
* @package workflow.engine.classes
*/
require_once "HTTP/WebDAV/Server.php";
require_once "System.php";
@@ -17,6 +17,7 @@ require_once "System.php";
*/
class ProcessMakerWebDav extends HTTP_WebDAV_Server
{
/**
* Root directory for WebDAV access
*
@@ -25,7 +26,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @access private
* @var string
*/
var $base = "";
public $base = "";
/**
* Serve a webdav request
@@ -33,7 +34,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @access public
* @param string
*/
function ServeRequest ($base = false)
public function ServeRequest($base = false)
{
//$this->base = '/';
$this->uriBase = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/webdav/';
@@ -51,7 +52,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param string Password
* @return bool true on successful authentication
*/
function check_auth ($type, $user, $pass)
public function check_auth($type, $user, $pass)
{
return true;
}
@@ -63,7 +64,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param array return array for file properties
* @return bool true on success
*/
function PROPFIND (&$options, &$files)
public function PROPFIND(&$options, &$files)
{
$paths = $this->paths;
// prepare property array
@@ -98,13 +99,12 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
$props[] = $this->mkprop("resourcetype", '');
$props[] = $this->mkprop("getcontenttype", 'text/plain');
$props[] = $this->mkprop("getcontentlength", filesize($pathClasses . $filename));
if (count( $paths ) == 1 || (count( $paths ) == 2 && $paths[1] == $filename))
$files["files"][] = array ('path' => "classes/$filename",'props' => $props
);
if (count($paths) == 1 || (count($paths) == 2 && $paths[1] == $filename)) {
$files["files"][] = array('path' => "classes/$filename", 'props' => $props);
}
}
}
}
} //path classes
@@ -147,8 +147,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
$oDataset->next();
}
} //dir of processes
//content of any process ( the three major folders of Processes )
$pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP;
if (count($paths) == 2 && $paths[0] == 'processes' && is_dir($pathProcesses)) {
@@ -180,8 +178,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
$files["files"][] = array('path' => 'processes/' . $paths[1] . '/public_html', 'props' => $props
);
} //content of any processes
//list available xmlforms
if (count($paths) == 3 && $paths[0] == 'processes' && $paths[2] == 'xmlforms' && is_dir($pathXmlform)) {
$pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP . $paths[1] . PATH_SEP;
@@ -207,8 +203,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
}
}
} //content of xmlforms
//list available mailTemplates
$pathTemplates = $pathProcesses . 'mailTemplates' . PATH_SEP;
if (count($paths) == 3 && $paths[0] == 'processes' && $paths[2] == 'mailTemplates' && is_dir($pathTemplates)) {
@@ -235,8 +229,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
}
}
} //content of mailTemplates
//list available public_html files
$pathPublic = $pathProcesses . 'public' . PATH_SEP;
if (count($paths) == 3 && $paths[0] == 'processes' && $paths[2] == 'public_html' && is_dir($pathTemplates)) {
@@ -290,7 +282,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param string optional search path, defaults to $PATH
* @return bool true if executable program found in path
*/
function _can_execute ($name, $path = false)
public function _can_execute($name, $path = false)
{
// path defaults to PATH from environment if not set
if ($path === false) {
@@ -313,17 +305,20 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
// now check the directories in the path for the program
foreach (explode(PATH_SEPARATOR, $path) as $dir) {
// skip invalid path entries
if (! file_exists( $dir ))
if (!file_exists($dir)) {
continue;
if (! is_dir( $dir ))
}
if (!is_dir($dir)) {
continue;
}
// and now look for the file
foreach ($exts as $ext) {
if ($check_fn( "$dir/$name" . $ext ))
if ($check_fn("$dir/$name" . $ext)) {
return true;
}
}
}
return false;
}
@@ -334,7 +329,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param string file path
* @return string guessed mime type
*/
function _mimetype ($fspath)
public function _mimetype($fspath)
{
if (@is_dir($fspath)) {
// directories are easy
@@ -352,8 +347,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
// popen will not return an error if the binary was not found
// and find may not have mime support using "-i"
// so we test the format of the returned string
// the reply begins with the requested filename
if (!strncmp($reply, "$fspath: ", strlen($fspath) + 2)) {
$reply = substr($reply, strlen($fspath) + 2);
@@ -403,7 +396,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param array parameter passing array
* @return bool true on success
*/
function GET (&$options)
public function GET(&$options)
{
$paths = $this->paths;
@@ -460,7 +453,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
return true;
}
}
}
print_r($paths);
@@ -470,14 +462,13 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
return $this->getRoot($options);
}
//print_r ($options);
// get absolute fs path to requested resource
$fspath = $this->base . $options["path"];
// sanity check
if (! file_exists( $fspath ))
if (!file_exists($fspath)) {
return false;
}
// is this a collection?
if (is_dir($fspath)) {
@@ -508,7 +499,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param string &$options
* @return boolean false
*/
function getRoot (&$options)
public function getRoot(&$options)
{
$path = $this->_slashify($options["path"]);
// fixed width directory column format
@@ -566,7 +557,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param string directory path
* @return void function has to handle HTTP response itself
*/
function GetDir ($fspath, &$options)
public function GetDir($fspath, &$options)
{
$path = $this->_slashify($options["path"]);
if ($path != $options["path"]) {
@@ -613,7 +604,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param array parameter passing array
* @return bool true on success
*/
function PUT (&$options)
public function PUT(&$options)
{
$paths = $this->paths;
@@ -682,11 +673,9 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
return "201 Created " . $fsFile;
}
}
}
return "409 Conflict";
}
/**
@@ -695,7 +684,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param array general parameter passing array
* @return bool true on success
*/
function MKCOL ($options)
public function MKCOL($options)
{
$path = $this->base . $options["path"];
$parent = dirname($path);
@@ -713,7 +702,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
return "405 Method not allowed";
}
if (! empty( $_SERVER["CONTENT_LENGTH"] )) { // no body parsing yet
if (!empty($_SERVER["CONTENT_LENGTH"])) {
// no body parsing yet
return "415 Unsupported media type";
}
@@ -731,7 +721,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param array general parameter passing array
* @return bool true on success
*/
function DELETE ($options)
public function DELETE($options)
{
$path = $this->base . "/" . $options["path"];
@@ -758,7 +748,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param array general parameter passing array
* @return bool true on success
*/
function MOVE ($options)
public function MOVE($options)
{
return "423 Locked";
//return $this->COPY($options, true);
@@ -770,12 +760,13 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param array general parameter passing array
* @return bool true on success
*/
function COPY ($options, $del = false)
public function COPY($options, $del = false)
{
// TODO Property updates still broken (Litmus should detect this?)
if (! empty( $_SERVER["CONTENT_LENGTH"] )) { // no body parsing yet
if (!empty($_SERVER["CONTENT_LENGTH"])) {
// no body parsing yet
return "415 Unsupported media type";
}
@@ -785,8 +776,9 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
}
$source = $this->base . $options["path"];
if (! file_exists( $source ))
if (!file_exists($source)) {
return "404 Not found";
}
$dest = $this->base . $options["dest"];
@@ -889,7 +881,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param array general parameter passing array
* @return bool true on success
*/
function PROPPATCH (&$options)
public function PROPPATCH(&$options)
{
global $prefs, $tab;
@@ -922,9 +914,10 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param array general parameter passing array
* @return bool true on success
*/
function LOCK (&$options)
public function LOCK(&$options)
{
if (isset( $options["update"] )) { // Lock Update
if (isset($options["update"])) {
// Lock Update
$query = "UPDATE locks SET expires = " . (time() + 300);
mysql_query($query);
@@ -956,7 +949,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param array general parameter passing array
* @return bool true on success
*/
function UNLOCK (&$options)
public function UNLOCK(&$options)
{
$query = "DELETE FROM locks
WHERE path = '$options[path]'
@@ -972,7 +965,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param string resource path to check for locks
* @return bool true on success
*/
function checkLock ($path)
public function checkLock($path)
{
$result = false;
@@ -1000,12 +993,10 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* @param void
* @return bool true on success
*/
function create_database ()
public function create_database()
{
// TODO
return false;
}
}
?>

View File

@@ -1,4 +1,5 @@
<?php
/**
* processes_Ajax.php
*

View File

@@ -6,16 +6,14 @@ switch ($_POST['action']) {
case 'countryList':
require_once ("classes/model/IsoCountry.php");
$c = new Criteria();
$c->add( IsoCountryPeer::IC_UID, NULL, Criteria::ISNOTNULL );
$c->add(IsoCountryPeer::IC_UID, null, Criteria::ISNOTNULL);
$countries = IsoCountryPeer::doSelect($c);
foreach ($countries as $rowid => $row) {
$oData[] = Array ('IC_UID' => $row->getICUid(),'IC_NAME' => $row->getICName()
);
$oData[] = Array('IC_UID' => $row->getICUid(), 'IC_NAME' => $row->getICName());
}
print (G::json_encode($oData));
break;
case 'stateList':
require_once ("classes/model/IsoSubdivision.php");
$c = new Criteria();
@@ -25,13 +23,12 @@ switch ($_POST['action']) {
$oData = Array();
foreach ($locations as $rowid => $row) {
if (($row->getISUid() != '') && ($row->getISName() != ''))
$oData[] = Array ('IS_UID' => $row->getISUid(),'IS_NAME' => $row->getISName()
);
if (($row->getISUid() != '') && ($row->getISName() != '')) {
$oData[] = Array('IS_UID' => $row->getISUid(), 'IS_NAME' => $row->getISName());
}
}
print (G::json_encode($oData));
break;
case 'locationList':
require_once ("classes/model/IsoLocation.php");
$c = new Criteria();
@@ -43,9 +40,9 @@ switch ($_POST['action']) {
$oData = Array();
foreach ($locations as $rowid => $row) {
if (($row->getILUid() != '') && ($row->getILName() != ''))
$oData[] = Array ('IL_UID' => $row->getILUid(),'IL_NAME' => $row->getILName()
);
if (($row->getILUid() != '') && ($row->getILName() != '')) {
$oData[] = Array('IL_UID' => $row->getILUid(), 'IL_NAME' => $row->getILName());
}
}
print (G::json_encode($oData));
break;
@@ -57,8 +54,7 @@ switch ($_POST['action']) {
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_EMAIL);
$oCriteria->add( UsersPeer::USR_STATUS, array ('ACTIVE','VACATION'
), Criteria::IN );
$oCriteria->add(UsersPeer::USR_STATUS, array('ACTIVE', 'VACATION'), Criteria::IN);
if (isset($_POST['USR_UID'])) {
$oCriteria->add(UsersPeer::USR_UID, $_POST['USR_UID'], Criteria::NOT_EQUAL);
}
@@ -73,30 +69,26 @@ switch ($_POST['action']) {
$aUserInfo = array();
if (isset($_POST['addNone']) && $_POST['addNone'] == '1') {
$aUserInfo[] = array ('USR_UID' => '','USER_FULLNAME' => '- ' . G::LoadTranslation( 'ID_NONE' ) . ' -'
);
$aUserInfo[] = array('USR_UID' => '', 'USER_FULLNAME' => '- ' . G::LoadTranslation('ID_NONE') . ' -');
}
while ($oDataset->next()) {
$aRow1 = $oDataset->getRow();
$infoUser = G::getFormatUserList($defaultOption, $aRow1);
$aUserInfo[] = array ('USR_UID' => $aRow1['USR_UID'],'USER_FULLNAME' => $infoUser
);
$aUserInfo[] = array('USR_UID' => $aRow1['USR_UID'], 'USER_FULLNAME' => $infoUser);
}
print (G::json_encode($aUserInfo));
break;
case 'availableCalendars':
G::LoadClass('calendar');
$calendar = new Calendar();
$calendarObj = $calendar->getCalendarList(true, true);
$oData[] = array ('CALENDAR_UID' => '','CALENDAR_NAME' => '- None -'
);
$oData[] = array('CALENDAR_UID' => '', 'CALENDAR_NAME' => '- None -');
foreach ($calendarObj['array'] as $rowid => $row) {
if ($rowid > 0)
$oData[] = array ('CALENDAR_UID' => $row['CALENDAR_UID'],'CALENDAR_NAME' => $row['CALENDAR_NAME']
);
if ($rowid > 0) {
$oData[] = array('CALENDAR_UID' => $row['CALENDAR_UID'], 'CALENDAR_NAME' => $row['CALENDAR_NAME']);
}
}
print (G::json_encode($oData));
break;
@@ -105,14 +97,12 @@ switch ($_POST['action']) {
$roles = new Roles();
$rolesData = $roles->getAllRoles();
foreach ($rolesData as $rowid => $row) {
$oData[] = array ('ROL_UID' => $row['ROL_CODE'],'ROL_CODE' => $row['ROL_CODE']
);
$oData[] = array('ROL_UID' => $row['ROL_CODE'], 'ROL_CODE' => $row['ROL_CODE']);
}
print (G::json_encode($oData));
break;
case 'saveUser':
try {
$form = $_POST;
if (isset($_POST['USR_UID'])) {
@@ -211,9 +201,7 @@ switch ($_POST['action']) {
$aData['USR_PASSWORD'] = $form['USR_PASSWORD'];
require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties();
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists( $form['USR_UID'], array ('USR_PASSWORD_HISTORY' => serialize( array (md5( $form['USR_PASSWORD'] )
) )
) );
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($form['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array(md5($form['USR_PASSWORD'])))));
$memKey = 'rbacSession' . session_id();
$memcache = & PMmemcached::getSingleton(defined('SYS_SYS') ? SYS_SYS : '' );
@@ -252,7 +240,6 @@ switch ($_POST['action']) {
$result->msg = $sDescription;
print (G::json_encode($result));
die();
}
$aHistory = unserialize($aUserProperty['USR_PASSWORD_HISTORY']);
if (!is_array($aHistory)) {
@@ -364,8 +351,7 @@ switch ($_POST['action']) {
G::loadClass('configuration');
$oConf = new Configurations();
$aConf = Array ('DEFAULT_LANG' => $def_lang,'DEFAULT_MENU' => $def_menu,'DEFAULT_CASES_MENU' => $def_cases_menu
);
$aConf = Array('DEFAULT_LANG' => $def_lang, 'DEFAULT_MENU' => $def_menu, 'DEFAULT_CASES_MENU' => $def_cases_menu);
/* UPDATING SESSION VARIABLES */
$aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']);
@@ -374,7 +360,6 @@ switch ($_POST['action']) {
$oConf->aConfig = $aConf;
$oConf->saveConfig('USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED']);
}
if ($_SESSION['USER_LOGGED'] == $form['USR_UID']) {
@@ -398,7 +383,6 @@ switch ($_POST['action']) {
print (G::json_encode($result));
}
break;
case 'userData':
require_once 'classes/model/Users.php';
$_SESSION['CURRENT_USER'] = $_POST['USR_UID'];
@@ -419,7 +403,8 @@ switch ($_POST['action']) {
$aFields['PREF_DEFAULT_MENUSELECTED'] = '';
$aFields['PREF_DEFAULT_CASES_MENUSELECTED'] = '';
if (sizeof( $oConf->Fields ) > 0) { #this user has a configuration record
if (sizeof($oConf->Fields) > 0) {
// this user has a configuration record
$aFields['PREF_DEFAULT_LANG'] = $oConf->aConfig['DEFAULT_LANG'];
$aFields['PREF_DEFAULT_MENUSELECTED'] = isset($oConf->aConfig['DEFAULT_MENU']) ? $oConf->aConfig['DEFAULT_MENU'] : '';
$aFields['PREF_DEFAULT_CASES_MENUSELECTED'] = isset($oConf->aConfig['DEFAULT_CASES_MENU']) ? $oConf->aConfig['DEFAULT_CASES_MENU'] : '';
@@ -428,11 +413,9 @@ switch ($_POST['action']) {
case 'PROCESSMAKER_ADMIN':
$aFields['PREF_DEFAULT_MENUSELECTED'] = 'PM_SETUP';
break;
case 'PROCESSMAKER_OPERATOR':
$aFields['PREF_DEFAULT_MENUSELECTED'] = 'PM_CASES';
break;
}
$aFields['PREF_DEFAULT_LANG'] = SYS_LANG;
}
@@ -485,10 +468,11 @@ switch ($_POST['action']) {
if ($aFields['PREF_DEFAULT_CASES_MENUSELECTED'] != '') {
foreach ($oMenu->Id as $i => $item) {
if ($aFields['PREF_DEFAULT_CASES_MENUSELECTED'] == $item)
if ($aFields['PREF_DEFAULT_CASES_MENUSELECTED'] == $item) {
$casesMenuSelected = $oMenu->Labels[$i];
}
}
}
$aFields['CASES_MENUSELECTED_NAME'] = $casesMenuSelected;
@@ -497,7 +481,6 @@ switch ($_POST['action']) {
print (G::json_encode($result));
break;
case 'defaultMainMenuOptionList':
foreach ($RBAC->aUserInfo['PROCESSMAKER']['PERMISSIONS'] as $permission) {
switch ($permission['PER_CODE']) {
@@ -529,8 +512,7 @@ switch ($_POST['action']) {
foreach ($oMenu->Id as $i => $item) {
if ($oMenu->Types[$i] != 'blockHeader') {
$rowsCasesMenu[] = Array ('id' => $item,'name' => $oMenu->Labels[$i]
);
$rowsCasesMenu[] = Array('id' => $item, 'name' => $oMenu->Labels[$i]);
}
}
print (G::json_encode($rowsCasesMenu));
@@ -593,16 +575,14 @@ switch ($_POST['action']) {
$_POST['NEW_USERNAME'] = trim($_POST['NEW_USERNAME']);
$USR_UID = isset($_POST['USR_UID']) ? $_POST['USR_UID'] : '';
$response = array ("success" => true
);
$response = array("success" => true);
$oCriteria = new Criteria();
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
$oCriteria->add(UsersPeer::USR_USERNAME, $_POST['NEW_USERNAME']);
if ($USR_UID != '') {
$oCriteria->add( UsersPeer::USR_UID, array ($_POST['USR_UID']
), Criteria::NOT_IN );
$oCriteria->add(UsersPeer::USR_UID, array($_POST['USR_UID']), Criteria::NOT_IN);
}
$oDataset = UsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
@@ -628,6 +608,5 @@ switch ($_POST['action']) {
$response['descriptionText'] = $span . $gif . $text . '</span>';
echo G::json_encode($response);
break;
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* users_Ajax.php
*