From e7488e2ef964d74845701afdc9a1d52f6fb9e9d8 Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Mon, 2 Feb 2015 10:09:49 -0400 Subject: [PATCH 001/155] LISTS: Adicion de ESQUEMA y MODELO --- gulliver/js/codemirror/addon/hint/php-hint.js | 534 +++++++++--------- .../model/map/AddonsStoreMapBuilder.php | 12 +- .../model/map/ListMyInboxMapBuilder.php | 6 +- workflow/engine/config/schema.xml | 101 +++- 4 files changed, 375 insertions(+), 278 deletions(-) diff --git a/gulliver/js/codemirror/addon/hint/php-hint.js b/gulliver/js/codemirror/addon/hint/php-hint.js index d882dbe47..2b2f7338f 100644 --- a/gulliver/js/codemirror/addon/hint/php-hint.js +++ b/gulliver/js/codemirror/addon/hint/php-hint.js @@ -1,267 +1,267 @@ -(function () { - var Pos = CodeMirror.Pos; - - function forEach(arr, f) { - for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); - } - - function arrayContains(arr, item) { - if (!Array.prototype.indexOf) { - var i = arr.length; - while (i--) { - if (arr[i] === item) { - return true; - } - } - return false; - } - return arr.indexOf(item) != -1; - } - - function scriptHint(editor, keywords, getToken, options) { - // Find the token at the cursor - var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; - var sToken = token.string.trim(); - - if ( sToken == "(") { - token = tprop = getToken(editor, Pos(cur.line, tprop.start)); - return {list: getCompletions(token.string, keywords, options), - from: Pos(cur.line, token.start), - to: Pos(cur.line, token.end + 1)}; - } - if ( sToken == "=") { - return {list: getCompletions(token.string, keywords, options), - from: Pos(cur.line, token.start + 1), - to: Pos(cur.line, token.end)}; - } - return {list: getCompletions(token.string, keywords, options), - from: Pos(cur.line, token.start), - to: Pos(cur.line, token.end)}; - } - - CodeMirror.phpHint = function(editor, options) { - return scriptHint(editor, phpPMFunctions, function (e, cur) {return e.getTokenAt(cur);}, options); - }; - - var SPACE = " "; - var arrayFunctions = []; - - var formatDate = "formatDate"; - var formatDateFunction = [formatDate+"($date,$format,$language);",formatDate+"($date,$format);"]; - arrayFunctions[formatDate] = formatDateFunction; - - var getCurrentDate = "getCurrentDate"; - var getCurrentDateFunction = [getCurrentDate+"()"]; - arrayFunctions[getCurrentDate] = getCurrentDateFunction; - - var getCurrentTime = "getCurrentTime"; - var getCurrentTimeFunction = [getCurrentTime+"()"]; - arrayFunctions[getCurrentTime] = getCurrentTimeFunction; - - var literalDate = "literalDate"; - var literalDateFunction = [literalDate+"($date,$Language)",literalDate+"($date)"]; - arrayFunctions[literalDate] = literalDateFunction; - - var capitalize = "capitalize"; - var capitalizeFunction = [capitalize+"($textToConvert)"]; - arrayFunctions[capitalize] = capitalizeFunction; - - var lowerCase = "lowerCase"; - var lowerCaseFunction = [lowerCase+"($textToConvert)"]; - arrayFunctions[lowerCase] = lowerCaseFunction; - - var upperCase = "upperCase"; - var upperCaseFunction = [upperCase+"($textToConvert)"]; - arrayFunctions[upperCase] = upperCaseFunction; - - var userInfo = "userInfo"; - var userInfoFunction = [userInfo+"($USER_ID)"]; - arrayFunctions[userInfo] = userInfoFunction; - - var executeQuery = "executeQuery"; - var executeQueryFunction = [executeQuery+"($sqlStatement,$DBConnectionUID)",executeQuery+"($sqlStatement)"]; - arrayFunctions[executeQuery] = executeQueryFunction; - - var orderGrid = "orderGrid"; - var orderGridFunction = ("orderGrid($gridName,$field,$criteria) orderGrid($gridName,$field)").split(SPACE); - arrayFunctions[orderGrid] = orderGridFunction; - - var evaluateFunction = "evaluateFunction"; - var evaluateFunctionFunction = [evaluateFunction+"($gridName,$Expression)"]; - arrayFunctions[evaluateFunction] = evaluateFunctionFunction; - - var PMFTaskCase = "PMFTaskCase"; - var PMFTaskCaseFunction = [PMFTaskCase+"($caseId)"]; - arrayFunctions[PMFTaskCase] = PMFTaskCaseFunction; - - var PMFTaskList = "PMFTaskList"; - var PMFTaskListFunction = [PMFTaskList+"($userId)"]; - arrayFunctions[PMFTaskList] = PMFTaskListFunction; - - var PMFUserList = "PMFUserList"; - var PMFUserListFunction = [PMFUserList+"()"]; - arrayFunctions[PMFUserList] = PMFUserListFunction; - - var PMFGroupList = "PMFGroupList"; - var PMFGroupListFunction = [PMFGroupList+"()"]; - arrayFunctions[PMFGroupList] = PMFGroupListFunction; - - var PMFRoleList = "PMFRoleList"; - var PMFRoleListFunction = [PMFRoleList+"()"]; - arrayFunctions[PMFRoleList] = PMFRoleListFunction; - - var PMFCaseList = "PMFCaseList"; - var PMFCaseListFunction = [PMFCaseList+"($userId)",PMFCaseList+"()"]; - arrayFunctions[PMFCaseList] = PMFCaseListFunction; - - var PMFProcessList = "PMFProcessList"; - var PMFProcessListFunction = [PMFProcessList+"()"]; - arrayFunctions[PMFProcessList] = PMFProcessListFunction; - - var PMFSendVariables = "PMFSendVariables"; - var PMFSendVariablesFunction = [PMFSendVariables+"($caseId,$variables)"]; - arrayFunctions[PMFSendVariables] = PMFSendVariablesFunction; - - var PMFDerivateCase = "PMFDerivateCase"; - var PMFDerivateCaseFunction = [PMFDerivateCase+"($caseId,$delegation,$executeTriggersBeforeAssigment)",PMFDerivateCase+"($caseId,$delegation)"]; - arrayFunctions[PMFDerivateCase] = PMFDerivateCaseFunction; - - var PMFNewCaseImpersonate = "PMFNewCaseImpersonate"; - var PMFNewCaseImpersonateFunction = [PMFNewCaseImpersonate+"($processId,$userId,$variables)"]; - arrayFunctions[PMFNewCaseImpersonate] = PMFNewCaseImpersonateFunction; - - var PMFNewCase = "PMFNewCase"; - var PMFNewCaseFunction = [PMFNewCase+"($processId,$userId,$taskId,$variables)"]; - arrayFunctions[PMFNewCase] = PMFNewCaseFunction; - - var PMFPauseCase = "PMFPauseCase"; - var PMFPauseCaseFunction = [PMFPauseCase+"($caseUid,$delIndex,$userUid,$unpauseDate)",PMFPauseCase+"($caseUid,$delIndex,$userUid)"]; - arrayFunctions[PMFPauseCase] = PMFPauseCaseFunction; - - var PMFAssignUserToGroup = "PMFAssignUserToGroup"; - var PMFAssignUserToGroupFunction = [PMFAssignUserToGroup+"($userId,$groupId)"]; - arrayFunctions[PMFAssignUserToGroup] = PMFAssignUserToGroupFunction; - - var PMFCreateUser = "PMFCreateUser"; - var PMFCreateUserFunction = [PMFCreateUser+"($userId,$password,$firstname,$lastname,$email,$role)"]; - arrayFunctions[PMFCreateUser] = PMFCreateUserFunction; - - var PMFUpdateUser = "PMFUpdateUser"; - var PMFUpdateUserFunction = [PMFUpdateUser+"($userUid,$userName,$firstName,$lastName,$email,$dueDate,$status,$role,$password)"]; - arrayFunctions[PMFUpdateUser] = PMFUpdateUserFunction; - - var PMFInformationUser = "PMFInformationUser"; - var PMFInformationUserFunction = [PMFInformationUser+"($userUid)"]; - arrayFunctions[PMFInformationUser] = PMFInformationUserFunction; - - var generateCode = "generateCode"; - var generateCodeFunction = [generateCode+"($size,$type)"]; - arrayFunctions[generateCode] = generateCodeFunction; - - var setCaseTrackerCode = "setCaseTrackerCode"; - var setCaseTrackerCodeFunction = [setCaseTrackerCode+"($caseId,$code,$pin)"]; - arrayFunctions[setCaseTrackerCode] = setCaseTrackerCodeFunction; - - var jumping = "jumping"; - var jumpingFunction = [jumping+"($caseId,$delegation)"]; - arrayFunctions[jumping] = jumpingFunction; - - var PMFRedirectToStep = "PMFRedirectToStep"; - var PMFRedirectToStepFunction = [PMFRedirectToStep+"($caseId,$delegation,$stepType,$stepId)"]; - arrayFunctions[PMFRedirectToStep] = PMFRedirectToStepFunction; - - var pauseCase = "pauseCase"; - var pauseCaseFunction = [pauseCase+"($caseId,$delegation,$userId,$unpauseDate)",pauseCase+"($caseId,$delegation,$userId)"]; - arrayFunctions[pauseCase] = pauseCaseFunction; - - var PMFUnpauseCase = "PMFUnpauseCase"; - var PMFUnpauseCaseFunction = [PMFUnpauseCase+"($caseId,$delegation,$userId,$unpauseDate)",PMFUnpauseCase+"($caseId,$delegation,$userId)"]; - arrayFunctions[PMFUnpauseCase] = PMFUnpauseCaseFunction; - - var PMFSendMessage = "PMFSendMessage"; - var PMFSendMessageFunction = [PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields,$attachments)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template)"]; - arrayFunctions[PMFSendMessage] = PMFSendMessageFunction; - - var PMFgetLabelOption = "PMFgetLabelOption"; - var PMFgetLabelOptionFunction = [PMFgetLabelOption+"($processId,$dynaformId,$fieldName,$optionId)"]; - arrayFunctions[PMFgetLabelOption] = PMFgetLabelOptionFunction; - - var PMFGenerateOutputDocument = "PMFGenerateOutputDocument"; - var PMFGenerateOutputDocumentFunction = [PMFGenerateOutputDocument+"($outputID)"]; - arrayFunctions[PMFGenerateOutputDocument] = PMFGenerateOutputDocumentFunction; - - var PMFGetUserEmailAddress = "PMFGetUserEmailAddress"; - var PMFGetUserEmailAddressFunction = [PMFGetUserEmailAddress+"($id,$APP_UID,$prefix)",PMFGetUserEmailAddress+"($id,$APP_UID)",PMFGetUserEmailAddress+"($id)"]; - arrayFunctions[PMFGetUserEmailAddress] = PMFGetUserEmailAddressFunction; - - var PMFGetNextAssignedUser = "PMFGetNextAssignedUser"; - var PMFGetNextAssignedUserFunction = (PMFGetNextAssignedUser+"($application,$task)").split(SPACE); - arrayFunctions[PMFGetNextAssignedUser] = PMFGetNextAssignedUserFunction; - - var PMFDeleteCase = "PMFDeleteCase"; - var PMFDeleteCaseFunction = ("PMFDeleteCase($caseId)").split(SPACE); - arrayFunctions[PMFDeleteCase] = PMFDeleteCaseFunction; - - var PMFCancelCase = "PMFCancelCase"; - var PMFCancelCaseFunction = [PMFCancelCase+"($caseUid,$delIndex,$userUid)"]; - arrayFunctions[PMFCancelCase] = PMFCancelCaseFunction; - - var PMFAddInputDocument = "PMFAddInputDocument"; - var PMFAddInputDocumentFunction = [PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option,$file)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid)"]; - arrayFunctions[PMFAddInputDocument] = PMFAddInputDocumentFunction; - - var PMFAddCaseNote = "PMFAddCaseNote"; - var PMFAddCaseNoteFunction = [PMFAddCaseNote+"($caseUid,$processUid,$taskUid,$userUid,$note,$sendMail)"]; - arrayFunctions[PMFAddCaseNote] = PMFAddCaseNoteFunction; - - var PMFGetCaseNotes = "PMFGetCaseNotes"; - var PMFGetCaseNotesFunction = [PMFGetCaseNotes+"($applicationID,$type,$userUid);",PMFGetCaseNotes+"($applicationID,$type)",PMFGetCaseNotes+"($applicationID)"]; - arrayFunctions[PMFGetCaseNotes] = PMFGetCaseNotesFunction; - - var phpPMFunctions = [formatDate,getCurrentDate,getCurrentTime,literalDate,capitalize,lowerCase,upperCase,userInfo,executeQuery,orderGrid, - evaluateFunction,PMFTaskCase,PMFTaskList,PMFUserList,PMFGroupList,PMFRoleList,PMFCaseList,PMFProcessList,PMFSendVariables,PMFDerivateCase, - PMFNewCaseImpersonate,PMFNewCase,PMFPauseCase,PMFUnpauseCase,PMFAssignUserToGroup,PMFCreateUser,PMFUpdateUser,PMFInformationUser, - generateCode,setCaseTrackerCode,jumping,PMFRedirectToStep,pauseCase,PMFSendMessage,PMFgetLabelOption,PMFGenerateOutputDocument, - PMFGetUserEmailAddress,PMFGetNextAssignedUser,PMFDeleteCase,PMFCancelCase,PMFAddInputDocument,PMFAddCaseNote,PMFGetCaseNotes]; - - var phpKeywords = ("break case catch continue default do else false for function " + - "if new return switch throw true try var while").split(SPACE); - - function getCompletions(functionName, keywords, options) { - - var found = []; - - function maybeAdd(str) {// for keywords ? - if ( str.indexOf(functionName) == 0 && !arrayContains(found, str)) { - found.push(str); - } - } - - function yesAdd(str) { - if ( !arrayContains(found, str)) { - found.push(str); - } - } - - arrayFunction = arrayFunctions[functionName]; - - if (arrayFunction != undefined) { - forEach( arrayFunction, yesAdd); - } else { - if (functionName.trim() == "") { - forEach (phpKeywords, yesAdd); - forEach (keywords, yesAdd); - } else if (functionName == "=") { - forEach (phpPMFunctions, yesAdd); - } else { - for (index = 0; index < phpKeywords.length; index++) { - if ( phpKeywords[index].indexOf(functionName) == 0 ) { - found.push(phpKeywords[index]); - } - } - forEach(keywords, maybeAdd); - } - } - return found; - } -})(); +(function () { + var Pos = CodeMirror.Pos; + + function forEach(arr, f) { + for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); + } + + function arrayContains(arr, item) { + if (!Array.prototype.indexOf) { + var i = arr.length; + while (i--) { + if (arr[i] === item) { + return true; + } + } + return false; + } + return arr.indexOf(item) != -1; + } + + function scriptHint(editor, keywords, getToken, options) { + // Find the token at the cursor + var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; + var sToken = token.string.trim(); + + if ( sToken == "(") { + token = tprop = getToken(editor, Pos(cur.line, tprop.start)); + return {list: getCompletions(token.string, keywords, options), + from: Pos(cur.line, token.start), + to: Pos(cur.line, token.end + 1)}; + } + if ( sToken == "=") { + return {list: getCompletions(token.string, keywords, options), + from: Pos(cur.line, token.start + 1), + to: Pos(cur.line, token.end)}; + } + return {list: getCompletions(token.string, keywords, options), + from: Pos(cur.line, token.start), + to: Pos(cur.line, token.end)}; + } + + CodeMirror.phpHint = function(editor, options) { + return scriptHint(editor, phpPMFunctions, function (e, cur) {return e.getTokenAt(cur);}, options); + }; + + var SPACE = " "; + var arrayFunctions = []; + + var formatDate = "formatDate"; + var formatDateFunction = [formatDate+"($date,$format,$language);",formatDate+"($date,$format);"]; + arrayFunctions[formatDate] = formatDateFunction; + + var getCurrentDate = "getCurrentDate"; + var getCurrentDateFunction = [getCurrentDate+"()"]; + arrayFunctions[getCurrentDate] = getCurrentDateFunction; + + var getCurrentTime = "getCurrentTime"; + var getCurrentTimeFunction = [getCurrentTime+"()"]; + arrayFunctions[getCurrentTime] = getCurrentTimeFunction; + + var literalDate = "literalDate"; + var literalDateFunction = [literalDate+"($date,$Language)",literalDate+"($date)"]; + arrayFunctions[literalDate] = literalDateFunction; + + var capitalize = "capitalize"; + var capitalizeFunction = [capitalize+"($textToConvert)"]; + arrayFunctions[capitalize] = capitalizeFunction; + + var lowerCase = "lowerCase"; + var lowerCaseFunction = [lowerCase+"($textToConvert)"]; + arrayFunctions[lowerCase] = lowerCaseFunction; + + var upperCase = "upperCase"; + var upperCaseFunction = [upperCase+"($textToConvert)"]; + arrayFunctions[upperCase] = upperCaseFunction; + + var userInfo = "userInfo"; + var userInfoFunction = [userInfo+"($USER_ID)"]; + arrayFunctions[userInfo] = userInfoFunction; + + var executeQuery = "executeQuery"; + var executeQueryFunction = [executeQuery+"($sqlStatement,$DBConnectionUID)",executeQuery+"($sqlStatement)"]; + arrayFunctions[executeQuery] = executeQueryFunction; + + var orderGrid = "orderGrid"; + var orderGridFunction = ("orderGrid($gridName,$field,$criteria) orderGrid($gridName,$field)").split(SPACE); + arrayFunctions[orderGrid] = orderGridFunction; + + var evaluateFunction = "evaluateFunction"; + var evaluateFunctionFunction = [evaluateFunction+"($gridName,$Expression)"]; + arrayFunctions[evaluateFunction] = evaluateFunctionFunction; + + var PMFTaskCase = "PMFTaskCase"; + var PMFTaskCaseFunction = [PMFTaskCase+"($caseId)"]; + arrayFunctions[PMFTaskCase] = PMFTaskCaseFunction; + + var PMFTaskList = "PMFTaskList"; + var PMFTaskListFunction = [PMFTaskList+"($userId)"]; + arrayFunctions[PMFTaskList] = PMFTaskListFunction; + + var PMFUserList = "PMFUserList"; + var PMFUserListFunction = [PMFUserList+"()"]; + arrayFunctions[PMFUserList] = PMFUserListFunction; + + var PMFGroupList = "PMFGroupList"; + var PMFGroupListFunction = [PMFGroupList+"()"]; + arrayFunctions[PMFGroupList] = PMFGroupListFunction; + + var PMFRoleList = "PMFRoleList"; + var PMFRoleListFunction = [PMFRoleList+"()"]; + arrayFunctions[PMFRoleList] = PMFRoleListFunction; + + var PMFCaseList = "PMFCaseList"; + var PMFCaseListFunction = [PMFCaseList+"($userId)",PMFCaseList+"()"]; + arrayFunctions[PMFCaseList] = PMFCaseListFunction; + + var PMFProcessList = "PMFProcessList"; + var PMFProcessListFunction = [PMFProcessList+"()"]; + arrayFunctions[PMFProcessList] = PMFProcessListFunction; + + var PMFSendVariables = "PMFSendVariables"; + var PMFSendVariablesFunction = [PMFSendVariables+"($caseId,$variables)"]; + arrayFunctions[PMFSendVariables] = PMFSendVariablesFunction; + + var PMFDerivateCase = "PMFDerivateCase"; + var PMFDerivateCaseFunction = [PMFDerivateCase+"($caseId,$delegation,$executeTriggersBeforeAssigment)",PMFDerivateCase+"($caseId,$delegation)"]; + arrayFunctions[PMFDerivateCase] = PMFDerivateCaseFunction; + + var PMFNewCaseImpersonate = "PMFNewCaseImpersonate"; + var PMFNewCaseImpersonateFunction = [PMFNewCaseImpersonate+"($processId,$userId,$variables)"]; + arrayFunctions[PMFNewCaseImpersonate] = PMFNewCaseImpersonateFunction; + + var PMFNewCase = "PMFNewCase"; + var PMFNewCaseFunction = [PMFNewCase+"($processId,$userId,$taskId,$variables)"]; + arrayFunctions[PMFNewCase] = PMFNewCaseFunction; + + var PMFPauseCase = "PMFPauseCase"; + var PMFPauseCaseFunction = [PMFPauseCase+"($caseUid,$delIndex,$userUid,$unpauseDate)",PMFPauseCase+"($caseUid,$delIndex,$userUid)"]; + arrayFunctions[PMFPauseCase] = PMFPauseCaseFunction; + + var PMFAssignUserToGroup = "PMFAssignUserToGroup"; + var PMFAssignUserToGroupFunction = [PMFAssignUserToGroup+"($userId,$groupId)"]; + arrayFunctions[PMFAssignUserToGroup] = PMFAssignUserToGroupFunction; + + var PMFCreateUser = "PMFCreateUser"; + var PMFCreateUserFunction = [PMFCreateUser+"($userId,$password,$firstname,$lastname,$email,$role)"]; + arrayFunctions[PMFCreateUser] = PMFCreateUserFunction; + + var PMFUpdateUser = "PMFUpdateUser"; + var PMFUpdateUserFunction = [PMFUpdateUser+"($userUid,$userName,$firstName,$lastName,$email,$dueDate,$status,$role,$password)"]; + arrayFunctions[PMFUpdateUser] = PMFUpdateUserFunction; + + var PMFInformationUser = "PMFInformationUser"; + var PMFInformationUserFunction = [PMFInformationUser+"($userUid)"]; + arrayFunctions[PMFInformationUser] = PMFInformationUserFunction; + + var generateCode = "generateCode"; + var generateCodeFunction = [generateCode+"($size,$type)"]; + arrayFunctions[generateCode] = generateCodeFunction; + + var setCaseTrackerCode = "setCaseTrackerCode"; + var setCaseTrackerCodeFunction = [setCaseTrackerCode+"($caseId,$code,$pin)"]; + arrayFunctions[setCaseTrackerCode] = setCaseTrackerCodeFunction; + + var jumping = "jumping"; + var jumpingFunction = [jumping+"($caseId,$delegation)"]; + arrayFunctions[jumping] = jumpingFunction; + + var PMFRedirectToStep = "PMFRedirectToStep"; + var PMFRedirectToStepFunction = [PMFRedirectToStep+"($caseId,$delegation,$stepType,$stepId)"]; + arrayFunctions[PMFRedirectToStep] = PMFRedirectToStepFunction; + + var pauseCase = "pauseCase"; + var pauseCaseFunction = [pauseCase+"($caseId,$delegation,$userId,$unpauseDate)",pauseCase+"($caseId,$delegation,$userId)"]; + arrayFunctions[pauseCase] = pauseCaseFunction; + + var PMFUnpauseCase = "PMFUnpauseCase"; + var PMFUnpauseCaseFunction = [PMFUnpauseCase+"($caseId,$delegation,$userId,$unpauseDate)",PMFUnpauseCase+"($caseId,$delegation,$userId)"]; + arrayFunctions[PMFUnpauseCase] = PMFUnpauseCaseFunction; + + var PMFSendMessage = "PMFSendMessage"; + var PMFSendMessageFunction = [PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields,$attachments)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template)"]; + arrayFunctions[PMFSendMessage] = PMFSendMessageFunction; + + var PMFgetLabelOption = "PMFgetLabelOption"; + var PMFgetLabelOptionFunction = [PMFgetLabelOption+"($processId,$dynaformId,$fieldName,$optionId)"]; + arrayFunctions[PMFgetLabelOption] = PMFgetLabelOptionFunction; + + var PMFGenerateOutputDocument = "PMFGenerateOutputDocument"; + var PMFGenerateOutputDocumentFunction = [PMFGenerateOutputDocument+"($outputID)"]; + arrayFunctions[PMFGenerateOutputDocument] = PMFGenerateOutputDocumentFunction; + + var PMFGetUserEmailAddress = "PMFGetUserEmailAddress"; + var PMFGetUserEmailAddressFunction = [PMFGetUserEmailAddress+"($id,$APP_UID,$prefix)",PMFGetUserEmailAddress+"($id,$APP_UID)",PMFGetUserEmailAddress+"($id)"]; + arrayFunctions[PMFGetUserEmailAddress] = PMFGetUserEmailAddressFunction; + + var PMFGetNextAssignedUser = "PMFGetNextAssignedUser"; + var PMFGetNextAssignedUserFunction = (PMFGetNextAssignedUser+"($application,$task)").split(SPACE); + arrayFunctions[PMFGetNextAssignedUser] = PMFGetNextAssignedUserFunction; + + var PMFDeleteCase = "PMFDeleteCase"; + var PMFDeleteCaseFunction = ("PMFDeleteCase($caseId)").split(SPACE); + arrayFunctions[PMFDeleteCase] = PMFDeleteCaseFunction; + + var PMFCancelCase = "PMFCancelCase"; + var PMFCancelCaseFunction = [PMFCancelCase+"($caseUid,$delIndex,$userUid)"]; + arrayFunctions[PMFCancelCase] = PMFCancelCaseFunction; + + var PMFAddInputDocument = "PMFAddInputDocument"; + var PMFAddInputDocumentFunction = [PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option,$file)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid)"]; + arrayFunctions[PMFAddInputDocument] = PMFAddInputDocumentFunction; + + var PMFAddCaseNote = "PMFAddCaseNote"; + var PMFAddCaseNoteFunction = [PMFAddCaseNote+"($caseUid,$processUid,$taskUid,$userUid,$note,$sendMail)"]; + arrayFunctions[PMFAddCaseNote] = PMFAddCaseNoteFunction; + + var PMFGetCaseNotes = "PMFGetCaseNotes"; + var PMFGetCaseNotesFunction = [PMFGetCaseNotes+"($applicationID,$type,$userUid);",PMFGetCaseNotes+"($applicationID,$type)",PMFGetCaseNotes+"($applicationID)"]; + arrayFunctions[PMFGetCaseNotes] = PMFGetCaseNotesFunction; + + var phpPMFunctions = [formatDate,getCurrentDate,getCurrentTime,literalDate,capitalize,lowerCase,upperCase,userInfo,executeQuery,orderGrid, + evaluateFunction,PMFTaskCase,PMFTaskList,PMFUserList,PMFGroupList,PMFRoleList,PMFCaseList,PMFProcessList,PMFSendVariables,PMFDerivateCase, + PMFNewCaseImpersonate,PMFNewCase,PMFPauseCase,PMFUnpauseCase,PMFAssignUserToGroup,PMFCreateUser,PMFUpdateUser,PMFInformationUser, + generateCode,setCaseTrackerCode,jumping,PMFRedirectToStep,pauseCase,PMFSendMessage,PMFgetLabelOption,PMFGenerateOutputDocument, + PMFGetUserEmailAddress,PMFGetNextAssignedUser,PMFDeleteCase,PMFCancelCase,PMFAddInputDocument,PMFAddCaseNote,PMFGetCaseNotes]; + + var phpKeywords = ("break case catch continue default do else false for function " + + "if new return switch throw true try var while").split(SPACE); + + function getCompletions(functionName, keywords, options) { + + var found = []; + + function maybeAdd(str) {// for keywords ? + if ( str.indexOf(functionName) == 0 && !arrayContains(found, str)) { + found.push(str); + } + } + + function yesAdd(str) { + if ( !arrayContains(found, str)) { + found.push(str); + } + } + + arrayFunction = arrayFunctions[functionName]; + + if (arrayFunction != undefined) { + forEach( arrayFunction, yesAdd); + } else { + if (functionName.trim() == "") { + forEach (phpKeywords, yesAdd); + forEach (keywords, yesAdd); + } else if (functionName == "=") { + forEach (phpPMFunctions, yesAdd); + } else { + for (index = 0; index < phpKeywords.length; index++) { + if ( phpKeywords[index].indexOf(functionName) == 0 ) { + found.push(phpKeywords[index]); + } + } + forEach(keywords, maybeAdd); + } + } + return found; + } +})(); \ No newline at end of file diff --git a/workflow/engine/classes/model/map/AddonsStoreMapBuilder.php b/workflow/engine/classes/model/map/AddonsStoreMapBuilder.php index d97d723a5..93e2733b1 100644 --- a/workflow/engine/classes/model/map/AddonsStoreMapBuilder.php +++ b/workflow/engine/classes/model/map/AddonsStoreMapBuilder.php @@ -3,6 +3,7 @@ require_once 'propel/map/MapBuilder.php'; include_once 'creole/CreoleTypes.php'; + /** * This class adds structure of 'ADDONS_STORE' table to 'workflow' DatabaseMap object. * @@ -17,9 +18,10 @@ include_once 'creole/CreoleTypes.php'; */ class AddonsStoreMapBuilder { + /** * The (dot-path) name of this class - */ + */ const CLASS_NAME = 'classes.model.map.AddonsStoreMapBuilder'; /** @@ -43,7 +45,6 @@ class AddonsStoreMapBuilder * * @return the databasemap */ - public function getDatabaseMap() { return $this->dbMap; @@ -55,13 +56,11 @@ class AddonsStoreMapBuilder * @return void * @throws PropelException */ - public function doBuild() { $this->dbMap = Propel::getDatabaseMap('workflow'); $tMap = $this->dbMap->addTable('ADDONS_STORE'); - $tMap->setPhpName('AddonsStore'); $tMap->setUseIdGenerator(false); @@ -75,6 +74,7 @@ class AddonsStoreMapBuilder $tMap->addColumn('STORE_TYPE', 'StoreType', 'string', CreoleTypes::VARCHAR, true, 255); $tMap->addColumn('STORE_LAST_UPDATED', 'StoreLastUpdated', 'int', CreoleTypes::TIMESTAMP, false, null); - } -} + } // doBuild() + +} // AddonsStoreMapBuilder diff --git a/workflow/engine/classes/model/map/ListMyInboxMapBuilder.php b/workflow/engine/classes/model/map/ListMyInboxMapBuilder.php index 2aec4e7b9..42c8fbc11 100644 --- a/workflow/engine/classes/model/map/ListMyInboxMapBuilder.php +++ b/workflow/engine/classes/model/map/ListMyInboxMapBuilder.php @@ -81,11 +81,11 @@ class ListMyInboxMapBuilder $tMap->addColumn('APP_TAS_TITLE', 'AppTasTitle', 'string', CreoleTypes::VARCHAR, true, 255); - $tMap->addColumn('APP_CREATE_DATE', 'AppCreateDate', 'int', CreoleTypes::TIMESTAMP, true, null); + $tMap->addColumn('APP_CREATE_DATE', 'AppCreateDate', 'int', CreoleTypes::TIMESTAMP, false, null); - $tMap->addColumn('APP_UPDATE_DATE', 'AppUpdateDate', 'int', CreoleTypes::TIMESTAMP, true, null); + $tMap->addColumn('APP_UPDATE_DATE', 'AppUpdateDate', 'int', CreoleTypes::TIMESTAMP, false, null); - $tMap->addColumn('APP_FINISH_DATE', 'AppFinishDate', 'int', CreoleTypes::TIMESTAMP, true, null); + $tMap->addColumn('APP_FINISH_DATE', 'AppFinishDate', 'int', CreoleTypes::TIMESTAMP, false, null); $tMap->addColumn('APP_STATUS', 'AppStatus', 'string', CreoleTypes::VARCHAR, true, 100); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index bf077b4ff..82a844c84 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -2651,7 +2651,7 @@ - + @@ -4058,7 +4058,104 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
From 1dfce5a07450e986d4abe65a55e630fbeffae104 Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Mon, 2 Feb 2015 10:10:22 -0400 Subject: [PATCH 002/155] LISTS: Adicion de ESQUEMA y MODELO --- .../engine/classes/model/ListCanceled.php | 19 + .../engine/classes/model/ListCanceledPeer.php | 23 + workflow/engine/classes/model/ListPaused.php | 19 + .../engine/classes/model/ListPausedPeer.php | 23 + .../model/map/ListCanceledMapBuilder.php | 106 ++ .../model/map/ListPausedMapBuilder.php | 106 ++ .../classes/model/om/BaseListCanceled.php | 1608 ++++++++++++++++ .../classes/model/om/BaseListCanceledPeer.php | 652 +++++++ .../classes/model/om/BaseListPaused.php | 1648 +++++++++++++++++ .../classes/model/om/BaseListPausedPeer.php | 642 +++++++ 10 files changed, 4846 insertions(+) create mode 100644 workflow/engine/classes/model/ListCanceled.php create mode 100644 workflow/engine/classes/model/ListCanceledPeer.php create mode 100644 workflow/engine/classes/model/ListPaused.php create mode 100644 workflow/engine/classes/model/ListPausedPeer.php create mode 100644 workflow/engine/classes/model/map/ListCanceledMapBuilder.php create mode 100644 workflow/engine/classes/model/map/ListPausedMapBuilder.php create mode 100644 workflow/engine/classes/model/om/BaseListCanceled.php create mode 100644 workflow/engine/classes/model/om/BaseListCanceledPeer.php create mode 100644 workflow/engine/classes/model/om/BaseListPaused.php create mode 100644 workflow/engine/classes/model/om/BaseListPausedPeer.php diff --git a/workflow/engine/classes/model/ListCanceled.php b/workflow/engine/classes/model/ListCanceled.php new file mode 100644 index 000000000..a703a5bb3 --- /dev/null +++ b/workflow/engine/classes/model/ListCanceled.php @@ -0,0 +1,19 @@ +dbMap !== null); + } + + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return $this->dbMap; + } + + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('workflow'); + + $tMap = $this->dbMap->addTable('LIST_CANCELED'); + $tMap->setPhpName('ListCanceled'); + + $tMap->setUseIdGenerator(false); + + $tMap->addPrimaryKey('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('TAS_UID', 'TasUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('PRO_UID', 'ProUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('APP_NUMBER', 'AppNumber', 'int', CreoleTypes::INTEGER, true, null); + + $tMap->addColumn('APP_TITLE', 'AppTitle', 'string', CreoleTypes::VARCHAR, true, 255); + + $tMap->addColumn('APP_PRO_TITLE', 'AppProTitle', 'string', CreoleTypes::VARCHAR, true, 255); + + $tMap->addColumn('APP_TAS_TITLE', 'AppTasTitle', 'string', CreoleTypes::VARCHAR, true, 255); + + $tMap->addColumn('APP_CANCELED_DATE', 'AppCanceledDate', 'int', CreoleTypes::TIMESTAMP, true, null); + + $tMap->addColumn('DEL_INDEX', 'DelIndex', 'int', CreoleTypes::INTEGER, true, null); + + $tMap->addColumn('DEL_PREVIOUS_USR_UID', 'DelPreviousUsrUid', 'string', CreoleTypes::VARCHAR, false, 32); + + $tMap->addColumn('DEL_CURRENT_USR_USERNAME', 'DelCurrentUsrUsername', 'string', CreoleTypes::VARCHAR, false, 100); + + $tMap->addColumn('DEL_CURRENT_USR_FIRSTNAME', 'DelCurrentUsrFirstname', 'string', CreoleTypes::VARCHAR, false, 50); + + $tMap->addColumn('DEL_CURRENT_USR_LASTNAME', 'DelCurrentUsrLastname', 'string', CreoleTypes::VARCHAR, false, 50); + + $tMap->addColumn('DEL_DELEGATE_DATE', 'DelDelegateDate', 'int', CreoleTypes::TIMESTAMP, true, null); + + $tMap->addColumn('DEL_INIT_DATE', 'DelInitDate', 'int', CreoleTypes::TIMESTAMP, false, null); + + $tMap->addColumn('DEL_DUE_DATE', 'DelDueDate', 'int', CreoleTypes::TIMESTAMP, false, null); + + $tMap->addColumn('DEL_PRIORITY', 'DelPriority', 'string', CreoleTypes::VARCHAR, true, 32); + + } // doBuild() + +} // ListCanceledMapBuilder diff --git a/workflow/engine/classes/model/map/ListPausedMapBuilder.php b/workflow/engine/classes/model/map/ListPausedMapBuilder.php new file mode 100644 index 000000000..e7cd450a5 --- /dev/null +++ b/workflow/engine/classes/model/map/ListPausedMapBuilder.php @@ -0,0 +1,106 @@ +dbMap !== null); + } + + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return $this->dbMap; + } + + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('workflow'); + + $tMap = $this->dbMap->addTable('LIST_PAUSED'); + $tMap->setPhpName('ListPaused'); + + $tMap->setUseIdGenerator(false); + + $tMap->addPrimaryKey('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addPrimaryKey('DEL_INDEX', 'DelIndex', 'int', CreoleTypes::INTEGER, true, null); + + $tMap->addColumn('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('TAS_UID', 'TasUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('PRO_UID', 'ProUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('APP_NUMBER', 'AppNumber', 'int', CreoleTypes::INTEGER, true, null); + + $tMap->addColumn('APP_TITLE', 'AppTitle', 'string', CreoleTypes::VARCHAR, true, 255); + + $tMap->addColumn('APP_PRO_TITLE', 'AppProTitle', 'string', CreoleTypes::VARCHAR, true, 255); + + $tMap->addColumn('APP_TAS_TITLE', 'AppTasTitle', 'string', CreoleTypes::VARCHAR, true, 255); + + $tMap->addColumn('APP_PAUSED_DATE', 'AppPausedDate', 'int', CreoleTypes::TIMESTAMP, true, null); + + $tMap->addColumn('APP_RESTART_DATE', 'AppRestartDate', 'int', CreoleTypes::TIMESTAMP, true, null); + + $tMap->addColumn('DEL_CURRENT_USR_USERNAME', 'DelCurrentUsrUsername', 'string', CreoleTypes::VARCHAR, false, 100); + + $tMap->addColumn('DEL_CURRENT_USR_FIRSTNAME', 'DelCurrentUsrFirstname', 'string', CreoleTypes::VARCHAR, false, 50); + + $tMap->addColumn('DEL_CURRENT_USR_LASTNAME', 'DelCurrentUsrLastname', 'string', CreoleTypes::VARCHAR, false, 50); + + $tMap->addColumn('DEL_DELEGATE_DATE', 'DelDelegateDate', 'int', CreoleTypes::TIMESTAMP, true, null); + + $tMap->addColumn('DEL_INIT_DATE', 'DelInitDate', 'int', CreoleTypes::TIMESTAMP, false, null); + + $tMap->addColumn('DEL_DUE_DATE', 'DelDueDate', 'int', CreoleTypes::TIMESTAMP, false, null); + + $tMap->addColumn('DEL_PRIORITY', 'DelPriority', 'string', CreoleTypes::VARCHAR, true, 32); + + } // doBuild() + +} // ListPausedMapBuilder diff --git a/workflow/engine/classes/model/om/BaseListCanceled.php b/workflow/engine/classes/model/om/BaseListCanceled.php new file mode 100644 index 000000000..14bdcb1d6 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseListCanceled.php @@ -0,0 +1,1608 @@ +app_uid; + } + + /** + * Get the [usr_uid] column value. + * + * @return string + */ + public function getUsrUid() + { + + return $this->usr_uid; + } + + /** + * Get the [tas_uid] column value. + * + * @return string + */ + public function getTasUid() + { + + return $this->tas_uid; + } + + /** + * Get the [pro_uid] column value. + * + * @return string + */ + public function getProUid() + { + + return $this->pro_uid; + } + + /** + * Get the [app_number] column value. + * + * @return int + */ + public function getAppNumber() + { + + return $this->app_number; + } + + /** + * Get the [app_title] column value. + * + * @return string + */ + public function getAppTitle() + { + + return $this->app_title; + } + + /** + * Get the [app_pro_title] column value. + * + * @return string + */ + public function getAppProTitle() + { + + return $this->app_pro_title; + } + + /** + * Get the [app_tas_title] column value. + * + * @return string + */ + public function getAppTasTitle() + { + + return $this->app_tas_title; + } + + /** + * Get the [optionally formatted] [app_canceled_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getAppCanceledDate($format = 'Y-m-d H:i:s') + { + + if ($this->app_canceled_date === null || $this->app_canceled_date === '') { + return null; + } elseif (!is_int($this->app_canceled_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->app_canceled_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [app_canceled_date] as date/time value: " . + var_export($this->app_canceled_date, true)); + } + } else { + $ts = $this->app_canceled_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [del_index] column value. + * + * @return int + */ + public function getDelIndex() + { + + return $this->del_index; + } + + /** + * Get the [del_previous_usr_uid] column value. + * + * @return string + */ + public function getDelPreviousUsrUid() + { + + return $this->del_previous_usr_uid; + } + + /** + * Get the [del_current_usr_username] column value. + * + * @return string + */ + public function getDelCurrentUsrUsername() + { + + return $this->del_current_usr_username; + } + + /** + * Get the [del_current_usr_firstname] column value. + * + * @return string + */ + public function getDelCurrentUsrFirstname() + { + + return $this->del_current_usr_firstname; + } + + /** + * Get the [del_current_usr_lastname] column value. + * + * @return string + */ + public function getDelCurrentUsrLastname() + { + + return $this->del_current_usr_lastname; + } + + /** + * Get the [optionally formatted] [del_delegate_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getDelDelegateDate($format = 'Y-m-d H:i:s') + { + + if ($this->del_delegate_date === null || $this->del_delegate_date === '') { + return null; + } elseif (!is_int($this->del_delegate_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->del_delegate_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [del_delegate_date] as date/time value: " . + var_export($this->del_delegate_date, true)); + } + } else { + $ts = $this->del_delegate_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [optionally formatted] [del_init_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getDelInitDate($format = 'Y-m-d H:i:s') + { + + if ($this->del_init_date === null || $this->del_init_date === '') { + return null; + } elseif (!is_int($this->del_init_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->del_init_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [del_init_date] as date/time value: " . + var_export($this->del_init_date, true)); + } + } else { + $ts = $this->del_init_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [optionally formatted] [del_due_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getDelDueDate($format = 'Y-m-d H:i:s') + { + + if ($this->del_due_date === null || $this->del_due_date === '') { + return null; + } elseif (!is_int($this->del_due_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->del_due_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [del_due_date] as date/time value: " . + var_export($this->del_due_date, true)); + } + } else { + $ts = $this->del_due_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [del_priority] column value. + * + * @return string + */ + public function getDelPriority() + { + + return $this->del_priority; + } + + /** + * Set the value of [app_uid] column. + * + * @param string $v new value + * @return void + */ + public function setAppUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_uid !== $v || $v === '') { + $this->app_uid = $v; + $this->modifiedColumns[] = ListCanceledPeer::APP_UID; + } + + } // setAppUid() + + /** + * Set the value of [usr_uid] column. + * + * @param string $v new value + * @return void + */ + public function setUsrUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->usr_uid !== $v || $v === '') { + $this->usr_uid = $v; + $this->modifiedColumns[] = ListCanceledPeer::USR_UID; + } + + } // setUsrUid() + + /** + * Set the value of [tas_uid] column. + * + * @param string $v new value + * @return void + */ + public function setTasUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->tas_uid !== $v || $v === '') { + $this->tas_uid = $v; + $this->modifiedColumns[] = ListCanceledPeer::TAS_UID; + } + + } // setTasUid() + + /** + * Set the value of [pro_uid] column. + * + * @param string $v new value + * @return void + */ + public function setProUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->pro_uid !== $v || $v === '') { + $this->pro_uid = $v; + $this->modifiedColumns[] = ListCanceledPeer::PRO_UID; + } + + } // setProUid() + + /** + * Set the value of [app_number] column. + * + * @param int $v new value + * @return void + */ + public function setAppNumber($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->app_number !== $v || $v === 0) { + $this->app_number = $v; + $this->modifiedColumns[] = ListCanceledPeer::APP_NUMBER; + } + + } // setAppNumber() + + /** + * Set the value of [app_title] column. + * + * @param string $v new value + * @return void + */ + public function setAppTitle($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_title !== $v || $v === '') { + $this->app_title = $v; + $this->modifiedColumns[] = ListCanceledPeer::APP_TITLE; + } + + } // setAppTitle() + + /** + * Set the value of [app_pro_title] column. + * + * @param string $v new value + * @return void + */ + public function setAppProTitle($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_pro_title !== $v || $v === '') { + $this->app_pro_title = $v; + $this->modifiedColumns[] = ListCanceledPeer::APP_PRO_TITLE; + } + + } // setAppProTitle() + + /** + * Set the value of [app_tas_title] column. + * + * @param string $v new value + * @return void + */ + public function setAppTasTitle($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_tas_title !== $v || $v === '') { + $this->app_tas_title = $v; + $this->modifiedColumns[] = ListCanceledPeer::APP_TAS_TITLE; + } + + } // setAppTasTitle() + + /** + * Set the value of [app_canceled_date] column. + * + * @param int $v new value + * @return void + */ + public function setAppCanceledDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [app_canceled_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->app_canceled_date !== $ts) { + $this->app_canceled_date = $ts; + $this->modifiedColumns[] = ListCanceledPeer::APP_CANCELED_DATE; + } + + } // setAppCanceledDate() + + /** + * Set the value of [del_index] column. + * + * @param int $v new value + * @return void + */ + public function setDelIndex($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->del_index !== $v || $v === 0) { + $this->del_index = $v; + $this->modifiedColumns[] = ListCanceledPeer::DEL_INDEX; + } + + } // setDelIndex() + + /** + * Set the value of [del_previous_usr_uid] column. + * + * @param string $v new value + * @return void + */ + public function setDelPreviousUsrUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_previous_usr_uid !== $v || $v === '') { + $this->del_previous_usr_uid = $v; + $this->modifiedColumns[] = ListCanceledPeer::DEL_PREVIOUS_USR_UID; + } + + } // setDelPreviousUsrUid() + + /** + * Set the value of [del_current_usr_username] column. + * + * @param string $v new value + * @return void + */ + public function setDelCurrentUsrUsername($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_current_usr_username !== $v || $v === '') { + $this->del_current_usr_username = $v; + $this->modifiedColumns[] = ListCanceledPeer::DEL_CURRENT_USR_USERNAME; + } + + } // setDelCurrentUsrUsername() + + /** + * Set the value of [del_current_usr_firstname] column. + * + * @param string $v new value + * @return void + */ + public function setDelCurrentUsrFirstname($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_current_usr_firstname !== $v || $v === '') { + $this->del_current_usr_firstname = $v; + $this->modifiedColumns[] = ListCanceledPeer::DEL_CURRENT_USR_FIRSTNAME; + } + + } // setDelCurrentUsrFirstname() + + /** + * Set the value of [del_current_usr_lastname] column. + * + * @param string $v new value + * @return void + */ + public function setDelCurrentUsrLastname($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_current_usr_lastname !== $v || $v === '') { + $this->del_current_usr_lastname = $v; + $this->modifiedColumns[] = ListCanceledPeer::DEL_CURRENT_USR_LASTNAME; + } + + } // setDelCurrentUsrLastname() + + /** + * Set the value of [del_delegate_date] column. + * + * @param int $v new value + * @return void + */ + public function setDelDelegateDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [del_delegate_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->del_delegate_date !== $ts) { + $this->del_delegate_date = $ts; + $this->modifiedColumns[] = ListCanceledPeer::DEL_DELEGATE_DATE; + } + + } // setDelDelegateDate() + + /** + * Set the value of [del_init_date] column. + * + * @param int $v new value + * @return void + */ + public function setDelInitDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [del_init_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->del_init_date !== $ts) { + $this->del_init_date = $ts; + $this->modifiedColumns[] = ListCanceledPeer::DEL_INIT_DATE; + } + + } // setDelInitDate() + + /** + * Set the value of [del_due_date] column. + * + * @param int $v new value + * @return void + */ + public function setDelDueDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [del_due_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->del_due_date !== $ts) { + $this->del_due_date = $ts; + $this->modifiedColumns[] = ListCanceledPeer::DEL_DUE_DATE; + } + + } // setDelDueDate() + + /** + * Set the value of [del_priority] column. + * + * @param string $v new value + * @return void + */ + public function setDelPriority($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_priority !== $v || $v === '3') { + $this->del_priority = $v; + $this->modifiedColumns[] = ListCanceledPeer::DEL_PRIORITY; + } + + } // setDelPriority() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (1-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. + * @param int $startcol 1-based offset column which indicates which restultset column to start with. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->app_uid = $rs->getString($startcol + 0); + + $this->usr_uid = $rs->getString($startcol + 1); + + $this->tas_uid = $rs->getString($startcol + 2); + + $this->pro_uid = $rs->getString($startcol + 3); + + $this->app_number = $rs->getInt($startcol + 4); + + $this->app_title = $rs->getString($startcol + 5); + + $this->app_pro_title = $rs->getString($startcol + 6); + + $this->app_tas_title = $rs->getString($startcol + 7); + + $this->app_canceled_date = $rs->getTimestamp($startcol + 8, null); + + $this->del_index = $rs->getInt($startcol + 9); + + $this->del_previous_usr_uid = $rs->getString($startcol + 10); + + $this->del_current_usr_username = $rs->getString($startcol + 11); + + $this->del_current_usr_firstname = $rs->getString($startcol + 12); + + $this->del_current_usr_lastname = $rs->getString($startcol + 13); + + $this->del_delegate_date = $rs->getTimestamp($startcol + 14, null); + + $this->del_init_date = $rs->getTimestamp($startcol + 15, null); + + $this->del_due_date = $rs->getTimestamp($startcol + 16, null); + + $this->del_priority = $rs->getString($startcol + 17); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 18; // 18 = ListCanceledPeer::NUM_COLUMNS - ListCanceledPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating ListCanceled object", $e); + } + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param Connection $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ListCanceledPeer::DATABASE_NAME); + } + + try { + $con->begin(); + ListCanceledPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. If the object is new, + * it inserts it; otherwise an update is performed. This method + * wraps the doSave() worker method in a transaction. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update + * @throws PropelException + * @see doSave() + */ + public function save($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ListCanceledPeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring + * @throws PropelException + * @see save() + */ + protected function doSave($con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = ListCanceledPeer::doInsert($this, $con); + $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which + // should always be true here (even though technically + // BasePeer::doInsert() can insert multiple rows). + + $this->setNew(false); + } else { + $affectedRows += ListCanceledPeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; + array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = ListCanceledPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ListCanceledPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getAppUid(); + break; + case 1: + return $this->getUsrUid(); + break; + case 2: + return $this->getTasUid(); + break; + case 3: + return $this->getProUid(); + break; + case 4: + return $this->getAppNumber(); + break; + case 5: + return $this->getAppTitle(); + break; + case 6: + return $this->getAppProTitle(); + break; + case 7: + return $this->getAppTasTitle(); + break; + case 8: + return $this->getAppCanceledDate(); + break; + case 9: + return $this->getDelIndex(); + break; + case 10: + return $this->getDelPreviousUsrUid(); + break; + case 11: + return $this->getDelCurrentUsrUsername(); + break; + case 12: + return $this->getDelCurrentUsrFirstname(); + break; + case 13: + return $this->getDelCurrentUsrLastname(); + break; + case 14: + return $this->getDelDelegateDate(); + break; + case 15: + return $this->getDelInitDate(); + break; + case 16: + return $this->getDelDueDate(); + break; + case 17: + return $this->getDelPriority(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = ListCanceledPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getAppUid(), + $keys[1] => $this->getUsrUid(), + $keys[2] => $this->getTasUid(), + $keys[3] => $this->getProUid(), + $keys[4] => $this->getAppNumber(), + $keys[5] => $this->getAppTitle(), + $keys[6] => $this->getAppProTitle(), + $keys[7] => $this->getAppTasTitle(), + $keys[8] => $this->getAppCanceledDate(), + $keys[9] => $this->getDelIndex(), + $keys[10] => $this->getDelPreviousUsrUid(), + $keys[11] => $this->getDelCurrentUsrUsername(), + $keys[12] => $this->getDelCurrentUsrFirstname(), + $keys[13] => $this->getDelCurrentUsrLastname(), + $keys[14] => $this->getDelDelegateDate(), + $keys[15] => $this->getDelInitDate(), + $keys[16] => $this->getDelDueDate(), + $keys[17] => $this->getDelPriority(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ListCanceledPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setAppUid($value); + break; + case 1: + $this->setUsrUid($value); + break; + case 2: + $this->setTasUid($value); + break; + case 3: + $this->setProUid($value); + break; + case 4: + $this->setAppNumber($value); + break; + case 5: + $this->setAppTitle($value); + break; + case 6: + $this->setAppProTitle($value); + break; + case 7: + $this->setAppTasTitle($value); + break; + case 8: + $this->setAppCanceledDate($value); + break; + case 9: + $this->setDelIndex($value); + break; + case 10: + $this->setDelPreviousUsrUid($value); + break; + case 11: + $this->setDelCurrentUsrUsername($value); + break; + case 12: + $this->setDelCurrentUsrFirstname($value); + break; + case 13: + $this->setDelCurrentUsrLastname($value); + break; + case 14: + $this->setDelDelegateDate($value); + break; + case 15: + $this->setDelInitDate($value); + break; + case 16: + $this->setDelDueDate($value); + break; + case 17: + $this->setDelPriority($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, + * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = ListCanceledPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) { + $this->setAppUid($arr[$keys[0]]); + } + + if (array_key_exists($keys[1], $arr)) { + $this->setUsrUid($arr[$keys[1]]); + } + + if (array_key_exists($keys[2], $arr)) { + $this->setTasUid($arr[$keys[2]]); + } + + if (array_key_exists($keys[3], $arr)) { + $this->setProUid($arr[$keys[3]]); + } + + if (array_key_exists($keys[4], $arr)) { + $this->setAppNumber($arr[$keys[4]]); + } + + if (array_key_exists($keys[5], $arr)) { + $this->setAppTitle($arr[$keys[5]]); + } + + if (array_key_exists($keys[6], $arr)) { + $this->setAppProTitle($arr[$keys[6]]); + } + + if (array_key_exists($keys[7], $arr)) { + $this->setAppTasTitle($arr[$keys[7]]); + } + + if (array_key_exists($keys[8], $arr)) { + $this->setAppCanceledDate($arr[$keys[8]]); + } + + if (array_key_exists($keys[9], $arr)) { + $this->setDelIndex($arr[$keys[9]]); + } + + if (array_key_exists($keys[10], $arr)) { + $this->setDelPreviousUsrUid($arr[$keys[10]]); + } + + if (array_key_exists($keys[11], $arr)) { + $this->setDelCurrentUsrUsername($arr[$keys[11]]); + } + + if (array_key_exists($keys[12], $arr)) { + $this->setDelCurrentUsrFirstname($arr[$keys[12]]); + } + + if (array_key_exists($keys[13], $arr)) { + $this->setDelCurrentUsrLastname($arr[$keys[13]]); + } + + if (array_key_exists($keys[14], $arr)) { + $this->setDelDelegateDate($arr[$keys[14]]); + } + + if (array_key_exists($keys[15], $arr)) { + $this->setDelInitDate($arr[$keys[15]]); + } + + if (array_key_exists($keys[16], $arr)) { + $this->setDelDueDate($arr[$keys[16]]); + } + + if (array_key_exists($keys[17], $arr)) { + $this->setDelPriority($arr[$keys[17]]); + } + + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(ListCanceledPeer::DATABASE_NAME); + + if ($this->isColumnModified(ListCanceledPeer::APP_UID)) { + $criteria->add(ListCanceledPeer::APP_UID, $this->app_uid); + } + + if ($this->isColumnModified(ListCanceledPeer::USR_UID)) { + $criteria->add(ListCanceledPeer::USR_UID, $this->usr_uid); + } + + if ($this->isColumnModified(ListCanceledPeer::TAS_UID)) { + $criteria->add(ListCanceledPeer::TAS_UID, $this->tas_uid); + } + + if ($this->isColumnModified(ListCanceledPeer::PRO_UID)) { + $criteria->add(ListCanceledPeer::PRO_UID, $this->pro_uid); + } + + if ($this->isColumnModified(ListCanceledPeer::APP_NUMBER)) { + $criteria->add(ListCanceledPeer::APP_NUMBER, $this->app_number); + } + + if ($this->isColumnModified(ListCanceledPeer::APP_TITLE)) { + $criteria->add(ListCanceledPeer::APP_TITLE, $this->app_title); + } + + if ($this->isColumnModified(ListCanceledPeer::APP_PRO_TITLE)) { + $criteria->add(ListCanceledPeer::APP_PRO_TITLE, $this->app_pro_title); + } + + if ($this->isColumnModified(ListCanceledPeer::APP_TAS_TITLE)) { + $criteria->add(ListCanceledPeer::APP_TAS_TITLE, $this->app_tas_title); + } + + if ($this->isColumnModified(ListCanceledPeer::APP_CANCELED_DATE)) { + $criteria->add(ListCanceledPeer::APP_CANCELED_DATE, $this->app_canceled_date); + } + + if ($this->isColumnModified(ListCanceledPeer::DEL_INDEX)) { + $criteria->add(ListCanceledPeer::DEL_INDEX, $this->del_index); + } + + if ($this->isColumnModified(ListCanceledPeer::DEL_PREVIOUS_USR_UID)) { + $criteria->add(ListCanceledPeer::DEL_PREVIOUS_USR_UID, $this->del_previous_usr_uid); + } + + if ($this->isColumnModified(ListCanceledPeer::DEL_CURRENT_USR_USERNAME)) { + $criteria->add(ListCanceledPeer::DEL_CURRENT_USR_USERNAME, $this->del_current_usr_username); + } + + if ($this->isColumnModified(ListCanceledPeer::DEL_CURRENT_USR_FIRSTNAME)) { + $criteria->add(ListCanceledPeer::DEL_CURRENT_USR_FIRSTNAME, $this->del_current_usr_firstname); + } + + if ($this->isColumnModified(ListCanceledPeer::DEL_CURRENT_USR_LASTNAME)) { + $criteria->add(ListCanceledPeer::DEL_CURRENT_USR_LASTNAME, $this->del_current_usr_lastname); + } + + if ($this->isColumnModified(ListCanceledPeer::DEL_DELEGATE_DATE)) { + $criteria->add(ListCanceledPeer::DEL_DELEGATE_DATE, $this->del_delegate_date); + } + + if ($this->isColumnModified(ListCanceledPeer::DEL_INIT_DATE)) { + $criteria->add(ListCanceledPeer::DEL_INIT_DATE, $this->del_init_date); + } + + if ($this->isColumnModified(ListCanceledPeer::DEL_DUE_DATE)) { + $criteria->add(ListCanceledPeer::DEL_DUE_DATE, $this->del_due_date); + } + + if ($this->isColumnModified(ListCanceledPeer::DEL_PRIORITY)) { + $criteria->add(ListCanceledPeer::DEL_PRIORITY, $this->del_priority); + } + + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(ListCanceledPeer::DATABASE_NAME); + + $criteria->add(ListCanceledPeer::APP_UID, $this->app_uid); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getAppUid(); + } + + /** + * Generic method to set the primary key (app_uid column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setAppUid($key); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of ListCanceled (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setUsrUid($this->usr_uid); + + $copyObj->setTasUid($this->tas_uid); + + $copyObj->setProUid($this->pro_uid); + + $copyObj->setAppNumber($this->app_number); + + $copyObj->setAppTitle($this->app_title); + + $copyObj->setAppProTitle($this->app_pro_title); + + $copyObj->setAppTasTitle($this->app_tas_title); + + $copyObj->setAppCanceledDate($this->app_canceled_date); + + $copyObj->setDelIndex($this->del_index); + + $copyObj->setDelPreviousUsrUid($this->del_previous_usr_uid); + + $copyObj->setDelCurrentUsrUsername($this->del_current_usr_username); + + $copyObj->setDelCurrentUsrFirstname($this->del_current_usr_firstname); + + $copyObj->setDelCurrentUsrLastname($this->del_current_usr_lastname); + + $copyObj->setDelDelegateDate($this->del_delegate_date); + + $copyObj->setDelInitDate($this->del_init_date); + + $copyObj->setDelDueDate($this->del_due_date); + + $copyObj->setDelPriority($this->del_priority); + + + $copyObj->setNew(true); + + $copyObj->setAppUid(''); // this is a pkey column, so set to default value + + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return ListCanceled Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return ListCanceledPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new ListCanceledPeer(); + } + return self::$peer; + } +} + diff --git a/workflow/engine/classes/model/om/BaseListCanceledPeer.php b/workflow/engine/classes/model/om/BaseListCanceledPeer.php new file mode 100644 index 000000000..0ab6942a9 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseListCanceledPeer.php @@ -0,0 +1,652 @@ + array ('AppUid', 'UsrUid', 'TasUid', 'ProUid', 'AppNumber', 'AppTitle', 'AppProTitle', 'AppTasTitle', 'AppCanceledDate', 'DelIndex', 'DelPreviousUsrUid', 'DelCurrentUsrUsername', 'DelCurrentUsrFirstname', 'DelCurrentUsrLastname', 'DelDelegateDate', 'DelInitDate', 'DelDueDate', 'DelPriority', ), + BasePeer::TYPE_COLNAME => array (ListCanceledPeer::APP_UID, ListCanceledPeer::USR_UID, ListCanceledPeer::TAS_UID, ListCanceledPeer::PRO_UID, ListCanceledPeer::APP_NUMBER, ListCanceledPeer::APP_TITLE, ListCanceledPeer::APP_PRO_TITLE, ListCanceledPeer::APP_TAS_TITLE, ListCanceledPeer::APP_CANCELED_DATE, ListCanceledPeer::DEL_INDEX, ListCanceledPeer::DEL_PREVIOUS_USR_UID, ListCanceledPeer::DEL_CURRENT_USR_USERNAME, ListCanceledPeer::DEL_CURRENT_USR_FIRSTNAME, ListCanceledPeer::DEL_CURRENT_USR_LASTNAME, ListCanceledPeer::DEL_DELEGATE_DATE, ListCanceledPeer::DEL_INIT_DATE, ListCanceledPeer::DEL_DUE_DATE, ListCanceledPeer::DEL_PRIORITY, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'USR_UID', 'TAS_UID', 'PRO_UID', 'APP_NUMBER', 'APP_TITLE', 'APP_PRO_TITLE', 'APP_TAS_TITLE', 'APP_CANCELED_DATE', 'DEL_INDEX', 'DEL_PREVIOUS_USR_UID', 'DEL_CURRENT_USR_USERNAME', 'DEL_CURRENT_USR_FIRSTNAME', 'DEL_CURRENT_USR_LASTNAME', 'DEL_DELEGATE_DATE', 'DEL_INIT_DATE', 'DEL_DUE_DATE', 'DEL_PRIORITY', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'UsrUid' => 1, 'TasUid' => 2, 'ProUid' => 3, 'AppNumber' => 4, 'AppTitle' => 5, 'AppProTitle' => 6, 'AppTasTitle' => 7, 'AppCanceledDate' => 8, 'DelIndex' => 9, 'DelPreviousUsrUid' => 10, 'DelCurrentUsrUsername' => 11, 'DelCurrentUsrFirstname' => 12, 'DelCurrentUsrLastname' => 13, 'DelDelegateDate' => 14, 'DelInitDate' => 15, 'DelDueDate' => 16, 'DelPriority' => 17, ), + BasePeer::TYPE_COLNAME => array (ListCanceledPeer::APP_UID => 0, ListCanceledPeer::USR_UID => 1, ListCanceledPeer::TAS_UID => 2, ListCanceledPeer::PRO_UID => 3, ListCanceledPeer::APP_NUMBER => 4, ListCanceledPeer::APP_TITLE => 5, ListCanceledPeer::APP_PRO_TITLE => 6, ListCanceledPeer::APP_TAS_TITLE => 7, ListCanceledPeer::APP_CANCELED_DATE => 8, ListCanceledPeer::DEL_INDEX => 9, ListCanceledPeer::DEL_PREVIOUS_USR_UID => 10, ListCanceledPeer::DEL_CURRENT_USR_USERNAME => 11, ListCanceledPeer::DEL_CURRENT_USR_FIRSTNAME => 12, ListCanceledPeer::DEL_CURRENT_USR_LASTNAME => 13, ListCanceledPeer::DEL_DELEGATE_DATE => 14, ListCanceledPeer::DEL_INIT_DATE => 15, ListCanceledPeer::DEL_DUE_DATE => 16, ListCanceledPeer::DEL_PRIORITY => 17, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'USR_UID' => 1, 'TAS_UID' => 2, 'PRO_UID' => 3, 'APP_NUMBER' => 4, 'APP_TITLE' => 5, 'APP_PRO_TITLE' => 6, 'APP_TAS_TITLE' => 7, 'APP_CANCELED_DATE' => 8, 'DEL_INDEX' => 9, 'DEL_PREVIOUS_USR_UID' => 10, 'DEL_CURRENT_USR_USERNAME' => 11, 'DEL_CURRENT_USR_FIRSTNAME' => 12, 'DEL_CURRENT_USR_LASTNAME' => 13, 'DEL_DELEGATE_DATE' => 14, 'DEL_INIT_DATE' => 15, 'DEL_DUE_DATE' => 16, 'DEL_PRIORITY' => 17, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + ); + + /** + * @return MapBuilder the map builder for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getMapBuilder() + { + include_once 'classes/model/map/ListCanceledMapBuilder.php'; + return BasePeer::getMapBuilder('classes.model.map.ListCanceledMapBuilder'); + } + /** + * Gets a map (hash) of PHP names to DB column names. + * + * @return array The PHP to DB name map for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. + */ + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = ListCanceledPeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. ListCanceledPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(ListCanceledPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param criteria object containing the columns to add. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(ListCanceledPeer::APP_UID); + + $criteria->addSelectColumn(ListCanceledPeer::USR_UID); + + $criteria->addSelectColumn(ListCanceledPeer::TAS_UID); + + $criteria->addSelectColumn(ListCanceledPeer::PRO_UID); + + $criteria->addSelectColumn(ListCanceledPeer::APP_NUMBER); + + $criteria->addSelectColumn(ListCanceledPeer::APP_TITLE); + + $criteria->addSelectColumn(ListCanceledPeer::APP_PRO_TITLE); + + $criteria->addSelectColumn(ListCanceledPeer::APP_TAS_TITLE); + + $criteria->addSelectColumn(ListCanceledPeer::APP_CANCELED_DATE); + + $criteria->addSelectColumn(ListCanceledPeer::DEL_INDEX); + + $criteria->addSelectColumn(ListCanceledPeer::DEL_PREVIOUS_USR_UID); + + $criteria->addSelectColumn(ListCanceledPeer::DEL_CURRENT_USR_USERNAME); + + $criteria->addSelectColumn(ListCanceledPeer::DEL_CURRENT_USR_FIRSTNAME); + + $criteria->addSelectColumn(ListCanceledPeer::DEL_CURRENT_USR_LASTNAME); + + $criteria->addSelectColumn(ListCanceledPeer::DEL_DELEGATE_DATE); + + $criteria->addSelectColumn(ListCanceledPeer::DEL_INIT_DATE); + + $criteria->addSelectColumn(ListCanceledPeer::DEL_DUE_DATE); + + $criteria->addSelectColumn(ListCanceledPeer::DEL_PRIORITY); + + } + + const COUNT = 'COUNT(LIST_CANCELED.APP_UID)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT LIST_CANCELED.APP_UID)'; + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). + * @param Connection $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(ListCanceledPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(ListCanceledPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach ($criteria->getGroupByColumns() as $column) { + $criteria->addSelectColumn($column); + } + + $rs = ListCanceledPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return ListCanceled + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = ListCanceledPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, $con = null) + { + return ListCanceledPeer::populateObjects(ListCanceledPeer::doSelectRS($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() + * method to get a ResultSet. + * + * Use this method directly if you want to just get the resultset + * (instead of an array of objects). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return ResultSet The resultset object with numerically-indexed fields. + * @see BasePeer::doSelect() + */ + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + ListCanceledPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + return BasePeer::doSelect($criteria, $con); + } + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = ListCanceledPeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while ($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * The class that the Peer will make instances of. + * + * This uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @return string path.to.ClassName + */ + public static function getOMClass() + { + return ListCanceledPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a ListCanceled or Criteria object. + * + * @param mixed $values Criteria or ListCanceled object containing data that is used to create the INSERT statement. + * @param Connection $con the connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from ListCanceled object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a ListCanceled or Criteria object. + * + * @param mixed $values Criteria or ListCanceled object containing data create the UPDATE statement. + * @param Connection $con The connection to use (specify Connection exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(ListCanceledPeer::APP_UID); + $selectCriteria->add(ListCanceledPeer::APP_UID, $criteria->remove(ListCanceledPeer::APP_UID), $comparison); + + } else { + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the LIST_CANCELED table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(ListCanceledPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a ListCanceled or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ListCanceled object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param Connection $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ListCanceledPeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof ListCanceled) { + + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(ListCanceledPeer::APP_UID, (array) $values, Criteria::IN); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given ListCanceled object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param ListCanceled $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(ListCanceled $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(ListCanceledPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(ListCanceledPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(ListCanceledPeer::DATABASE_NAME, ListCanceledPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param mixed $pk the primary key. + * @param Connection $con the connection to use + * @return ListCanceled + */ + public static function retrieveByPK($pk, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $criteria = new Criteria(ListCanceledPeer::DATABASE_NAME); + + $criteria->add(ListCanceledPeer::APP_UID, $pk); + + + $v = ListCanceledPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(); + $criteria->add(ListCanceledPeer::APP_UID, $pks, Criteria::IN); + $objs = ListCanceledPeer::doSelect($criteria, $con); + } + return $objs; + } +} + + +// static code to register the map builder for this Peer with the main Propel class +if (Propel::isInit()) { + // the MapBuilder classes register themselves with Propel during initialization + // so we need to load them here. + try { + BaseListCanceledPeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + // even if Propel is not yet initialized, the map builder class can be registered + // now and then it will be loaded when Propel initializes. + require_once 'classes/model/map/ListCanceledMapBuilder.php'; + Propel::registerMapBuilder('classes.model.map.ListCanceledMapBuilder'); +} + diff --git a/workflow/engine/classes/model/om/BaseListPaused.php b/workflow/engine/classes/model/om/BaseListPaused.php new file mode 100644 index 000000000..719232659 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseListPaused.php @@ -0,0 +1,1648 @@ +app_uid; + } + + /** + * Get the [del_index] column value. + * + * @return int + */ + public function getDelIndex() + { + + return $this->del_index; + } + + /** + * Get the [usr_uid] column value. + * + * @return string + */ + public function getUsrUid() + { + + return $this->usr_uid; + } + + /** + * Get the [tas_uid] column value. + * + * @return string + */ + public function getTasUid() + { + + return $this->tas_uid; + } + + /** + * Get the [pro_uid] column value. + * + * @return string + */ + public function getProUid() + { + + return $this->pro_uid; + } + + /** + * Get the [app_number] column value. + * + * @return int + */ + public function getAppNumber() + { + + return $this->app_number; + } + + /** + * Get the [app_title] column value. + * + * @return string + */ + public function getAppTitle() + { + + return $this->app_title; + } + + /** + * Get the [app_pro_title] column value. + * + * @return string + */ + public function getAppProTitle() + { + + return $this->app_pro_title; + } + + /** + * Get the [app_tas_title] column value. + * + * @return string + */ + public function getAppTasTitle() + { + + return $this->app_tas_title; + } + + /** + * Get the [optionally formatted] [app_paused_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getAppPausedDate($format = 'Y-m-d H:i:s') + { + + if ($this->app_paused_date === null || $this->app_paused_date === '') { + return null; + } elseif (!is_int($this->app_paused_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->app_paused_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [app_paused_date] as date/time value: " . + var_export($this->app_paused_date, true)); + } + } else { + $ts = $this->app_paused_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [optionally formatted] [app_restart_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getAppRestartDate($format = 'Y-m-d H:i:s') + { + + if ($this->app_restart_date === null || $this->app_restart_date === '') { + return null; + } elseif (!is_int($this->app_restart_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->app_restart_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [app_restart_date] as date/time value: " . + var_export($this->app_restart_date, true)); + } + } else { + $ts = $this->app_restart_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [del_current_usr_username] column value. + * + * @return string + */ + public function getDelCurrentUsrUsername() + { + + return $this->del_current_usr_username; + } + + /** + * Get the [del_current_usr_firstname] column value. + * + * @return string + */ + public function getDelCurrentUsrFirstname() + { + + return $this->del_current_usr_firstname; + } + + /** + * Get the [del_current_usr_lastname] column value. + * + * @return string + */ + public function getDelCurrentUsrLastname() + { + + return $this->del_current_usr_lastname; + } + + /** + * Get the [optionally formatted] [del_delegate_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getDelDelegateDate($format = 'Y-m-d H:i:s') + { + + if ($this->del_delegate_date === null || $this->del_delegate_date === '') { + return null; + } elseif (!is_int($this->del_delegate_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->del_delegate_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [del_delegate_date] as date/time value: " . + var_export($this->del_delegate_date, true)); + } + } else { + $ts = $this->del_delegate_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [optionally formatted] [del_init_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getDelInitDate($format = 'Y-m-d H:i:s') + { + + if ($this->del_init_date === null || $this->del_init_date === '') { + return null; + } elseif (!is_int($this->del_init_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->del_init_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [del_init_date] as date/time value: " . + var_export($this->del_init_date, true)); + } + } else { + $ts = $this->del_init_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [optionally formatted] [del_due_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getDelDueDate($format = 'Y-m-d H:i:s') + { + + if ($this->del_due_date === null || $this->del_due_date === '') { + return null; + } elseif (!is_int($this->del_due_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->del_due_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [del_due_date] as date/time value: " . + var_export($this->del_due_date, true)); + } + } else { + $ts = $this->del_due_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [del_priority] column value. + * + * @return string + */ + public function getDelPriority() + { + + return $this->del_priority; + } + + /** + * Set the value of [app_uid] column. + * + * @param string $v new value + * @return void + */ + public function setAppUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_uid !== $v || $v === '') { + $this->app_uid = $v; + $this->modifiedColumns[] = ListPausedPeer::APP_UID; + } + + } // setAppUid() + + /** + * Set the value of [del_index] column. + * + * @param int $v new value + * @return void + */ + public function setDelIndex($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->del_index !== $v || $v === 0) { + $this->del_index = $v; + $this->modifiedColumns[] = ListPausedPeer::DEL_INDEX; + } + + } // setDelIndex() + + /** + * Set the value of [usr_uid] column. + * + * @param string $v new value + * @return void + */ + public function setUsrUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->usr_uid !== $v || $v === '') { + $this->usr_uid = $v; + $this->modifiedColumns[] = ListPausedPeer::USR_UID; + } + + } // setUsrUid() + + /** + * Set the value of [tas_uid] column. + * + * @param string $v new value + * @return void + */ + public function setTasUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->tas_uid !== $v || $v === '') { + $this->tas_uid = $v; + $this->modifiedColumns[] = ListPausedPeer::TAS_UID; + } + + } // setTasUid() + + /** + * Set the value of [pro_uid] column. + * + * @param string $v new value + * @return void + */ + public function setProUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->pro_uid !== $v || $v === '') { + $this->pro_uid = $v; + $this->modifiedColumns[] = ListPausedPeer::PRO_UID; + } + + } // setProUid() + + /** + * Set the value of [app_number] column. + * + * @param int $v new value + * @return void + */ + public function setAppNumber($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->app_number !== $v || $v === 0) { + $this->app_number = $v; + $this->modifiedColumns[] = ListPausedPeer::APP_NUMBER; + } + + } // setAppNumber() + + /** + * Set the value of [app_title] column. + * + * @param string $v new value + * @return void + */ + public function setAppTitle($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_title !== $v || $v === '') { + $this->app_title = $v; + $this->modifiedColumns[] = ListPausedPeer::APP_TITLE; + } + + } // setAppTitle() + + /** + * Set the value of [app_pro_title] column. + * + * @param string $v new value + * @return void + */ + public function setAppProTitle($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_pro_title !== $v || $v === '') { + $this->app_pro_title = $v; + $this->modifiedColumns[] = ListPausedPeer::APP_PRO_TITLE; + } + + } // setAppProTitle() + + /** + * Set the value of [app_tas_title] column. + * + * @param string $v new value + * @return void + */ + public function setAppTasTitle($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_tas_title !== $v || $v === '') { + $this->app_tas_title = $v; + $this->modifiedColumns[] = ListPausedPeer::APP_TAS_TITLE; + } + + } // setAppTasTitle() + + /** + * Set the value of [app_paused_date] column. + * + * @param int $v new value + * @return void + */ + public function setAppPausedDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [app_paused_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->app_paused_date !== $ts) { + $this->app_paused_date = $ts; + $this->modifiedColumns[] = ListPausedPeer::APP_PAUSED_DATE; + } + + } // setAppPausedDate() + + /** + * Set the value of [app_restart_date] column. + * + * @param int $v new value + * @return void + */ + public function setAppRestartDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [app_restart_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->app_restart_date !== $ts) { + $this->app_restart_date = $ts; + $this->modifiedColumns[] = ListPausedPeer::APP_RESTART_DATE; + } + + } // setAppRestartDate() + + /** + * Set the value of [del_current_usr_username] column. + * + * @param string $v new value + * @return void + */ + public function setDelCurrentUsrUsername($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_current_usr_username !== $v || $v === '') { + $this->del_current_usr_username = $v; + $this->modifiedColumns[] = ListPausedPeer::DEL_CURRENT_USR_USERNAME; + } + + } // setDelCurrentUsrUsername() + + /** + * Set the value of [del_current_usr_firstname] column. + * + * @param string $v new value + * @return void + */ + public function setDelCurrentUsrFirstname($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_current_usr_firstname !== $v || $v === '') { + $this->del_current_usr_firstname = $v; + $this->modifiedColumns[] = ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME; + } + + } // setDelCurrentUsrFirstname() + + /** + * Set the value of [del_current_usr_lastname] column. + * + * @param string $v new value + * @return void + */ + public function setDelCurrentUsrLastname($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_current_usr_lastname !== $v || $v === '') { + $this->del_current_usr_lastname = $v; + $this->modifiedColumns[] = ListPausedPeer::DEL_CURRENT_USR_LASTNAME; + } + + } // setDelCurrentUsrLastname() + + /** + * Set the value of [del_delegate_date] column. + * + * @param int $v new value + * @return void + */ + public function setDelDelegateDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [del_delegate_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->del_delegate_date !== $ts) { + $this->del_delegate_date = $ts; + $this->modifiedColumns[] = ListPausedPeer::DEL_DELEGATE_DATE; + } + + } // setDelDelegateDate() + + /** + * Set the value of [del_init_date] column. + * + * @param int $v new value + * @return void + */ + public function setDelInitDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [del_init_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->del_init_date !== $ts) { + $this->del_init_date = $ts; + $this->modifiedColumns[] = ListPausedPeer::DEL_INIT_DATE; + } + + } // setDelInitDate() + + /** + * Set the value of [del_due_date] column. + * + * @param int $v new value + * @return void + */ + public function setDelDueDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [del_due_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->del_due_date !== $ts) { + $this->del_due_date = $ts; + $this->modifiedColumns[] = ListPausedPeer::DEL_DUE_DATE; + } + + } // setDelDueDate() + + /** + * Set the value of [del_priority] column. + * + * @param string $v new value + * @return void + */ + public function setDelPriority($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_priority !== $v || $v === '3') { + $this->del_priority = $v; + $this->modifiedColumns[] = ListPausedPeer::DEL_PRIORITY; + } + + } // setDelPriority() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (1-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. + * @param int $startcol 1-based offset column which indicates which restultset column to start with. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->app_uid = $rs->getString($startcol + 0); + + $this->del_index = $rs->getInt($startcol + 1); + + $this->usr_uid = $rs->getString($startcol + 2); + + $this->tas_uid = $rs->getString($startcol + 3); + + $this->pro_uid = $rs->getString($startcol + 4); + + $this->app_number = $rs->getInt($startcol + 5); + + $this->app_title = $rs->getString($startcol + 6); + + $this->app_pro_title = $rs->getString($startcol + 7); + + $this->app_tas_title = $rs->getString($startcol + 8); + + $this->app_paused_date = $rs->getTimestamp($startcol + 9, null); + + $this->app_restart_date = $rs->getTimestamp($startcol + 10, null); + + $this->del_current_usr_username = $rs->getString($startcol + 11); + + $this->del_current_usr_firstname = $rs->getString($startcol + 12); + + $this->del_current_usr_lastname = $rs->getString($startcol + 13); + + $this->del_delegate_date = $rs->getTimestamp($startcol + 14, null); + + $this->del_init_date = $rs->getTimestamp($startcol + 15, null); + + $this->del_due_date = $rs->getTimestamp($startcol + 16, null); + + $this->del_priority = $rs->getString($startcol + 17); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 18; // 18 = ListPausedPeer::NUM_COLUMNS - ListPausedPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating ListPaused object", $e); + } + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param Connection $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ListPausedPeer::DATABASE_NAME); + } + + try { + $con->begin(); + ListPausedPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. If the object is new, + * it inserts it; otherwise an update is performed. This method + * wraps the doSave() worker method in a transaction. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update + * @throws PropelException + * @see doSave() + */ + public function save($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ListPausedPeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring + * @throws PropelException + * @see save() + */ + protected function doSave($con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = ListPausedPeer::doInsert($this, $con); + $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which + // should always be true here (even though technically + // BasePeer::doInsert() can insert multiple rows). + + $this->setNew(false); + } else { + $affectedRows += ListPausedPeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; + array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = ListPausedPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ListPausedPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getAppUid(); + break; + case 1: + return $this->getDelIndex(); + break; + case 2: + return $this->getUsrUid(); + break; + case 3: + return $this->getTasUid(); + break; + case 4: + return $this->getProUid(); + break; + case 5: + return $this->getAppNumber(); + break; + case 6: + return $this->getAppTitle(); + break; + case 7: + return $this->getAppProTitle(); + break; + case 8: + return $this->getAppTasTitle(); + break; + case 9: + return $this->getAppPausedDate(); + break; + case 10: + return $this->getAppRestartDate(); + break; + case 11: + return $this->getDelCurrentUsrUsername(); + break; + case 12: + return $this->getDelCurrentUsrFirstname(); + break; + case 13: + return $this->getDelCurrentUsrLastname(); + break; + case 14: + return $this->getDelDelegateDate(); + break; + case 15: + return $this->getDelInitDate(); + break; + case 16: + return $this->getDelDueDate(); + break; + case 17: + return $this->getDelPriority(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = ListPausedPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getAppUid(), + $keys[1] => $this->getDelIndex(), + $keys[2] => $this->getUsrUid(), + $keys[3] => $this->getTasUid(), + $keys[4] => $this->getProUid(), + $keys[5] => $this->getAppNumber(), + $keys[6] => $this->getAppTitle(), + $keys[7] => $this->getAppProTitle(), + $keys[8] => $this->getAppTasTitle(), + $keys[9] => $this->getAppPausedDate(), + $keys[10] => $this->getAppRestartDate(), + $keys[11] => $this->getDelCurrentUsrUsername(), + $keys[12] => $this->getDelCurrentUsrFirstname(), + $keys[13] => $this->getDelCurrentUsrLastname(), + $keys[14] => $this->getDelDelegateDate(), + $keys[15] => $this->getDelInitDate(), + $keys[16] => $this->getDelDueDate(), + $keys[17] => $this->getDelPriority(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ListPausedPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setAppUid($value); + break; + case 1: + $this->setDelIndex($value); + break; + case 2: + $this->setUsrUid($value); + break; + case 3: + $this->setTasUid($value); + break; + case 4: + $this->setProUid($value); + break; + case 5: + $this->setAppNumber($value); + break; + case 6: + $this->setAppTitle($value); + break; + case 7: + $this->setAppProTitle($value); + break; + case 8: + $this->setAppTasTitle($value); + break; + case 9: + $this->setAppPausedDate($value); + break; + case 10: + $this->setAppRestartDate($value); + break; + case 11: + $this->setDelCurrentUsrUsername($value); + break; + case 12: + $this->setDelCurrentUsrFirstname($value); + break; + case 13: + $this->setDelCurrentUsrLastname($value); + break; + case 14: + $this->setDelDelegateDate($value); + break; + case 15: + $this->setDelInitDate($value); + break; + case 16: + $this->setDelDueDate($value); + break; + case 17: + $this->setDelPriority($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, + * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = ListPausedPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) { + $this->setAppUid($arr[$keys[0]]); + } + + if (array_key_exists($keys[1], $arr)) { + $this->setDelIndex($arr[$keys[1]]); + } + + if (array_key_exists($keys[2], $arr)) { + $this->setUsrUid($arr[$keys[2]]); + } + + if (array_key_exists($keys[3], $arr)) { + $this->setTasUid($arr[$keys[3]]); + } + + if (array_key_exists($keys[4], $arr)) { + $this->setProUid($arr[$keys[4]]); + } + + if (array_key_exists($keys[5], $arr)) { + $this->setAppNumber($arr[$keys[5]]); + } + + if (array_key_exists($keys[6], $arr)) { + $this->setAppTitle($arr[$keys[6]]); + } + + if (array_key_exists($keys[7], $arr)) { + $this->setAppProTitle($arr[$keys[7]]); + } + + if (array_key_exists($keys[8], $arr)) { + $this->setAppTasTitle($arr[$keys[8]]); + } + + if (array_key_exists($keys[9], $arr)) { + $this->setAppPausedDate($arr[$keys[9]]); + } + + if (array_key_exists($keys[10], $arr)) { + $this->setAppRestartDate($arr[$keys[10]]); + } + + if (array_key_exists($keys[11], $arr)) { + $this->setDelCurrentUsrUsername($arr[$keys[11]]); + } + + if (array_key_exists($keys[12], $arr)) { + $this->setDelCurrentUsrFirstname($arr[$keys[12]]); + } + + if (array_key_exists($keys[13], $arr)) { + $this->setDelCurrentUsrLastname($arr[$keys[13]]); + } + + if (array_key_exists($keys[14], $arr)) { + $this->setDelDelegateDate($arr[$keys[14]]); + } + + if (array_key_exists($keys[15], $arr)) { + $this->setDelInitDate($arr[$keys[15]]); + } + + if (array_key_exists($keys[16], $arr)) { + $this->setDelDueDate($arr[$keys[16]]); + } + + if (array_key_exists($keys[17], $arr)) { + $this->setDelPriority($arr[$keys[17]]); + } + + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(ListPausedPeer::DATABASE_NAME); + + if ($this->isColumnModified(ListPausedPeer::APP_UID)) { + $criteria->add(ListPausedPeer::APP_UID, $this->app_uid); + } + + if ($this->isColumnModified(ListPausedPeer::DEL_INDEX)) { + $criteria->add(ListPausedPeer::DEL_INDEX, $this->del_index); + } + + if ($this->isColumnModified(ListPausedPeer::USR_UID)) { + $criteria->add(ListPausedPeer::USR_UID, $this->usr_uid); + } + + if ($this->isColumnModified(ListPausedPeer::TAS_UID)) { + $criteria->add(ListPausedPeer::TAS_UID, $this->tas_uid); + } + + if ($this->isColumnModified(ListPausedPeer::PRO_UID)) { + $criteria->add(ListPausedPeer::PRO_UID, $this->pro_uid); + } + + if ($this->isColumnModified(ListPausedPeer::APP_NUMBER)) { + $criteria->add(ListPausedPeer::APP_NUMBER, $this->app_number); + } + + if ($this->isColumnModified(ListPausedPeer::APP_TITLE)) { + $criteria->add(ListPausedPeer::APP_TITLE, $this->app_title); + } + + if ($this->isColumnModified(ListPausedPeer::APP_PRO_TITLE)) { + $criteria->add(ListPausedPeer::APP_PRO_TITLE, $this->app_pro_title); + } + + if ($this->isColumnModified(ListPausedPeer::APP_TAS_TITLE)) { + $criteria->add(ListPausedPeer::APP_TAS_TITLE, $this->app_tas_title); + } + + if ($this->isColumnModified(ListPausedPeer::APP_PAUSED_DATE)) { + $criteria->add(ListPausedPeer::APP_PAUSED_DATE, $this->app_paused_date); + } + + if ($this->isColumnModified(ListPausedPeer::APP_RESTART_DATE)) { + $criteria->add(ListPausedPeer::APP_RESTART_DATE, $this->app_restart_date); + } + + if ($this->isColumnModified(ListPausedPeer::DEL_CURRENT_USR_USERNAME)) { + $criteria->add(ListPausedPeer::DEL_CURRENT_USR_USERNAME, $this->del_current_usr_username); + } + + if ($this->isColumnModified(ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME)) { + $criteria->add(ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME, $this->del_current_usr_firstname); + } + + if ($this->isColumnModified(ListPausedPeer::DEL_CURRENT_USR_LASTNAME)) { + $criteria->add(ListPausedPeer::DEL_CURRENT_USR_LASTNAME, $this->del_current_usr_lastname); + } + + if ($this->isColumnModified(ListPausedPeer::DEL_DELEGATE_DATE)) { + $criteria->add(ListPausedPeer::DEL_DELEGATE_DATE, $this->del_delegate_date); + } + + if ($this->isColumnModified(ListPausedPeer::DEL_INIT_DATE)) { + $criteria->add(ListPausedPeer::DEL_INIT_DATE, $this->del_init_date); + } + + if ($this->isColumnModified(ListPausedPeer::DEL_DUE_DATE)) { + $criteria->add(ListPausedPeer::DEL_DUE_DATE, $this->del_due_date); + } + + if ($this->isColumnModified(ListPausedPeer::DEL_PRIORITY)) { + $criteria->add(ListPausedPeer::DEL_PRIORITY, $this->del_priority); + } + + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(ListPausedPeer::DATABASE_NAME); + + $criteria->add(ListPausedPeer::APP_UID, $this->app_uid); + $criteria->add(ListPausedPeer::DEL_INDEX, $this->del_index); + + return $criteria; + } + + /** + * Returns the composite primary key for this object. + * The array elements will be in same order as specified in XML. + * @return array + */ + public function getPrimaryKey() + { + $pks = array(); + + $pks[0] = $this->getAppUid(); + + $pks[1] = $this->getDelIndex(); + + return $pks; + } + + /** + * Set the [composite] primary key. + * + * @param array $keys The elements of the composite key (order must match the order in XML file). + * @return void + */ + public function setPrimaryKey($keys) + { + + $this->setAppUid($keys[0]); + + $this->setDelIndex($keys[1]); + + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of ListPaused (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setUsrUid($this->usr_uid); + + $copyObj->setTasUid($this->tas_uid); + + $copyObj->setProUid($this->pro_uid); + + $copyObj->setAppNumber($this->app_number); + + $copyObj->setAppTitle($this->app_title); + + $copyObj->setAppProTitle($this->app_pro_title); + + $copyObj->setAppTasTitle($this->app_tas_title); + + $copyObj->setAppPausedDate($this->app_paused_date); + + $copyObj->setAppRestartDate($this->app_restart_date); + + $copyObj->setDelCurrentUsrUsername($this->del_current_usr_username); + + $copyObj->setDelCurrentUsrFirstname($this->del_current_usr_firstname); + + $copyObj->setDelCurrentUsrLastname($this->del_current_usr_lastname); + + $copyObj->setDelDelegateDate($this->del_delegate_date); + + $copyObj->setDelInitDate($this->del_init_date); + + $copyObj->setDelDueDate($this->del_due_date); + + $copyObj->setDelPriority($this->del_priority); + + + $copyObj->setNew(true); + + $copyObj->setAppUid(''); // this is a pkey column, so set to default value + + $copyObj->setDelIndex('0'); // this is a pkey column, so set to default value + + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return ListPaused Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return ListPausedPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new ListPausedPeer(); + } + return self::$peer; + } +} + diff --git a/workflow/engine/classes/model/om/BaseListPausedPeer.php b/workflow/engine/classes/model/om/BaseListPausedPeer.php new file mode 100644 index 000000000..b62ca915c --- /dev/null +++ b/workflow/engine/classes/model/om/BaseListPausedPeer.php @@ -0,0 +1,642 @@ + array ('AppUid', 'DelIndex', 'UsrUid', 'TasUid', 'ProUid', 'AppNumber', 'AppTitle', 'AppProTitle', 'AppTasTitle', 'AppPausedDate', 'AppRestartDate', 'DelCurrentUsrUsername', 'DelCurrentUsrFirstname', 'DelCurrentUsrLastname', 'DelDelegateDate', 'DelInitDate', 'DelDueDate', 'DelPriority', ), + BasePeer::TYPE_COLNAME => array (ListPausedPeer::APP_UID, ListPausedPeer::DEL_INDEX, ListPausedPeer::USR_UID, ListPausedPeer::TAS_UID, ListPausedPeer::PRO_UID, ListPausedPeer::APP_NUMBER, ListPausedPeer::APP_TITLE, ListPausedPeer::APP_PRO_TITLE, ListPausedPeer::APP_TAS_TITLE, ListPausedPeer::APP_PAUSED_DATE, ListPausedPeer::APP_RESTART_DATE, ListPausedPeer::DEL_CURRENT_USR_USERNAME, ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME, ListPausedPeer::DEL_CURRENT_USR_LASTNAME, ListPausedPeer::DEL_DELEGATE_DATE, ListPausedPeer::DEL_INIT_DATE, ListPausedPeer::DEL_DUE_DATE, ListPausedPeer::DEL_PRIORITY, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'DEL_INDEX', 'USR_UID', 'TAS_UID', 'PRO_UID', 'APP_NUMBER', 'APP_TITLE', 'APP_PRO_TITLE', 'APP_TAS_TITLE', 'APP_PAUSED_DATE', 'APP_RESTART_DATE', 'DEL_CURRENT_USR_USERNAME', 'DEL_CURRENT_USR_FIRSTNAME', 'DEL_CURRENT_USR_LASTNAME', 'DEL_DELEGATE_DATE', 'DEL_INIT_DATE', 'DEL_DUE_DATE', 'DEL_PRIORITY', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'DelIndex' => 1, 'UsrUid' => 2, 'TasUid' => 3, 'ProUid' => 4, 'AppNumber' => 5, 'AppTitle' => 6, 'AppProTitle' => 7, 'AppTasTitle' => 8, 'AppPausedDate' => 9, 'AppRestartDate' => 10, 'DelCurrentUsrUsername' => 11, 'DelCurrentUsrFirstname' => 12, 'DelCurrentUsrLastname' => 13, 'DelDelegateDate' => 14, 'DelInitDate' => 15, 'DelDueDate' => 16, 'DelPriority' => 17, ), + BasePeer::TYPE_COLNAME => array (ListPausedPeer::APP_UID => 0, ListPausedPeer::DEL_INDEX => 1, ListPausedPeer::USR_UID => 2, ListPausedPeer::TAS_UID => 3, ListPausedPeer::PRO_UID => 4, ListPausedPeer::APP_NUMBER => 5, ListPausedPeer::APP_TITLE => 6, ListPausedPeer::APP_PRO_TITLE => 7, ListPausedPeer::APP_TAS_TITLE => 8, ListPausedPeer::APP_PAUSED_DATE => 9, ListPausedPeer::APP_RESTART_DATE => 10, ListPausedPeer::DEL_CURRENT_USR_USERNAME => 11, ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME => 12, ListPausedPeer::DEL_CURRENT_USR_LASTNAME => 13, ListPausedPeer::DEL_DELEGATE_DATE => 14, ListPausedPeer::DEL_INIT_DATE => 15, ListPausedPeer::DEL_DUE_DATE => 16, ListPausedPeer::DEL_PRIORITY => 17, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'DEL_INDEX' => 1, 'USR_UID' => 2, 'TAS_UID' => 3, 'PRO_UID' => 4, 'APP_NUMBER' => 5, 'APP_TITLE' => 6, 'APP_PRO_TITLE' => 7, 'APP_TAS_TITLE' => 8, 'APP_PAUSED_DATE' => 9, 'APP_RESTART_DATE' => 10, 'DEL_CURRENT_USR_USERNAME' => 11, 'DEL_CURRENT_USR_FIRSTNAME' => 12, 'DEL_CURRENT_USR_LASTNAME' => 13, 'DEL_DELEGATE_DATE' => 14, 'DEL_INIT_DATE' => 15, 'DEL_DUE_DATE' => 16, 'DEL_PRIORITY' => 17, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + ); + + /** + * @return MapBuilder the map builder for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getMapBuilder() + { + include_once 'classes/model/map/ListPausedMapBuilder.php'; + return BasePeer::getMapBuilder('classes.model.map.ListPausedMapBuilder'); + } + /** + * Gets a map (hash) of PHP names to DB column names. + * + * @return array The PHP to DB name map for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. + */ + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = ListPausedPeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. ListPausedPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(ListPausedPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param criteria object containing the columns to add. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(ListPausedPeer::APP_UID); + + $criteria->addSelectColumn(ListPausedPeer::DEL_INDEX); + + $criteria->addSelectColumn(ListPausedPeer::USR_UID); + + $criteria->addSelectColumn(ListPausedPeer::TAS_UID); + + $criteria->addSelectColumn(ListPausedPeer::PRO_UID); + + $criteria->addSelectColumn(ListPausedPeer::APP_NUMBER); + + $criteria->addSelectColumn(ListPausedPeer::APP_TITLE); + + $criteria->addSelectColumn(ListPausedPeer::APP_PRO_TITLE); + + $criteria->addSelectColumn(ListPausedPeer::APP_TAS_TITLE); + + $criteria->addSelectColumn(ListPausedPeer::APP_PAUSED_DATE); + + $criteria->addSelectColumn(ListPausedPeer::APP_RESTART_DATE); + + $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_USERNAME); + + $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME); + + $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_LASTNAME); + + $criteria->addSelectColumn(ListPausedPeer::DEL_DELEGATE_DATE); + + $criteria->addSelectColumn(ListPausedPeer::DEL_INIT_DATE); + + $criteria->addSelectColumn(ListPausedPeer::DEL_DUE_DATE); + + $criteria->addSelectColumn(ListPausedPeer::DEL_PRIORITY); + + } + + const COUNT = 'COUNT(LIST_PAUSED.APP_UID)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT LIST_PAUSED.APP_UID)'; + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). + * @param Connection $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(ListPausedPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(ListPausedPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach ($criteria->getGroupByColumns() as $column) { + $criteria->addSelectColumn($column); + } + + $rs = ListPausedPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return ListPaused + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = ListPausedPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, $con = null) + { + return ListPausedPeer::populateObjects(ListPausedPeer::doSelectRS($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() + * method to get a ResultSet. + * + * Use this method directly if you want to just get the resultset + * (instead of an array of objects). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return ResultSet The resultset object with numerically-indexed fields. + * @see BasePeer::doSelect() + */ + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + ListPausedPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + return BasePeer::doSelect($criteria, $con); + } + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = ListPausedPeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while ($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * The class that the Peer will make instances of. + * + * This uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @return string path.to.ClassName + */ + public static function getOMClass() + { + return ListPausedPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a ListPaused or Criteria object. + * + * @param mixed $values Criteria or ListPaused object containing data that is used to create the INSERT statement. + * @param Connection $con the connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from ListPaused object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a ListPaused or Criteria object. + * + * @param mixed $values Criteria or ListPaused object containing data create the UPDATE statement. + * @param Connection $con The connection to use (specify Connection exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(ListPausedPeer::APP_UID); + $selectCriteria->add(ListPausedPeer::APP_UID, $criteria->remove(ListPausedPeer::APP_UID), $comparison); + + $comparison = $criteria->getComparison(ListPausedPeer::DEL_INDEX); + $selectCriteria->add(ListPausedPeer::DEL_INDEX, $criteria->remove(ListPausedPeer::DEL_INDEX), $comparison); + + } else { + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the LIST_PAUSED table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(ListPausedPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a ListPaused or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ListPaused object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param Connection $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ListPausedPeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof ListPaused) { + + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + // primary key is composite; we therefore, expect + // the primary key passed to be an array of pkey + // values + if (count($values) == count($values, COUNT_RECURSIVE)) { + // array is not multi-dimensional + $values = array($values); + } + $vals = array(); + foreach ($values as $value) { + + $vals[0][] = $value[0]; + $vals[1][] = $value[1]; + } + + $criteria->add(ListPausedPeer::APP_UID, $vals[0], Criteria::IN); + $criteria->add(ListPausedPeer::DEL_INDEX, $vals[1], Criteria::IN); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given ListPaused object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param ListPaused $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(ListPaused $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(ListPausedPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(ListPausedPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(ListPausedPeer::DATABASE_NAME, ListPausedPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve object using using composite pkey values. + * @param string $app_uid + * @param int $del_index + * @param Connection $con + * @return ListPaused + */ + public static function retrieveByPK($app_uid, $del_index, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $criteria = new Criteria(); + $criteria->add(ListPausedPeer::APP_UID, $app_uid); + $criteria->add(ListPausedPeer::DEL_INDEX, $del_index); + $v = ListPausedPeer::doSelect($criteria, $con); + + return !empty($v) ? $v[0] : null; + } +} + + +// static code to register the map builder for this Peer with the main Propel class +if (Propel::isInit()) { + // the MapBuilder classes register themselves with Propel during initialization + // so we need to load them here. + try { + BaseListPausedPeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + // even if Propel is not yet initialized, the map builder class can be registered + // now and then it will be loaded when Propel initializes. + require_once 'classes/model/map/ListPausedMapBuilder.php'; + Propel::registerMapBuilder('classes.model.map.ListPausedMapBuilder'); +} + From ac8d31fa37e4a9702ec61e0942cfceee86b56a1f Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Mon, 2 Feb 2015 10:18:27 -0400 Subject: [PATCH 003/155] LISTS: Adicion de SCRIPT SQL para MYSQL --- workflow/engine/config/schema.xml | 3 + workflow/engine/data/mysql/schema.sql | 132 ++++++++++++++++++-------- 2 files changed, 98 insertions(+), 37 deletions(-) diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 82a844c84..e5dcaa917 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -3706,6 +3706,9 @@ + + +
diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 8e39891b3..eaf5b4ce2 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -486,7 +486,7 @@ CREATE TABLE `ROUTE` `ROU_PARENT` VARCHAR(32) default '0' NOT NULL, `PRO_UID` VARCHAR(32) default '' NOT NULL, `TAS_UID` VARCHAR(32) default '' NOT NULL, -`ROU_NEXT_TASK` VARCHAR(32) default '0' NOT NULL, + `ROU_NEXT_TASK` VARCHAR(32) default '0' NOT NULL, `ROU_CASE` INTEGER default 0 NOT NULL, `ROU_TYPE` VARCHAR(25) default 'SEQUENTIAL' NOT NULL, `ROU_DEFAULT` INTEGER default 0 NOT NULL, @@ -1207,7 +1207,7 @@ CREATE TABLE `APP_HISTORY` `PRO_UID` VARCHAR(32) default '' NOT NULL, `TAS_UID` VARCHAR(32) default '' NOT NULL, `DYN_UID` VARCHAR(32) default '' NOT NULL, - `OBJ_TYPE` VARCHAR(20) default 'DYNAFORM' NOT NULL, + `OBJ_TYPE` VARCHAR(20) default 'DYNAFORM' NOT NULL, `USR_UID` VARCHAR(32) default '' NOT NULL, `APP_STATUS` VARCHAR(100) default '' NOT NULL, `HISTORY_DATE` DATETIME, @@ -2300,6 +2300,66 @@ CREATE TABLE `LIST_COMPLETED` PRIMARY KEY (`APP_UID`) )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Completed list'; #----------------------------------------------------------------------------- +#-- LIST_PAUSED +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `LIST_PAUSED`; + + +CREATE TABLE `LIST_PAUSED` +( + `APP_UID` VARCHAR(32) default '' NOT NULL, + `DEL_INDEX` INTEGER default 0 NOT NULL, + `USR_UID` VARCHAR(32) default '' NOT NULL, + `TAS_UID` VARCHAR(32) default '' NOT NULL, + `PRO_UID` VARCHAR(32) default '' NOT NULL, + `APP_NUMBER` INTEGER default 0 NOT NULL, + `APP_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_PRO_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_TAS_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_PAUSED_DATE` DATETIME NOT NULL, + `APP_RESTART_DATE` DATETIME NOT NULL, + `DEL_CURRENT_USR_USERNAME` VARCHAR(100) default '', + `DEL_CURRENT_USR_FIRSTNAME` VARCHAR(50) default '', + `DEL_CURRENT_USR_LASTNAME` VARCHAR(50) default '', + `DEL_DELEGATE_DATE` DATETIME NOT NULL, + `DEL_INIT_DATE` DATETIME, + `DEL_DUE_DATE` DATETIME, + `DEL_PRIORITY` VARCHAR(32) default '3' NOT NULL, + PRIMARY KEY (`APP_UID`,`DEL_INDEX`), + KEY `indexPausedUser`(`USR_UID`) +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Paused list'; +#----------------------------------------------------------------------------- +#-- LIST_CANCELED +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `LIST_CANCELED`; + + +CREATE TABLE `LIST_CANCELED` +( + `APP_UID` VARCHAR(32) default '' NOT NULL, + `USR_UID` VARCHAR(32) default '' NOT NULL, + `TAS_UID` VARCHAR(32) default '' NOT NULL, + `PRO_UID` VARCHAR(32) default '' NOT NULL, + `APP_NUMBER` INTEGER default 0 NOT NULL, + `APP_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_PRO_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_TAS_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_CANCELED_DATE` DATETIME NOT NULL, + `DEL_INDEX` INTEGER default 0 NOT NULL, + `DEL_PREVIOUS_USR_UID` VARCHAR(32) default '', + `DEL_CURRENT_USR_USERNAME` VARCHAR(100) default '', + `DEL_CURRENT_USR_FIRSTNAME` VARCHAR(50) default '', + `DEL_CURRENT_USR_LASTNAME` VARCHAR(50) default '', + `DEL_DELEGATE_DATE` DATETIME NOT NULL, + `DEL_INIT_DATE` DATETIME, + `DEL_DUE_DATE` DATETIME, + `DEL_PRIORITY` VARCHAR(32) default '3' NOT NULL, + PRIMARY KEY (`APP_UID`), + KEY `indexCanceledUser`(`USR_UID`) +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Canceled list'; +#----------------------------------------------------------------------------- #-- LIST_MY_INBOX #----------------------------------------------------------------------------- @@ -2407,51 +2467,49 @@ CREATE TABLE `MESSAGE_DETAIL` `MD_NAME` VARCHAR(255) default '', PRIMARY KEY (`MD_UID`) )ENGINE=InnoDB ; -# This restores the fkey checks, after having unset them earlier -SET FOREIGN_KEY_CHECKS = 1; - #----------------------------------------------------------------------------- -#-- TABLE: EMAIL_SERVER +#-- EMAIL_SERVER #----------------------------------------------------------------------------- DROP TABLE IF EXISTS `EMAIL_SERVER`; + CREATE TABLE `EMAIL_SERVER` ( - `MESS_UID` VARCHAR(32) default '' NOT NULL, - `MESS_ENGINE` VARCHAR(256) default '' NOT NULL, - `MESS_SERVER` VARCHAR(256) default '' NOT NULL, - `MESS_PORT` INTEGER default 0 NOT NULL, - `MESS_RAUTH` INTEGER default 0 NOT NULL, - `MESS_ACCOUNT` VARCHAR(256) default '' NOT NULL, - `MESS_PASSWORD` VARCHAR(256) default '' NOT NULL, - `MESS_FROM_MAIL` VARCHAR(256) default '' NOT NULL, - `MESS_FROM_NAME` VARCHAR(256) default '' NOT NULL, - `SMTPSECURE` VARCHAR(3) default 'No' NOT NULL, - `MESS_TRY_SEND_INMEDIATLY` INTEGER default 0 NOT NULL, - `MAIL_TO` VARCHAR(256) default '' NOT NULL, - `MESS_DEFAULT` INTEGER default 0 NOT NULL, - PRIMARY KEY (`MESS_UID`) -)ENGINE=InnoDB DEFAULT CHARSET='utf8'; - + `MESS_UID` VARCHAR(32) default '' NOT NULL, + `MESS_ENGINE` VARCHAR(256) default '' NOT NULL, + `MESS_SERVER` VARCHAR(256) default '' NOT NULL, + `MESS_PORT` INTEGER default 0 NOT NULL, + `MESS_RAUTH` INTEGER default 0 NOT NULL, + `MESS_ACCOUNT` VARCHAR(256) default '' NOT NULL, + `MESS_PASSWORD` VARCHAR(256) default '' NOT NULL, + `MESS_FROM_MAIL` VARCHAR(256) default '' NOT NULL, + `MESS_FROM_NAME` VARCHAR(256) default '' NOT NULL, + `SMTPSECURE` VARCHAR(3) default 'No' NOT NULL, + `MESS_TRY_SEND_INMEDIATLY` INTEGER default 0 NOT NULL, + `MAIL_TO` VARCHAR(256) default '' NOT NULL, + `MESS_DEFAULT` INTEGER default 0 NOT NULL, + PRIMARY KEY (`MESS_UID`) +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; #----------------------------------------------------------------------------- #-- WEB_ENTRY_EVENT #----------------------------------------------------------------------------- -DROP TABLE IF EXISTS WEB_ENTRY_EVENT; +DROP TABLE IF EXISTS `WEB_ENTRY_EVENT`; -CREATE TABLE WEB_ENTRY_EVENT + +CREATE TABLE `WEB_ENTRY_EVENT` ( - WEE_UID VARCHAR(32) NOT NULL, - PRJ_UID VARCHAR(32) NOT NULL, - EVN_UID VARCHAR(32) NOT NULL, - ACT_UID VARCHAR(32) NOT NULL, - DYN_UID VARCHAR(32) NOT NULL, - USR_UID VARCHAR(32) NOT NULL, - WEE_STATUS VARCHAR(10) NOT NULL DEFAULT 'ENABLED', - WEE_WE_UID VARCHAR(32) NOT NULL DEFAULT '', - WEE_WE_TAS_UID VARCHAR(32) NOT NULL DEFAULT '', - - PRIMARY KEY (WEE_UID) -) ENGINE=InnoDB DEFAULT CHARSET='utf8'; - + `WEE_UID` VARCHAR(32) NOT NULL, + `PRJ_UID` VARCHAR(32) NOT NULL, + `EVN_UID` VARCHAR(32) NOT NULL, + `ACT_UID` VARCHAR(32) NOT NULL, + `DYN_UID` VARCHAR(32) NOT NULL, + `USR_UID` VARCHAR(32) NOT NULL, + `WEE_STATUS` VARCHAR(10) default 'ENABLED' NOT NULL, + `WEE_WE_UID` VARCHAR(32) default '' NOT NULL, + `WEE_WE_TAS_UID` VARCHAR(32) default '' NOT NULL, + PRIMARY KEY (`WEE_UID`) +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; +# This restores the fkey checks, after having unset them earlier +SET FOREIGN_KEY_CHECKS = 1; From 5c3a4ac9776f2704f4071fe54c5c532afb46c118 Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Tue, 3 Feb 2015 09:32:15 -0400 Subject: [PATCH 004/155] LISTS: Creacion de APIs --- workflow/engine/classes/class.case.php | 23 ++ .../engine/classes/model/ListCanceled.php | 283 +++++++++++++++++ workflow/engine/classes/model/ListInbox.php | 29 +- workflow/engine/classes/model/ListPaused.php | 285 ++++++++++++++++++ .../model/map/ListPausedMapBuilder.php | 2 + .../classes/model/om/BaseListPaused.php | 126 +++++--- .../classes/model/om/BaseListPausedPeer.php | 23 +- workflow/engine/config/schema.xml | 1 + workflow/engine/data/mysql/schema.sql | 1 + .../src/ProcessMaker/BusinessModel/Lists.php | 8 + .../src/ProcessMaker/Services/Api/Lists.php | 211 +++++++++++++ 11 files changed, 947 insertions(+), 45 deletions(-) diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index e9e76ec53..5bccbdb2c 100755 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -3906,6 +3906,17 @@ class Cases } $this->getExecuteTriggerProcess($sApplicationUID, 'PAUSED'); + + + $data = array ( + 'APP_UID' => $sApplicationUID, + 'DEL_INDEX' => $iDelegation, + 'USR_UID' => $sUserUID, + 'APP_RESTART_DATE' => $sUnpauseDate + ); + $data = array_merge($aFields, $data); + $oListPaused = new ListPaused(); + $oListPaused->create($data); } /* @@ -3996,6 +4007,9 @@ class Cases } $this->getExecuteTriggerProcess($sApplicationUID, "UNPAUSE"); + + $oListPaused = new ListPaused(); + $oListPaused->remove($sApplicationUID, $iDelegation, true); } /* @@ -4080,6 +4094,15 @@ class Cases if ($this->appSolr != null) { $this->appSolr->updateApplicationSearchIndex($sApplicationUID); } + + $data = array ( + 'APP_UID' => $sApplicationUID, + 'DEL_INDEX' => $iIndex, + 'USR_UID' => $user_logged + ); + $data = array_merge($aFields, $data); + $oListCanceled = new ListCanceled(); + $oListCanceled->create($data); } /* diff --git a/workflow/engine/classes/model/ListCanceled.php b/workflow/engine/classes/model/ListCanceled.php index a703a5bb3..a0974f76d 100644 --- a/workflow/engine/classes/model/ListCanceled.php +++ b/workflow/engine/classes/model/ListCanceled.php @@ -15,5 +15,288 @@ require_once 'classes/model/om/BaseListCanceled.php'; * @package classes.model */ class ListCanceled extends BaseListCanceled { + /** + * Create List Canceled Table + * + * @param type $data + * @return type + * + */ + public function create($data) + { + $criteria = new Criteria(); + $criteria->addSelectColumn(ContentPeer::CON_VALUE); + $criteria->add( ContentPeer::CON_ID, $data['APP_UID'], Criteria::EQUAL ); + $criteria->add( ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL ); + $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL ); + $dataset = ContentPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['APP_TITLE'] = $aRow['CON_VALUE']; + $criteria = new Criteria(); + $criteria->addSelectColumn(ContentPeer::CON_VALUE); + $criteria->add( ContentPeer::CON_ID, $data['PRO_UID'], Criteria::EQUAL ); + $criteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL ); + $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL ); + $dataset = ContentPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['APP_PRO_TITLE'] = $aRow['CON_VALUE']; + + $criteria = new Criteria(); + $criteria->addSelectColumn(AppDelegationPeer::TAS_UID); + $criteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); + $criteria->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE); + $criteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); + $criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS); + $criteria->add( AppDelegationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL ); + $criteria->add( AppDelegationPeer::DEL_INDEX, $data['DEL_INDEX'], Criteria::EQUAL ); + $dataset = ContentPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['TAS_UID'] = $aRow['TAS_UID']; + $data['DEL_INIT_DATE'] = $aRow['DEL_INIT_DATE']; + $data['DEL_DUE_DATE'] = $aRow['DEL_TASK_DUE_DATE']; + $data['DEL_DELEGATE_DATE'] = $aRow['DEL_DELEGATE_DATE']; + $delPrevious = $aRow['DEL_PREVIOUS']; + + $criteria = new Criteria(); + $criteria->addSelectColumn(AppDelegationPeer::USR_UID); + $criteria->add( AppDelegationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL ); + $criteria->add( AppDelegationPeer::DEL_INDEX, $delPrevious, Criteria::EQUAL ); + $dataset = ContentPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['DEL_PREVIOUS_USR_UID'] = $aRow['USR_UID']; + + $criteria = new Criteria(); + $criteria->addSelectColumn(ContentPeer::CON_VALUE); + $criteria->add( ContentPeer::CON_ID, $data['TAS_UID'], Criteria::EQUAL ); + $criteria->add( ContentPeer::CON_CATEGORY, 'TAS_TITLE', Criteria::EQUAL ); + $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL ); + $dataset = ContentPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['APP_TAS_TITLE'] = $aRow['CON_VALUE']; + + $criteria = new Criteria(); + $criteria->addSelectColumn(UsersPeer::USR_USERNAME); + $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); + $criteria->addSelectColumn(UsersPeer::USR_LASTNAME); + $criteria->add( UsersPeer::USR_UID, $data['USR_UID'], Criteria::EQUAL ); + $dataset = UsersPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['DEL_CURRENT_USR_USERNAME'] = $aRow['USR_USERNAME']; + $data['DEL_CURRENT_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME']; + $data['DEL_CURRENT_USR_LASTNAME'] = $aRow['USR_LASTNAME']; + + $data['APP_CANCELED_DATE'] = Date("Y-m-d H:i:s"); + + $oListInbox = new ListInbox(); + $oListInbox->removeAll($data['APP_UID']); + + $con = Propel::getConnection( ListCanceledPeer::DATABASE_NAME ); + try { + $this->fromArray( $data, BasePeer::TYPE_FIELDNAME ); + if ($this->validate()) { + $result = $this->save(); + } else { + $e = new Exception( "Failed Validation in class " . get_class( $this ) . "." ); + $e->aValidationFailures = $this->getValidationFailures(); + throw ($e); + } + $con->commit(); + return $result; + } catch(Exception $e) { + $con->rollback(); + throw ($e); + } + } + + /** + * Update List Canceled Table + * + * @param type $data + * @return type + * @throws type + */ + public function update($data) + { + $con = Propel::getConnection( ListCanceledPeer::DATABASE_NAME ); + try { + $con->begin(); + $this->setNew( false ); + $this->fromArray( $data, BasePeer::TYPE_FIELDNAME ); + if ($this->validate()) { + $result = $this->save(); + $con->commit(); + return $result; + } else { + $con->rollback(); + throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." )); + } + } catch (Exception $e) { + $con->rollback(); + throw ($e); + } + } + + /** + * Remove List Canceled + * + * @param type $seqName + * @return type + * @throws type + * + */ + public function remove ($app_uid) + { + $con = Propel::getConnection( ListCanceledPeer::DATABASE_NAME ); + try { + $this->setAppUid($app_uid); + $con->begin(); + $this->delete(); + $con->commit(); + } catch (Exception $e) { + $con->rollback(); + throw ($e); + } + } + + public function loadFilters (&$criteria, $filters) + { + $filter = isset($filters['filter']) ? $filters['filter'] : ""; + $search = isset($filters['search']) ? $filters['search'] : ""; + $process = isset($filters['process']) ? $filters['process'] : ""; + $category = isset($filters['category']) ? $filters['category'] : ""; + $dateFrom = isset($filters['dateFrom']) ? $filters['dateFrom'] : ""; + $dateTo = isset($filters['dateTo']) ? $filters['dateTo'] : ""; + + if ($filter != '') { + switch ($filter) { + case 'read': + $criteria->add( ListCanceledPeer::DEL_INIT_DATE, null, Criteria::ISNOTNULL ); + break; + case 'unread': + $criteria->add( ListCanceledPeer::DEL_INIT_DATE, null, Criteria::ISNULL ); + break; + } + } + + if ($search != '') { + $criteria->add( + $criteria->getNewCriterion( 'CON_APP.CON_VALUE', '%' . $search . '%', Criteria::LIKE )-> + addOr( $criteria->getNewCriterion( 'CON_TAS.CON_VALUE', '%' . $search . '%', Criteria::LIKE )-> + addOr( $criteria->getNewCriterion( ListCanceledPeer::APP_NUMBER, $search, Criteria::LIKE ) ) ) ); + } + + if ($process != '') { + $criteria->add( ListCanceledPeer::PRO_UID, $process, Criteria::EQUAL); + } + + if ($category != '') { + // INNER JOIN FOR TAS_TITLE + $criteria->addSelectColumn(ProcessPeer::PRO_CATEGORY); + $aConditions = array(); + $aConditions[] = array(ListCanceledPeer::PRO_UID, ProcessPeer::PRO_UID); + $aConditions[] = array(ProcessPeer::PRO_CATEGORY, "'" . $category . "'"); + $criteria->addJoinMC($aConditions, Criteria::INNER_JOIN); + } + + if ($dateFrom != "") { + if ($dateTo != "") { + if ($dateFrom == $dateTo) { + $dateSame = $dateFrom; + $dateFrom = $dateSame . " 00:00:00"; + $dateTo = $dateSame . " 23:59:59"; + } else { + $dateFrom = $dateFrom . " 00:00:00"; + $dateTo = $dateTo . " 23:59:59"; + } + + $criteria->add( $criteria->getNewCriterion( ListCanceledPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL )-> + addAnd( $criteria->getNewCriterion( ListCanceledPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL ) ) ); + } else { + $dateFrom = $dateFrom . " 00:00:00"; + + $criteria->add( ListCanceledPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL ); + } + } elseif ($dateTo != "") { + $dateTo = $dateTo . " 23:59:59"; + + $criteria->add( ListCanceledPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL ); + } + } + + public function countTotal ($usr_uid, $filters = array()) + { + $criteria = new Criteria(); + $criteria->add( ListCanceledPeer::USR_UID, $usr_uid, Criteria::EQUAL ); + self::loadFilters($criteria, $filters); + $total = ListCanceledPeer::doCount( $criteria ); + return (int)$total; + } + + public function loadList ($usr_uid, $filters = array()) + { + $resp = array(); + $criteria = new Criteria(); + + $criteria->addSelectColumn(ListCanceledPeer::APP_UID); + $criteria->addSelectColumn(ListCanceledPeer::USR_UID); + $criteria->addSelectColumn(ListCanceledPeer::TAS_UID); + $criteria->addSelectColumn(ListCanceledPeer::PRO_UID); + $criteria->addSelectColumn(ListCanceledPeer::APP_NUMBER); + $criteria->addSelectColumn(ListCanceledPeer::APP_TITLE); + $criteria->addSelectColumn(ListCanceledPeer::APP_PRO_TITLE); + $criteria->addSelectColumn(ListCanceledPeer::APP_TAS_TITLE); + $criteria->addSelectColumn(ListCanceledPeer::APP_CANCELED_DATE); + $criteria->addSelectColumn(ListCanceledPeer::DEL_INDEX); + $criteria->addSelectColumn(ListCanceledPeer::DEL_PREVIOUS_USR_UID); + $criteria->addSelectColumn(ListCanceledPeer::DEL_CURRENT_USR_FIRSTNAME); + $criteria->addSelectColumn(ListCanceledPeer::DEL_CURRENT_USR_LASTNAME); + $criteria->addSelectColumn(ListCanceledPeer::DEL_CURRENT_USR_USERNAME); + $criteria->addSelectColumn(ListCanceledPeer::DEL_DELEGATE_DATE); + $criteria->addSelectColumn(ListCanceledPeer::DEL_INIT_DATE); + $criteria->addSelectColumn(ListCanceledPeer::DEL_DUE_DATE); + $criteria->addSelectColumn(ListCanceledPeer::DEL_PRIORITY); + + $criteria->add( ListCanceledPeer::USR_UID, $usr_uid, Criteria::EQUAL ); + self::loadFilters($criteria, $filters); + + $sort = (!empty($filters['sort'])) ? $filters['sort'] : "APP_FINISH_DATE"; + $dir = isset($filters['dir']) ? $filters['dir'] : "ASC"; + $start = isset($filters['start']) ? $filters['start'] : "0"; + $limit = isset($filters['limit']) ? $filters['limit'] : "25"; + $paged = isset($filters['paged']) ? $filters['paged'] : 1; + + if ($dir == "DESC") { + $criteria->addDescendingOrderByColumn($sort); + } else { + $criteria->addAscendingOrderByColumn($sort); + } + + if ($paged == 1) { + $criteria->setLimit( $limit ); + $criteria->setOffset( $start ); + } + + $dataset = ListCanceledPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $data = array(); + while ($dataset->next()) { + $aRow = $dataset->getRow(); + $data[] = $aRow; + } + + return $data; + } } // ListCanceled diff --git a/workflow/engine/classes/model/ListInbox.php b/workflow/engine/classes/model/ListInbox.php index 36ff8c0ee..29c00eec3 100644 --- a/workflow/engine/classes/model/ListInbox.php +++ b/workflow/engine/classes/model/ListInbox.php @@ -36,7 +36,7 @@ class ListInbox extends BaseListInbox throw ($e); } $con->commit(); - + // create participated history $listParticipatedHistory = new ListParticipatedHistory(); $listParticipatedHistory->create($data); @@ -121,9 +121,34 @@ class ListInbox extends BaseListInbox } } + /** + * Remove All List Inbox + * + * @param type $seqName + * @return type + * @throws type + * + */ + public function removeAll ($app_uid) + { + $con = Propel::getConnection( ListInboxPeer::DATABASE_NAME ); + try { + $this->setAppUid($app_uid); + + $con->begin(); + $this->delete(); + $con->commit(); + } catch (Exception $e) { + $con->rollback(); + throw ($e); + } + } + public function newRow ($data, $delPreviusUsrUid) { $data['DEL_PREVIOUS_USR_UID'] = $delPreviusUsrUid; - $data['DEL_DUE_DATE'] = $data['DEL_TASK_DUE_DATE']; + if (isset($data['DEL_TASK_DUE_DATE'])) { + $data['DEL_DUE_DATE'] = $data['DEL_TASK_DUE_DATE']; + } $criteria = new Criteria(); $criteria->addSelectColumn( ApplicationPeer::APP_NUMBER ); diff --git a/workflow/engine/classes/model/ListPaused.php b/workflow/engine/classes/model/ListPaused.php index 467366661..e432f6b9e 100644 --- a/workflow/engine/classes/model/ListPaused.php +++ b/workflow/engine/classes/model/ListPaused.php @@ -15,5 +15,290 @@ require_once 'classes/model/om/BaseListPaused.php'; * @package classes.model */ class ListPaused extends BaseListPaused { + /** + * Create List Paused Table + * + * @param type $data + * @return type + * + */ + public function create($data) + { + $criteria = new Criteria(); + $criteria->addSelectColumn(ContentPeer::CON_VALUE); + $criteria->add( ContentPeer::CON_ID, $data['APP_UID'], Criteria::EQUAL ); + $criteria->add( ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL ); + $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL ); + $dataset = ContentPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['APP_TITLE'] = $aRow['CON_VALUE']; + $criteria = new Criteria(); + $criteria->addSelectColumn(ContentPeer::CON_VALUE); + $criteria->add( ContentPeer::CON_ID, $data['PRO_UID'], Criteria::EQUAL ); + $criteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL ); + $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL ); + $dataset = ContentPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['APP_PRO_TITLE'] = $aRow['CON_VALUE']; + + $criteria = new Criteria(); + $criteria->addSelectColumn(AppDelegationPeer::TAS_UID); + $criteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); + $criteria->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE); + $criteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); + $criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS); + $criteria->add( AppDelegationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL ); + $criteria->add( AppDelegationPeer::DEL_INDEX, $data['DEL_INDEX'], Criteria::EQUAL ); + $dataset = ContentPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['TAS_UID'] = $aRow['TAS_UID']; + $data['DEL_INIT_DATE'] = $aRow['DEL_INIT_DATE']; + $data['DEL_DUE_DATE'] = $aRow['DEL_TASK_DUE_DATE']; + $data['DEL_DELEGATE_DATE'] = $aRow['DEL_DELEGATE_DATE']; + $delPrevious = $aRow['DEL_PREVIOUS']; + + $criteria = new Criteria(); + $criteria->addSelectColumn(AppDelegationPeer::USR_UID); + $criteria->add( AppDelegationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL ); + $criteria->add( AppDelegationPeer::DEL_INDEX, $delPrevious, Criteria::EQUAL ); + $dataset = ContentPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['DEL_PREVIOUS_USR_UID'] = $aRow['USR_UID']; + + $criteria = new Criteria(); + $criteria->addSelectColumn(ContentPeer::CON_VALUE); + $criteria->add( ContentPeer::CON_ID, $data['TAS_UID'], Criteria::EQUAL ); + $criteria->add( ContentPeer::CON_CATEGORY, 'TAS_TITLE', Criteria::EQUAL ); + $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL ); + $dataset = ContentPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['APP_TAS_TITLE'] = $aRow['CON_VALUE']; + + $criteria = new Criteria(); + $criteria->addSelectColumn(UsersPeer::USR_USERNAME); + $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); + $criteria->addSelectColumn(UsersPeer::USR_LASTNAME); + $criteria->add( UsersPeer::USR_UID, $data['USR_UID'], Criteria::EQUAL ); + $dataset = UsersPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['DEL_CURRENT_USR_USERNAME'] = $aRow['USR_USERNAME']; + $data['DEL_CURRENT_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME']; + $data['DEL_CURRENT_USR_LASTNAME'] = $aRow['USR_LASTNAME']; + + $data['APP_PAUSED_DATE'] = Date("Y-m-d H:i:s"); + + $oListInbox = new ListInbox(); + $oListInbox->remove($data['APP_UID'], $data['DEL_INDEX']); + + $con = Propel::getConnection( ListPausedPeer::DATABASE_NAME ); + try { + $this->fromArray( $data, BasePeer::TYPE_FIELDNAME ); + if ($this->validate()) { + $result = $this->save(); + } else { + $e = new Exception( "Failed Validation in class " . get_class( $this ) . "." ); + $e->aValidationFailures = $this->getValidationFailures(); + throw ($e); + } + $con->commit(); + return $result; + } catch(Exception $e) { + $con->rollback(); + throw ($e); + } + } + + /** + * Update List Paused Table + * + * @param type $data + * @return type + * @throws type + */ + public function update($data) + { + $con = Propel::getConnection( ListPausedPeer::DATABASE_NAME ); + try { + $con->begin(); + $this->setNew( false ); + $this->fromArray( $data, BasePeer::TYPE_FIELDNAME ); + if ($this->validate()) { + $result = $this->save(); + $con->commit(); + return $result; + } else { + $con->rollback(); + throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." )); + } + } catch (Exception $e) { + $con->rollback(); + throw ($e); + } + } + + /** + * Remove List Paused + * + * @param type $seqName + * @return type + * @throws type + * + */ + public function remove ($app_uid, $del_index) + { + $con = Propel::getConnection( ListPausedPeer::DATABASE_NAME ); + try { + $this->setAppUid($app_uid); + $this->setDelIndex($del_index); + $con->begin(); + $this->delete(); + $con->commit(); + } catch (Exception $e) { + $con->rollback(); + throw ($e); + } + } + + public function loadFilters (&$criteria, $filters) + { + $filter = isset($filters['filter']) ? $filters['filter'] : ""; + $search = isset($filters['search']) ? $filters['search'] : ""; + $process = isset($filters['process']) ? $filters['process'] : ""; + $category = isset($filters['category']) ? $filters['category'] : ""; + $dateFrom = isset($filters['dateFrom']) ? $filters['dateFrom'] : ""; + $dateTo = isset($filters['dateTo']) ? $filters['dateTo'] : ""; + + if ($filter != '') { + switch ($filter) { + case 'read': + $criteria->add( ListPausedPeer::DEL_INIT_DATE, null, Criteria::ISNOTNULL ); + break; + case 'unread': + $criteria->add( ListPausedPeer::DEL_INIT_DATE, null, Criteria::ISNULL ); + break; + } + } + + if ($search != '') { + $criteria->add( + $criteria->getNewCriterion( 'CON_APP.CON_VALUE', '%' . $search . '%', Criteria::LIKE )-> + addOr( $criteria->getNewCriterion( 'CON_TAS.CON_VALUE', '%' . $search . '%', Criteria::LIKE )-> + addOr( $criteria->getNewCriterion( ListPausedPeer::APP_NUMBER, $search, Criteria::LIKE ) ) ) ); + } + + if ($process != '') { + $criteria->add( ListPausedPeer::PRO_UID, $process, Criteria::EQUAL); + } + + if ($category != '') { + // INNER JOIN FOR TAS_TITLE + $criteria->addSelectColumn(ProcessPeer::PRO_CATEGORY); + $aConditions = array(); + $aConditions[] = array(ListPausedPeer::PRO_UID, ProcessPeer::PRO_UID); + $aConditions[] = array(ProcessPeer::PRO_CATEGORY, "'" . $category . "'"); + $criteria->addJoinMC($aConditions, Criteria::INNER_JOIN); + } + + if ($dateFrom != "") { + if ($dateTo != "") { + if ($dateFrom == $dateTo) { + $dateSame = $dateFrom; + $dateFrom = $dateSame . " 00:00:00"; + $dateTo = $dateSame . " 23:59:59"; + } else { + $dateFrom = $dateFrom . " 00:00:00"; + $dateTo = $dateTo . " 23:59:59"; + } + + $criteria->add( $criteria->getNewCriterion( ListPausedPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL )-> + addAnd( $criteria->getNewCriterion( ListPausedPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL ) ) ); + } else { + $dateFrom = $dateFrom . " 00:00:00"; + + $criteria->add( ListPausedPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL ); + } + } elseif ($dateTo != "") { + $dateTo = $dateTo . " 23:59:59"; + + $criteria->add( ListPausedPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL ); + } + } + + public function countTotal ($usr_uid, $filters = array()) + { + $criteria = new Criteria(); + $criteria->add( ListPausedPeer::USR_UID, $usr_uid, Criteria::EQUAL ); + self::loadFilters($criteria, $filters); + $total = ListPausedPeer::doCount( $criteria ); + return (int)$total; + } + + public function loadList ($usr_uid, $filters = array()) + { + $resp = array(); + $criteria = new Criteria(); + + $criteria->addSelectColumn(ListPausedPeer::APP_UID); + $criteria->addSelectColumn(ListPausedPeer::USR_UID); + $criteria->addSelectColumn(ListPausedPeer::TAS_UID); + $criteria->addSelectColumn(ListPausedPeer::PRO_UID); + $criteria->addSelectColumn(ListPausedPeer::APP_NUMBER); + $criteria->addSelectColumn(ListPausedPeer::APP_TITLE); + $criteria->addSelectColumn(ListPausedPeer::APP_PRO_TITLE); + $criteria->addSelectColumn(ListPausedPeer::APP_TAS_TITLE); + $criteria->addSelectColumn(ListPausedPeer::APP_PAUSED_DATE); + $criteria->addSelectColumn(ListPausedPeer::APP_RESTART_DATE); + $criteria->addSelectColumn(ListPausedPeer::DEL_INDEX); + $criteria->addSelectColumn(ListPausedPeer::DEL_PREVIOUS_USR_UID); + $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME); + $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_LASTNAME); + $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_USERNAME); + $criteria->addSelectColumn(ListPausedPeer::DEL_DELEGATE_DATE); + $criteria->addSelectColumn(ListPausedPeer::DEL_INIT_DATE); + $criteria->addSelectColumn(ListPausedPeer::DEL_DUE_DATE); + $criteria->addSelectColumn(ListPausedPeer::DEL_PRIORITY); + + $criteria->add( ListPausedPeer::USR_UID, $usr_uid, Criteria::EQUAL ); + self::loadFilters($criteria, $filters); + + $sort = (!empty($filters['sort'])) ? $filters['sort'] : "APP_PAUSED_DATE"; + $dir = isset($filters['dir']) ? $filters['dir'] : "ASC"; + $start = isset($filters['start']) ? $filters['start'] : "0"; + $limit = isset($filters['limit']) ? $filters['limit'] : "25"; + $paged = isset($filters['paged']) ? $filters['paged'] : 1; + + if ($dir == "DESC") { + $criteria->addDescendingOrderByColumn($sort); + } else { + $criteria->addAscendingOrderByColumn($sort); + } + + if ($paged == 1) { + $criteria->setLimit( $limit ); + $criteria->setOffset( $start ); + } + + $dataset = ListPausedPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $data = array(); + while ($dataset->next()) { + $aRow = $dataset->getRow(); + $data[] = $aRow; + } + + return $data; + } } // ListPaused diff --git a/workflow/engine/classes/model/map/ListPausedMapBuilder.php b/workflow/engine/classes/model/map/ListPausedMapBuilder.php index e7cd450a5..e525dbf7a 100644 --- a/workflow/engine/classes/model/map/ListPausedMapBuilder.php +++ b/workflow/engine/classes/model/map/ListPausedMapBuilder.php @@ -87,6 +87,8 @@ class ListPausedMapBuilder $tMap->addColumn('APP_RESTART_DATE', 'AppRestartDate', 'int', CreoleTypes::TIMESTAMP, true, null); + $tMap->addColumn('DEL_PREVIOUS_USR_UID', 'DelPreviousUsrUid', 'string', CreoleTypes::VARCHAR, false, 32); + $tMap->addColumn('DEL_CURRENT_USR_USERNAME', 'DelCurrentUsrUsername', 'string', CreoleTypes::VARCHAR, false, 100); $tMap->addColumn('DEL_CURRENT_USR_FIRSTNAME', 'DelCurrentUsrFirstname', 'string', CreoleTypes::VARCHAR, false, 50); diff --git a/workflow/engine/classes/model/om/BaseListPaused.php b/workflow/engine/classes/model/om/BaseListPaused.php index 719232659..d5efaa523 100644 --- a/workflow/engine/classes/model/om/BaseListPaused.php +++ b/workflow/engine/classes/model/om/BaseListPaused.php @@ -93,6 +93,12 @@ abstract class BaseListPaused extends BaseObject implements Persistent */ protected $app_restart_date; + /** + * The value for the del_previous_usr_uid field. + * @var string + */ + protected $del_previous_usr_uid = ''; + /** * The value for the del_current_usr_username field. * @var string @@ -312,6 +318,17 @@ abstract class BaseListPaused extends BaseObject implements Persistent } } + /** + * Get the [del_previous_usr_uid] column value. + * + * @return string + */ + public function getDelPreviousUsrUid() + { + + return $this->del_previous_usr_uid; + } + /** * Get the [del_current_usr_username] column value. * @@ -708,6 +725,28 @@ abstract class BaseListPaused extends BaseObject implements Persistent } // setAppRestartDate() + /** + * Set the value of [del_previous_usr_uid] column. + * + * @param string $v new value + * @return void + */ + public function setDelPreviousUsrUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_previous_usr_uid !== $v || $v === '') { + $this->del_previous_usr_uid = $v; + $this->modifiedColumns[] = ListPausedPeer::DEL_PREVIOUS_USR_UID; + } + + } // setDelPreviousUsrUid() + /** * Set the value of [del_current_usr_username] column. * @@ -922,26 +961,28 @@ abstract class BaseListPaused extends BaseObject implements Persistent $this->app_restart_date = $rs->getTimestamp($startcol + 10, null); - $this->del_current_usr_username = $rs->getString($startcol + 11); + $this->del_previous_usr_uid = $rs->getString($startcol + 11); - $this->del_current_usr_firstname = $rs->getString($startcol + 12); + $this->del_current_usr_username = $rs->getString($startcol + 12); - $this->del_current_usr_lastname = $rs->getString($startcol + 13); + $this->del_current_usr_firstname = $rs->getString($startcol + 13); - $this->del_delegate_date = $rs->getTimestamp($startcol + 14, null); + $this->del_current_usr_lastname = $rs->getString($startcol + 14); - $this->del_init_date = $rs->getTimestamp($startcol + 15, null); + $this->del_delegate_date = $rs->getTimestamp($startcol + 15, null); - $this->del_due_date = $rs->getTimestamp($startcol + 16, null); + $this->del_init_date = $rs->getTimestamp($startcol + 16, null); - $this->del_priority = $rs->getString($startcol + 17); + $this->del_due_date = $rs->getTimestamp($startcol + 17, null); + + $this->del_priority = $rs->getString($startcol + 18); $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 18; // 18 = ListPausedPeer::NUM_COLUMNS - ListPausedPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 19; // 19 = ListPausedPeer::NUM_COLUMNS - ListPausedPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating ListPaused object", $e); @@ -1179,24 +1220,27 @@ abstract class BaseListPaused extends BaseObject implements Persistent return $this->getAppRestartDate(); break; case 11: - return $this->getDelCurrentUsrUsername(); + return $this->getDelPreviousUsrUid(); break; case 12: - return $this->getDelCurrentUsrFirstname(); + return $this->getDelCurrentUsrUsername(); break; case 13: - return $this->getDelCurrentUsrLastname(); + return $this->getDelCurrentUsrFirstname(); break; case 14: - return $this->getDelDelegateDate(); + return $this->getDelCurrentUsrLastname(); break; case 15: - return $this->getDelInitDate(); + return $this->getDelDelegateDate(); break; case 16: - return $this->getDelDueDate(); + return $this->getDelInitDate(); break; case 17: + return $this->getDelDueDate(); + break; + case 18: return $this->getDelPriority(); break; default: @@ -1230,13 +1274,14 @@ abstract class BaseListPaused extends BaseObject implements Persistent $keys[8] => $this->getAppTasTitle(), $keys[9] => $this->getAppPausedDate(), $keys[10] => $this->getAppRestartDate(), - $keys[11] => $this->getDelCurrentUsrUsername(), - $keys[12] => $this->getDelCurrentUsrFirstname(), - $keys[13] => $this->getDelCurrentUsrLastname(), - $keys[14] => $this->getDelDelegateDate(), - $keys[15] => $this->getDelInitDate(), - $keys[16] => $this->getDelDueDate(), - $keys[17] => $this->getDelPriority(), + $keys[11] => $this->getDelPreviousUsrUid(), + $keys[12] => $this->getDelCurrentUsrUsername(), + $keys[13] => $this->getDelCurrentUsrFirstname(), + $keys[14] => $this->getDelCurrentUsrLastname(), + $keys[15] => $this->getDelDelegateDate(), + $keys[16] => $this->getDelInitDate(), + $keys[17] => $this->getDelDueDate(), + $keys[18] => $this->getDelPriority(), ); return $result; } @@ -1302,24 +1347,27 @@ abstract class BaseListPaused extends BaseObject implements Persistent $this->setAppRestartDate($value); break; case 11: - $this->setDelCurrentUsrUsername($value); + $this->setDelPreviousUsrUid($value); break; case 12: - $this->setDelCurrentUsrFirstname($value); + $this->setDelCurrentUsrUsername($value); break; case 13: - $this->setDelCurrentUsrLastname($value); + $this->setDelCurrentUsrFirstname($value); break; case 14: - $this->setDelDelegateDate($value); + $this->setDelCurrentUsrLastname($value); break; case 15: - $this->setDelInitDate($value); + $this->setDelDelegateDate($value); break; case 16: - $this->setDelDueDate($value); + $this->setDelInitDate($value); break; case 17: + $this->setDelDueDate($value); + break; + case 18: $this->setDelPriority($value); break; } // switch() @@ -1390,31 +1438,35 @@ abstract class BaseListPaused extends BaseObject implements Persistent } if (array_key_exists($keys[11], $arr)) { - $this->setDelCurrentUsrUsername($arr[$keys[11]]); + $this->setDelPreviousUsrUid($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { - $this->setDelCurrentUsrFirstname($arr[$keys[12]]); + $this->setDelCurrentUsrUsername($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { - $this->setDelCurrentUsrLastname($arr[$keys[13]]); + $this->setDelCurrentUsrFirstname($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { - $this->setDelDelegateDate($arr[$keys[14]]); + $this->setDelCurrentUsrLastname($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { - $this->setDelInitDate($arr[$keys[15]]); + $this->setDelDelegateDate($arr[$keys[15]]); } if (array_key_exists($keys[16], $arr)) { - $this->setDelDueDate($arr[$keys[16]]); + $this->setDelInitDate($arr[$keys[16]]); } if (array_key_exists($keys[17], $arr)) { - $this->setDelPriority($arr[$keys[17]]); + $this->setDelDueDate($arr[$keys[17]]); + } + + if (array_key_exists($keys[18], $arr)) { + $this->setDelPriority($arr[$keys[18]]); } } @@ -1472,6 +1524,10 @@ abstract class BaseListPaused extends BaseObject implements Persistent $criteria->add(ListPausedPeer::APP_RESTART_DATE, $this->app_restart_date); } + if ($this->isColumnModified(ListPausedPeer::DEL_PREVIOUS_USR_UID)) { + $criteria->add(ListPausedPeer::DEL_PREVIOUS_USR_UID, $this->del_previous_usr_uid); + } + if ($this->isColumnModified(ListPausedPeer::DEL_CURRENT_USR_USERNAME)) { $criteria->add(ListPausedPeer::DEL_CURRENT_USR_USERNAME, $this->del_current_usr_username); } @@ -1584,6 +1640,8 @@ abstract class BaseListPaused extends BaseObject implements Persistent $copyObj->setAppRestartDate($this->app_restart_date); + $copyObj->setDelPreviousUsrUid($this->del_previous_usr_uid); + $copyObj->setDelCurrentUsrUsername($this->del_current_usr_username); $copyObj->setDelCurrentUsrFirstname($this->del_current_usr_firstname); diff --git a/workflow/engine/classes/model/om/BaseListPausedPeer.php b/workflow/engine/classes/model/om/BaseListPausedPeer.php index b62ca915c..56aa8dbd1 100644 --- a/workflow/engine/classes/model/om/BaseListPausedPeer.php +++ b/workflow/engine/classes/model/om/BaseListPausedPeer.php @@ -25,7 +25,7 @@ abstract class BaseListPausedPeer const CLASS_DEFAULT = 'classes.model.ListPaused'; /** The total number of columns. */ - const NUM_COLUMNS = 18; + const NUM_COLUMNS = 19; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -64,6 +64,9 @@ abstract class BaseListPausedPeer /** the column name for the APP_RESTART_DATE field */ const APP_RESTART_DATE = 'LIST_PAUSED.APP_RESTART_DATE'; + /** the column name for the DEL_PREVIOUS_USR_UID field */ + const DEL_PREVIOUS_USR_UID = 'LIST_PAUSED.DEL_PREVIOUS_USR_UID'; + /** the column name for the DEL_CURRENT_USR_USERNAME field */ const DEL_CURRENT_USR_USERNAME = 'LIST_PAUSED.DEL_CURRENT_USR_USERNAME'; @@ -96,10 +99,10 @@ abstract class BaseListPausedPeer * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('AppUid', 'DelIndex', 'UsrUid', 'TasUid', 'ProUid', 'AppNumber', 'AppTitle', 'AppProTitle', 'AppTasTitle', 'AppPausedDate', 'AppRestartDate', 'DelCurrentUsrUsername', 'DelCurrentUsrFirstname', 'DelCurrentUsrLastname', 'DelDelegateDate', 'DelInitDate', 'DelDueDate', 'DelPriority', ), - BasePeer::TYPE_COLNAME => array (ListPausedPeer::APP_UID, ListPausedPeer::DEL_INDEX, ListPausedPeer::USR_UID, ListPausedPeer::TAS_UID, ListPausedPeer::PRO_UID, ListPausedPeer::APP_NUMBER, ListPausedPeer::APP_TITLE, ListPausedPeer::APP_PRO_TITLE, ListPausedPeer::APP_TAS_TITLE, ListPausedPeer::APP_PAUSED_DATE, ListPausedPeer::APP_RESTART_DATE, ListPausedPeer::DEL_CURRENT_USR_USERNAME, ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME, ListPausedPeer::DEL_CURRENT_USR_LASTNAME, ListPausedPeer::DEL_DELEGATE_DATE, ListPausedPeer::DEL_INIT_DATE, ListPausedPeer::DEL_DUE_DATE, ListPausedPeer::DEL_PRIORITY, ), - BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'DEL_INDEX', 'USR_UID', 'TAS_UID', 'PRO_UID', 'APP_NUMBER', 'APP_TITLE', 'APP_PRO_TITLE', 'APP_TAS_TITLE', 'APP_PAUSED_DATE', 'APP_RESTART_DATE', 'DEL_CURRENT_USR_USERNAME', 'DEL_CURRENT_USR_FIRSTNAME', 'DEL_CURRENT_USR_LASTNAME', 'DEL_DELEGATE_DATE', 'DEL_INIT_DATE', 'DEL_DUE_DATE', 'DEL_PRIORITY', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + BasePeer::TYPE_PHPNAME => array ('AppUid', 'DelIndex', 'UsrUid', 'TasUid', 'ProUid', 'AppNumber', 'AppTitle', 'AppProTitle', 'AppTasTitle', 'AppPausedDate', 'AppRestartDate', 'DelPreviousUsrUid', 'DelCurrentUsrUsername', 'DelCurrentUsrFirstname', 'DelCurrentUsrLastname', 'DelDelegateDate', 'DelInitDate', 'DelDueDate', 'DelPriority', ), + BasePeer::TYPE_COLNAME => array (ListPausedPeer::APP_UID, ListPausedPeer::DEL_INDEX, ListPausedPeer::USR_UID, ListPausedPeer::TAS_UID, ListPausedPeer::PRO_UID, ListPausedPeer::APP_NUMBER, ListPausedPeer::APP_TITLE, ListPausedPeer::APP_PRO_TITLE, ListPausedPeer::APP_TAS_TITLE, ListPausedPeer::APP_PAUSED_DATE, ListPausedPeer::APP_RESTART_DATE, ListPausedPeer::DEL_PREVIOUS_USR_UID, ListPausedPeer::DEL_CURRENT_USR_USERNAME, ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME, ListPausedPeer::DEL_CURRENT_USR_LASTNAME, ListPausedPeer::DEL_DELEGATE_DATE, ListPausedPeer::DEL_INIT_DATE, ListPausedPeer::DEL_DUE_DATE, ListPausedPeer::DEL_PRIORITY, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'DEL_INDEX', 'USR_UID', 'TAS_UID', 'PRO_UID', 'APP_NUMBER', 'APP_TITLE', 'APP_PRO_TITLE', 'APP_TAS_TITLE', 'APP_PAUSED_DATE', 'APP_RESTART_DATE', 'DEL_PREVIOUS_USR_UID', 'DEL_CURRENT_USR_USERNAME', 'DEL_CURRENT_USR_FIRSTNAME', 'DEL_CURRENT_USR_LASTNAME', 'DEL_DELEGATE_DATE', 'DEL_INIT_DATE', 'DEL_DUE_DATE', 'DEL_PRIORITY', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) ); /** @@ -109,10 +112,10 @@ abstract class BaseListPausedPeer * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'DelIndex' => 1, 'UsrUid' => 2, 'TasUid' => 3, 'ProUid' => 4, 'AppNumber' => 5, 'AppTitle' => 6, 'AppProTitle' => 7, 'AppTasTitle' => 8, 'AppPausedDate' => 9, 'AppRestartDate' => 10, 'DelCurrentUsrUsername' => 11, 'DelCurrentUsrFirstname' => 12, 'DelCurrentUsrLastname' => 13, 'DelDelegateDate' => 14, 'DelInitDate' => 15, 'DelDueDate' => 16, 'DelPriority' => 17, ), - BasePeer::TYPE_COLNAME => array (ListPausedPeer::APP_UID => 0, ListPausedPeer::DEL_INDEX => 1, ListPausedPeer::USR_UID => 2, ListPausedPeer::TAS_UID => 3, ListPausedPeer::PRO_UID => 4, ListPausedPeer::APP_NUMBER => 5, ListPausedPeer::APP_TITLE => 6, ListPausedPeer::APP_PRO_TITLE => 7, ListPausedPeer::APP_TAS_TITLE => 8, ListPausedPeer::APP_PAUSED_DATE => 9, ListPausedPeer::APP_RESTART_DATE => 10, ListPausedPeer::DEL_CURRENT_USR_USERNAME => 11, ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME => 12, ListPausedPeer::DEL_CURRENT_USR_LASTNAME => 13, ListPausedPeer::DEL_DELEGATE_DATE => 14, ListPausedPeer::DEL_INIT_DATE => 15, ListPausedPeer::DEL_DUE_DATE => 16, ListPausedPeer::DEL_PRIORITY => 17, ), - BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'DEL_INDEX' => 1, 'USR_UID' => 2, 'TAS_UID' => 3, 'PRO_UID' => 4, 'APP_NUMBER' => 5, 'APP_TITLE' => 6, 'APP_PRO_TITLE' => 7, 'APP_TAS_TITLE' => 8, 'APP_PAUSED_DATE' => 9, 'APP_RESTART_DATE' => 10, 'DEL_CURRENT_USR_USERNAME' => 11, 'DEL_CURRENT_USR_FIRSTNAME' => 12, 'DEL_CURRENT_USR_LASTNAME' => 13, 'DEL_DELEGATE_DATE' => 14, 'DEL_INIT_DATE' => 15, 'DEL_DUE_DATE' => 16, 'DEL_PRIORITY' => 17, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'DelIndex' => 1, 'UsrUid' => 2, 'TasUid' => 3, 'ProUid' => 4, 'AppNumber' => 5, 'AppTitle' => 6, 'AppProTitle' => 7, 'AppTasTitle' => 8, 'AppPausedDate' => 9, 'AppRestartDate' => 10, 'DelPreviousUsrUid' => 11, 'DelCurrentUsrUsername' => 12, 'DelCurrentUsrFirstname' => 13, 'DelCurrentUsrLastname' => 14, 'DelDelegateDate' => 15, 'DelInitDate' => 16, 'DelDueDate' => 17, 'DelPriority' => 18, ), + BasePeer::TYPE_COLNAME => array (ListPausedPeer::APP_UID => 0, ListPausedPeer::DEL_INDEX => 1, ListPausedPeer::USR_UID => 2, ListPausedPeer::TAS_UID => 3, ListPausedPeer::PRO_UID => 4, ListPausedPeer::APP_NUMBER => 5, ListPausedPeer::APP_TITLE => 6, ListPausedPeer::APP_PRO_TITLE => 7, ListPausedPeer::APP_TAS_TITLE => 8, ListPausedPeer::APP_PAUSED_DATE => 9, ListPausedPeer::APP_RESTART_DATE => 10, ListPausedPeer::DEL_PREVIOUS_USR_UID => 11, ListPausedPeer::DEL_CURRENT_USR_USERNAME => 12, ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME => 13, ListPausedPeer::DEL_CURRENT_USR_LASTNAME => 14, ListPausedPeer::DEL_DELEGATE_DATE => 15, ListPausedPeer::DEL_INIT_DATE => 16, ListPausedPeer::DEL_DUE_DATE => 17, ListPausedPeer::DEL_PRIORITY => 18, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'DEL_INDEX' => 1, 'USR_UID' => 2, 'TAS_UID' => 3, 'PRO_UID' => 4, 'APP_NUMBER' => 5, 'APP_TITLE' => 6, 'APP_PRO_TITLE' => 7, 'APP_TAS_TITLE' => 8, 'APP_PAUSED_DATE' => 9, 'APP_RESTART_DATE' => 10, 'DEL_PREVIOUS_USR_UID' => 11, 'DEL_CURRENT_USR_USERNAME' => 12, 'DEL_CURRENT_USR_FIRSTNAME' => 13, 'DEL_CURRENT_USR_LASTNAME' => 14, 'DEL_DELEGATE_DATE' => 15, 'DEL_INIT_DATE' => 16, 'DEL_DUE_DATE' => 17, 'DEL_PRIORITY' => 18, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) ); /** @@ -235,6 +238,8 @@ abstract class BaseListPausedPeer $criteria->addSelectColumn(ListPausedPeer::APP_RESTART_DATE); + $criteria->addSelectColumn(ListPausedPeer::DEL_PREVIOUS_USR_UID); + $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_USERNAME); $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index e5dcaa917..5442acdf7 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -4093,6 +4093,7 @@ + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index eaf5b4ce2..11bf2e19f 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2319,6 +2319,7 @@ CREATE TABLE `LIST_PAUSED` `APP_TAS_TITLE` VARCHAR(255) default '' NOT NULL, `APP_PAUSED_DATE` DATETIME NOT NULL, `APP_RESTART_DATE` DATETIME NOT NULL, + `DEL_PREVIOUS_USR_UID` VARCHAR(32) default '', `DEL_CURRENT_USR_USERNAME` VARCHAR(100) default '', `DEL_CURRENT_USR_FIRSTNAME` VARCHAR(50) default '', `DEL_CURRENT_USR_LASTNAME` VARCHAR(50) default '', diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php b/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php index 5c91a4038..2ba4c70db 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php @@ -62,6 +62,14 @@ class Lists { $list = new \ListCompleted(); $listpeer = 'ListCompletedPeer'; break; + case 'paused': + $list = new \ListPaused(); + $listpeer = 'ListPausedPeer'; + break; + case 'canceled': + $list = new \ListCanceled(); + $listpeer = 'ListCanceledPeer'; + break; case 'my_inbox': $list = new \ListMyInbox(); $listpeer = 'ListMyInboxPeer'; diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Lists.php b/workflow/engine/src/ProcessMaker/Services/Api/Lists.php index 5e95ade99..d0e021153 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Lists.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Lists.php @@ -329,6 +329,217 @@ class Lists extends Api } + + + /** + * Get list Paused + * + * @param string $count {@from path} + * @param string $paged {@from path} + * @param string $start {@from path} + * @param string $limit {@from path} + * @param string $sort {@from path} + * @param string $dir {@from path} + * @param string $cat_uid {@from path} + * @param string $pro_uid {@from path} + * @param string $search {@from path} + * @param string $filter {@from path} + * @param string $date_from {@from path} + * @param string $date_to {@from path} + * @return array + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @url GET /paused + */ + public function doGetListPaused( + $count = true, + $paged = true, + $start = 0, + $limit = 0, + $sort = 'APP_PAUSED_DATE', + $dir = 'DESC', + $cat_uid = '', + $pro_uid = '', + $search = '', + $filter = '', + $date_from = '', + $date_to = '' + ) { + try { + $dataList['userId'] = $this->getUserId(); + $dataList['paged'] = $paged; + $dataList['count'] = $count; + + $dataList['start'] = $start; + $dataList['limit'] = $limit; + $dataList['sort'] = $sort; + $dataList['dir'] = $dir; + + $dataList['category'] = $cat_uid; + $dataList['process'] = $pro_uid; + $dataList['search'] = $search; + $dataList['filter'] = $filter; + $dataList['dateFrom'] = $date_from; + $dataList['dateTo'] = $date_to; + + $lists = new \ProcessMaker\BusinessModel\Lists(); + $response = $lists->getList('paused', $dataList); + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * Get count list Paused + * + * @param string $cat_uid {@from path} + * @param string $pro_uid {@from path} + * @param string $search {@from path} + * @param string $filter {@from path} + * @param string $date_from {@from path} + * @param string $date_to {@from path} + * @return array + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @url GET /paused/total + */ + public function doGetCountPaused( + $cat_uid = '', + $pro_uid = '', + $search = '', + $filter = '', + $date_from = '', + $date_to = '' + ) { + try { + $dataList['userId'] = $this->getUserId(); + + $dataList['category'] = $cat_uid; + $dataList['process'] = $pro_uid; + $dataList['search'] = $search; + $dataList['filter'] = $filter; + $dataList['dateFrom'] = $date_from; + $dataList['dateTo'] = $date_to; + + $lists = new \ProcessMaker\BusinessModel\Lists(); + $response = $lists->getList('paused', $dataList, true); + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + + + /** + * Get list Canceled + * + * @param string $count {@from path} + * @param string $paged {@from path} + * @param string $start {@from path} + * @param string $limit {@from path} + * @param string $sort {@from path} + * @param string $dir {@from path} + * @param string $cat_uid {@from path} + * @param string $pro_uid {@from path} + * @param string $search {@from path} + * @param string $filter {@from path} + * @param string $date_from {@from path} + * @param string $date_to {@from path} + * @return array + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @url GET /canceled + */ + public function doGetListCanceled( + $count = true, + $paged = true, + $start = 0, + $limit = 0, + $sort = 'APP_CANCELED_DATE', + $dir = 'DESC', + $cat_uid = '', + $pro_uid = '', + $search = '', + $filter = '', + $date_from = '', + $date_to = '' + ) { + try { + $dataList['userId'] = $this->getUserId(); + $dataList['paged'] = $paged; + $dataList['count'] = $count; + + $dataList['start'] = $start; + $dataList['limit'] = $limit; + $dataList['sort'] = $sort; + $dataList['dir'] = $dir; + + $dataList['category'] = $cat_uid; + $dataList['process'] = $pro_uid; + $dataList['search'] = $search; + $dataList['filter'] = $filter; + $dataList['dateFrom'] = $date_from; + $dataList['dateTo'] = $date_to; + + $lists = new \ProcessMaker\BusinessModel\Lists(); + $response = $lists->getList('canceled', $dataList); + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * Get count list Canceled + * + * @param string $cat_uid {@from path} + * @param string $pro_uid {@from path} + * @param string $search {@from path} + * @param string $filter {@from path} + * @param string $date_from {@from path} + * @param string $date_to {@from path} + * @return array + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @url GET /canceled/total + */ + public function doGetCountCanceled( + $cat_uid = '', + $pro_uid = '', + $search = '', + $filter = '', + $date_from = '', + $date_to = '' + ) { + try { + $dataList['userId'] = $this->getUserId(); + + $dataList['category'] = $cat_uid; + $dataList['process'] = $pro_uid; + $dataList['search'] = $search; + $dataList['filter'] = $filter; + $dataList['dateFrom'] = $date_from; + $dataList['dateTo'] = $date_to; + + $lists = new \ProcessMaker\BusinessModel\Lists(); + $response = $lists->getList('canceled', $dataList, true); + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** * Get List Completed * From 5fa88630ee0b56a3e3bb1b694815db67d5b26eba Mon Sep 17 00:00:00 2001 From: "marcelo.cuiza" Date: Fri, 6 Feb 2015 14:35:44 -0400 Subject: [PATCH 005/155] PM-1492 Las condiciones no funcionan correctamente, si es que no estan dentro de parentesis (). Se encapsulo en parentesis toda condicion dada. --- workflow/engine/classes/class.derivation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/classes/class.derivation.php b/workflow/engine/classes/class.derivation.php index 9c3328886..88416c60d 100755 --- a/workflow/engine/classes/class.derivation.php +++ b/workflow/engine/classes/class.derivation.php @@ -194,7 +194,7 @@ class Derivation $pmScript = new PMScript(); $pmScript->setFields($arrayApplicationData["APP_DATA"]); - $pmScript->setScript($arrayRouteData["ROU_CONDITION"]); + $pmScript->setScript("( ".$arrayRouteData["ROU_CONDITION"]." )"); $flagContinue = $pmScript->evaluate(); } From 8be9610114b9fd3272849617974d3ce98a2a8201 Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Fri, 6 Feb 2015 14:57:59 -0400 Subject: [PATCH 006/155] Cambios para draft --- .../engine/classes/class.configuration.php | 7 +- workflow/engine/classes/model/ListInbox.php | 3 + .../classes/model/ListParticipatedLast.php | 26 ++ workflow/engine/classes/model/ListPaused.php | 16 + .../map/ListParticipatedLastMapBuilder.php | 8 + .../model/map/ListPausedMapBuilder.php | 6 + .../model/om/BaseListParticipatedLast.php | 320 +++++++++++++++--- .../model/om/BaseListParticipatedLastPeer.php | 38 ++- .../classes/model/om/BaseListPaused.php | 242 +++++++++++-- .../classes/model/om/BaseListPausedPeer.php | 33 +- workflow/engine/config/schema.xml | 7 + workflow/engine/data/mysql/schema.sql | 7 + .../engine/methods/cases/casesListExtJs.php | 106 +++++- .../methods/setup/environmentSettingsAjax.php | 4 + .../src/ProcessMaker/BusinessModel/Lists.php | 28 +- .../src/ProcessMaker/Services/Api/Lists.php | 5 +- workflow/engine/templates/cases/casesList.js | 14 +- 17 files changed, 762 insertions(+), 108 deletions(-) diff --git a/workflow/engine/classes/class.configuration.php b/workflow/engine/classes/class.configuration.php index 5ec6c2346..d5590fbb8 100755 --- a/workflow/engine/classes/class.configuration.php +++ b/workflow/engine/classes/class.configuration.php @@ -373,9 +373,10 @@ class Configurations // extends Configuration */ public function getFormats() { - $this->UserConfig = array(); - if (!isset($this->UserConfig)) { - $this->UserConfig = $this->getConfiguration("ENVIRONMENT_SETTINGS", ""); + $this->UserConfig = $this->getConfiguration("ENVIRONMENT_SETTINGS", ""); + + if (is_numeric($this->UserConfig)) { + $this->UserConfig = array(); } //Setting defaults diff --git a/workflow/engine/classes/model/ListInbox.php b/workflow/engine/classes/model/ListInbox.php index 29c00eec3..aba18506e 100644 --- a/workflow/engine/classes/model/ListInbox.php +++ b/workflow/engine/classes/model/ListInbox.php @@ -322,6 +322,9 @@ class ListInbox extends BaseListInbox $limit = isset($filters['limit']) ? $filters['limit'] : "25"; $paged = isset($filters['paged']) ? $filters['paged'] : 1; + if ($filters['action'] == 'draft') { + $criteria->add( ListInboxPeer::DEL_INDEX, 1, Criteria::EQUAL ); + } if ($dir == "DESC") { $criteria->addDescendingOrderByColumn($sort); } else { diff --git a/workflow/engine/classes/model/ListParticipatedLast.php b/workflow/engine/classes/model/ListParticipatedLast.php index ac48121f9..b1ccb12eb 100644 --- a/workflow/engine/classes/model/ListParticipatedLast.php +++ b/workflow/engine/classes/model/ListParticipatedLast.php @@ -25,6 +25,28 @@ class ListParticipatedLast extends BaseListParticipatedLast */ public function create($data) { + $criteria = new Criteria(); + $criteria->addSelectColumn(UsersPeer::USR_USERNAME); + $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); + $criteria->addSelectColumn(UsersPeer::USR_LASTNAME); + $criteria->add( UsersPeer::USR_UID, $data['USR_UID'], Criteria::EQUAL ); + $dataset = UsersPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['DEL_CURRENT_USR_USERNAME'] = $aRow['USR_USERNAME']; + $data['DEL_CURRENT_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME']; + $data['DEL_CURRENT_USR_LASTNAME'] = $aRow['USR_LASTNAME']; + + $criteria = new Criteria(); + $criteria->addSelectColumn(ApplicationPeer::APP_STATUS); + $criteria->add( ApplicationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL ); + $dataset = UsersPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['APP_STATUS'] = $aRow['APP_STATUS']; + $con = Propel::getConnection( ListParticipatedLastPeer::DATABASE_NAME ); try { $this->fromArray( $data, BasePeer::TYPE_FIELDNAME ); @@ -182,11 +204,15 @@ class ListParticipatedLast extends BaseListParticipatedLast $criteria->addSelectColumn(ListParticipatedLastPeer::APP_TITLE); $criteria->addSelectColumn(ListParticipatedLastPeer::APP_PRO_TITLE); $criteria->addSelectColumn(ListParticipatedLastPeer::APP_TAS_TITLE); + $criteria->addSelectColumn(ListParticipatedLastPeer::APP_STATUS); $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_INDEX); $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_PREVIOUS_USR_UID); $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_PREVIOUS_USR_USERNAME); $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_PREVIOUS_USR_FIRSTNAME); $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_PREVIOUS_USR_LASTNAME); + $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_CURRENT_USR_USERNAME); + $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_CURRENT_USR_FIRSTNAME); + $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_CURRENT_USR_LASTNAME); $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_DELEGATE_DATE); $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_INIT_DATE); $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_DUE_DATE); diff --git a/workflow/engine/classes/model/ListPaused.php b/workflow/engine/classes/model/ListPaused.php index e432f6b9e..c211efd76 100644 --- a/workflow/engine/classes/model/ListPaused.php +++ b/workflow/engine/classes/model/ListPaused.php @@ -74,6 +74,19 @@ class ListPaused extends BaseListPaused { $aRow = $dataset->getRow(); $data['DEL_PREVIOUS_USR_UID'] = $aRow['USR_UID']; + $criteria = new Criteria(); + $criteria->addSelectColumn(UsersPeer::USR_USERNAME); + $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); + $criteria->addSelectColumn(UsersPeer::USR_LASTNAME); + $criteria->add( UsersPeer::USR_UID, $data['DEL_PREVIOUS_USR_UID'], Criteria::EQUAL ); + $dataset = UsersPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $aRow = $dataset->getRow(); + $data['DEL_PREVIOUS_USR_USERNAME'] = $aRow['USR_USERNAME']; + $data['DEL_PREVIOUS_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME']; + $data['DEL_PREVIOUS_USR_LASTNAME'] = $aRow['USR_LASTNAME']; + $criteria = new Criteria(); $criteria->addSelectColumn(ContentPeer::CON_VALUE); $criteria->add( ContentPeer::CON_ID, $data['TAS_UID'], Criteria::EQUAL ); @@ -263,6 +276,9 @@ class ListPaused extends BaseListPaused { $criteria->addSelectColumn(ListPausedPeer::APP_RESTART_DATE); $criteria->addSelectColumn(ListPausedPeer::DEL_INDEX); $criteria->addSelectColumn(ListPausedPeer::DEL_PREVIOUS_USR_UID); + $criteria->addSelectColumn(ListPausedPeer::DEL_PREVIOUS_USR_USERNAME); + $criteria->addSelectColumn(ListPausedPeer::DEL_PREVIOUS_USR_FIRSTNAME); + $criteria->addSelectColumn(ListPausedPeer::DEL_PREVIOUS_USR_LASTNAME); $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME); $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_LASTNAME); $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_USERNAME); diff --git a/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php b/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php index e9ee783d9..10a3e1bf3 100644 --- a/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php +++ b/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php @@ -81,6 +81,8 @@ class ListParticipatedLastMapBuilder $tMap->addColumn('APP_TAS_TITLE', 'AppTasTitle', 'string', CreoleTypes::VARCHAR, true, 255); + $tMap->addColumn('APP_STATUS', 'AppStatus', 'string', CreoleTypes::VARCHAR, true, 20); + $tMap->addColumn('DEL_INDEX', 'DelIndex', 'int', CreoleTypes::INTEGER, true, null); $tMap->addColumn('DEL_PREVIOUS_USR_UID', 'DelPreviousUsrUid', 'string', CreoleTypes::VARCHAR, false, 32); @@ -91,6 +93,12 @@ class ListParticipatedLastMapBuilder $tMap->addColumn('DEL_PREVIOUS_USR_LASTNAME', 'DelPreviousUsrLastname', 'string', CreoleTypes::VARCHAR, false, 50); + $tMap->addColumn('DEL_CURRENT_USR_USERNAME', 'DelCurrentUsrUsername', 'string', CreoleTypes::VARCHAR, false, 100); + + $tMap->addColumn('DEL_CURRENT_USR_FIRSTNAME', 'DelCurrentUsrFirstname', 'string', CreoleTypes::VARCHAR, false, 50); + + $tMap->addColumn('DEL_CURRENT_USR_LASTNAME', 'DelCurrentUsrLastname', 'string', CreoleTypes::VARCHAR, false, 50); + $tMap->addColumn('DEL_DELEGATE_DATE', 'DelDelegateDate', 'int', CreoleTypes::TIMESTAMP, true, null); $tMap->addColumn('DEL_INIT_DATE', 'DelInitDate', 'int', CreoleTypes::TIMESTAMP, false, null); diff --git a/workflow/engine/classes/model/map/ListPausedMapBuilder.php b/workflow/engine/classes/model/map/ListPausedMapBuilder.php index e525dbf7a..a535e261d 100644 --- a/workflow/engine/classes/model/map/ListPausedMapBuilder.php +++ b/workflow/engine/classes/model/map/ListPausedMapBuilder.php @@ -89,6 +89,12 @@ class ListPausedMapBuilder $tMap->addColumn('DEL_PREVIOUS_USR_UID', 'DelPreviousUsrUid', 'string', CreoleTypes::VARCHAR, false, 32); + $tMap->addColumn('DEL_PREVIOUS_USR_USERNAME', 'DelPreviousUsrUsername', 'string', CreoleTypes::VARCHAR, false, 100); + + $tMap->addColumn('DEL_PREVIOUS_USR_FIRSTNAME', 'DelPreviousUsrFirstname', 'string', CreoleTypes::VARCHAR, false, 50); + + $tMap->addColumn('DEL_PREVIOUS_USR_LASTNAME', 'DelPreviousUsrLastname', 'string', CreoleTypes::VARCHAR, false, 50); + $tMap->addColumn('DEL_CURRENT_USR_USERNAME', 'DelCurrentUsrUsername', 'string', CreoleTypes::VARCHAR, false, 100); $tMap->addColumn('DEL_CURRENT_USR_FIRSTNAME', 'DelCurrentUsrFirstname', 'string', CreoleTypes::VARCHAR, false, 50); diff --git a/workflow/engine/classes/model/om/BaseListParticipatedLast.php b/workflow/engine/classes/model/om/BaseListParticipatedLast.php index 6b6288169..8ee9a0191 100644 --- a/workflow/engine/classes/model/om/BaseListParticipatedLast.php +++ b/workflow/engine/classes/model/om/BaseListParticipatedLast.php @@ -75,6 +75,12 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent */ protected $app_tas_title = ''; + /** + * The value for the app_status field. + * @var string + */ + protected $app_status = '0'; + /** * The value for the del_index field. * @var int @@ -105,6 +111,24 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent */ protected $del_previous_usr_lastname = ''; + /** + * The value for the del_current_usr_username field. + * @var string + */ + protected $del_current_usr_username = ''; + + /** + * The value for the del_current_usr_firstname field. + * @var string + */ + protected $del_current_usr_firstname = ''; + + /** + * The value for the del_current_usr_lastname field. + * @var string + */ + protected $del_current_usr_lastname = ''; + /** * The value for the del_delegate_date field. * @var int @@ -231,6 +255,17 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent return $this->app_tas_title; } + /** + * Get the [app_status] column value. + * + * @return string + */ + public function getAppStatus() + { + + return $this->app_status; + } + /** * Get the [del_index] column value. * @@ -286,6 +321,39 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent return $this->del_previous_usr_lastname; } + /** + * Get the [del_current_usr_username] column value. + * + * @return string + */ + public function getDelCurrentUsrUsername() + { + + return $this->del_current_usr_username; + } + + /** + * Get the [del_current_usr_firstname] column value. + * + * @return string + */ + public function getDelCurrentUsrFirstname() + { + + return $this->del_current_usr_firstname; + } + + /** + * Get the [del_current_usr_lastname] column value. + * + * @return string + */ + public function getDelCurrentUsrLastname() + { + + return $this->del_current_usr_lastname; + } + /** * Get the [optionally formatted] [del_delegate_date] column value. * @@ -569,6 +637,28 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent } // setAppTasTitle() + /** + * Set the value of [app_status] column. + * + * @param string $v new value + * @return void + */ + public function setAppStatus($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_status !== $v || $v === '0') { + $this->app_status = $v; + $this->modifiedColumns[] = ListParticipatedLastPeer::APP_STATUS; + } + + } // setAppStatus() + /** * Set the value of [del_index] column. * @@ -679,6 +769,72 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent } // setDelPreviousUsrLastname() + /** + * Set the value of [del_current_usr_username] column. + * + * @param string $v new value + * @return void + */ + public function setDelCurrentUsrUsername($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_current_usr_username !== $v || $v === '') { + $this->del_current_usr_username = $v; + $this->modifiedColumns[] = ListParticipatedLastPeer::DEL_CURRENT_USR_USERNAME; + } + + } // setDelCurrentUsrUsername() + + /** + * Set the value of [del_current_usr_firstname] column. + * + * @param string $v new value + * @return void + */ + public function setDelCurrentUsrFirstname($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_current_usr_firstname !== $v || $v === '') { + $this->del_current_usr_firstname = $v; + $this->modifiedColumns[] = ListParticipatedLastPeer::DEL_CURRENT_USR_FIRSTNAME; + } + + } // setDelCurrentUsrFirstname() + + /** + * Set the value of [del_current_usr_lastname] column. + * + * @param string $v new value + * @return void + */ + public function setDelCurrentUsrLastname($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_current_usr_lastname !== $v || $v === '') { + $this->del_current_usr_lastname = $v; + $this->modifiedColumns[] = ListParticipatedLastPeer::DEL_CURRENT_USR_LASTNAME; + } + + } // setDelCurrentUsrLastname() + /** * Set the value of [del_delegate_date] column. * @@ -821,30 +977,38 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent $this->app_tas_title = $rs->getString($startcol + 7); - $this->del_index = $rs->getInt($startcol + 8); + $this->app_status = $rs->getString($startcol + 8); - $this->del_previous_usr_uid = $rs->getString($startcol + 9); + $this->del_index = $rs->getInt($startcol + 9); - $this->del_previous_usr_username = $rs->getString($startcol + 10); + $this->del_previous_usr_uid = $rs->getString($startcol + 10); - $this->del_previous_usr_firstname = $rs->getString($startcol + 11); + $this->del_previous_usr_username = $rs->getString($startcol + 11); - $this->del_previous_usr_lastname = $rs->getString($startcol + 12); + $this->del_previous_usr_firstname = $rs->getString($startcol + 12); - $this->del_delegate_date = $rs->getTimestamp($startcol + 13, null); + $this->del_previous_usr_lastname = $rs->getString($startcol + 13); - $this->del_init_date = $rs->getTimestamp($startcol + 14, null); + $this->del_current_usr_username = $rs->getString($startcol + 14); - $this->del_due_date = $rs->getTimestamp($startcol + 15, null); + $this->del_current_usr_firstname = $rs->getString($startcol + 15); - $this->del_priority = $rs->getString($startcol + 16); + $this->del_current_usr_lastname = $rs->getString($startcol + 16); + + $this->del_delegate_date = $rs->getTimestamp($startcol + 17, null); + + $this->del_init_date = $rs->getTimestamp($startcol + 18, null); + + $this->del_due_date = $rs->getTimestamp($startcol + 19, null); + + $this->del_priority = $rs->getString($startcol + 20); $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 17; // 17 = ListParticipatedLastPeer::NUM_COLUMNS - ListParticipatedLastPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 21; // 21 = ListParticipatedLastPeer::NUM_COLUMNS - ListParticipatedLastPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating ListParticipatedLast object", $e); @@ -1073,30 +1237,42 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent return $this->getAppTasTitle(); break; case 8: - return $this->getDelIndex(); + return $this->getAppStatus(); break; case 9: - return $this->getDelPreviousUsrUid(); + return $this->getDelIndex(); break; case 10: - return $this->getDelPreviousUsrUsername(); + return $this->getDelPreviousUsrUid(); break; case 11: - return $this->getDelPreviousUsrFirstname(); + return $this->getDelPreviousUsrUsername(); break; case 12: - return $this->getDelPreviousUsrLastname(); + return $this->getDelPreviousUsrFirstname(); break; case 13: - return $this->getDelDelegateDate(); + return $this->getDelPreviousUsrLastname(); break; case 14: - return $this->getDelInitDate(); + return $this->getDelCurrentUsrUsername(); break; case 15: - return $this->getDelDueDate(); + return $this->getDelCurrentUsrFirstname(); break; case 16: + return $this->getDelCurrentUsrLastname(); + break; + case 17: + return $this->getDelDelegateDate(); + break; + case 18: + return $this->getDelInitDate(); + break; + case 19: + return $this->getDelDueDate(); + break; + case 20: return $this->getDelPriority(); break; default: @@ -1127,15 +1303,19 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent $keys[5] => $this->getAppTitle(), $keys[6] => $this->getAppProTitle(), $keys[7] => $this->getAppTasTitle(), - $keys[8] => $this->getDelIndex(), - $keys[9] => $this->getDelPreviousUsrUid(), - $keys[10] => $this->getDelPreviousUsrUsername(), - $keys[11] => $this->getDelPreviousUsrFirstname(), - $keys[12] => $this->getDelPreviousUsrLastname(), - $keys[13] => $this->getDelDelegateDate(), - $keys[14] => $this->getDelInitDate(), - $keys[15] => $this->getDelDueDate(), - $keys[16] => $this->getDelPriority(), + $keys[8] => $this->getAppStatus(), + $keys[9] => $this->getDelIndex(), + $keys[10] => $this->getDelPreviousUsrUid(), + $keys[11] => $this->getDelPreviousUsrUsername(), + $keys[12] => $this->getDelPreviousUsrFirstname(), + $keys[13] => $this->getDelPreviousUsrLastname(), + $keys[14] => $this->getDelCurrentUsrUsername(), + $keys[15] => $this->getDelCurrentUsrFirstname(), + $keys[16] => $this->getDelCurrentUsrLastname(), + $keys[17] => $this->getDelDelegateDate(), + $keys[18] => $this->getDelInitDate(), + $keys[19] => $this->getDelDueDate(), + $keys[20] => $this->getDelPriority(), ); return $result; } @@ -1192,30 +1372,42 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent $this->setAppTasTitle($value); break; case 8: - $this->setDelIndex($value); + $this->setAppStatus($value); break; case 9: - $this->setDelPreviousUsrUid($value); + $this->setDelIndex($value); break; case 10: - $this->setDelPreviousUsrUsername($value); + $this->setDelPreviousUsrUid($value); break; case 11: - $this->setDelPreviousUsrFirstname($value); + $this->setDelPreviousUsrUsername($value); break; case 12: - $this->setDelPreviousUsrLastname($value); + $this->setDelPreviousUsrFirstname($value); break; case 13: - $this->setDelDelegateDate($value); + $this->setDelPreviousUsrLastname($value); break; case 14: - $this->setDelInitDate($value); + $this->setDelCurrentUsrUsername($value); break; case 15: - $this->setDelDueDate($value); + $this->setDelCurrentUsrFirstname($value); break; case 16: + $this->setDelCurrentUsrLastname($value); + break; + case 17: + $this->setDelDelegateDate($value); + break; + case 18: + $this->setDelInitDate($value); + break; + case 19: + $this->setDelDueDate($value); + break; + case 20: $this->setDelPriority($value); break; } // switch() @@ -1274,39 +1466,55 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent } if (array_key_exists($keys[8], $arr)) { - $this->setDelIndex($arr[$keys[8]]); + $this->setAppStatus($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { - $this->setDelPreviousUsrUid($arr[$keys[9]]); + $this->setDelIndex($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { - $this->setDelPreviousUsrUsername($arr[$keys[10]]); + $this->setDelPreviousUsrUid($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { - $this->setDelPreviousUsrFirstname($arr[$keys[11]]); + $this->setDelPreviousUsrUsername($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { - $this->setDelPreviousUsrLastname($arr[$keys[12]]); + $this->setDelPreviousUsrFirstname($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { - $this->setDelDelegateDate($arr[$keys[13]]); + $this->setDelPreviousUsrLastname($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { - $this->setDelInitDate($arr[$keys[14]]); + $this->setDelCurrentUsrUsername($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { - $this->setDelDueDate($arr[$keys[15]]); + $this->setDelCurrentUsrFirstname($arr[$keys[15]]); } if (array_key_exists($keys[16], $arr)) { - $this->setDelPriority($arr[$keys[16]]); + $this->setDelCurrentUsrLastname($arr[$keys[16]]); + } + + if (array_key_exists($keys[17], $arr)) { + $this->setDelDelegateDate($arr[$keys[17]]); + } + + if (array_key_exists($keys[18], $arr)) { + $this->setDelInitDate($arr[$keys[18]]); + } + + if (array_key_exists($keys[19], $arr)) { + $this->setDelDueDate($arr[$keys[19]]); + } + + if (array_key_exists($keys[20], $arr)) { + $this->setDelPriority($arr[$keys[20]]); } } @@ -1352,6 +1560,10 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent $criteria->add(ListParticipatedLastPeer::APP_TAS_TITLE, $this->app_tas_title); } + if ($this->isColumnModified(ListParticipatedLastPeer::APP_STATUS)) { + $criteria->add(ListParticipatedLastPeer::APP_STATUS, $this->app_status); + } + if ($this->isColumnModified(ListParticipatedLastPeer::DEL_INDEX)) { $criteria->add(ListParticipatedLastPeer::DEL_INDEX, $this->del_index); } @@ -1372,6 +1584,18 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent $criteria->add(ListParticipatedLastPeer::DEL_PREVIOUS_USR_LASTNAME, $this->del_previous_usr_lastname); } + if ($this->isColumnModified(ListParticipatedLastPeer::DEL_CURRENT_USR_USERNAME)) { + $criteria->add(ListParticipatedLastPeer::DEL_CURRENT_USR_USERNAME, $this->del_current_usr_username); + } + + if ($this->isColumnModified(ListParticipatedLastPeer::DEL_CURRENT_USR_FIRSTNAME)) { + $criteria->add(ListParticipatedLastPeer::DEL_CURRENT_USR_FIRSTNAME, $this->del_current_usr_firstname); + } + + if ($this->isColumnModified(ListParticipatedLastPeer::DEL_CURRENT_USR_LASTNAME)) { + $criteria->add(ListParticipatedLastPeer::DEL_CURRENT_USR_LASTNAME, $this->del_current_usr_lastname); + } + if ($this->isColumnModified(ListParticipatedLastPeer::DEL_DELEGATE_DATE)) { $criteria->add(ListParticipatedLastPeer::DEL_DELEGATE_DATE, $this->del_delegate_date); } @@ -1466,6 +1690,8 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent $copyObj->setAppTasTitle($this->app_tas_title); + $copyObj->setAppStatus($this->app_status); + $copyObj->setDelIndex($this->del_index); $copyObj->setDelPreviousUsrUid($this->del_previous_usr_uid); @@ -1476,6 +1702,12 @@ abstract class BaseListParticipatedLast extends BaseObject implements Persistent $copyObj->setDelPreviousUsrLastname($this->del_previous_usr_lastname); + $copyObj->setDelCurrentUsrUsername($this->del_current_usr_username); + + $copyObj->setDelCurrentUsrFirstname($this->del_current_usr_firstname); + + $copyObj->setDelCurrentUsrLastname($this->del_current_usr_lastname); + $copyObj->setDelDelegateDate($this->del_delegate_date); $copyObj->setDelInitDate($this->del_init_date); diff --git a/workflow/engine/classes/model/om/BaseListParticipatedLastPeer.php b/workflow/engine/classes/model/om/BaseListParticipatedLastPeer.php index cd9362886..b79a16061 100644 --- a/workflow/engine/classes/model/om/BaseListParticipatedLastPeer.php +++ b/workflow/engine/classes/model/om/BaseListParticipatedLastPeer.php @@ -25,7 +25,7 @@ abstract class BaseListParticipatedLastPeer const CLASS_DEFAULT = 'classes.model.ListParticipatedLast'; /** The total number of columns. */ - const NUM_COLUMNS = 17; + const NUM_COLUMNS = 21; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -55,6 +55,9 @@ abstract class BaseListParticipatedLastPeer /** the column name for the APP_TAS_TITLE field */ const APP_TAS_TITLE = 'LIST_PARTICIPATED_LAST.APP_TAS_TITLE'; + /** the column name for the APP_STATUS field */ + const APP_STATUS = 'LIST_PARTICIPATED_LAST.APP_STATUS'; + /** the column name for the DEL_INDEX field */ const DEL_INDEX = 'LIST_PARTICIPATED_LAST.DEL_INDEX'; @@ -70,6 +73,15 @@ abstract class BaseListParticipatedLastPeer /** the column name for the DEL_PREVIOUS_USR_LASTNAME field */ const DEL_PREVIOUS_USR_LASTNAME = 'LIST_PARTICIPATED_LAST.DEL_PREVIOUS_USR_LASTNAME'; + /** the column name for the DEL_CURRENT_USR_USERNAME field */ + const DEL_CURRENT_USR_USERNAME = 'LIST_PARTICIPATED_LAST.DEL_CURRENT_USR_USERNAME'; + + /** the column name for the DEL_CURRENT_USR_FIRSTNAME field */ + const DEL_CURRENT_USR_FIRSTNAME = 'LIST_PARTICIPATED_LAST.DEL_CURRENT_USR_FIRSTNAME'; + + /** the column name for the DEL_CURRENT_USR_LASTNAME field */ + const DEL_CURRENT_USR_LASTNAME = 'LIST_PARTICIPATED_LAST.DEL_CURRENT_USR_LASTNAME'; + /** the column name for the DEL_DELEGATE_DATE field */ const DEL_DELEGATE_DATE = 'LIST_PARTICIPATED_LAST.DEL_DELEGATE_DATE'; @@ -93,10 +105,10 @@ abstract class BaseListParticipatedLastPeer * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('AppUid', 'UsrUid', 'TasUid', 'ProUid', 'AppNumber', 'AppTitle', 'AppProTitle', 'AppTasTitle', 'DelIndex', 'DelPreviousUsrUid', 'DelPreviousUsrUsername', 'DelPreviousUsrFirstname', 'DelPreviousUsrLastname', 'DelDelegateDate', 'DelInitDate', 'DelDueDate', 'DelPriority', ), - BasePeer::TYPE_COLNAME => array (ListParticipatedLastPeer::APP_UID, ListParticipatedLastPeer::USR_UID, ListParticipatedLastPeer::TAS_UID, ListParticipatedLastPeer::PRO_UID, ListParticipatedLastPeer::APP_NUMBER, ListParticipatedLastPeer::APP_TITLE, ListParticipatedLastPeer::APP_PRO_TITLE, ListParticipatedLastPeer::APP_TAS_TITLE, ListParticipatedLastPeer::DEL_INDEX, ListParticipatedLastPeer::DEL_PREVIOUS_USR_UID, ListParticipatedLastPeer::DEL_PREVIOUS_USR_USERNAME, ListParticipatedLastPeer::DEL_PREVIOUS_USR_FIRSTNAME, ListParticipatedLastPeer::DEL_PREVIOUS_USR_LASTNAME, ListParticipatedLastPeer::DEL_DELEGATE_DATE, ListParticipatedLastPeer::DEL_INIT_DATE, ListParticipatedLastPeer::DEL_DUE_DATE, ListParticipatedLastPeer::DEL_PRIORITY, ), - BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'USR_UID', 'TAS_UID', 'PRO_UID', 'APP_NUMBER', 'APP_TITLE', 'APP_PRO_TITLE', 'APP_TAS_TITLE', 'DEL_INDEX', 'DEL_PREVIOUS_USR_UID', 'DEL_PREVIOUS_USR_USERNAME', 'DEL_PREVIOUS_USR_FIRSTNAME', 'DEL_PREVIOUS_USR_LASTNAME', 'DEL_DELEGATE_DATE', 'DEL_INIT_DATE', 'DEL_DUE_DATE', 'DEL_PRIORITY', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ) + BasePeer::TYPE_PHPNAME => array ('AppUid', 'UsrUid', 'TasUid', 'ProUid', 'AppNumber', 'AppTitle', 'AppProTitle', 'AppTasTitle', 'AppStatus', 'DelIndex', 'DelPreviousUsrUid', 'DelPreviousUsrUsername', 'DelPreviousUsrFirstname', 'DelPreviousUsrLastname', 'DelCurrentUsrUsername', 'DelCurrentUsrFirstname', 'DelCurrentUsrLastname', 'DelDelegateDate', 'DelInitDate', 'DelDueDate', 'DelPriority', ), + BasePeer::TYPE_COLNAME => array (ListParticipatedLastPeer::APP_UID, ListParticipatedLastPeer::USR_UID, ListParticipatedLastPeer::TAS_UID, ListParticipatedLastPeer::PRO_UID, ListParticipatedLastPeer::APP_NUMBER, ListParticipatedLastPeer::APP_TITLE, ListParticipatedLastPeer::APP_PRO_TITLE, ListParticipatedLastPeer::APP_TAS_TITLE, ListParticipatedLastPeer::APP_STATUS, ListParticipatedLastPeer::DEL_INDEX, ListParticipatedLastPeer::DEL_PREVIOUS_USR_UID, ListParticipatedLastPeer::DEL_PREVIOUS_USR_USERNAME, ListParticipatedLastPeer::DEL_PREVIOUS_USR_FIRSTNAME, ListParticipatedLastPeer::DEL_PREVIOUS_USR_LASTNAME, ListParticipatedLastPeer::DEL_CURRENT_USR_USERNAME, ListParticipatedLastPeer::DEL_CURRENT_USR_FIRSTNAME, ListParticipatedLastPeer::DEL_CURRENT_USR_LASTNAME, ListParticipatedLastPeer::DEL_DELEGATE_DATE, ListParticipatedLastPeer::DEL_INIT_DATE, ListParticipatedLastPeer::DEL_DUE_DATE, ListParticipatedLastPeer::DEL_PRIORITY, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'USR_UID', 'TAS_UID', 'PRO_UID', 'APP_NUMBER', 'APP_TITLE', 'APP_PRO_TITLE', 'APP_TAS_TITLE', 'APP_STATUS', 'DEL_INDEX', 'DEL_PREVIOUS_USR_UID', 'DEL_PREVIOUS_USR_USERNAME', 'DEL_PREVIOUS_USR_FIRSTNAME', 'DEL_PREVIOUS_USR_LASTNAME', 'DEL_CURRENT_USR_USERNAME', 'DEL_CURRENT_USR_FIRSTNAME', 'DEL_CURRENT_USR_LASTNAME', 'DEL_DELEGATE_DATE', 'DEL_INIT_DATE', 'DEL_DUE_DATE', 'DEL_PRIORITY', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ) ); /** @@ -106,10 +118,10 @@ abstract class BaseListParticipatedLastPeer * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'UsrUid' => 1, 'TasUid' => 2, 'ProUid' => 3, 'AppNumber' => 4, 'AppTitle' => 5, 'AppProTitle' => 6, 'AppTasTitle' => 7, 'DelIndex' => 8, 'DelPreviousUsrUid' => 9, 'DelPreviousUsrUsername' => 10, 'DelPreviousUsrFirstname' => 11, 'DelPreviousUsrLastname' => 12, 'DelDelegateDate' => 13, 'DelInitDate' => 14, 'DelDueDate' => 15, 'DelPriority' => 16, ), - BasePeer::TYPE_COLNAME => array (ListParticipatedLastPeer::APP_UID => 0, ListParticipatedLastPeer::USR_UID => 1, ListParticipatedLastPeer::TAS_UID => 2, ListParticipatedLastPeer::PRO_UID => 3, ListParticipatedLastPeer::APP_NUMBER => 4, ListParticipatedLastPeer::APP_TITLE => 5, ListParticipatedLastPeer::APP_PRO_TITLE => 6, ListParticipatedLastPeer::APP_TAS_TITLE => 7, ListParticipatedLastPeer::DEL_INDEX => 8, ListParticipatedLastPeer::DEL_PREVIOUS_USR_UID => 9, ListParticipatedLastPeer::DEL_PREVIOUS_USR_USERNAME => 10, ListParticipatedLastPeer::DEL_PREVIOUS_USR_FIRSTNAME => 11, ListParticipatedLastPeer::DEL_PREVIOUS_USR_LASTNAME => 12, ListParticipatedLastPeer::DEL_DELEGATE_DATE => 13, ListParticipatedLastPeer::DEL_INIT_DATE => 14, ListParticipatedLastPeer::DEL_DUE_DATE => 15, ListParticipatedLastPeer::DEL_PRIORITY => 16, ), - BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'USR_UID' => 1, 'TAS_UID' => 2, 'PRO_UID' => 3, 'APP_NUMBER' => 4, 'APP_TITLE' => 5, 'APP_PRO_TITLE' => 6, 'APP_TAS_TITLE' => 7, 'DEL_INDEX' => 8, 'DEL_PREVIOUS_USR_UID' => 9, 'DEL_PREVIOUS_USR_USERNAME' => 10, 'DEL_PREVIOUS_USR_FIRSTNAME' => 11, 'DEL_PREVIOUS_USR_LASTNAME' => 12, 'DEL_DELEGATE_DATE' => 13, 'DEL_INIT_DATE' => 14, 'DEL_DUE_DATE' => 15, 'DEL_PRIORITY' => 16, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ) + BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'UsrUid' => 1, 'TasUid' => 2, 'ProUid' => 3, 'AppNumber' => 4, 'AppTitle' => 5, 'AppProTitle' => 6, 'AppTasTitle' => 7, 'AppStatus' => 8, 'DelIndex' => 9, 'DelPreviousUsrUid' => 10, 'DelPreviousUsrUsername' => 11, 'DelPreviousUsrFirstname' => 12, 'DelPreviousUsrLastname' => 13, 'DelCurrentUsrUsername' => 14, 'DelCurrentUsrFirstname' => 15, 'DelCurrentUsrLastname' => 16, 'DelDelegateDate' => 17, 'DelInitDate' => 18, 'DelDueDate' => 19, 'DelPriority' => 20, ), + BasePeer::TYPE_COLNAME => array (ListParticipatedLastPeer::APP_UID => 0, ListParticipatedLastPeer::USR_UID => 1, ListParticipatedLastPeer::TAS_UID => 2, ListParticipatedLastPeer::PRO_UID => 3, ListParticipatedLastPeer::APP_NUMBER => 4, ListParticipatedLastPeer::APP_TITLE => 5, ListParticipatedLastPeer::APP_PRO_TITLE => 6, ListParticipatedLastPeer::APP_TAS_TITLE => 7, ListParticipatedLastPeer::APP_STATUS => 8, ListParticipatedLastPeer::DEL_INDEX => 9, ListParticipatedLastPeer::DEL_PREVIOUS_USR_UID => 10, ListParticipatedLastPeer::DEL_PREVIOUS_USR_USERNAME => 11, ListParticipatedLastPeer::DEL_PREVIOUS_USR_FIRSTNAME => 12, ListParticipatedLastPeer::DEL_PREVIOUS_USR_LASTNAME => 13, ListParticipatedLastPeer::DEL_CURRENT_USR_USERNAME => 14, ListParticipatedLastPeer::DEL_CURRENT_USR_FIRSTNAME => 15, ListParticipatedLastPeer::DEL_CURRENT_USR_LASTNAME => 16, ListParticipatedLastPeer::DEL_DELEGATE_DATE => 17, ListParticipatedLastPeer::DEL_INIT_DATE => 18, ListParticipatedLastPeer::DEL_DUE_DATE => 19, ListParticipatedLastPeer::DEL_PRIORITY => 20, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'USR_UID' => 1, 'TAS_UID' => 2, 'PRO_UID' => 3, 'APP_NUMBER' => 4, 'APP_TITLE' => 5, 'APP_PRO_TITLE' => 6, 'APP_TAS_TITLE' => 7, 'APP_STATUS' => 8, 'DEL_INDEX' => 9, 'DEL_PREVIOUS_USR_UID' => 10, 'DEL_PREVIOUS_USR_USERNAME' => 11, 'DEL_PREVIOUS_USR_FIRSTNAME' => 12, 'DEL_PREVIOUS_USR_LASTNAME' => 13, 'DEL_CURRENT_USR_USERNAME' => 14, 'DEL_CURRENT_USR_FIRSTNAME' => 15, 'DEL_CURRENT_USR_LASTNAME' => 16, 'DEL_DELEGATE_DATE' => 17, 'DEL_INIT_DATE' => 18, 'DEL_DUE_DATE' => 19, 'DEL_PRIORITY' => 20, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ) ); /** @@ -226,6 +238,8 @@ abstract class BaseListParticipatedLastPeer $criteria->addSelectColumn(ListParticipatedLastPeer::APP_TAS_TITLE); + $criteria->addSelectColumn(ListParticipatedLastPeer::APP_STATUS); + $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_INDEX); $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_PREVIOUS_USR_UID); @@ -236,6 +250,12 @@ abstract class BaseListParticipatedLastPeer $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_PREVIOUS_USR_LASTNAME); + $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_CURRENT_USR_USERNAME); + + $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_CURRENT_USR_FIRSTNAME); + + $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_CURRENT_USR_LASTNAME); + $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_DELEGATE_DATE); $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_INIT_DATE); diff --git a/workflow/engine/classes/model/om/BaseListPaused.php b/workflow/engine/classes/model/om/BaseListPaused.php index d5efaa523..9233bc9f9 100644 --- a/workflow/engine/classes/model/om/BaseListPaused.php +++ b/workflow/engine/classes/model/om/BaseListPaused.php @@ -99,6 +99,24 @@ abstract class BaseListPaused extends BaseObject implements Persistent */ protected $del_previous_usr_uid = ''; + /** + * The value for the del_previous_usr_username field. + * @var string + */ + protected $del_previous_usr_username = ''; + + /** + * The value for the del_previous_usr_firstname field. + * @var string + */ + protected $del_previous_usr_firstname = ''; + + /** + * The value for the del_previous_usr_lastname field. + * @var string + */ + protected $del_previous_usr_lastname = ''; + /** * The value for the del_current_usr_username field. * @var string @@ -329,6 +347,39 @@ abstract class BaseListPaused extends BaseObject implements Persistent return $this->del_previous_usr_uid; } + /** + * Get the [del_previous_usr_username] column value. + * + * @return string + */ + public function getDelPreviousUsrUsername() + { + + return $this->del_previous_usr_username; + } + + /** + * Get the [del_previous_usr_firstname] column value. + * + * @return string + */ + public function getDelPreviousUsrFirstname() + { + + return $this->del_previous_usr_firstname; + } + + /** + * Get the [del_previous_usr_lastname] column value. + * + * @return string + */ + public function getDelPreviousUsrLastname() + { + + return $this->del_previous_usr_lastname; + } + /** * Get the [del_current_usr_username] column value. * @@ -747,6 +798,72 @@ abstract class BaseListPaused extends BaseObject implements Persistent } // setDelPreviousUsrUid() + /** + * Set the value of [del_previous_usr_username] column. + * + * @param string $v new value + * @return void + */ + public function setDelPreviousUsrUsername($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_previous_usr_username !== $v || $v === '') { + $this->del_previous_usr_username = $v; + $this->modifiedColumns[] = ListPausedPeer::DEL_PREVIOUS_USR_USERNAME; + } + + } // setDelPreviousUsrUsername() + + /** + * Set the value of [del_previous_usr_firstname] column. + * + * @param string $v new value + * @return void + */ + public function setDelPreviousUsrFirstname($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_previous_usr_firstname !== $v || $v === '') { + $this->del_previous_usr_firstname = $v; + $this->modifiedColumns[] = ListPausedPeer::DEL_PREVIOUS_USR_FIRSTNAME; + } + + } // setDelPreviousUsrFirstname() + + /** + * Set the value of [del_previous_usr_lastname] column. + * + * @param string $v new value + * @return void + */ + public function setDelPreviousUsrLastname($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->del_previous_usr_lastname !== $v || $v === '') { + $this->del_previous_usr_lastname = $v; + $this->modifiedColumns[] = ListPausedPeer::DEL_PREVIOUS_USR_LASTNAME; + } + + } // setDelPreviousUsrLastname() + /** * Set the value of [del_current_usr_username] column. * @@ -963,26 +1080,32 @@ abstract class BaseListPaused extends BaseObject implements Persistent $this->del_previous_usr_uid = $rs->getString($startcol + 11); - $this->del_current_usr_username = $rs->getString($startcol + 12); + $this->del_previous_usr_username = $rs->getString($startcol + 12); - $this->del_current_usr_firstname = $rs->getString($startcol + 13); + $this->del_previous_usr_firstname = $rs->getString($startcol + 13); - $this->del_current_usr_lastname = $rs->getString($startcol + 14); + $this->del_previous_usr_lastname = $rs->getString($startcol + 14); - $this->del_delegate_date = $rs->getTimestamp($startcol + 15, null); + $this->del_current_usr_username = $rs->getString($startcol + 15); - $this->del_init_date = $rs->getTimestamp($startcol + 16, null); + $this->del_current_usr_firstname = $rs->getString($startcol + 16); - $this->del_due_date = $rs->getTimestamp($startcol + 17, null); + $this->del_current_usr_lastname = $rs->getString($startcol + 17); - $this->del_priority = $rs->getString($startcol + 18); + $this->del_delegate_date = $rs->getTimestamp($startcol + 18, null); + + $this->del_init_date = $rs->getTimestamp($startcol + 19, null); + + $this->del_due_date = $rs->getTimestamp($startcol + 20, null); + + $this->del_priority = $rs->getString($startcol + 21); $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 19; // 19 = ListPausedPeer::NUM_COLUMNS - ListPausedPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 22; // 22 = ListPausedPeer::NUM_COLUMNS - ListPausedPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating ListPaused object", $e); @@ -1223,24 +1346,33 @@ abstract class BaseListPaused extends BaseObject implements Persistent return $this->getDelPreviousUsrUid(); break; case 12: - return $this->getDelCurrentUsrUsername(); + return $this->getDelPreviousUsrUsername(); break; case 13: - return $this->getDelCurrentUsrFirstname(); + return $this->getDelPreviousUsrFirstname(); break; case 14: - return $this->getDelCurrentUsrLastname(); + return $this->getDelPreviousUsrLastname(); break; case 15: - return $this->getDelDelegateDate(); + return $this->getDelCurrentUsrUsername(); break; case 16: - return $this->getDelInitDate(); + return $this->getDelCurrentUsrFirstname(); break; case 17: - return $this->getDelDueDate(); + return $this->getDelCurrentUsrLastname(); break; case 18: + return $this->getDelDelegateDate(); + break; + case 19: + return $this->getDelInitDate(); + break; + case 20: + return $this->getDelDueDate(); + break; + case 21: return $this->getDelPriority(); break; default: @@ -1275,13 +1407,16 @@ abstract class BaseListPaused extends BaseObject implements Persistent $keys[9] => $this->getAppPausedDate(), $keys[10] => $this->getAppRestartDate(), $keys[11] => $this->getDelPreviousUsrUid(), - $keys[12] => $this->getDelCurrentUsrUsername(), - $keys[13] => $this->getDelCurrentUsrFirstname(), - $keys[14] => $this->getDelCurrentUsrLastname(), - $keys[15] => $this->getDelDelegateDate(), - $keys[16] => $this->getDelInitDate(), - $keys[17] => $this->getDelDueDate(), - $keys[18] => $this->getDelPriority(), + $keys[12] => $this->getDelPreviousUsrUsername(), + $keys[13] => $this->getDelPreviousUsrFirstname(), + $keys[14] => $this->getDelPreviousUsrLastname(), + $keys[15] => $this->getDelCurrentUsrUsername(), + $keys[16] => $this->getDelCurrentUsrFirstname(), + $keys[17] => $this->getDelCurrentUsrLastname(), + $keys[18] => $this->getDelDelegateDate(), + $keys[19] => $this->getDelInitDate(), + $keys[20] => $this->getDelDueDate(), + $keys[21] => $this->getDelPriority(), ); return $result; } @@ -1350,24 +1485,33 @@ abstract class BaseListPaused extends BaseObject implements Persistent $this->setDelPreviousUsrUid($value); break; case 12: - $this->setDelCurrentUsrUsername($value); + $this->setDelPreviousUsrUsername($value); break; case 13: - $this->setDelCurrentUsrFirstname($value); + $this->setDelPreviousUsrFirstname($value); break; case 14: - $this->setDelCurrentUsrLastname($value); + $this->setDelPreviousUsrLastname($value); break; case 15: - $this->setDelDelegateDate($value); + $this->setDelCurrentUsrUsername($value); break; case 16: - $this->setDelInitDate($value); + $this->setDelCurrentUsrFirstname($value); break; case 17: - $this->setDelDueDate($value); + $this->setDelCurrentUsrLastname($value); break; case 18: + $this->setDelDelegateDate($value); + break; + case 19: + $this->setDelInitDate($value); + break; + case 20: + $this->setDelDueDate($value); + break; + case 21: $this->setDelPriority($value); break; } // switch() @@ -1442,31 +1586,43 @@ abstract class BaseListPaused extends BaseObject implements Persistent } if (array_key_exists($keys[12], $arr)) { - $this->setDelCurrentUsrUsername($arr[$keys[12]]); + $this->setDelPreviousUsrUsername($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { - $this->setDelCurrentUsrFirstname($arr[$keys[13]]); + $this->setDelPreviousUsrFirstname($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { - $this->setDelCurrentUsrLastname($arr[$keys[14]]); + $this->setDelPreviousUsrLastname($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { - $this->setDelDelegateDate($arr[$keys[15]]); + $this->setDelCurrentUsrUsername($arr[$keys[15]]); } if (array_key_exists($keys[16], $arr)) { - $this->setDelInitDate($arr[$keys[16]]); + $this->setDelCurrentUsrFirstname($arr[$keys[16]]); } if (array_key_exists($keys[17], $arr)) { - $this->setDelDueDate($arr[$keys[17]]); + $this->setDelCurrentUsrLastname($arr[$keys[17]]); } if (array_key_exists($keys[18], $arr)) { - $this->setDelPriority($arr[$keys[18]]); + $this->setDelDelegateDate($arr[$keys[18]]); + } + + if (array_key_exists($keys[19], $arr)) { + $this->setDelInitDate($arr[$keys[19]]); + } + + if (array_key_exists($keys[20], $arr)) { + $this->setDelDueDate($arr[$keys[20]]); + } + + if (array_key_exists($keys[21], $arr)) { + $this->setDelPriority($arr[$keys[21]]); } } @@ -1528,6 +1684,18 @@ abstract class BaseListPaused extends BaseObject implements Persistent $criteria->add(ListPausedPeer::DEL_PREVIOUS_USR_UID, $this->del_previous_usr_uid); } + if ($this->isColumnModified(ListPausedPeer::DEL_PREVIOUS_USR_USERNAME)) { + $criteria->add(ListPausedPeer::DEL_PREVIOUS_USR_USERNAME, $this->del_previous_usr_username); + } + + if ($this->isColumnModified(ListPausedPeer::DEL_PREVIOUS_USR_FIRSTNAME)) { + $criteria->add(ListPausedPeer::DEL_PREVIOUS_USR_FIRSTNAME, $this->del_previous_usr_firstname); + } + + if ($this->isColumnModified(ListPausedPeer::DEL_PREVIOUS_USR_LASTNAME)) { + $criteria->add(ListPausedPeer::DEL_PREVIOUS_USR_LASTNAME, $this->del_previous_usr_lastname); + } + if ($this->isColumnModified(ListPausedPeer::DEL_CURRENT_USR_USERNAME)) { $criteria->add(ListPausedPeer::DEL_CURRENT_USR_USERNAME, $this->del_current_usr_username); } @@ -1642,6 +1810,12 @@ abstract class BaseListPaused extends BaseObject implements Persistent $copyObj->setDelPreviousUsrUid($this->del_previous_usr_uid); + $copyObj->setDelPreviousUsrUsername($this->del_previous_usr_username); + + $copyObj->setDelPreviousUsrFirstname($this->del_previous_usr_firstname); + + $copyObj->setDelPreviousUsrLastname($this->del_previous_usr_lastname); + $copyObj->setDelCurrentUsrUsername($this->del_current_usr_username); $copyObj->setDelCurrentUsrFirstname($this->del_current_usr_firstname); diff --git a/workflow/engine/classes/model/om/BaseListPausedPeer.php b/workflow/engine/classes/model/om/BaseListPausedPeer.php index 56aa8dbd1..16d0ec452 100644 --- a/workflow/engine/classes/model/om/BaseListPausedPeer.php +++ b/workflow/engine/classes/model/om/BaseListPausedPeer.php @@ -25,7 +25,7 @@ abstract class BaseListPausedPeer const CLASS_DEFAULT = 'classes.model.ListPaused'; /** The total number of columns. */ - const NUM_COLUMNS = 19; + const NUM_COLUMNS = 22; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -67,6 +67,15 @@ abstract class BaseListPausedPeer /** the column name for the DEL_PREVIOUS_USR_UID field */ const DEL_PREVIOUS_USR_UID = 'LIST_PAUSED.DEL_PREVIOUS_USR_UID'; + /** the column name for the DEL_PREVIOUS_USR_USERNAME field */ + const DEL_PREVIOUS_USR_USERNAME = 'LIST_PAUSED.DEL_PREVIOUS_USR_USERNAME'; + + /** the column name for the DEL_PREVIOUS_USR_FIRSTNAME field */ + const DEL_PREVIOUS_USR_FIRSTNAME = 'LIST_PAUSED.DEL_PREVIOUS_USR_FIRSTNAME'; + + /** the column name for the DEL_PREVIOUS_USR_LASTNAME field */ + const DEL_PREVIOUS_USR_LASTNAME = 'LIST_PAUSED.DEL_PREVIOUS_USR_LASTNAME'; + /** the column name for the DEL_CURRENT_USR_USERNAME field */ const DEL_CURRENT_USR_USERNAME = 'LIST_PAUSED.DEL_CURRENT_USR_USERNAME'; @@ -99,10 +108,10 @@ abstract class BaseListPausedPeer * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('AppUid', 'DelIndex', 'UsrUid', 'TasUid', 'ProUid', 'AppNumber', 'AppTitle', 'AppProTitle', 'AppTasTitle', 'AppPausedDate', 'AppRestartDate', 'DelPreviousUsrUid', 'DelCurrentUsrUsername', 'DelCurrentUsrFirstname', 'DelCurrentUsrLastname', 'DelDelegateDate', 'DelInitDate', 'DelDueDate', 'DelPriority', ), - BasePeer::TYPE_COLNAME => array (ListPausedPeer::APP_UID, ListPausedPeer::DEL_INDEX, ListPausedPeer::USR_UID, ListPausedPeer::TAS_UID, ListPausedPeer::PRO_UID, ListPausedPeer::APP_NUMBER, ListPausedPeer::APP_TITLE, ListPausedPeer::APP_PRO_TITLE, ListPausedPeer::APP_TAS_TITLE, ListPausedPeer::APP_PAUSED_DATE, ListPausedPeer::APP_RESTART_DATE, ListPausedPeer::DEL_PREVIOUS_USR_UID, ListPausedPeer::DEL_CURRENT_USR_USERNAME, ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME, ListPausedPeer::DEL_CURRENT_USR_LASTNAME, ListPausedPeer::DEL_DELEGATE_DATE, ListPausedPeer::DEL_INIT_DATE, ListPausedPeer::DEL_DUE_DATE, ListPausedPeer::DEL_PRIORITY, ), - BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'DEL_INDEX', 'USR_UID', 'TAS_UID', 'PRO_UID', 'APP_NUMBER', 'APP_TITLE', 'APP_PRO_TITLE', 'APP_TAS_TITLE', 'APP_PAUSED_DATE', 'APP_RESTART_DATE', 'DEL_PREVIOUS_USR_UID', 'DEL_CURRENT_USR_USERNAME', 'DEL_CURRENT_USR_FIRSTNAME', 'DEL_CURRENT_USR_LASTNAME', 'DEL_DELEGATE_DATE', 'DEL_INIT_DATE', 'DEL_DUE_DATE', 'DEL_PRIORITY', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) + BasePeer::TYPE_PHPNAME => array ('AppUid', 'DelIndex', 'UsrUid', 'TasUid', 'ProUid', 'AppNumber', 'AppTitle', 'AppProTitle', 'AppTasTitle', 'AppPausedDate', 'AppRestartDate', 'DelPreviousUsrUid', 'DelPreviousUsrUsername', 'DelPreviousUsrFirstname', 'DelPreviousUsrLastname', 'DelCurrentUsrUsername', 'DelCurrentUsrFirstname', 'DelCurrentUsrLastname', 'DelDelegateDate', 'DelInitDate', 'DelDueDate', 'DelPriority', ), + BasePeer::TYPE_COLNAME => array (ListPausedPeer::APP_UID, ListPausedPeer::DEL_INDEX, ListPausedPeer::USR_UID, ListPausedPeer::TAS_UID, ListPausedPeer::PRO_UID, ListPausedPeer::APP_NUMBER, ListPausedPeer::APP_TITLE, ListPausedPeer::APP_PRO_TITLE, ListPausedPeer::APP_TAS_TITLE, ListPausedPeer::APP_PAUSED_DATE, ListPausedPeer::APP_RESTART_DATE, ListPausedPeer::DEL_PREVIOUS_USR_UID, ListPausedPeer::DEL_PREVIOUS_USR_USERNAME, ListPausedPeer::DEL_PREVIOUS_USR_FIRSTNAME, ListPausedPeer::DEL_PREVIOUS_USR_LASTNAME, ListPausedPeer::DEL_CURRENT_USR_USERNAME, ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME, ListPausedPeer::DEL_CURRENT_USR_LASTNAME, ListPausedPeer::DEL_DELEGATE_DATE, ListPausedPeer::DEL_INIT_DATE, ListPausedPeer::DEL_DUE_DATE, ListPausedPeer::DEL_PRIORITY, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'DEL_INDEX', 'USR_UID', 'TAS_UID', 'PRO_UID', 'APP_NUMBER', 'APP_TITLE', 'APP_PRO_TITLE', 'APP_TAS_TITLE', 'APP_PAUSED_DATE', 'APP_RESTART_DATE', 'DEL_PREVIOUS_USR_UID', 'DEL_PREVIOUS_USR_USERNAME', 'DEL_PREVIOUS_USR_FIRSTNAME', 'DEL_PREVIOUS_USR_LASTNAME', 'DEL_CURRENT_USR_USERNAME', 'DEL_CURRENT_USR_FIRSTNAME', 'DEL_CURRENT_USR_LASTNAME', 'DEL_DELEGATE_DATE', 'DEL_INIT_DATE', 'DEL_DUE_DATE', 'DEL_PRIORITY', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ) ); /** @@ -112,10 +121,10 @@ abstract class BaseListPausedPeer * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'DelIndex' => 1, 'UsrUid' => 2, 'TasUid' => 3, 'ProUid' => 4, 'AppNumber' => 5, 'AppTitle' => 6, 'AppProTitle' => 7, 'AppTasTitle' => 8, 'AppPausedDate' => 9, 'AppRestartDate' => 10, 'DelPreviousUsrUid' => 11, 'DelCurrentUsrUsername' => 12, 'DelCurrentUsrFirstname' => 13, 'DelCurrentUsrLastname' => 14, 'DelDelegateDate' => 15, 'DelInitDate' => 16, 'DelDueDate' => 17, 'DelPriority' => 18, ), - BasePeer::TYPE_COLNAME => array (ListPausedPeer::APP_UID => 0, ListPausedPeer::DEL_INDEX => 1, ListPausedPeer::USR_UID => 2, ListPausedPeer::TAS_UID => 3, ListPausedPeer::PRO_UID => 4, ListPausedPeer::APP_NUMBER => 5, ListPausedPeer::APP_TITLE => 6, ListPausedPeer::APP_PRO_TITLE => 7, ListPausedPeer::APP_TAS_TITLE => 8, ListPausedPeer::APP_PAUSED_DATE => 9, ListPausedPeer::APP_RESTART_DATE => 10, ListPausedPeer::DEL_PREVIOUS_USR_UID => 11, ListPausedPeer::DEL_CURRENT_USR_USERNAME => 12, ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME => 13, ListPausedPeer::DEL_CURRENT_USR_LASTNAME => 14, ListPausedPeer::DEL_DELEGATE_DATE => 15, ListPausedPeer::DEL_INIT_DATE => 16, ListPausedPeer::DEL_DUE_DATE => 17, ListPausedPeer::DEL_PRIORITY => 18, ), - BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'DEL_INDEX' => 1, 'USR_UID' => 2, 'TAS_UID' => 3, 'PRO_UID' => 4, 'APP_NUMBER' => 5, 'APP_TITLE' => 6, 'APP_PRO_TITLE' => 7, 'APP_TAS_TITLE' => 8, 'APP_PAUSED_DATE' => 9, 'APP_RESTART_DATE' => 10, 'DEL_PREVIOUS_USR_UID' => 11, 'DEL_CURRENT_USR_USERNAME' => 12, 'DEL_CURRENT_USR_FIRSTNAME' => 13, 'DEL_CURRENT_USR_LASTNAME' => 14, 'DEL_DELEGATE_DATE' => 15, 'DEL_INIT_DATE' => 16, 'DEL_DUE_DATE' => 17, 'DEL_PRIORITY' => 18, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) + BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'DelIndex' => 1, 'UsrUid' => 2, 'TasUid' => 3, 'ProUid' => 4, 'AppNumber' => 5, 'AppTitle' => 6, 'AppProTitle' => 7, 'AppTasTitle' => 8, 'AppPausedDate' => 9, 'AppRestartDate' => 10, 'DelPreviousUsrUid' => 11, 'DelPreviousUsrUsername' => 12, 'DelPreviousUsrFirstname' => 13, 'DelPreviousUsrLastname' => 14, 'DelCurrentUsrUsername' => 15, 'DelCurrentUsrFirstname' => 16, 'DelCurrentUsrLastname' => 17, 'DelDelegateDate' => 18, 'DelInitDate' => 19, 'DelDueDate' => 20, 'DelPriority' => 21, ), + BasePeer::TYPE_COLNAME => array (ListPausedPeer::APP_UID => 0, ListPausedPeer::DEL_INDEX => 1, ListPausedPeer::USR_UID => 2, ListPausedPeer::TAS_UID => 3, ListPausedPeer::PRO_UID => 4, ListPausedPeer::APP_NUMBER => 5, ListPausedPeer::APP_TITLE => 6, ListPausedPeer::APP_PRO_TITLE => 7, ListPausedPeer::APP_TAS_TITLE => 8, ListPausedPeer::APP_PAUSED_DATE => 9, ListPausedPeer::APP_RESTART_DATE => 10, ListPausedPeer::DEL_PREVIOUS_USR_UID => 11, ListPausedPeer::DEL_PREVIOUS_USR_USERNAME => 12, ListPausedPeer::DEL_PREVIOUS_USR_FIRSTNAME => 13, ListPausedPeer::DEL_PREVIOUS_USR_LASTNAME => 14, ListPausedPeer::DEL_CURRENT_USR_USERNAME => 15, ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME => 16, ListPausedPeer::DEL_CURRENT_USR_LASTNAME => 17, ListPausedPeer::DEL_DELEGATE_DATE => 18, ListPausedPeer::DEL_INIT_DATE => 19, ListPausedPeer::DEL_DUE_DATE => 20, ListPausedPeer::DEL_PRIORITY => 21, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'DEL_INDEX' => 1, 'USR_UID' => 2, 'TAS_UID' => 3, 'PRO_UID' => 4, 'APP_NUMBER' => 5, 'APP_TITLE' => 6, 'APP_PRO_TITLE' => 7, 'APP_TAS_TITLE' => 8, 'APP_PAUSED_DATE' => 9, 'APP_RESTART_DATE' => 10, 'DEL_PREVIOUS_USR_UID' => 11, 'DEL_PREVIOUS_USR_USERNAME' => 12, 'DEL_PREVIOUS_USR_FIRSTNAME' => 13, 'DEL_PREVIOUS_USR_LASTNAME' => 14, 'DEL_CURRENT_USR_USERNAME' => 15, 'DEL_CURRENT_USR_FIRSTNAME' => 16, 'DEL_CURRENT_USR_LASTNAME' => 17, 'DEL_DELEGATE_DATE' => 18, 'DEL_INIT_DATE' => 19, 'DEL_DUE_DATE' => 20, 'DEL_PRIORITY' => 21, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ) ); /** @@ -240,6 +249,12 @@ abstract class BaseListPausedPeer $criteria->addSelectColumn(ListPausedPeer::DEL_PREVIOUS_USR_UID); + $criteria->addSelectColumn(ListPausedPeer::DEL_PREVIOUS_USR_USERNAME); + + $criteria->addSelectColumn(ListPausedPeer::DEL_PREVIOUS_USR_FIRSTNAME); + + $criteria->addSelectColumn(ListPausedPeer::DEL_PREVIOUS_USR_LASTNAME); + $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_USERNAME); $criteria->addSelectColumn(ListPausedPeer::DEL_CURRENT_USR_FIRSTNAME); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 5442acdf7..3939a35da 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -4014,11 +4014,15 @@ + + + + @@ -4094,6 +4098,9 @@ + + + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 11bf2e19f..27855e339 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2262,11 +2262,15 @@ CREATE TABLE `LIST_PARTICIPATED_LAST` `APP_TITLE` VARCHAR(255) default '' NOT NULL, `APP_PRO_TITLE` VARCHAR(255) default '' NOT NULL, `APP_TAS_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_STATUS` VARCHAR(20) default '0' NOT NULL, `DEL_INDEX` INTEGER default 0 NOT NULL, `DEL_PREVIOUS_USR_UID` VARCHAR(32) default '', `DEL_PREVIOUS_USR_USERNAME` VARCHAR(100) default '', `DEL_PREVIOUS_USR_FIRSTNAME` VARCHAR(50) default '', `DEL_PREVIOUS_USR_LASTNAME` VARCHAR(50) default '', + `DEL_CURRENT_USR_USERNAME` VARCHAR(100) default '', + `DEL_CURRENT_USR_FIRSTNAME` VARCHAR(50) default '', + `DEL_CURRENT_USR_LASTNAME` VARCHAR(50) default '', `DEL_DELEGATE_DATE` DATETIME NOT NULL, `DEL_INIT_DATE` DATETIME, `DEL_DUE_DATE` DATETIME, @@ -2320,6 +2324,9 @@ CREATE TABLE `LIST_PAUSED` `APP_PAUSED_DATE` DATETIME NOT NULL, `APP_RESTART_DATE` DATETIME NOT NULL, `DEL_PREVIOUS_USR_UID` VARCHAR(32) default '', + `DEL_PREVIOUS_USR_USERNAME` VARCHAR(100) default '', + `DEL_PREVIOUS_USR_FIRSTNAME` VARCHAR(50) default '', + `DEL_PREVIOUS_USR_LASTNAME` VARCHAR(50) default '', `DEL_CURRENT_USR_USERNAME` VARCHAR(100) default '', `DEL_CURRENT_USR_FIRSTNAME` VARCHAR(50) default '', `DEL_CURRENT_USR_LASTNAME` VARCHAR(50) default '', diff --git a/workflow/engine/methods/cases/casesListExtJs.php b/workflow/engine/methods/cases/casesListExtJs.php index 12de433a2..7c4868c5c 100755 --- a/workflow/engine/methods/cases/casesListExtJs.php +++ b/workflow/engine/methods/cases/casesListExtJs.php @@ -3,12 +3,73 @@ unset($_SESSION['APPLICATION']); //get the action from GET or POST, default is todo $action = isset( $_GET['action'] ) ? $_GET['action'] : (isset( $_POST['action'] ) ? $_POST['action'] : 'todo'); +$clientId = 'x-pm-local-client'; //fix a previous inconsistency -if ($action == 'selfservice') { - $action = 'unassigned'; - //if ( $action == 'sent' ) $action = 'participated'; + +$urlProxy = '/api/1.0/' . SYS_SYS . '/lists/'; +$methodProxy = 'GET'; +switch ($action) { + case 'todo': + case 'draft': + $urlProxy .= 'inbox'; + break; + case 'sent': + $urlProxy .= 'participated'; + break; + case 'search': + case 'participated-history': + $urlProxy = 'proxyCasesList'; + break; + case 'paused': + $urlProxy .= 'paused'; + break; + case 'cancel': + case 'canceled': + $urlProxy .= 'canceled'; + break; + case 'completed': + $urlProxy .= 'completed'; + break; + case 'myinbox': + case 'my-inbox': + $urlProxy .= 'my-inbox'; + break; + case 'selfservice': + $urlProxy = 'proxyCasesList'; + $action = 'unassigned'; + break; } +$client = getClientCredentials($clientId); +$authCode = getAuthorizationCode($client); +$debug = false; //System::isDebugMode(); + +$loader = Maveriks\Util\ClassLoader::getInstance(); +$loader->add(PATH_TRUNK . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2"); + +$request = array( + 'grant_type' => 'authorization_code', + 'code' => $authCode +); +$server = array( + 'REQUEST_METHOD' => 'POST' +); +$headers = array( + "PHP_AUTH_USER" => $client['CLIENT_ID'], + "PHP_AUTH_PW" => $client['CLIENT_SECRET'], + "Content-Type" => "multipart/form-data;", + "Authorization" => "Basic " . base64_encode($client['CLIENT_ID'] . ":" . $client['CLIENT_SECRET']) +); + +$request = new \OAuth2\Request(array(), $request, array(), array(), array(), $server, null, $headers); +$oauthServer = new \ProcessMaker\Services\OAuth2\Server(); +$response = $oauthServer->postToken($request, true); +$clientToken = $response->getParameters(); +$clientToken["client_id"] = $client['CLIENT_ID']; +$clientToken["client_secret"] = $client['CLIENT_SECRET']; + + + G::LoadClass("BasePeer"); G::LoadClass("configuration"); //require_once ("classes/model/Fields.php"); @@ -120,6 +181,9 @@ $oHeadPublisher->assign( 'columns', $columns ); //sending the columns to display $oHeadPublisher->assign( 'readerFields', $readerFields ); //sending the fields to get from proxy $oHeadPublisher->assign( 'reassignColumns', $reassignColumns ); //sending the columns to display in grid $oHeadPublisher->assign( 'action', $action ); //sending the action to make +$oHeadPublisher->assign( 'urlProxy', $urlProxy ); //sending the urlProxy to make +$oHeadPublisher->assign( 'methodProxy', $methodProxy ); //sending the urlProxy to make +$oHeadPublisher->assign( 'credentials', $clientToken ); //sending the SYS_SYS to make $oHeadPublisher->assign( 'PMDateFormat', $dateFormat ); //sending the fields to get from proxy $oHeadPublisher->assign( 'statusValues', $status ); //Sending the listing of status $oHeadPublisher->assign( 'processValues', $processes ); //Sending the listing of processes @@ -429,3 +493,39 @@ function getAdditionalFields($action, $confCasesList = array()) return $arrayConfig; } + +function getClientCredentials($clientId) +{ + $oauthQuery = new ProcessMaker\Services\OAuth2\PmPdo(getDsn()); + return $oauthQuery->getClientDetails($clientId); +} + +function getDsn() +{ + list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, ''); + $port = empty($port) ? '' : ";port=$port"; + $dsn = DB_ADAPTER.':host='.$host.';dbname='.DB_NAME.$port; + + return array('dsn' => $dsn, 'username' => DB_USER, 'password' => DB_PASS); +} + + +function getAuthorizationCode($client) +{ + \ProcessMaker\Services\OAuth2\Server::setDatabaseSource(getDsn()); + \ProcessMaker\Services\OAuth2\Server::setPmClientId($client['CLIENT_ID']); + + $oauthServer = new \ProcessMaker\Services\OAuth2\Server(); + $userId = $_SESSION['USER_LOGGED']; + $authorize = true; + $_GET = array_merge($_GET, array( + 'response_type' => 'code', + 'client_id' => $client['CLIENT_ID'], + 'scope' => implode(' ', $oauthServer->getScope()) + )); + + $response = $oauthServer->postAuthorize($authorize, $userId, true); + $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40); + + return $code; +} \ No newline at end of file diff --git a/workflow/engine/methods/setup/environmentSettingsAjax.php b/workflow/engine/methods/setup/environmentSettingsAjax.php index e03a107b0..538248d40 100755 --- a/workflow/engine/methods/setup/environmentSettingsAjax.php +++ b/workflow/engine/methods/setup/environmentSettingsAjax.php @@ -36,6 +36,9 @@ switch ($request) { case "save": $conf = new Configurations(); $config = $conf->getConfiguration("ENVIRONMENT_SETTINGS", "" ); + if (is_numeric($config)) { + $config = array(); + } $config['format'] = $_POST["userFormat"]; $config['dateFormat'] = $_POST["dateFormat"]; $config['startCaseHideProcessInf'] = ((isset( $_POST["hideProcessInf"] )) ? true : false); @@ -43,6 +46,7 @@ switch ($request) { $config['casesListRowNumber'] = intval( $_POST["casesListRowNumber"] ); $config['casesListRefreshTime'] = intval( $_POST["txtCasesRefreshTime"]); + $conf->aConfig = $config; $conf->saveConfig( "ENVIRONMENT_SETTINGS", "" ); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php b/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php index 2ba4c70db..007e09970 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php @@ -44,6 +44,8 @@ class Lists { $filters["sort"] = isset( $dataList["sort"] ) ? $dataList["sort"] : ""; $filters["dir"] = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC"; + $filters["action"] = isset( $dataList["action"] ) ? $dataList["action"] : ""; + // Select list switch ($listName) { case 'inbox': @@ -134,7 +136,30 @@ class Lists { $result = $list->loadList($userUid, $filters); if (!empty($result)) { foreach ($result as &$value) { - $value = array_change_key_case($value, CASE_LOWER); + if (isset($value['DEL_PREVIOUS_USR_UID'])) { + $value['PREVIOUS_USR_UID'] = $value['DEL_PREVIOUS_USR_UID']; + $value['PREVIOUS_USR_USERNAME'] = $value['DEL_PREVIOUS_USR_USERNAME']; + $value['PREVIOUS_USR_FIRSTNAME'] = $value['DEL_PREVIOUS_USR_FIRSTNAME']; + $value['PREVIOUS_USR_LASTNAME'] = $value['DEL_PREVIOUS_USR_LASTNAME']; + } + if (isset($value['DEL_DUE_DATE'])) { + $value['DEL_TASK_DUE_DATE'] = $value['DEL_DUE_DATE']; + } + if (isset($value['APP_PAUSED_DATE'])) { + $value['APP_UPDATE_DATE'] = $value['APP_PAUSED_DATE']; + } + if (isset($value['DEL_CURRENT_USR_USERNAME'])) { + $value['USR_USERNAME'] = $value['DEL_CURRENT_USR_USERNAME']; + $value['USR_FIRSTNAME'] = $value['DEL_CURRENT_USR_FIRSTNAME']; + $value['USR_LASTNAME'] = $value['DEL_CURRENT_USR_LASTNAME']; + $value['APP_UPDATE_DATE'] = $value['DEL_DELEGATE_DATE']; + } + if (isset($value['APP_STATUS'])) { + $value['APP_STATUS_LABEL'] = G::LoadTranslation( "ID_{$value['APP_STATUS']}" ); + } + + + //$value = array_change_key_case($value, CASE_LOWER); } } @@ -152,6 +177,7 @@ class Lists { $filtersData['date_to'] = $filters["dateTo"]; $response['filters'] = $filtersData; $response['data'] = $result; + $response['totalCount'] = $list->countTotal($userUid, $filters); } else { $response = $result; } diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Lists.php b/workflow/engine/src/ProcessMaker/Services/Api/Lists.php index d0e021153..3e32cb60c 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Lists.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Lists.php @@ -50,7 +50,8 @@ class Lists extends Api $search = '', $filter = '', $date_from = '', - $date_to = '' + $date_to = '', + $action = '' ) { try { $dataList['userId'] = $this->getUserId(); @@ -69,6 +70,8 @@ class Lists extends Api $dataList['dateFrom'] = $date_from; $dataList['dateTo'] = $date_to; + $dataList['action'] = $action; + $lists = new \ProcessMaker\BusinessModel\Lists(); $response = $lists->getList('inbox', $dataList); return $response; diff --git a/workflow/engine/templates/cases/casesList.js b/workflow/engine/templates/cases/casesList.js index a40c81fa3..dc4d8e5bd 100755 --- a/workflow/engine/templates/cases/casesList.js +++ b/workflow/engine/templates/cases/casesList.js @@ -24,6 +24,7 @@ var grid; var textJump; var ids = ''; var winReassignInCasesList; +var totalRowsGrid = ''; function formatAMPM(date, initVal, calendarDate) { @@ -740,7 +741,12 @@ Ext.onReady ( function() { // Create HttpProxy instance, all CRUD requests will be directed to single proxy url. var proxyCasesList = new Ext.data.HttpProxy({ api: { - read : 'proxyCasesList' + read : urlProxy + }, + method: 'GET', + headers: { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + credentials.access_token } }); @@ -799,12 +805,12 @@ Ext.onReady ( function() { autoSave: true, // <-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton. sortInfo:{field: 'APP_CACHE_VIEW.APP_NUMBER', direction: "DESC"}, listeners: { - load: function(response){ - //console.log(response.reader.jsonData); - if (response.reader.jsonData.result === false) { + load: function(response){ + if (response.reader.jsonData.result === false) { PMExt.notify('ERROR', response.reader.jsonData.message); //PMExt.error } + //console.log(response.reader.jsonData); }, exception: function(dp, type, action, options, response, arg) { responseObject = Ext.util.JSON.decode(response.responseText); From 40d841820e448beceac2d304812595507382292f Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Fri, 6 Feb 2015 15:48:01 -0400 Subject: [PATCH 007/155] Correccion de conflicto --- workflow/engine/data/mysql/schema.sql | 176 ++++++++------------------ 1 file changed, 53 insertions(+), 123 deletions(-) diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 27855e339..d764fc14e 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -486,7 +486,7 @@ CREATE TABLE `ROUTE` `ROU_PARENT` VARCHAR(32) default '0' NOT NULL, `PRO_UID` VARCHAR(32) default '' NOT NULL, `TAS_UID` VARCHAR(32) default '' NOT NULL, - `ROU_NEXT_TASK` VARCHAR(32) default '0' NOT NULL, +`ROU_NEXT_TASK` VARCHAR(32) default '0' NOT NULL, `ROU_CASE` INTEGER default 0 NOT NULL, `ROU_TYPE` VARCHAR(25) default 'SEQUENTIAL' NOT NULL, `ROU_DEFAULT` INTEGER default 0 NOT NULL, @@ -1207,7 +1207,7 @@ CREATE TABLE `APP_HISTORY` `PRO_UID` VARCHAR(32) default '' NOT NULL, `TAS_UID` VARCHAR(32) default '' NOT NULL, `DYN_UID` VARCHAR(32) default '' NOT NULL, - `OBJ_TYPE` VARCHAR(20) default 'DYNAFORM' NOT NULL, + `OBJ_TYPE` VARCHAR(20) default 'DYNAFORM' NOT NULL, `USR_UID` VARCHAR(32) default '' NOT NULL, `APP_STATUS` VARCHAR(100) default '' NOT NULL, `HISTORY_DATE` DATETIME, @@ -1907,6 +1907,7 @@ CREATE TABLE `BPMN_FLOW` `FLO_X2` INTEGER default 0 NOT NULL, `FLO_Y2` INTEGER default 0 NOT NULL, `FLO_STATE` MEDIUMTEXT, + `FLO_POSITION` INTEGER default 0 NOT NULL, PRIMARY KEY (`FLO_UID`), KEY `BPMN_FLOW_I_1`(`FLO_UID`), KEY `BPMN_FLOW_I_2`(`PRJ_UID`), @@ -2262,15 +2263,11 @@ CREATE TABLE `LIST_PARTICIPATED_LAST` `APP_TITLE` VARCHAR(255) default '' NOT NULL, `APP_PRO_TITLE` VARCHAR(255) default '' NOT NULL, `APP_TAS_TITLE` VARCHAR(255) default '' NOT NULL, - `APP_STATUS` VARCHAR(20) default '0' NOT NULL, `DEL_INDEX` INTEGER default 0 NOT NULL, `DEL_PREVIOUS_USR_UID` VARCHAR(32) default '', `DEL_PREVIOUS_USR_USERNAME` VARCHAR(100) default '', `DEL_PREVIOUS_USR_FIRSTNAME` VARCHAR(50) default '', `DEL_PREVIOUS_USR_LASTNAME` VARCHAR(50) default '', - `DEL_CURRENT_USR_USERNAME` VARCHAR(100) default '', - `DEL_CURRENT_USR_FIRSTNAME` VARCHAR(50) default '', - `DEL_CURRENT_USR_LASTNAME` VARCHAR(50) default '', `DEL_DELEGATE_DATE` DATETIME NOT NULL, `DEL_INIT_DATE` DATETIME, `DEL_DUE_DATE` DATETIME, @@ -2304,70 +2301,6 @@ CREATE TABLE `LIST_COMPLETED` PRIMARY KEY (`APP_UID`) )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Completed list'; #----------------------------------------------------------------------------- -#-- LIST_PAUSED -#----------------------------------------------------------------------------- - -DROP TABLE IF EXISTS `LIST_PAUSED`; - - -CREATE TABLE `LIST_PAUSED` -( - `APP_UID` VARCHAR(32) default '' NOT NULL, - `DEL_INDEX` INTEGER default 0 NOT NULL, - `USR_UID` VARCHAR(32) default '' NOT NULL, - `TAS_UID` VARCHAR(32) default '' NOT NULL, - `PRO_UID` VARCHAR(32) default '' NOT NULL, - `APP_NUMBER` INTEGER default 0 NOT NULL, - `APP_TITLE` VARCHAR(255) default '' NOT NULL, - `APP_PRO_TITLE` VARCHAR(255) default '' NOT NULL, - `APP_TAS_TITLE` VARCHAR(255) default '' NOT NULL, - `APP_PAUSED_DATE` DATETIME NOT NULL, - `APP_RESTART_DATE` DATETIME NOT NULL, - `DEL_PREVIOUS_USR_UID` VARCHAR(32) default '', - `DEL_PREVIOUS_USR_USERNAME` VARCHAR(100) default '', - `DEL_PREVIOUS_USR_FIRSTNAME` VARCHAR(50) default '', - `DEL_PREVIOUS_USR_LASTNAME` VARCHAR(50) default '', - `DEL_CURRENT_USR_USERNAME` VARCHAR(100) default '', - `DEL_CURRENT_USR_FIRSTNAME` VARCHAR(50) default '', - `DEL_CURRENT_USR_LASTNAME` VARCHAR(50) default '', - `DEL_DELEGATE_DATE` DATETIME NOT NULL, - `DEL_INIT_DATE` DATETIME, - `DEL_DUE_DATE` DATETIME, - `DEL_PRIORITY` VARCHAR(32) default '3' NOT NULL, - PRIMARY KEY (`APP_UID`,`DEL_INDEX`), - KEY `indexPausedUser`(`USR_UID`) -)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Paused list'; -#----------------------------------------------------------------------------- -#-- LIST_CANCELED -#----------------------------------------------------------------------------- - -DROP TABLE IF EXISTS `LIST_CANCELED`; - - -CREATE TABLE `LIST_CANCELED` -( - `APP_UID` VARCHAR(32) default '' NOT NULL, - `USR_UID` VARCHAR(32) default '' NOT NULL, - `TAS_UID` VARCHAR(32) default '' NOT NULL, - `PRO_UID` VARCHAR(32) default '' NOT NULL, - `APP_NUMBER` INTEGER default 0 NOT NULL, - `APP_TITLE` VARCHAR(255) default '' NOT NULL, - `APP_PRO_TITLE` VARCHAR(255) default '' NOT NULL, - `APP_TAS_TITLE` VARCHAR(255) default '' NOT NULL, - `APP_CANCELED_DATE` DATETIME NOT NULL, - `DEL_INDEX` INTEGER default 0 NOT NULL, - `DEL_PREVIOUS_USR_UID` VARCHAR(32) default '', - `DEL_CURRENT_USR_USERNAME` VARCHAR(100) default '', - `DEL_CURRENT_USR_FIRSTNAME` VARCHAR(50) default '', - `DEL_CURRENT_USR_LASTNAME` VARCHAR(50) default '', - `DEL_DELEGATE_DATE` DATETIME NOT NULL, - `DEL_INIT_DATE` DATETIME, - `DEL_DUE_DATE` DATETIME, - `DEL_PRIORITY` VARCHAR(32) default '3' NOT NULL, - PRIMARY KEY (`APP_UID`), - KEY `indexCanceledUser`(`USR_UID`) -)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Canceled list'; -#----------------------------------------------------------------------------- #-- LIST_MY_INBOX #----------------------------------------------------------------------------- @@ -2446,78 +2379,75 @@ CREATE TABLE `LIST_UNASSIGNED_GROUP` PRIMARY KEY (`UNA_UID`,`USR_UID`,`TYPE`) )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Unassiged list'; #----------------------------------------------------------------------------- -#-- MESSAGE +#-- MESSAGE_TYPE #----------------------------------------------------------------------------- -DROP TABLE IF EXISTS `MESSAGE`; +DROP TABLE IF EXISTS MESSAGE_TYPE; - -CREATE TABLE `MESSAGE` +CREATE TABLE MESSAGE_TYPE ( - `MES_UID` VARCHAR(32) NOT NULL, - `PRJ_UID` VARCHAR(32) NOT NULL, - `MES_NAME` VARCHAR(255) default '', - `MES_CONDITION` VARCHAR(255) default '', - PRIMARY KEY (`MES_UID`) -)ENGINE=InnoDB ; + MSGT_UID VARCHAR(32) default '' NOT NULL, + PRJ_UID VARCHAR(32) default '' NOT NULL, + MSGT_NAME VARCHAR(256) default '' NOT NULL, + PRIMARY KEY (MSGT_UID) +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; + #----------------------------------------------------------------------------- -#-- MESSAGE_DETAIL +#-- MESSAGE_TYPE_VARIABLE #----------------------------------------------------------------------------- -DROP TABLE IF EXISTS `MESSAGE_DETAIL`; +DROP TABLE IF EXISTS MESSAGE_TYPE_VARIABLE; - -CREATE TABLE `MESSAGE_DETAIL` +CREATE TABLE MESSAGE_TYPE_VARIABLE ( - `MD_UID` VARCHAR(32) NOT NULL, - `MES_UID` VARCHAR(32) NOT NULL, - `MD_TYPE` VARCHAR(32) default '', - `MD_NAME` VARCHAR(255) default '', - PRIMARY KEY (`MD_UID`) -)ENGINE=InnoDB ; + MSGTV_UID VARCHAR(32) default '' NOT NULL, + MSGT_UID VARCHAR(32) default '' NOT NULL, + MSGTV_NAME VARCHAR(256) default '' NOT NULL, + MSGTV_DEFAULT_VALUE VARCHAR(256) default '' NOT NULL, + PRIMARY KEY (MSGTV_UID) +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; + #----------------------------------------------------------------------------- -#-- EMAIL_SERVER +#-- TABLE: EMAIL_SERVER #----------------------------------------------------------------------------- DROP TABLE IF EXISTS `EMAIL_SERVER`; - CREATE TABLE `EMAIL_SERVER` ( - `MESS_UID` VARCHAR(32) default '' NOT NULL, - `MESS_ENGINE` VARCHAR(256) default '' NOT NULL, - `MESS_SERVER` VARCHAR(256) default '' NOT NULL, - `MESS_PORT` INTEGER default 0 NOT NULL, - `MESS_RAUTH` INTEGER default 0 NOT NULL, - `MESS_ACCOUNT` VARCHAR(256) default '' NOT NULL, - `MESS_PASSWORD` VARCHAR(256) default '' NOT NULL, - `MESS_FROM_MAIL` VARCHAR(256) default '' NOT NULL, - `MESS_FROM_NAME` VARCHAR(256) default '' NOT NULL, - `SMTPSECURE` VARCHAR(3) default 'No' NOT NULL, - `MESS_TRY_SEND_INMEDIATLY` INTEGER default 0 NOT NULL, - `MAIL_TO` VARCHAR(256) default '' NOT NULL, - `MESS_DEFAULT` INTEGER default 0 NOT NULL, - PRIMARY KEY (`MESS_UID`) -)ENGINE=InnoDB DEFAULT CHARSET='utf8'; + `MESS_UID` VARCHAR(32) default '' NOT NULL, + `MESS_ENGINE` VARCHAR(256) default '' NOT NULL, + `MESS_SERVER` VARCHAR(256) default '' NOT NULL, + `MESS_PORT` INTEGER default 0 NOT NULL, + `MESS_RAUTH` INTEGER default 0 NOT NULL, + `MESS_ACCOUNT` VARCHAR(256) default '' NOT NULL, + `MESS_PASSWORD` VARCHAR(256) default '' NOT NULL, + `MESS_FROM_MAIL` VARCHAR(256) default '' NOT NULL, + `MESS_FROM_NAME` VARCHAR(256) default '' NOT NULL, + `SMTPSECURE` VARCHAR(3) default 'No' NOT NULL, + `MESS_TRY_SEND_INMEDIATLY` INTEGER default 0 NOT NULL, + `MAIL_TO` VARCHAR(256) default '' NOT NULL, + `MESS_DEFAULT` INTEGER default 0 NOT NULL, + PRIMARY KEY (`MESS_UID`) +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; + #----------------------------------------------------------------------------- #-- WEB_ENTRY_EVENT #----------------------------------------------------------------------------- -DROP TABLE IF EXISTS `WEB_ENTRY_EVENT`; +DROP TABLE IF EXISTS WEB_ENTRY_EVENT; - -CREATE TABLE `WEB_ENTRY_EVENT` +CREATE TABLE WEB_ENTRY_EVENT ( - `WEE_UID` VARCHAR(32) NOT NULL, - `PRJ_UID` VARCHAR(32) NOT NULL, - `EVN_UID` VARCHAR(32) NOT NULL, - `ACT_UID` VARCHAR(32) NOT NULL, - `DYN_UID` VARCHAR(32) NOT NULL, - `USR_UID` VARCHAR(32) NOT NULL, - `WEE_STATUS` VARCHAR(10) default 'ENABLED' NOT NULL, - `WEE_WE_UID` VARCHAR(32) default '' NOT NULL, - `WEE_WE_TAS_UID` VARCHAR(32) default '' NOT NULL, - PRIMARY KEY (`WEE_UID`) -)ENGINE=InnoDB DEFAULT CHARSET='utf8'; -# This restores the fkey checks, after having unset them earlier -SET FOREIGN_KEY_CHECKS = 1; + WEE_UID VARCHAR(32) NOT NULL, + PRJ_UID VARCHAR(32) NOT NULL, + EVN_UID VARCHAR(32) NOT NULL, + ACT_UID VARCHAR(32) NOT NULL, + DYN_UID VARCHAR(32) NOT NULL, + USR_UID VARCHAR(32) NOT NULL, + WEE_STATUS VARCHAR(10) NOT NULL DEFAULT 'ENABLED', + WEE_WE_UID VARCHAR(32) NOT NULL DEFAULT '', + WEE_WE_TAS_UID VARCHAR(32) NOT NULL DEFAULT '', + + PRIMARY KEY (WEE_UID) +) ENGINE=InnoDB DEFAULT CHARSET='utf8'; From 8611dd24a7efec343204539ff737107a296cf17f Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Fri, 6 Feb 2015 15:49:10 -0400 Subject: [PATCH 008/155] Actualizacion de archivo --- workflow/engine/data/mysql/schema.sql | 172 ++++++++++++++++++-------- 1 file changed, 121 insertions(+), 51 deletions(-) diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index d764fc14e..e034b44a1 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -486,7 +486,7 @@ CREATE TABLE `ROUTE` `ROU_PARENT` VARCHAR(32) default '0' NOT NULL, `PRO_UID` VARCHAR(32) default '' NOT NULL, `TAS_UID` VARCHAR(32) default '' NOT NULL, -`ROU_NEXT_TASK` VARCHAR(32) default '0' NOT NULL, + `ROU_NEXT_TASK` VARCHAR(32) default '0' NOT NULL, `ROU_CASE` INTEGER default 0 NOT NULL, `ROU_TYPE` VARCHAR(25) default 'SEQUENTIAL' NOT NULL, `ROU_DEFAULT` INTEGER default 0 NOT NULL, @@ -1207,7 +1207,7 @@ CREATE TABLE `APP_HISTORY` `PRO_UID` VARCHAR(32) default '' NOT NULL, `TAS_UID` VARCHAR(32) default '' NOT NULL, `DYN_UID` VARCHAR(32) default '' NOT NULL, - `OBJ_TYPE` VARCHAR(20) default 'DYNAFORM' NOT NULL, + `OBJ_TYPE` VARCHAR(20) default 'DYNAFORM' NOT NULL, `USR_UID` VARCHAR(32) default '' NOT NULL, `APP_STATUS` VARCHAR(100) default '' NOT NULL, `HISTORY_DATE` DATETIME, @@ -1907,7 +1907,7 @@ CREATE TABLE `BPMN_FLOW` `FLO_X2` INTEGER default 0 NOT NULL, `FLO_Y2` INTEGER default 0 NOT NULL, `FLO_STATE` MEDIUMTEXT, - `FLO_POSITION` INTEGER default 0 NOT NULL, + `FLO_POSITION` INTEGER default 0 NOT NULL, PRIMARY KEY (`FLO_UID`), KEY `BPMN_FLOW_I_1`(`FLO_UID`), KEY `BPMN_FLOW_I_2`(`PRJ_UID`), @@ -2263,11 +2263,15 @@ CREATE TABLE `LIST_PARTICIPATED_LAST` `APP_TITLE` VARCHAR(255) default '' NOT NULL, `APP_PRO_TITLE` VARCHAR(255) default '' NOT NULL, `APP_TAS_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_STATUS` VARCHAR(20) default '0' NOT NULL, `DEL_INDEX` INTEGER default 0 NOT NULL, `DEL_PREVIOUS_USR_UID` VARCHAR(32) default '', `DEL_PREVIOUS_USR_USERNAME` VARCHAR(100) default '', `DEL_PREVIOUS_USR_FIRSTNAME` VARCHAR(50) default '', `DEL_PREVIOUS_USR_LASTNAME` VARCHAR(50) default '', + `DEL_CURRENT_USR_USERNAME` VARCHAR(100) default '', + `DEL_CURRENT_USR_FIRSTNAME` VARCHAR(50) default '', + `DEL_CURRENT_USR_LASTNAME` VARCHAR(50) default '', `DEL_DELEGATE_DATE` DATETIME NOT NULL, `DEL_INIT_DATE` DATETIME, `DEL_DUE_DATE` DATETIME, @@ -2301,6 +2305,70 @@ CREATE TABLE `LIST_COMPLETED` PRIMARY KEY (`APP_UID`) )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Completed list'; #----------------------------------------------------------------------------- +#-- LIST_PAUSED +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `LIST_PAUSED`; + + +CREATE TABLE `LIST_PAUSED` +( + `APP_UID` VARCHAR(32) default '' NOT NULL, + `DEL_INDEX` INTEGER default 0 NOT NULL, + `USR_UID` VARCHAR(32) default '' NOT NULL, + `TAS_UID` VARCHAR(32) default '' NOT NULL, + `PRO_UID` VARCHAR(32) default '' NOT NULL, + `APP_NUMBER` INTEGER default 0 NOT NULL, + `APP_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_PRO_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_TAS_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_PAUSED_DATE` DATETIME NOT NULL, + `APP_RESTART_DATE` DATETIME NOT NULL, + `DEL_PREVIOUS_USR_UID` VARCHAR(32) default '', + `DEL_PREVIOUS_USR_USERNAME` VARCHAR(100) default '', + `DEL_PREVIOUS_USR_FIRSTNAME` VARCHAR(50) default '', + `DEL_PREVIOUS_USR_LASTNAME` VARCHAR(50) default '', + `DEL_CURRENT_USR_USERNAME` VARCHAR(100) default '', + `DEL_CURRENT_USR_FIRSTNAME` VARCHAR(50) default '', + `DEL_CURRENT_USR_LASTNAME` VARCHAR(50) default '', + `DEL_DELEGATE_DATE` DATETIME NOT NULL, + `DEL_INIT_DATE` DATETIME, + `DEL_DUE_DATE` DATETIME, + `DEL_PRIORITY` VARCHAR(32) default '3' NOT NULL, + PRIMARY KEY (`APP_UID`,`DEL_INDEX`), + KEY `indexPausedUser`(`USR_UID`) +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Paused list'; +#----------------------------------------------------------------------------- +#-- LIST_CANCELED +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `LIST_CANCELED`; + + +CREATE TABLE `LIST_CANCELED` +( + `APP_UID` VARCHAR(32) default '' NOT NULL, + `USR_UID` VARCHAR(32) default '' NOT NULL, + `TAS_UID` VARCHAR(32) default '' NOT NULL, + `PRO_UID` VARCHAR(32) default '' NOT NULL, + `APP_NUMBER` INTEGER default 0 NOT NULL, + `APP_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_PRO_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_TAS_TITLE` VARCHAR(255) default '' NOT NULL, + `APP_CANCELED_DATE` DATETIME NOT NULL, + `DEL_INDEX` INTEGER default 0 NOT NULL, + `DEL_PREVIOUS_USR_UID` VARCHAR(32) default '', + `DEL_CURRENT_USR_USERNAME` VARCHAR(100) default '', + `DEL_CURRENT_USR_FIRSTNAME` VARCHAR(50) default '', + `DEL_CURRENT_USR_LASTNAME` VARCHAR(50) default '', + `DEL_DELEGATE_DATE` DATETIME NOT NULL, + `DEL_INIT_DATE` DATETIME, + `DEL_DUE_DATE` DATETIME, + `DEL_PRIORITY` VARCHAR(32) default '3' NOT NULL, + PRIMARY KEY (`APP_UID`), + KEY `indexCanceledUser`(`USR_UID`) +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Canceled list'; +#----------------------------------------------------------------------------- #-- LIST_MY_INBOX #----------------------------------------------------------------------------- @@ -2382,72 +2450,74 @@ CREATE TABLE `LIST_UNASSIGNED_GROUP` #-- MESSAGE_TYPE #----------------------------------------------------------------------------- -DROP TABLE IF EXISTS MESSAGE_TYPE; +DROP TABLE IF EXISTS `MESSAGE_TYPE`; -CREATE TABLE MESSAGE_TYPE + +CREATE TABLE `MESSAGE_TYPE` ( - MSGT_UID VARCHAR(32) default '' NOT NULL, - PRJ_UID VARCHAR(32) default '' NOT NULL, - MSGT_NAME VARCHAR(256) default '' NOT NULL, - PRIMARY KEY (MSGT_UID) -)ENGINE=InnoDB DEFAULT CHARSET='utf8'; - + `MSGT_UID` VARCHAR(32) NOT NULL, + `PRJ_UID` VARCHAR(32) NOT NULL, + `MSGT_NAME` VARCHAR(512) default '', + PRIMARY KEY (`MSGT_UID`) +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; #----------------------------------------------------------------------------- #-- MESSAGE_TYPE_VARIABLE #----------------------------------------------------------------------------- -DROP TABLE IF EXISTS MESSAGE_TYPE_VARIABLE; +DROP TABLE IF EXISTS `MESSAGE_TYPE_VARIABLE`; -CREATE TABLE MESSAGE_TYPE_VARIABLE + +CREATE TABLE `MESSAGE_TYPE_VARIABLE` ( - MSGTV_UID VARCHAR(32) default '' NOT NULL, - MSGT_UID VARCHAR(32) default '' NOT NULL, - MSGTV_NAME VARCHAR(256) default '' NOT NULL, - MSGTV_DEFAULT_VALUE VARCHAR(256) default '' NOT NULL, - PRIMARY KEY (MSGTV_UID) -)ENGINE=InnoDB DEFAULT CHARSET='utf8'; - + `MSGTV_UID` VARCHAR(32) NOT NULL, + `MSGT_UID` VARCHAR(32) NOT NULL, + `MSGTV_NAME` VARCHAR(512) default '', + `MSGTV_DEFAULT_VALUE` VARCHAR(512) default '', + PRIMARY KEY (`MSGTV_UID`) +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; #----------------------------------------------------------------------------- -#-- TABLE: EMAIL_SERVER +#-- EMAIL_SERVER #----------------------------------------------------------------------------- DROP TABLE IF EXISTS `EMAIL_SERVER`; + CREATE TABLE `EMAIL_SERVER` ( - `MESS_UID` VARCHAR(32) default '' NOT NULL, - `MESS_ENGINE` VARCHAR(256) default '' NOT NULL, - `MESS_SERVER` VARCHAR(256) default '' NOT NULL, - `MESS_PORT` INTEGER default 0 NOT NULL, - `MESS_RAUTH` INTEGER default 0 NOT NULL, - `MESS_ACCOUNT` VARCHAR(256) default '' NOT NULL, - `MESS_PASSWORD` VARCHAR(256) default '' NOT NULL, - `MESS_FROM_MAIL` VARCHAR(256) default '' NOT NULL, - `MESS_FROM_NAME` VARCHAR(256) default '' NOT NULL, - `SMTPSECURE` VARCHAR(3) default 'No' NOT NULL, - `MESS_TRY_SEND_INMEDIATLY` INTEGER default 0 NOT NULL, - `MAIL_TO` VARCHAR(256) default '' NOT NULL, - `MESS_DEFAULT` INTEGER default 0 NOT NULL, - PRIMARY KEY (`MESS_UID`) -)ENGINE=InnoDB DEFAULT CHARSET='utf8'; - + `MESS_UID` VARCHAR(32) default '' NOT NULL, + `MESS_ENGINE` VARCHAR(256) default '' NOT NULL, + `MESS_SERVER` VARCHAR(256) default '' NOT NULL, + `MESS_PORT` INTEGER default 0 NOT NULL, + `MESS_RAUTH` INTEGER default 0 NOT NULL, + `MESS_ACCOUNT` VARCHAR(256) default '' NOT NULL, + `MESS_PASSWORD` VARCHAR(256) default '' NOT NULL, + `MESS_FROM_MAIL` VARCHAR(256) default '' NOT NULL, + `MESS_FROM_NAME` VARCHAR(256) default '' NOT NULL, + `SMTPSECURE` VARCHAR(3) default 'No' NOT NULL, + `MESS_TRY_SEND_INMEDIATLY` INTEGER default 0 NOT NULL, + `MAIL_TO` VARCHAR(256) default '' NOT NULL, + `MESS_DEFAULT` INTEGER default 0 NOT NULL, + PRIMARY KEY (`MESS_UID`) +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; #----------------------------------------------------------------------------- #-- WEB_ENTRY_EVENT #----------------------------------------------------------------------------- -DROP TABLE IF EXISTS WEB_ENTRY_EVENT; +DROP TABLE IF EXISTS `WEB_ENTRY_EVENT`; -CREATE TABLE WEB_ENTRY_EVENT + +CREATE TABLE `WEB_ENTRY_EVENT` ( - WEE_UID VARCHAR(32) NOT NULL, - PRJ_UID VARCHAR(32) NOT NULL, - EVN_UID VARCHAR(32) NOT NULL, - ACT_UID VARCHAR(32) NOT NULL, - DYN_UID VARCHAR(32) NOT NULL, - USR_UID VARCHAR(32) NOT NULL, - WEE_STATUS VARCHAR(10) NOT NULL DEFAULT 'ENABLED', - WEE_WE_UID VARCHAR(32) NOT NULL DEFAULT '', - WEE_WE_TAS_UID VARCHAR(32) NOT NULL DEFAULT '', - - PRIMARY KEY (WEE_UID) -) ENGINE=InnoDB DEFAULT CHARSET='utf8'; + `WEE_UID` VARCHAR(32) NOT NULL, + `PRJ_UID` VARCHAR(32) NOT NULL, + `EVN_UID` VARCHAR(32) NOT NULL, + `ACT_UID` VARCHAR(32) NOT NULL, + `DYN_UID` VARCHAR(32) NOT NULL, + `USR_UID` VARCHAR(32) NOT NULL, + `WEE_STATUS` VARCHAR(10) default 'ENABLED' NOT NULL, + `WEE_WE_UID` VARCHAR(32) default '' NOT NULL, + `WEE_WE_TAS_UID` VARCHAR(32) default '' NOT NULL, + PRIMARY KEY (`WEE_UID`) +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; +# This restores the fkey checks, after having unset them earlier +SET FOREIGN_KEY_CHECKS = 1; From bf0d8417340c94567cfc4e3de087c2ff7c1548c5 Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Wed, 11 Feb 2015 09:01:47 -0400 Subject: [PATCH 009/155] Archivo loco --- gulliver/js/codemirror/addon/hint/php-hint.js | 534 +++++++++--------- 1 file changed, 267 insertions(+), 267 deletions(-) diff --git a/gulliver/js/codemirror/addon/hint/php-hint.js b/gulliver/js/codemirror/addon/hint/php-hint.js index d882dbe47..9723cb250 100644 --- a/gulliver/js/codemirror/addon/hint/php-hint.js +++ b/gulliver/js/codemirror/addon/hint/php-hint.js @@ -1,267 +1,267 @@ -(function () { - var Pos = CodeMirror.Pos; - - function forEach(arr, f) { - for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); - } - - function arrayContains(arr, item) { - if (!Array.prototype.indexOf) { - var i = arr.length; - while (i--) { - if (arr[i] === item) { - return true; - } - } - return false; - } - return arr.indexOf(item) != -1; - } - - function scriptHint(editor, keywords, getToken, options) { - // Find the token at the cursor - var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; - var sToken = token.string.trim(); - - if ( sToken == "(") { - token = tprop = getToken(editor, Pos(cur.line, tprop.start)); - return {list: getCompletions(token.string, keywords, options), - from: Pos(cur.line, token.start), - to: Pos(cur.line, token.end + 1)}; - } - if ( sToken == "=") { - return {list: getCompletions(token.string, keywords, options), - from: Pos(cur.line, token.start + 1), - to: Pos(cur.line, token.end)}; - } - return {list: getCompletions(token.string, keywords, options), - from: Pos(cur.line, token.start), - to: Pos(cur.line, token.end)}; - } - - CodeMirror.phpHint = function(editor, options) { - return scriptHint(editor, phpPMFunctions, function (e, cur) {return e.getTokenAt(cur);}, options); - }; - - var SPACE = " "; - var arrayFunctions = []; - - var formatDate = "formatDate"; - var formatDateFunction = [formatDate+"($date,$format,$language);",formatDate+"($date,$format);"]; - arrayFunctions[formatDate] = formatDateFunction; - - var getCurrentDate = "getCurrentDate"; - var getCurrentDateFunction = [getCurrentDate+"()"]; - arrayFunctions[getCurrentDate] = getCurrentDateFunction; - - var getCurrentTime = "getCurrentTime"; - var getCurrentTimeFunction = [getCurrentTime+"()"]; - arrayFunctions[getCurrentTime] = getCurrentTimeFunction; - - var literalDate = "literalDate"; - var literalDateFunction = [literalDate+"($date,$Language)",literalDate+"($date)"]; - arrayFunctions[literalDate] = literalDateFunction; - - var capitalize = "capitalize"; - var capitalizeFunction = [capitalize+"($textToConvert)"]; - arrayFunctions[capitalize] = capitalizeFunction; - - var lowerCase = "lowerCase"; - var lowerCaseFunction = [lowerCase+"($textToConvert)"]; - arrayFunctions[lowerCase] = lowerCaseFunction; - - var upperCase = "upperCase"; - var upperCaseFunction = [upperCase+"($textToConvert)"]; - arrayFunctions[upperCase] = upperCaseFunction; - - var userInfo = "userInfo"; - var userInfoFunction = [userInfo+"($USER_ID)"]; - arrayFunctions[userInfo] = userInfoFunction; - - var executeQuery = "executeQuery"; - var executeQueryFunction = [executeQuery+"($sqlStatement,$DBConnectionUID)",executeQuery+"($sqlStatement)"]; - arrayFunctions[executeQuery] = executeQueryFunction; - - var orderGrid = "orderGrid"; - var orderGridFunction = ("orderGrid($gridName,$field,$criteria) orderGrid($gridName,$field)").split(SPACE); - arrayFunctions[orderGrid] = orderGridFunction; - - var evaluateFunction = "evaluateFunction"; - var evaluateFunctionFunction = [evaluateFunction+"($gridName,$Expression)"]; - arrayFunctions[evaluateFunction] = evaluateFunctionFunction; - - var PMFTaskCase = "PMFTaskCase"; - var PMFTaskCaseFunction = [PMFTaskCase+"($caseId)"]; - arrayFunctions[PMFTaskCase] = PMFTaskCaseFunction; - - var PMFTaskList = "PMFTaskList"; - var PMFTaskListFunction = [PMFTaskList+"($userId)"]; - arrayFunctions[PMFTaskList] = PMFTaskListFunction; - - var PMFUserList = "PMFUserList"; - var PMFUserListFunction = [PMFUserList+"()"]; - arrayFunctions[PMFUserList] = PMFUserListFunction; - - var PMFGroupList = "PMFGroupList"; - var PMFGroupListFunction = [PMFGroupList+"()"]; - arrayFunctions[PMFGroupList] = PMFGroupListFunction; - - var PMFRoleList = "PMFRoleList"; - var PMFRoleListFunction = [PMFRoleList+"()"]; - arrayFunctions[PMFRoleList] = PMFRoleListFunction; - - var PMFCaseList = "PMFCaseList"; - var PMFCaseListFunction = [PMFCaseList+"($userId)",PMFCaseList+"()"]; - arrayFunctions[PMFCaseList] = PMFCaseListFunction; - - var PMFProcessList = "PMFProcessList"; - var PMFProcessListFunction = [PMFProcessList+"()"]; - arrayFunctions[PMFProcessList] = PMFProcessListFunction; - - var PMFSendVariables = "PMFSendVariables"; - var PMFSendVariablesFunction = [PMFSendVariables+"($caseId,$variables)"]; - arrayFunctions[PMFSendVariables] = PMFSendVariablesFunction; - - var PMFDerivateCase = "PMFDerivateCase"; - var PMFDerivateCaseFunction = [PMFDerivateCase+"($caseId,$delegation,$executeTriggersBeforeAssigment)",PMFDerivateCase+"($caseId,$delegation)"]; - arrayFunctions[PMFDerivateCase] = PMFDerivateCaseFunction; - - var PMFNewCaseImpersonate = "PMFNewCaseImpersonate"; - var PMFNewCaseImpersonateFunction = [PMFNewCaseImpersonate+"($processId,$userId,$variables)"]; - arrayFunctions[PMFNewCaseImpersonate] = PMFNewCaseImpersonateFunction; - - var PMFNewCase = "PMFNewCase"; - var PMFNewCaseFunction = [PMFNewCase+"($processId,$userId,$taskId,$variables)"]; - arrayFunctions[PMFNewCase] = PMFNewCaseFunction; - - var PMFPauseCase = "PMFPauseCase"; - var PMFPauseCaseFunction = [PMFPauseCase+"($caseUid,$delIndex,$userUid,$unpauseDate)",PMFPauseCase+"($caseUid,$delIndex,$userUid)"]; - arrayFunctions[PMFPauseCase] = PMFPauseCaseFunction; - - var PMFAssignUserToGroup = "PMFAssignUserToGroup"; - var PMFAssignUserToGroupFunction = [PMFAssignUserToGroup+"($userId,$groupId)"]; - arrayFunctions[PMFAssignUserToGroup] = PMFAssignUserToGroupFunction; - - var PMFCreateUser = "PMFCreateUser"; - var PMFCreateUserFunction = [PMFCreateUser+"($userId,$password,$firstname,$lastname,$email,$role)"]; - arrayFunctions[PMFCreateUser] = PMFCreateUserFunction; - - var PMFUpdateUser = "PMFUpdateUser"; - var PMFUpdateUserFunction = [PMFUpdateUser+"($userUid,$userName,$firstName,$lastName,$email,$dueDate,$status,$role,$password)"]; - arrayFunctions[PMFUpdateUser] = PMFUpdateUserFunction; - - var PMFInformationUser = "PMFInformationUser"; - var PMFInformationUserFunction = [PMFInformationUser+"($userUid)"]; - arrayFunctions[PMFInformationUser] = PMFInformationUserFunction; - - var generateCode = "generateCode"; - var generateCodeFunction = [generateCode+"($size,$type)"]; - arrayFunctions[generateCode] = generateCodeFunction; - - var setCaseTrackerCode = "setCaseTrackerCode"; - var setCaseTrackerCodeFunction = [setCaseTrackerCode+"($caseId,$code,$pin)"]; - arrayFunctions[setCaseTrackerCode] = setCaseTrackerCodeFunction; - - var jumping = "jumping"; - var jumpingFunction = [jumping+"($caseId,$delegation)"]; - arrayFunctions[jumping] = jumpingFunction; - - var PMFRedirectToStep = "PMFRedirectToStep"; - var PMFRedirectToStepFunction = [PMFRedirectToStep+"($caseId,$delegation,$stepType,$stepId)"]; - arrayFunctions[PMFRedirectToStep] = PMFRedirectToStepFunction; - - var pauseCase = "pauseCase"; - var pauseCaseFunction = [pauseCase+"($caseId,$delegation,$userId,$unpauseDate)",pauseCase+"($caseId,$delegation,$userId)"]; - arrayFunctions[pauseCase] = pauseCaseFunction; - - var PMFUnpauseCase = "PMFUnpauseCase"; - var PMFUnpauseCaseFunction = [PMFUnpauseCase+"($caseId,$delegation,$userId,$unpauseDate)",PMFUnpauseCase+"($caseId,$delegation,$userId)"]; - arrayFunctions[PMFUnpauseCase] = PMFUnpauseCaseFunction; - - var PMFSendMessage = "PMFSendMessage"; - var PMFSendMessageFunction = [PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields,$attachments)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template)"]; - arrayFunctions[PMFSendMessage] = PMFSendMessageFunction; - - var PMFgetLabelOption = "PMFgetLabelOption"; - var PMFgetLabelOptionFunction = [PMFgetLabelOption+"($processId,$dynaformId,$fieldName,$optionId)"]; - arrayFunctions[PMFgetLabelOption] = PMFgetLabelOptionFunction; - - var PMFGenerateOutputDocument = "PMFGenerateOutputDocument"; - var PMFGenerateOutputDocumentFunction = [PMFGenerateOutputDocument+"($outputID)"]; - arrayFunctions[PMFGenerateOutputDocument] = PMFGenerateOutputDocumentFunction; - - var PMFGetUserEmailAddress = "PMFGetUserEmailAddress"; - var PMFGetUserEmailAddressFunction = [PMFGetUserEmailAddress+"($id,$APP_UID,$prefix)",PMFGetUserEmailAddress+"($id,$APP_UID)",PMFGetUserEmailAddress+"($id)"]; - arrayFunctions[PMFGetUserEmailAddress] = PMFGetUserEmailAddressFunction; - - var PMFGetNextAssignedUser = "PMFGetNextAssignedUser"; - var PMFGetNextAssignedUserFunction = (PMFGetNextAssignedUser+"($application,$task)").split(SPACE); - arrayFunctions[PMFGetNextAssignedUser] = PMFGetNextAssignedUserFunction; - - var PMFDeleteCase = "PMFDeleteCase"; - var PMFDeleteCaseFunction = ("PMFDeleteCase($caseId)").split(SPACE); - arrayFunctions[PMFDeleteCase] = PMFDeleteCaseFunction; - - var PMFCancelCase = "PMFCancelCase"; - var PMFCancelCaseFunction = [PMFCancelCase+"($caseUid,$delIndex,$userUid)"]; - arrayFunctions[PMFCancelCase] = PMFCancelCaseFunction; - - var PMFAddInputDocument = "PMFAddInputDocument"; - var PMFAddInputDocumentFunction = [PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option,$file)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid)"]; - arrayFunctions[PMFAddInputDocument] = PMFAddInputDocumentFunction; - - var PMFAddCaseNote = "PMFAddCaseNote"; - var PMFAddCaseNoteFunction = [PMFAddCaseNote+"($caseUid,$processUid,$taskUid,$userUid,$note,$sendMail)"]; - arrayFunctions[PMFAddCaseNote] = PMFAddCaseNoteFunction; - - var PMFGetCaseNotes = "PMFGetCaseNotes"; - var PMFGetCaseNotesFunction = [PMFGetCaseNotes+"($applicationID,$type,$userUid);",PMFGetCaseNotes+"($applicationID,$type)",PMFGetCaseNotes+"($applicationID)"]; - arrayFunctions[PMFGetCaseNotes] = PMFGetCaseNotesFunction; - - var phpPMFunctions = [formatDate,getCurrentDate,getCurrentTime,literalDate,capitalize,lowerCase,upperCase,userInfo,executeQuery,orderGrid, - evaluateFunction,PMFTaskCase,PMFTaskList,PMFUserList,PMFGroupList,PMFRoleList,PMFCaseList,PMFProcessList,PMFSendVariables,PMFDerivateCase, - PMFNewCaseImpersonate,PMFNewCase,PMFPauseCase,PMFUnpauseCase,PMFAssignUserToGroup,PMFCreateUser,PMFUpdateUser,PMFInformationUser, - generateCode,setCaseTrackerCode,jumping,PMFRedirectToStep,pauseCase,PMFSendMessage,PMFgetLabelOption,PMFGenerateOutputDocument, - PMFGetUserEmailAddress,PMFGetNextAssignedUser,PMFDeleteCase,PMFCancelCase,PMFAddInputDocument,PMFAddCaseNote,PMFGetCaseNotes]; - - var phpKeywords = ("break case catch continue default do else false for function " + - "if new return switch throw true try var while").split(SPACE); - - function getCompletions(functionName, keywords, options) { - - var found = []; - - function maybeAdd(str) {// for keywords ? - if ( str.indexOf(functionName) == 0 && !arrayContains(found, str)) { - found.push(str); - } - } - - function yesAdd(str) { - if ( !arrayContains(found, str)) { - found.push(str); - } - } - - arrayFunction = arrayFunctions[functionName]; - - if (arrayFunction != undefined) { - forEach( arrayFunction, yesAdd); - } else { - if (functionName.trim() == "") { - forEach (phpKeywords, yesAdd); - forEach (keywords, yesAdd); - } else if (functionName == "=") { - forEach (phpPMFunctions, yesAdd); - } else { - for (index = 0; index < phpKeywords.length; index++) { - if ( phpKeywords[index].indexOf(functionName) == 0 ) { - found.push(phpKeywords[index]); - } - } - forEach(keywords, maybeAdd); - } - } - return found; - } -})(); +(function () { + var Pos = CodeMirror.Pos; + + function forEach(arr, f) { + for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); + } + + function arrayContains(arr, item) { + if (!Array.prototype.indexOf) { + var i = arr.length; + while (i--) { + if (arr[i] === item) { + return true; + } + } + return false; + } + return arr.indexOf(item) != -1; + } + + function scriptHint(editor, keywords, getToken, options) { + // Find the token at the cursor + var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; + var sToken = token.string.trim(); + + if ( sToken == "(") { + token = tprop = getToken(editor, Pos(cur.line, tprop.start)); + return {list: getCompletions(token.string, keywords, options), + from: Pos(cur.line, token.start), + to: Pos(cur.line, token.end + 1)}; + } + if ( sToken == "=") { + return {list: getCompletions(token.string, keywords, options), + from: Pos(cur.line, token.start + 1), + to: Pos(cur.line, token.end)}; + } + return {list: getCompletions(token.string, keywords, options), + from: Pos(cur.line, token.start), + to: Pos(cur.line, token.end)}; + } + + CodeMirror.phpHint = function(editor, options) { + return scriptHint(editor, phpPMFunctions, function (e, cur) {return e.getTokenAt(cur);}, options); + }; + + var SPACE = " "; + var arrayFunctions = []; + + var formatDate = "formatDate"; + var formatDateFunction = [formatDate+"($date,$format,$language);",formatDate+"($date,$format);"]; + arrayFunctions[formatDate] = formatDateFunction; + + var getCurrentDate = "getCurrentDate"; + var getCurrentDateFunction = [getCurrentDate+"()"]; + arrayFunctions[getCurrentDate] = getCurrentDateFunction; + + var getCurrentTime = "getCurrentTime"; + var getCurrentTimeFunction = [getCurrentTime+"()"]; + arrayFunctions[getCurrentTime] = getCurrentTimeFunction; + + var literalDate = "literalDate"; + var literalDateFunction = [literalDate+"($date,$Language)",literalDate+"($date)"]; + arrayFunctions[literalDate] = literalDateFunction; + + var capitalize = "capitalize"; + var capitalizeFunction = [capitalize+"($textToConvert)"]; + arrayFunctions[capitalize] = capitalizeFunction; + + var lowerCase = "lowerCase"; + var lowerCaseFunction = [lowerCase+"($textToConvert)"]; + arrayFunctions[lowerCase] = lowerCaseFunction; + + var upperCase = "upperCase"; + var upperCaseFunction = [upperCase+"($textToConvert)"]; + arrayFunctions[upperCase] = upperCaseFunction; + + var userInfo = "userInfo"; + var userInfoFunction = [userInfo+"($USER_ID)"]; + arrayFunctions[userInfo] = userInfoFunction; + + var executeQuery = "executeQuery"; + var executeQueryFunction = [executeQuery+"($sqlStatement,$DBConnectionUID)",executeQuery+"($sqlStatement)"]; + arrayFunctions[executeQuery] = executeQueryFunction; + + var orderGrid = "orderGrid"; + var orderGridFunction = ("orderGrid($gridName,$field,$criteria) orderGrid($gridName,$field)").split(SPACE); + arrayFunctions[orderGrid] = orderGridFunction; + + var evaluateFunction = "evaluateFunction"; + var evaluateFunctionFunction = [evaluateFunction+"($gridName,$Expression)"]; + arrayFunctions[evaluateFunction] = evaluateFunctionFunction; + + var PMFTaskCase = "PMFTaskCase"; + var PMFTaskCaseFunction = [PMFTaskCase+"($caseId)"]; + arrayFunctions[PMFTaskCase] = PMFTaskCaseFunction; + + var PMFTaskList = "PMFTaskList"; + var PMFTaskListFunction = [PMFTaskList+"($userId)"]; + arrayFunctions[PMFTaskList] = PMFTaskListFunction; + + var PMFUserList = "PMFUserList"; + var PMFUserListFunction = [PMFUserList+"()"]; + arrayFunctions[PMFUserList] = PMFUserListFunction; + + var PMFGroupList = "PMFGroupList"; + var PMFGroupListFunction = [PMFGroupList+"()"]; + arrayFunctions[PMFGroupList] = PMFGroupListFunction; + + var PMFRoleList = "PMFRoleList"; + var PMFRoleListFunction = [PMFRoleList+"()"]; + arrayFunctions[PMFRoleList] = PMFRoleListFunction; + + var PMFCaseList = "PMFCaseList"; + var PMFCaseListFunction = [PMFCaseList+"($userId)",PMFCaseList+"()"]; + arrayFunctions[PMFCaseList] = PMFCaseListFunction; + + var PMFProcessList = "PMFProcessList"; + var PMFProcessListFunction = [PMFProcessList+"()"]; + arrayFunctions[PMFProcessList] = PMFProcessListFunction; + + var PMFSendVariables = "PMFSendVariables"; + var PMFSendVariablesFunction = [PMFSendVariables+"($caseId,$variables)"]; + arrayFunctions[PMFSendVariables] = PMFSendVariablesFunction; + + var PMFDerivateCase = "PMFDerivateCase"; + var PMFDerivateCaseFunction = [PMFDerivateCase+"($caseId,$delegation,$executeTriggersBeforeAssigment)",PMFDerivateCase+"($caseId,$delegation)"]; + arrayFunctions[PMFDerivateCase] = PMFDerivateCaseFunction; + + var PMFNewCaseImpersonate = "PMFNewCaseImpersonate"; + var PMFNewCaseImpersonateFunction = [PMFNewCaseImpersonate+"($processId,$userId,$variables)"]; + arrayFunctions[PMFNewCaseImpersonate] = PMFNewCaseImpersonateFunction; + + var PMFNewCase = "PMFNewCase"; + var PMFNewCaseFunction = [PMFNewCase+"($processId,$userId,$taskId,$variables)"]; + arrayFunctions[PMFNewCase] = PMFNewCaseFunction; + + var PMFPauseCase = "PMFPauseCase"; + var PMFPauseCaseFunction = [PMFPauseCase+"($caseUid,$delIndex,$userUid,$unpauseDate)",PMFPauseCase+"($caseUid,$delIndex,$userUid)"]; + arrayFunctions[PMFPauseCase] = PMFPauseCaseFunction; + + var PMFAssignUserToGroup = "PMFAssignUserToGroup"; + var PMFAssignUserToGroupFunction = [PMFAssignUserToGroup+"($userId,$groupId)"]; + arrayFunctions[PMFAssignUserToGroup] = PMFAssignUserToGroupFunction; + + var PMFCreateUser = "PMFCreateUser"; + var PMFCreateUserFunction = [PMFCreateUser+"($userId,$password,$firstname,$lastname,$email,$role)"]; + arrayFunctions[PMFCreateUser] = PMFCreateUserFunction; + + var PMFUpdateUser = "PMFUpdateUser"; + var PMFUpdateUserFunction = [PMFUpdateUser+"($userUid,$userName,$firstName,$lastName,$email,$dueDate,$status,$role,$password)"]; + arrayFunctions[PMFUpdateUser] = PMFUpdateUserFunction; + + var PMFInformationUser = "PMFInformationUser"; + var PMFInformationUserFunction = [PMFInformationUser+"($userUid)"]; + arrayFunctions[PMFInformationUser] = PMFInformationUserFunction; + + var generateCode = "generateCode"; + var generateCodeFunction = [generateCode+"($size,$type)"]; + arrayFunctions[generateCode] = generateCodeFunction; + + var setCaseTrackerCode = "setCaseTrackerCode"; + var setCaseTrackerCodeFunction = [setCaseTrackerCode+"($caseId,$code,$pin)"]; + arrayFunctions[setCaseTrackerCode] = setCaseTrackerCodeFunction; + + var jumping = "jumping"; + var jumpingFunction = [jumping+"($caseId,$delegation)"]; + arrayFunctions[jumping] = jumpingFunction; + + var PMFRedirectToStep = "PMFRedirectToStep"; + var PMFRedirectToStepFunction = [PMFRedirectToStep+"($caseId,$delegation,$stepType,$stepId)"]; + arrayFunctions[PMFRedirectToStep] = PMFRedirectToStepFunction; + + var pauseCase = "pauseCase"; + var pauseCaseFunction = [pauseCase+"($caseId,$delegation,$userId,$unpauseDate)",pauseCase+"($caseId,$delegation,$userId)"]; + arrayFunctions[pauseCase] = pauseCaseFunction; + + var PMFUnpauseCase = "PMFUnpauseCase"; + var PMFUnpauseCaseFunction = [PMFUnpauseCase+"($caseId,$delegation,$userId,$unpauseDate)",PMFUnpauseCase+"($caseId,$delegation,$userId)"]; + arrayFunctions[PMFUnpauseCase] = PMFUnpauseCaseFunction; + + var PMFSendMessage = "PMFSendMessage"; + var PMFSendMessageFunction = [PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields,$attachments)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template)"]; + arrayFunctions[PMFSendMessage] = PMFSendMessageFunction; + + var PMFgetLabelOption = "PMFgetLabelOption"; + var PMFgetLabelOptionFunction = [PMFgetLabelOption+"($processId,$dynaformId,$fieldName,$optionId)"]; + arrayFunctions[PMFgetLabelOption] = PMFgetLabelOptionFunction; + + var PMFGenerateOutputDocument = "PMFGenerateOutputDocument"; + var PMFGenerateOutputDocumentFunction = [PMFGenerateOutputDocument+"($outputID)"]; + arrayFunctions[PMFGenerateOutputDocument] = PMFGenerateOutputDocumentFunction; + + var PMFGetUserEmailAddress = "PMFGetUserEmailAddress"; + var PMFGetUserEmailAddressFunction = [PMFGetUserEmailAddress+"($id,$APP_UID,$prefix)",PMFGetUserEmailAddress+"($id,$APP_UID)",PMFGetUserEmailAddress+"($id)"]; + arrayFunctions[PMFGetUserEmailAddress] = PMFGetUserEmailAddressFunction; + + var PMFGetNextAssignedUser = "PMFGetNextAssignedUser"; + var PMFGetNextAssignedUserFunction = (PMFGetNextAssignedUser+"($application,$task)").split(SPACE); + arrayFunctions[PMFGetNextAssignedUser] = PMFGetNextAssignedUserFunction; + + var PMFDeleteCase = "PMFDeleteCase"; + var PMFDeleteCaseFunction = ("PMFDeleteCase($caseId)").split(SPACE); + arrayFunctions[PMFDeleteCase] = PMFDeleteCaseFunction; + + var PMFCancelCase = "PMFCancelCase"; + var PMFCancelCaseFunction = [PMFCancelCase+"($caseUid,$delIndex,$userUid)"]; + arrayFunctions[PMFCancelCase] = PMFCancelCaseFunction; + + var PMFAddInputDocument = "PMFAddInputDocument"; + var PMFAddInputDocumentFunction = [PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option,$file)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid)"]; + arrayFunctions[PMFAddInputDocument] = PMFAddInputDocumentFunction; + + var PMFAddCaseNote = "PMFAddCaseNote"; + var PMFAddCaseNoteFunction = [PMFAddCaseNote+"($caseUid,$processUid,$taskUid,$userUid,$note,$sendMail)"]; + arrayFunctions[PMFAddCaseNote] = PMFAddCaseNoteFunction; + + var PMFGetCaseNotes = "PMFGetCaseNotes"; + var PMFGetCaseNotesFunction = [PMFGetCaseNotes+"($applicationID,$type,$userUid);",PMFGetCaseNotes+"($applicationID,$type)",PMFGetCaseNotes+"($applicationID)"]; + arrayFunctions[PMFGetCaseNotes] = PMFGetCaseNotesFunction; + + var phpPMFunctions = [formatDate,getCurrentDate,getCurrentTime,literalDate,capitalize,lowerCase,upperCase,userInfo,executeQuery,orderGrid, + evaluateFunction,PMFTaskCase,PMFTaskList,PMFUserList,PMFGroupList,PMFRoleList,PMFCaseList,PMFProcessList,PMFSendVariables,PMFDerivateCase, + PMFNewCaseImpersonate,PMFNewCase,PMFPauseCase,PMFUnpauseCase,PMFAssignUserToGroup,PMFCreateUser,PMFUpdateUser,PMFInformationUser, + generateCode,setCaseTrackerCode,jumping,PMFRedirectToStep,pauseCase,PMFSendMessage,PMFgetLabelOption,PMFGenerateOutputDocument, + PMFGetUserEmailAddress,PMFGetNextAssignedUser,PMFDeleteCase,PMFCancelCase,PMFAddInputDocument,PMFAddCaseNote,PMFGetCaseNotes]; + + var phpKeywords = ("break case catch continue default do else false for function " + + "if new return switch throw true try var while").split(SPACE); + + function getCompletions(functionName, keywords, options) { + + var found = []; + + function maybeAdd(str) {// for keywords ? + if ( str.indexOf(functionName) == 0 && !arrayContains(found, str)) { + found.push(str); + } + } + + function yesAdd(str) { + if ( !arrayContains(found, str)) { + found.push(str); + } + } + + arrayFunction = arrayFunctions[functionName]; + + if (arrayFunction != undefined) { + forEach( arrayFunction, yesAdd); + } else { + if (functionName.trim() == "") { + forEach (phpKeywords, yesAdd); + forEach (keywords, yesAdd); + } else if (functionName == "=") { + forEach (phpPMFunctions, yesAdd); + } else { + for (index = 0; index < phpKeywords.length; index++) { + if ( phpKeywords[index].indexOf(functionName) == 0 ) { + found.push(phpKeywords[index]); + } + } + forEach(keywords, maybeAdd); + } + } + return found; + } +})(); From 3471373a1676684d5073a83eeac6a71d168f8f72 Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Wed, 11 Feb 2015 10:20:22 -0400 Subject: [PATCH 010/155] Adecuacion para pm enterprise --- workflow/engine/classes/class.case.php | 5 ++++- workflow/engine/classes/model/ListInbox.php | 2 +- workflow/engine/methods/cases/casesListExtJs.php | 16 ++++++++++++---- .../methods/setup/environmentSettingsAjax.php | 1 - workflow/engine/templates/cases/casesList.js | 10 +++++----- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index 5bccbdb2c..78f021b69 100755 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -3907,7 +3907,7 @@ class Cases $this->getExecuteTriggerProcess($sApplicationUID, 'PAUSED'); - + /*----------------------------------********---------------------------------*/ $data = array ( 'APP_UID' => $sApplicationUID, 'DEL_INDEX' => $iDelegation, @@ -3917,6 +3917,7 @@ class Cases $data = array_merge($aFields, $data); $oListPaused = new ListPaused(); $oListPaused->create($data); + /*----------------------------------********---------------------------------*/ } /* @@ -4008,8 +4009,10 @@ class Cases $this->getExecuteTriggerProcess($sApplicationUID, "UNPAUSE"); + /*----------------------------------********---------------------------------*/ $oListPaused = new ListPaused(); $oListPaused->remove($sApplicationUID, $iDelegation, true); + /*----------------------------------********---------------------------------*/ } /* diff --git a/workflow/engine/classes/model/ListInbox.php b/workflow/engine/classes/model/ListInbox.php index aba18506e..f04aefe5c 100644 --- a/workflow/engine/classes/model/ListInbox.php +++ b/workflow/engine/classes/model/ListInbox.php @@ -36,7 +36,7 @@ class ListInbox extends BaseListInbox throw ($e); } $con->commit(); - + // create participated history $listParticipatedHistory = new ListParticipatedHistory(); $listParticipatedHistory->create($data); diff --git a/workflow/engine/methods/cases/casesListExtJs.php b/workflow/engine/methods/cases/casesListExtJs.php index 7c4868c5c..0882bdac8 100755 --- a/workflow/engine/methods/cases/casesListExtJs.php +++ b/workflow/engine/methods/cases/casesListExtJs.php @@ -3,11 +3,14 @@ unset($_SESSION['APPLICATION']); //get the action from GET or POST, default is todo $action = isset( $_GET['action'] ) ? $_GET['action'] : (isset( $_POST['action'] ) ? $_POST['action'] : 'todo'); -$clientId = 'x-pm-local-client'; //fix a previous inconsistency +$urlProxy = 'proxyCasesList'; +if ($action == 'selfservice') { + $action = 'unassigned'; +} +/*----------------------------------********---------------------------------*/ $urlProxy = '/api/1.0/' . SYS_SYS . '/lists/'; -$methodProxy = 'GET'; switch ($action) { case 'todo': case 'draft': @@ -40,6 +43,7 @@ switch ($action) { break; } +$clientId = 'x-pm-local-client'; $client = getClientCredentials($clientId); $authCode = getAuthorizationCode($client); $debug = false; //System::isDebugMode(); @@ -67,6 +71,7 @@ $response = $oauthServer->postToken($request, true); $clientToken = $response->getParameters(); $clientToken["client_id"] = $client['CLIENT_ID']; $clientToken["client_secret"] = $client['CLIENT_SECRET']; +/*----------------------------------********---------------------------------*/ @@ -182,8 +187,9 @@ $oHeadPublisher->assign( 'readerFields', $readerFields ); //sending the fields t $oHeadPublisher->assign( 'reassignColumns', $reassignColumns ); //sending the columns to display in grid $oHeadPublisher->assign( 'action', $action ); //sending the action to make $oHeadPublisher->assign( 'urlProxy', $urlProxy ); //sending the urlProxy to make -$oHeadPublisher->assign( 'methodProxy', $methodProxy ); //sending the urlProxy to make +/*----------------------------------********---------------------------------*/ $oHeadPublisher->assign( 'credentials', $clientToken ); //sending the SYS_SYS to make +/*----------------------------------********---------------------------------*/ $oHeadPublisher->assign( 'PMDateFormat', $dateFormat ); //sending the fields to get from proxy $oHeadPublisher->assign( 'statusValues', $status ); //Sending the listing of status $oHeadPublisher->assign( 'processValues', $processes ); //Sending the listing of processes @@ -494,6 +500,7 @@ function getAdditionalFields($action, $confCasesList = array()) } +/*----------------------------------********---------------------------------*/ function getClientCredentials($clientId) { $oauthQuery = new ProcessMaker\Services\OAuth2\PmPdo(getDsn()); @@ -528,4 +535,5 @@ function getAuthorizationCode($client) $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40); return $code; -} \ No newline at end of file +} +/*----------------------------------********---------------------------------*/ \ No newline at end of file diff --git a/workflow/engine/methods/setup/environmentSettingsAjax.php b/workflow/engine/methods/setup/environmentSettingsAjax.php index 538248d40..704e4b2e4 100755 --- a/workflow/engine/methods/setup/environmentSettingsAjax.php +++ b/workflow/engine/methods/setup/environmentSettingsAjax.php @@ -46,7 +46,6 @@ switch ($request) { $config['casesListRowNumber'] = intval( $_POST["casesListRowNumber"] ); $config['casesListRefreshTime'] = intval( $_POST["txtCasesRefreshTime"]); - $conf->aConfig = $config; $conf->saveConfig( "ENVIRONMENT_SETTINGS", "" ); diff --git a/workflow/engine/templates/cases/casesList.js b/workflow/engine/templates/cases/casesList.js index dc4d8e5bd..cfc1d1929 100755 --- a/workflow/engine/templates/cases/casesList.js +++ b/workflow/engine/templates/cases/casesList.js @@ -24,7 +24,6 @@ var grid; var textJump; var ids = ''; var winReassignInCasesList; -var totalRowsGrid = ''; function formatAMPM(date, initVal, calendarDate) { @@ -742,12 +741,13 @@ Ext.onReady ( function() { var proxyCasesList = new Ext.data.HttpProxy({ api: { read : urlProxy - }, - method: 'GET', - headers: { + } + /*----------------------------------********---------------------------------*/ + ,headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + credentials.access_token } + /*----------------------------------********---------------------------------*/ }); // Typical JsonReader with additional meta-data params for defining the core attributes of your json-response @@ -806,11 +806,11 @@ Ext.onReady ( function() { sortInfo:{field: 'APP_CACHE_VIEW.APP_NUMBER', direction: "DESC"}, listeners: { load: function(response){ + //console.log(response.reader.jsonData); if (response.reader.jsonData.result === false) { PMExt.notify('ERROR', response.reader.jsonData.message); //PMExt.error } - //console.log(response.reader.jsonData); }, exception: function(dp, type, action, options, response, arg) { responseObject = Ext.util.JSON.decode(response.responseText); From 5b7c423238b5eddff4313848a8bc0956af2243c3 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Wed, 11 Feb 2015 15:51:11 -0400 Subject: [PATCH 011/155] I solved the issue with Task Information [Issue Mantis 15959] --- workflow/engine/methods/cases/cases_Open.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/methods/cases/cases_Open.php b/workflow/engine/methods/cases/cases_Open.php index cf07981fe..28432a792 100755 --- a/workflow/engine/methods/cases/cases_Open.php +++ b/workflow/engine/methods/cases/cases_Open.php @@ -77,7 +77,7 @@ try { $aFields = $oCase->loadCase( $sAppUid, $iDelIndex ); // g::pr($aFields); // die; - + if( !isset($_SESSION['CURRENT_TASK']) || $_SESSION['CURRENT_TASK']=='') $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; switch ($aFields['APP_STATUS']) { case 'DRAFT': case 'TO_DO': From 3cc1ad2d77fcb9aa0bb399c0e05ee64b24b32e21 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Wed, 11 Feb 2015 16:56:27 -0400 Subject: [PATCH 012/155] I corrected with the standard --- workflow/engine/methods/cases/cases_Open.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/workflow/engine/methods/cases/cases_Open.php b/workflow/engine/methods/cases/cases_Open.php index 28432a792..422336fbd 100755 --- a/workflow/engine/methods/cases/cases_Open.php +++ b/workflow/engine/methods/cases/cases_Open.php @@ -77,7 +77,9 @@ try { $aFields = $oCase->loadCase( $sAppUid, $iDelIndex ); // g::pr($aFields); // die; - if( !isset($_SESSION['CURRENT_TASK']) || $_SESSION['CURRENT_TASK']=='') $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; + if( !isset($_SESSION['CURRENT_TASK']) || $_SESSION['CURRENT_TASK']==''){ + $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; + } switch ($aFields['APP_STATUS']) { case 'DRAFT': case 'TO_DO': From 2dde55a1aa48d980ddb8cb5dde5128adf02db4e5 Mon Sep 17 00:00:00 2001 From: dheeyi Date: Wed, 11 Feb 2015 17:04:04 -0400 Subject: [PATCH 013/155] PM-1399 En la configuracion de "Enviroment" no se aplica el formato para el User Name. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Causa. Esto fue debido a los siguientes motivos. Inicialmente si funcionaba... se realizo un leve cambio parecida a la siguiente instrucció $this->UserConfig = array(); /* Esto no existia en un principio y la logica de funcionamiento era el correcto*/ if (!isset($this->UserConfig)) { $this->UserConfig = $this->getConfiguration("ENVIRONMENT_SETTINGS", ""); } Sin enbargo al adicionar esa linea(Motivo Warnings de PHP), el if que se menciona tubo otra logica de trabajo es por eso que no se reflejaba los cambios realizados por el usuario. Solució Lo que se realizo fue cambiar la instruccion isset por empty, de la siguiente manera. if (empty($this->UserConfig)) { $this->UserConfig = $this->getConfiguration("ENVIRONMENT_SETTINGS", ""); } Con esto fue resuelto el error. Nota.- A medida que se corrigio este error, tambien fue corregido los Notices PHP generados(Index Indefinido) y asi tener mas limpio el codigo. Ejem. Estado Inicial >> $config['format'] = $_POST["userFormat"]; Estado final >> if (isset($_POST["dateFormat"])) { $config['dateFormat'] = $_POST["dateFormat"]; } --- .../engine/classes/class.configuration.php | 2 +- .../methods/setup/environmentSettingsAjax.php | 28 ++++++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/workflow/engine/classes/class.configuration.php b/workflow/engine/classes/class.configuration.php index 5ec6c2346..917c260ba 100755 --- a/workflow/engine/classes/class.configuration.php +++ b/workflow/engine/classes/class.configuration.php @@ -374,7 +374,7 @@ class Configurations // extends Configuration public function getFormats() { $this->UserConfig = array(); - if (!isset($this->UserConfig)) { + if (empty($this->UserConfig)) { $this->UserConfig = $this->getConfiguration("ENVIRONMENT_SETTINGS", ""); } diff --git a/workflow/engine/methods/setup/environmentSettingsAjax.php b/workflow/engine/methods/setup/environmentSettingsAjax.php index e03a107b0..d888d6159 100755 --- a/workflow/engine/methods/setup/environmentSettingsAjax.php +++ b/workflow/engine/methods/setup/environmentSettingsAjax.php @@ -5,7 +5,6 @@ * @date Sept 13th, 2010 * */ - G::LoadClass( "configuration" ); $request = isset( $_POST["request"] ) ? $_POST["request"] : (isset( $_GET["request"] ) ? $_GET["request"] : null); @@ -36,17 +35,32 @@ switch ($request) { case "save": $conf = new Configurations(); $config = $conf->getConfiguration("ENVIRONMENT_SETTINGS", "" ); - $config['format'] = $_POST["userFormat"]; - $config['dateFormat'] = $_POST["dateFormat"]; + //$config['format'] = $_POST["userFormat"]; + if (isset($_POST["userFormat"])) { + $config['format'] = $_POST["userFormat"]; + } + //$config['dateFormat'] = $_POST["dateFormat"]; + if (isset($_POST["dateFormat"])) { + $config['dateFormat'] = $_POST["dateFormat"]; + } $config['startCaseHideProcessInf'] = ((isset( $_POST["hideProcessInf"] )) ? true : false); - $config['casesListDateFormat'] = $_POST["casesListDateFormat"]; - $config['casesListRowNumber'] = intval( $_POST["casesListRowNumber"] ); - $config['casesListRefreshTime'] = intval( $_POST["txtCasesRefreshTime"]); + //$config['casesListDateFormat'] = $_POST["casesListDateFormat"]; + if (isset($_POST["casesListDateFormat"])) { + $config['casesListDateFormat'] = $_POST["casesListDateFormat"]; + } + //$config['casesListRowNumber'] = intval( $_POST["casesListRowNumber"] ); + if (isset($_POST["casesListDateFormat"])) { + $config['casesListRowNumber'] = intval( $_POST["casesListRowNumber"] ); + } + //$config['casesListRefreshTime'] = intval( $_POST["txtCasesRefreshTime"]); + if (isset($_POST["txtCasesRefreshTime"])) { + $config['casesListRefreshTime'] = intval( $_POST["txtCasesRefreshTime"]); + } $conf->aConfig = $config; $conf->saveConfig( "ENVIRONMENT_SETTINGS", "" ); - G::auditLog("UpdateEnvironmentSettings", "UserNameDisplayFormat -> ".$_POST["userFormat"].", GlobalDateFormat -> ".$_POST["dateFormat"].", HideProcessInformation -> ".(string)isset($_POST["hideProcessInf"]).", DateFormat -> ".$_POST["casesListDateFormat"].", NumberOfRowsPerPage -> ".$_POST["casesListRowNumber"].", RefreshTimeSeconds -> ".$_POST["txtCasesRefreshTime"]); + G::auditLog("UpdateEnvironmentSettings", "UserNameDisplayFormat -> ".isset($_POST["userFormat"]).", GlobalDateFormat -> ".isset($_POST["dateFormat"]).", HideProcessInformation -> ".(string)isset($_POST["hideProcessInf"]).", DateFormat -> ".isset($_POST["casesListDateFormat"]).", NumberOfRowsPerPage -> ".isset($_POST["casesListRowNumber"]).", RefreshTimeSeconds -> ".isset($_POST["txtCasesRefreshTime"])); $response = new stdclass(); $response->success = true; From 9f8be84cae67036890c22b4b3b54f2e6706eea1f Mon Sep 17 00:00:00 2001 From: dheeyi Date: Wed, 11 Feb 2015 17:33:48 -0400 Subject: [PATCH 014/155] PM-1399 En la configuracion de "Enviroment" no se aplica el formato para el User Name. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Causa. Esto fue debido a los siguientes motivos. Inicialmente si funcionaba... se realizo un leve cambio parecida a la siguiente instrucció $this->UserConfig = array(); /* Esto no existia en un principio y la logica de funcionamiento era el correcto*/ if (!isset($this->UserConfig)) { $this->UserConfig = $this->getConfiguration("ENVIRONMENT_SETTINGS", ""); } Sin enbargo al adicionar esa linea(Motivo Warnings de PHP), el if que se menciona tubo otra logica de trabajo es por eso que no se reflejaba los cambios realizados por el usuario. Solució Lo que se realizo fue cambiar la instruccion isset por empty, de la siguiente manera. if (empty($this->UserConfig)) { $this->UserConfig = $this->getConfiguration("ENVIRONMENT_SETTINGS", ""); } Con esto fue resuelto el error. Nota.- A medida que se corrigio este error, tambien fue corregido los Notices PHP generados(Index Indefinido) y asi tener mas limpio el codigo. Ejem. Estado Inicial >> $config['format'] = $_POST["userFormat"]; Estado final >> if (isset($_POST["dateFormat"])) { $config['dateFormat'] = $_POST["dateFormat"]; } --- .../engine/methods/setup/environmentSettingsAjax.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/workflow/engine/methods/setup/environmentSettingsAjax.php b/workflow/engine/methods/setup/environmentSettingsAjax.php index d888d6159..e953e51de 100755 --- a/workflow/engine/methods/setup/environmentSettingsAjax.php +++ b/workflow/engine/methods/setup/environmentSettingsAjax.php @@ -35,24 +35,19 @@ switch ($request) { case "save": $conf = new Configurations(); $config = $conf->getConfiguration("ENVIRONMENT_SETTINGS", "" ); - //$config['format'] = $_POST["userFormat"]; if (isset($_POST["userFormat"])) { $config['format'] = $_POST["userFormat"]; - } - //$config['dateFormat'] = $_POST["dateFormat"]; + } if (isset($_POST["dateFormat"])) { $config['dateFormat'] = $_POST["dateFormat"]; } $config['startCaseHideProcessInf'] = ((isset( $_POST["hideProcessInf"] )) ? true : false); - //$config['casesListDateFormat'] = $_POST["casesListDateFormat"]; if (isset($_POST["casesListDateFormat"])) { $config['casesListDateFormat'] = $_POST["casesListDateFormat"]; - } - //$config['casesListRowNumber'] = intval( $_POST["casesListRowNumber"] ); + } if (isset($_POST["casesListDateFormat"])) { $config['casesListRowNumber'] = intval( $_POST["casesListRowNumber"] ); } - //$config['casesListRefreshTime'] = intval( $_POST["txtCasesRefreshTime"]); if (isset($_POST["txtCasesRefreshTime"])) { $config['casesListRefreshTime'] = intval( $_POST["txtCasesRefreshTime"]); } From 9035a71c2b8b67e7dbbf877d3743d352033554a9 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Wed, 11 Feb 2015 17:45:00 -0400 Subject: [PATCH 015/155] I corrected with some changes --- workflow/engine/methods/cases/cases_Open.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/methods/cases/cases_Open.php b/workflow/engine/methods/cases/cases_Open.php index 422336fbd..eaba5b836 100755 --- a/workflow/engine/methods/cases/cases_Open.php +++ b/workflow/engine/methods/cases/cases_Open.php @@ -77,7 +77,7 @@ try { $aFields = $oCase->loadCase( $sAppUid, $iDelIndex ); // g::pr($aFields); // die; - if( !isset($_SESSION['CURRENT_TASK']) || $_SESSION['CURRENT_TASK']==''){ + if (!isset($_SESSION['CURRENT_TASK']) && $_SESSION['CURRENT_TASK'] != ''){ $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; } switch ($aFields['APP_STATUS']) { From 632f199d841cbd11729ca7df7a60573257462bc5 Mon Sep 17 00:00:00 2001 From: "marcelo.cuiza" Date: Thu, 12 Feb 2015 10:05:30 -0400 Subject: [PATCH 016/155] PM-1497 0016743: Apostrofe en direccion de correos genera error Se agrego a la validacion en las expresiones regulares el caracter de apostrofe, teniendo como resultado el envio de email con estado "sent" ya sea por trigger, cases notes o task notifications. --- workflow/engine/classes/class.spool.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow/engine/classes/class.spool.php b/workflow/engine/classes/class.spool.php index c524d25bd..45f523e64 100755 --- a/workflow/engine/classes/class.spool.php +++ b/workflow/engine/classes/class.spool.php @@ -86,8 +86,8 @@ class spoolRun $this->ExceptionCode['WARNING'] = 2; $this->ExceptionCode['NOTICE'] = 3; - $this->longMailEreg = '/(.*)(<([\w\-\.]+@[\w\-_\.]+\.\w{2,5})+>)/'; - $this->mailEreg = '/^([\w\-_\.]+@[\w\-_\.]+\.\w{2,5}+)$/'; + $this->longMailEreg = "/(.*)(<([\w\-\.']+@[\w\-_\.]+\.\w{2,5})+>)/"; + $this->mailEreg = "/^([\w\-_\.']+@[\w\-_\.]+\.\w{2,5}+)$/"; } /** @@ -289,7 +289,7 @@ class spoolRun */ private function handleFrom () { - $eregA = "/^.*@.*$/"; + $eregA = "/^'.*@.*$/"; if (strpos( $this->fileData['from'], '<' ) !== false) { //to validate complex email address i.e. Erik A. O From e93224646902c2c8c94c616f0ea2cb709a3b4af8 Mon Sep 17 00:00:00 2001 From: dheeyi Date: Thu, 12 Feb 2015 13:07:01 -0400 Subject: [PATCH 017/155] =?UTF-8?q?Causa:=20Esto=20fue=20debido=20a=20los?= =?UTF-8?q?=20siguientes=20motivos,inicialmente=20si=20funcionaba...=20se?= =?UTF-8?q?=20realizo=20un=20leve=20=20cambio=20parecida=20a=20la=20siguie?= =?UTF-8?q?nte=20instrucci=C3=B3=20=20=20=20=20$this->UserConfig=20=3D=20a?= =?UTF-8?q?rray();=20/*=20Esto=20no=20existia=20en=20un=20principio=20y=20?= =?UTF-8?q?la=20logica=20de=20funcionamiento=20era=20el=20correcto*/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if (!isset($this->UserConfig)) { $this->UserConfig = $this->getConfiguration("ENVIRONMENT_SETTINGS", ""); } Sin enbargo al adicionar esa linea(Motivo Warnings de PHP), el if que se menciona tubo otra logica de trabajo es por eso que no se reflejaba los cambios realizados por el usuario. SolucióLo que se realizo fue cambiar la instruccion isset por empty, de la siguiente manera. if (empty($this->UserConfig)) { $this->UserConfig = $this->getConfiguration("ENVIRONMENT_SETTINGS", ""); } Con esto fue resuelto el error. Nota.- A medida que se corrigio este error, tambien fue corregido los Notices PHP generados(Index Indefinido) y asi tener mas limpio el codigo. Ejem. Estado Inicial >> $config['format'] = $_POST["userFormat"]; Estado final >> if (isset($_POST["dateFormat"])) { $config['dateFormat'] = $_POST["dateFormat"]; } --- workflow/engine/classes/class.configuration.php | 4 +++- workflow/engine/methods/setup/environmentSettingsAjax.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/workflow/engine/classes/class.configuration.php b/workflow/engine/classes/class.configuration.php index 917c260ba..16c44cf0e 100755 --- a/workflow/engine/classes/class.configuration.php +++ b/workflow/engine/classes/class.configuration.php @@ -373,7 +373,9 @@ class Configurations // extends Configuration */ public function getFormats() { - $this->UserConfig = array(); + if (!isset($this->UserConfig)) { + $this->UserConfig = array(); + } if (empty($this->UserConfig)) { $this->UserConfig = $this->getConfiguration("ENVIRONMENT_SETTINGS", ""); } diff --git a/workflow/engine/methods/setup/environmentSettingsAjax.php b/workflow/engine/methods/setup/environmentSettingsAjax.php index e953e51de..553e09a43 100755 --- a/workflow/engine/methods/setup/environmentSettingsAjax.php +++ b/workflow/engine/methods/setup/environmentSettingsAjax.php @@ -55,7 +55,7 @@ switch ($request) { $conf->aConfig = $config; $conf->saveConfig( "ENVIRONMENT_SETTINGS", "" ); - G::auditLog("UpdateEnvironmentSettings", "UserNameDisplayFormat -> ".isset($_POST["userFormat"]).", GlobalDateFormat -> ".isset($_POST["dateFormat"]).", HideProcessInformation -> ".(string)isset($_POST["hideProcessInf"]).", DateFormat -> ".isset($_POST["casesListDateFormat"]).", NumberOfRowsPerPage -> ".isset($_POST["casesListRowNumber"]).", RefreshTimeSeconds -> ".isset($_POST["txtCasesRefreshTime"])); + G::auditLog("UpdateEnvironmentSettings", "UserNameDisplayFormat -> ".(isset($_POST["userFormat"]) ? $_POST["userFormat"] : '').", GlobalDateFormat -> ".(isset($_POST["dateFormat"]) ? $_POST["dateFormat"] : '').", HideProcessInformation -> ".(string)isset($_POST["hideProcessInf"]).", DateFormat -> ".(isset($_POST["casesListDateFormat"]) ? $_POST["casesListDateFormat"] : '').", NumberOfRowsPerPage -> ".(isset($_POST["casesListRowNumber"]) ? $_POST["casesListRowNumber"] : '').", RefreshTimeSeconds -> ".(isset($_POST["txtCasesRefreshTime"]) ? $_POST["txtCasesRefreshTime"] : '')); $response = new stdclass(); $response->success = true; From c9a62416bdf02075abf82a1960c863663e97e483 Mon Sep 17 00:00:00 2001 From: dheeyi Date: Thu, 12 Feb 2015 14:08:49 -0400 Subject: [PATCH 018/155] =?UTF-8?q?PM-1378=20Cuando=20se=20pierde=20la=20s?= =?UTF-8?q?esi=C3=B3n=20el=20Case=20Tacker=20se=20lanza=20un=20Runtime=20E?= =?UTF-8?q?rror=20que=20indica=20"the=20row=20''=20in=20table=20CASE=5FTRA?= =?UTF-8?q?CKER=20doesn't=20exist!.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Causa. Este tipo de error es generado por lo general cuando hacemos inicio de sesiones dobles desde un mismo navegador(Chrome, Firefox or IE) a un mismo server. Es decir en este caso asumo que se tenia abierto processamker(admin), y paralelamente en otro tab se tenia abierto Tracker. Lo cual acasiono que de alguna u otra manera se pisaran las sesiones. SolucióNo abrir dos sesiones haciendo llamada a un mismo server. Ademas si adiciono una nueva validacion. if (! isset( $_SESSION['PROCESS'] ) || ! isset( $_SESSION['APPLICATION'] ) ) { G::header( 'location: login' ); } --- workflow/engine/methods/tracker/tracker_DynaDocs.php | 12 ++++++------ workflow/engine/methods/tracker/tracker_History.php | 12 ++++++------ workflow/engine/methods/tracker/tracker_Messages.php | 12 ++++++------ workflow/engine/methods/tracker/tracker_ViewMap.php | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/workflow/engine/methods/tracker/tracker_DynaDocs.php b/workflow/engine/methods/tracker/tracker_DynaDocs.php index f41f847b0..5d8280d06 100755 --- a/workflow/engine/methods/tracker/tracker_DynaDocs.php +++ b/workflow/engine/methods/tracker/tracker_DynaDocs.php @@ -22,13 +22,13 @@ * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ -/* - * dynaforms & documents for Case Tracker - * - * @author Everth S. Berrios Morales - * +/* + * dynaforms & documents for Case Tracker + * + * @author Everth S. Berrios Morales + * */ -if (! isset( $_SESSION['PROCESS'] )) { +if (! isset( $_SESSION['PROCESS'] ) || ! isset( $_SESSION['APPLICATION'] )) { G::header( 'location: login' ); } $G_MAIN_MENU = 'caseTracker'; diff --git a/workflow/engine/methods/tracker/tracker_History.php b/workflow/engine/methods/tracker/tracker_History.php index 22154d040..b81c5a37f 100755 --- a/workflow/engine/methods/tracker/tracker_History.php +++ b/workflow/engine/methods/tracker/tracker_History.php @@ -22,13 +22,13 @@ * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ -/* - * Hystory case for Case Tracker - * - * @author Everth S. Berrios Morales - * +/* + * Hystory case for Case Tracker + * + * @author Everth S. Berrios Morales + * */ -if (! isset( $_SESSION['PROCESS'] )) { +if (! isset( $_SESSION['PROCESS'] ) || ! isset( $_SESSION['APPLICATION'] ) ) { G::header( 'location: login' ); } diff --git a/workflow/engine/methods/tracker/tracker_Messages.php b/workflow/engine/methods/tracker/tracker_Messages.php index 547514d11..8c7652d3a 100755 --- a/workflow/engine/methods/tracker/tracker_Messages.php +++ b/workflow/engine/methods/tracker/tracker_Messages.php @@ -22,13 +22,13 @@ * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ -/* - * History messages for Case Tracker - * - * @author Everth S. Berrios Morales - * +/* + * History messages for Case Tracker + * + * @author Everth S. Berrios Morales + * */ -if (! isset( $_SESSION['PROCESS'] )) { +if (! isset( $_SESSION['PROCESS'] ) || ! isset( $_SESSION['APPLICATION'] )) { G::header( 'location: login' ); } $G_MAIN_MENU = 'caseTracker'; diff --git a/workflow/engine/methods/tracker/tracker_ViewMap.php b/workflow/engine/methods/tracker/tracker_ViewMap.php index 34e2eae52..b3dff829b 100755 --- a/workflow/engine/methods/tracker/tracker_ViewMap.php +++ b/workflow/engine/methods/tracker/tracker_ViewMap.php @@ -29,7 +29,7 @@ * */ require_once 'classes/model/Process.php'; -if (! isset( $_SESSION['PROCESS'] )) { +if (! isset( $_SESSION['PROCESS'] ) || ! isset( $_SESSION['APPLICATION'] )) { G::header( 'location: login' ); } $G_MAIN_MENU = 'caseTracker'; From 803599d729739f92015e168f6bd788faa2c76722 Mon Sep 17 00:00:00 2001 From: dheeyi Date: Thu, 12 Feb 2015 15:04:14 -0400 Subject: [PATCH 019/155] PM-1408 No se muestran los triggers en el debug de un caso cuando el proceso es importado MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Causa. Este tipo de error es generado cuando se tiene PHP5.4(object from empty value) o en su caso cuando se hace una actualizacióe PHP5.3 a PHP5.4 SolucióEs necesario crear una clase PHP de tipo Object y vacia. Esto debido a que a este objeto vacio se añra nuevas propiedades(nuestras necesidades). Vease ejemplo siguiente. $myObject = new StdClass(); $myObject->total = count( $triggersList ); $myObject->data = $triggersList; --- workflow/engine/methods/cases/debug_triggers.php | 1 + 1 file changed, 1 insertion(+) diff --git a/workflow/engine/methods/cases/debug_triggers.php b/workflow/engine/methods/cases/debug_triggers.php index f8b372388..ba78fe0ff 100755 --- a/workflow/engine/methods/cases/debug_triggers.php +++ b/workflow/engine/methods/cases/debug_triggers.php @@ -62,6 +62,7 @@ foreach ($DEBUG_ERRORS as $error) { ]}'; */ +$triggersRet = new StdClass(); $triggersRet->total = count( $triggersList ); $triggersRet->data = $triggersList; echo G::json_encode( $triggersRet ); From c993bd00f265687bc09bdde9eb0b685a41d4dc3e Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Thu, 12 Feb 2015 15:56:30 -0400 Subject: [PATCH 020/155] I completed the issue PM-1588 [Audit log by Forms] --- .../engine/classes/class.dynaformEditor.php | 1962 +++++++++-------- workflow/engine/classes/model/Dynaform.php | 27 +- 2 files changed, 1037 insertions(+), 952 deletions(-) diff --git a/workflow/engine/classes/class.dynaformEditor.php b/workflow/engine/classes/class.dynaformEditor.php index 2499b60f1..f59ae7c9d 100755 --- a/workflow/engine/classes/class.dynaformEditor.php +++ b/workflow/engine/classes/class.dynaformEditor.php @@ -1,950 +1,1012 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ -/** - * Created on 21/12/2007 - * Dynaform - Dynaform class - * - * @copyright 2007 COLOSA - * @author David Callizaya - */ -G::LoadSystem("webResource"); -G::LoadClass('toolBar'); -G::LoadClass('dynaFormField'); -require_once ('classes/model/Process.php'); -require_once ('classes/model/Dynaform.php'); -G::LoadClass('xmlDb'); -G::LoadSystem('dynaformhandler'); - -/** - * - * @package workflow.engine.classes - */ -class dynaformEditor extends WebResource -{ - - private $isOldCopy = false; - public $file = ''; - public $title = 'New Dynaform'; - public $dyn_uid = ''; - public $dyn_type = ''; - public $home = ''; - - /** - * Other Options for Editor: - * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))', - * top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', - * height: '3/4*(document.body.clientWidth-getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))*2)', - * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))' - * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))' - * - * Other Options for Toolbar: - * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))', - * top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', - */ - public $defaultConfig = array('Editor' => array('left' => '0', 'top' => '0', 'width' => 'document.body.clientWidth-4', 'height' => 'document.body.clientHeight-4'), - 'Toolbar' => array('left' => 'document.body.clientWidth-2-toolbar.clientWidth-24-3+7', 'top' => '52'), - 'FieldsList' => array('left' => '4+toolbar.clientWidth+24', 'top' => 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', 'width' => 244, 'height' => 400) - ); - public $panelConf = array('style' => array('title' => array('textAlign' => 'center')), - 'width' => 700, 'height' => 600, 'tabWidth' => 120, 'modal' => true, 'drag' => false, 'resize' => false, 'blinkToFront' => false - ); - - /** - * Constructor of the class dynaformEditor - * - * @param string $get - * @return void - */ - public function dynaformEditor($get) - { - $this->panelConf = array_merge($this->panelConf, $this->defaultConfig['Editor']); - //'title' => G::LoadTranslation('ID_DYNAFORM_EDITOR').' - ['.$this->title.']', - } - - /** - * Create the xml form default - * - * @param string $filename - * @return void - */ - public function _createDefaultXmlForm($fileName) - { - //Create the default Dynaform - $sampleForm = '' . "\n"; - $sampleForm .= '' . "\n"; - switch ($this->dyn_type) { - case "xmlform": - /* $sampleForm.='' . "\n" . - ' <en>Sample form</en>' . "\n" . - ''."\n"; - $sampleForm.='' . "\n" . - ' Submit' . "\n" . - ''."\n"; */ - break; - case "grid": - /* $sampleForm.='' . "\n" . - 'A' . "\n" . - ''."\n"; - $sampleForm.='' . "\n" . - 'B' . "\n" . - ''."\n"; */ - break; - } - $sampleForm .= ''; - G::verifyPath(dirname($fileName), true); - $fp = fopen($fileName, 'w'); - $sampleForm = str_replace('name=""', 'name="' . $this->_getFilename($this->file) . '"', $sampleForm); - fwrite($fp, $sampleForm); - fclose($fp); - } - - /** - * Prints the DynaformEditor - * - * @return void - */ - public function _render() - { - global $G_PUBLISH; - $script = ''; - - /* Start Block: Load (Create if doesn't exist) the xmlform */ - $Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($this->file, URL_KEY), 'DYN_UID' => $this->dyn_uid, 'PRO_UID' => $this->pro_uid, 'DYNAFORM_NAME' => $this->dyn_title, 'FILE' => $this->file, 'DYN_EDITOR' => $this->dyn_editor - ); - $_SESSION['Current_Dynafom']['Parameters'] = $Parameters; - - $XmlEditor = array('URL' => G::encrypt($this->file, URL_KEY), 'XML' => '' //$openDoc->getXml() - ); - $JSEditor = array('URL' => G::encrypt($this->file, URL_KEY) - ); - - $A = G::encrypt($this->file, URL_KEY); - - try { - $openDoc = new Xml_Document(); - $fileName = $this->home . $this->file . '.xml'; - if (file_exists($fileName)) { - $openDoc->parseXmlFile($fileName); - } else { - $this->_createDefaultXmlForm($fileName); - $openDoc->parseXmlFile($fileName); - } - //$form = new Form( $this->file , $this->home, SYS_LANG, true ); - $Properties = dynaformEditorAjax::get_properties($A, $this->dyn_uid); - /* Start Block: Prepare the XMLDB connection */ - define('DB_XMLDB_HOST', PATH_DYNAFORM . $this->file . '.xml'); - define('DB_XMLDB_USER', ''); - define('DB_XMLDB_PASS', ''); - define('DB_XMLDB_NAME', ''); - define('DB_XMLDB_TYPE', 'myxml'); - /* Start Block: Prepare the dynaformEditor */ - $G_PUBLISH = new Publisher(); - $sName = 'dynaformEditor'; - $G_PUBLISH->publisherId = $sName; - $oHeadPublisher = & headPublisher::getSingleton(); - $oHeadPublisher->setTitle(G::LoadTranslation('ID_DYNAFORM_EDITOR') . ' - ' . $Properties['DYN_TITLE']); - $G_PUBLISH->AddContent('blank'); - $this->panelConf['title'] = ''; - $G_PUBLISH->AddContent('panel-init', 'mainPanel', $this->panelConf); - if ($Properties['DYN_TYPE'] == 'xmlform') { - $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', ''); - } else { - $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', ''); - } - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', 'display:none', $Parameters, '', ''); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', 'display:none', $XmlEditor, '', ''); - $G_PUBLISH->AddContent('blank'); - $i = 0; - $aFields = array(); - $aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char' - ); - $oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $this->file . '.xml', '', '', '', 'myxml')); - $oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"'); - $iMaximun = $oDataset->count(); - while ($aRow = $oDataset->Read()) { - $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => ($i > 0 ? G::LoadTranslation('ID_UP') : ''), 'DOWN' => ($i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : ''), 'row__' => ($i + 1) - ); - $i++; - break; - } - global $_DBArray; - $_DBArray['fields'] = $aFields; - $_SESSION['_DBArray'] = $_DBArray; - G::LoadClass('ArrayPeer'); - $oCriteria = new Criteria('dbarray'); - $oCriteria->setDBArrayTable('fields'); - /** - * *@Erik-> this is deprecated,. - * (unuseful) $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/fields_List', $oCriteria, $Parameters, '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');** - */ - $G_PUBLISH->AddContent('blank'); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', 'display:none', $JSEditor, '', ''); - } catch (Exception $e) { - - } - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', 'display:none', $Properties, '', ''); - //for showHide tab option @Neyek - $G_PUBLISH->AddContent('blank'); - $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PREVIEW"), $sName . '[3]', 'dynaformEditor.changeToPreview', 'dynaformEditor.saveCurrentView'); - $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_XML"), $sName . '[4]', 'dynaformEditor.changeToXmlCode', 'dynaformEditor.saveCurrentView'); - if ($Properties['DYN_TYPE'] != 'grid') { - $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_HTML"), $sName . '[5]', 'dynaformEditor.changeToHtmlCode', 'dynaformEditor.saveCurrentView'); - } - $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_FIELDS_LIST"), $sName . '[6]', 'dynaformEditor.changeToFieldsList', 'dynaformEditor.saveCurrentView'); - if ($Properties["DYN_TYPE"] != "grid") { - $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView'); - } - $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PROPERTIES"), $sName . '[8]', 'dynaformEditor.changeToProperties', 'dynaformEditor.saveCurrentView'); - - //for showHide tab option @Neyek - if ($Properties["DYN_TYPE"] != "grid") { - $G_PUBLISH->AddContent("panel-tab", G::LoadTranslation("ID_CONDITIONS_EDITOR"), $sName . "[9]", "dynaformEditor.changeToShowHide", "dynaformEditor.saveShowHide"); - } - - $G_PUBLISH->AddContent('panel-close'); - $oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js",2); - $oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js'); - //$oHeadPublisher->addScriptFile('/js/dveditor/core/dveditor.js'); - //$oHeadPublisher->addScriptFile('/codepress/codepress.js',1); - - $oHeadPublisher->addScriptFile('/js/codemirrorOld/js/codemirror.js',1); - - $oHeadPublisher->addScriptFile('/js/grid/core/grid.js'); - $oHeadPublisher->addScriptCode(' - var DYNAFORM_URL="' . $Parameters['URL'] . '"; - leimnud.event.add(window,"load",function(){ loadEditor(); }); - '); - $oHeadPublisher->addScriptCode(' var jsMeta;var __usernameLoggedDE__ = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";var __DYN_UID__ = "' . $this->dyn_uid . '";'); - - $arrayParameterAux = $Parameters; - $arrayParameterAux["DYNAFORM_NAME"] = base64_encode($arrayParameterAux["DYNAFORM_NAME"]); - $oHeadPublisher->addScriptCode('var dynaformEditorParams = \'' . serialize($arrayParameterAux) . '\';'); - - G::RenderPage("publish", 'blank'); - } - - /** - * Get the filename - * - * @param string $file - * @return string - */ - public function _getFilename($file) - { - return (strcasecmp(substr($file, - 5), '_tmp0') == 0) ? substr($file, 0, strlen($file) - 5) : $file; - } - - /** - * Set the temporal copy - * - * @param string $onOff - * @return void - */ - public function _setUseTemporalCopy($onOff) - { - $file = self::_getFilename($this->file); - if ($onOff) { - $this->file = $file . '_tmp0'; - self::_setTmpData(array('useTmpCopy' => true )); - if (!file_exists(PATH_DYNAFORM . $file . '.xml')) { - $this->_createDefaultXmlForm(PATH_DYNAFORM . $file . '.xml'); - } - //Creates a copy if it doesn't exist, else, use the old copy - if (!file_exists(PATH_DYNAFORM . $this->file . '.xml')) { - self::_copyFile(PATH_DYNAFORM . $file . '.xml', PATH_DYNAFORM . $this->file . '.xml'); - } - if (!file_exists(PATH_DYNAFORM . $this->file . '.html') && file_exists(PATH_DYNAFORM . $file . '.html')) { - self::_copyFile(PATH_DYNAFORM . $file . '.html', PATH_DYNAFORM . $this->file . '.html'); - } - } else { - $this->file = $file; - self::_setTmpData(array()); - } - } - - /** - * Set temporal data - * - * @param $data - * @return void - */ - public function _setTmpData($data) - { - G::verifyPath(PATH_C . 'dynEditor/', true); - $fp = fopen(PATH_C . 'dynEditor/' . session_id() . '.php', 'w'); - fwrite($fp, '$tmpData=unserialize(\'' . addcslashes(serialize($data), '\\\'') . '\');'); - fclose($fp); - } - - /** - * Get temporal data - * - * @param string $filename - * @return array - */ - public function _getTmpData() - { - $tmpData = array(); - $file = PATH_C . 'dynEditor/' . session_id() . '.php'; - if (file_exists($file)) { - eval(implode('', file($file))); - } - return $tmpData; - } - - /** - * Copy files - * - * @param file $from - * @param file $to - * @return void - */ - public function _copyFile($from, $to) - { - $copy = implode('', file($from)); - $fcopy = fopen($to, "w"); - fwrite($fcopy, $copy); - fclose($fcopy); - } -} - -interface iDynaformEditorAjax -{ - //public function render_preview($A); -} - -/** - * DynaformEditorAjax - DynaformEditorAjax class - * - * @package workflow.engine.classes - */ -class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax -{ - - /** - * Constructor of the class dynaformEditorAjax - * - * @param var $post - * @return void - */ - public function dynaformEditorAjax($post) - { - $this->_run($post); - } - - /** - * Function Run - * - * @param var $post - * @return void - */ - public function _run($post) - { - WebResource::WebResource($_SERVER['REQUEST_URI'], $post); - } - - /** - * Prints the DynaformEditorAjax - * - * @param object $A - * @return ob_get_clean - */ - public function render_preview($A) - { - ob_start(); - $file = G::decrypt($A, URL_KEY); - global $G_PUBLISH; - $G_PUBLISH = new Publisher(); - $G_PUBLISH->publisherId = 'preview'; - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true, $G_PUBLISH->publisherId); - switch (basename($form->template, '.html')) { - case 'grid': - $template = 'grid'; - $aAux = array_keys($form->fields); - if (count($aAux) > 0) { - $aFields = (array_combine($aAux, $aAux)); - } else { - $aFields = $aAux; - } - if (is_array($aFields)) { - foreach ($aFields as $key => $val) { - $aFields[$key] = array(1 => "", 2 => "", 3 => "", 4 => "", 5 => ""); - } - } - break; - default: - $template = 'xmlform_' . $G_PUBLISH->publisherId; - $aFields = array('__DYNAFORM_OPTIONS' => array('PREVIOUS_STEP' => '#', 'NEXT_STEP' => '#', 'NEXT_STEP_LABEL' => G::loadTranslation('ID_NEXT_STEP'), 'PREVIOUS_ACTION' => 'return false;', 'NEXT_ACTION' => 'return false;' - ) - ); - } - $G_PUBLISH->AddContent('dynaform', $template, $file, '', $aFields, ''); - G::RenderPage('publish', 'raw'); - return ob_get_clean(); - } - - /** - * Prints the Dynaform in format HTML - * - * @param object $A - * @return array - */ - public function render_htmledit($A) - { - $script = ''; - $file = G::decrypt($A, URL_KEY); - ob_start(); - global $G_PUBLISH; - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - $G_PUBLISH = new Publisher(); - $G_PUBLISH->publisherId = ''; - $html = $this->get_htmlcode($A); - if (!is_string($html)) { - $error = $html; - $html = ''; - } else { - $error = 0; - } - $HtmlEditor = array('URL' => $A, 'HTML' => $html, 'DYN_UID' => $file ); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_HtmlEditor', '', $HtmlEditor, '', ''); - G::RenderPage("publish", 'raw'); - return array('error' => $error, 'html' => ob_get_clean() - ); - } - - /** - * Get the html code - * Loads the stored HTML or the default Template if - * it doesn't exist. - * - * @param object $A - * @return code html - */ - public function get_htmlcode($A) - { - try { - $script = null; - $fileTmp = G::decrypt($A, URL_KEY); - $form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true); - - //Navigation Bar - $form->fields = G::array_merges(array("__DYNAFORM_OPTIONS" => new XmlForm_Field_XmlMenu(new Xml_Node("__DYNAFORM_OPTIONS", "complete", "", array("type" => "xmlmenu", "xmlfile" => "gulliver/dynaforms_Options" - )), SYS_LANG, PATH_XMLFORM, $form) - ), $form->fields); - - //Loads the stored HTML or the default Template if - //it doesn't exist. - $filename = substr($form->fileName, 0, - 3) . ($form->type === "xmlform" ? "" : "." . $form->type) . "html"; - - if (!file_exists($filename)) { - $html = $form->printTemplate($form->template, $script); - } else { - $html = implode("", file($filename)); - } - - /* - * It adds the new fields automatically at the bottom of the form. - * TODO: �TOP OR BOTTOM? - * Improving detection algorithm of new fields. - * Current: Do not check the fields that have already been reviewed (saving) - * Already checked the temporary file dynaforms editor. - */ - $tmp = self::_getTmpData(); - if (!isset($tmp['OLD_FIELDS'])) { - $tmp['OLD_FIELDS'] = array(); //var_dump($html);die; - } - $aAux = explode('', $html); - foreach ($form->fields as $field) { - if ((strpos($html, '{$form.' . $field->name . '}') === false) && (strpos($html, '{$' . $field->name . '}') === false)) { - //Aparantly is new (but could be a deleted or non visible like private type fields) - switch (strtolower($field->type)) { - case 'private': - case 'phpvariable': - break; - default: - if (array_search($field->name, $tmp['OLD_FIELDS']) === false) { - //TOP - $aAux[0] .= '
{$' . $field->name . '}' . '{$form.' . $field->name . '}'; - //$html.='
{$'.$field->name.'}'.'{$form.'.$field->name.'}'; - //BOTTOM - //$html='{$'.$field->name.'}'.'{$form.'.$field->name.'}'.$html; - //$tmp['OLD_FIELDS'][]=$field->name; - } - } - } - } - self::_setTmpData($tmp); - //$html=str_replace('{$form_className}','formDefault', $html ); - $html = str_replace('{$form_className}', 'formDefault', $aAux[0] . ''); - - return $html; - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Restore the html code - * - * @param object $A - * @return code html - */ - public function restore_html($A) - { - $script = null; - $fileTmp = G::decrypt($A, URL_KEY); - $form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true); - - //Navigation Bar - $form->fields = G::array_merges(array("__DYNAFORM_OPTIONS" => new XmlForm_Field_XmlMenu(new Xml_Node("__DYNAFORM_OPTIONS", "complete", "", array("type" => "xmlmenu", "xmlfile" => "gulliver/dynaforms_Options" - )), SYS_LANG, PATH_XMLFORM, $form) - ), $form->fields); - - $form->enableTemplate = false; - $html = $form->printTemplate($form->template, $script); - $html = str_replace('{$form_className}', 'formDefault', $html); - if (file_exists(PATH_DYNAFORM . $fileTmp . '.html')) { - unlink(PATH_DYNAFORM . $fileTmp . '.html'); - } - $fp = fopen(PATH_DYNAFORM . $fileTmp . '.html', 'w'); - fwrite($fp, $html); - fclose($fp); - - return $html; - } - - /** - * Set the html code - * - * @param object $A - * @return array - */ - public function set_htmlcode($A, $htmlcode) - { - try { - $iOcurrences = preg_match_all('/\{\$.*?\}/im', $htmlcode, $matches); - if ($iOcurrences) { - if (isset($matches[0])) { - $tagsHtml = $matches[0]; - foreach ($tagsHtml as $value) { - $aTagVar = strip_tags($value); - if ($value != $aTagVar) { - $htmlcode = str_replace($value, $aTagVar, $htmlcode); - } - } - } - } - $file = G::decrypt($A, URL_KEY); - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - $filename = substr($form->fileName, 0, - 3) . ($form->type === 'xmlform' ? '' : '.' . $form->type) . 'html'; - $fp = fopen($filename, 'w'); - fwrite($fp, $htmlcode); - fclose($fp); - return 0; - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Get the xml code - * - * @param object $A - * @return array - */ - public function get_xmlcode($A) - { - try { - $file = G::decrypt($A, URL_KEY); - $xmlcode = implode('', file(PATH_DYNAFORM . $file . '.xml')); - return array("xmlcode" => $xmlcode, "error" => 0 - ); - } catch (Exception $e) { - return array("xmlcode" => "", "error" => (array) $e - ); - } - } - - /** - * Set the xml code - * - * @param object $A - * @param array $xmlcode - * @return string - */ - public function set_xmlcode($A, $xmlcode) - { - $xmlcode = urldecode($xmlcode); - $file = G::decrypt($A, URL_KEY); - $xmlcode = str_replace(' ', ' ', trim($xmlcode)); - $fp = fopen(PATH_DYNAFORM . $file . '.xml', 'w'); - fwrite($fp, $xmlcode); - fclose($fp); - return ""; - } - - /** - * Get the javascript code - * - * @param object $A - * @param string $fieldName - * @return array - */ - public function get_javascripts($A, $fieldName) - { - try { - $file = G::decrypt($A, URL_KEY); - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - $aOptions = array(); - $sCode = ''; - foreach ($form->fields as $name => $value) { - if (strcasecmp($value->type, "javascript") == 0) { - $aOptions[] = array('key' => $name, 'value' => $name - ); - if ($name == $fieldName) { - $sCode = $value->code; - } - } - } - return array('aOptions' => $aOptions, 'sCode' => $sCode - ); - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Set the javascript code - * - * @param object $A - * @param string $fieldName - * @param string $sCode - * @return array - */ - public function set_javascript($A, $fieldName, $sCode, $meta = '') - { - if ($fieldName == '___pm_boot_strap___') { - return 0; - } - - $sCode = urldecode($sCode); - try { - $sCode = rtrim($sCode); - $file = G::decrypt($A, URL_KEY); - /* $dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml' ,'','','','myxml' ); - $ses2 = new DBSession($dbc2); - $ses2->execute(G::replaceDataField("UPDATE dynaForm SET XMLNODE_VALUE = @@CODE WHERE XMLNODE_NAME = @@FIELDNAME ", array('FIELDNAME'=>$fieldName,'CODE'=>$sCode), "myxml" )); - */ - - G::LoadSystem('dynaformhandler'); - - $dynaform = new dynaFormHandler(PATH_DYNAFORM . "{$file}.xml"); - $dynaform->replace($fieldName, $fieldName, Array('type' => 'javascript', 'meta' => $meta, '#cdata' => $sCode - )); - - return 0; - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Get properties of the dynaForm - * - * @param file $A - * @param string $DYN_UID - * @return array - */ - public function get_properties($A, $DYN_UID) - { - $file = G::decrypt($A, URL_KEY); - $tmp = self::_getTmpData(); - if (!(isset($tmp['Properties']) && isset($tmp['useTmpCopy']))) { - $dynaform = new dynaform(); - $dynaform->load($DYN_UID); - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - $Properties = array('A' => $A, 'DYN_UID' => $dynaform->getDynUid(), 'PRO_UID' => $dynaform->getProUid(), 'DYN_TITLE' => $dynaform->getDynTitle(), 'DYN_TYPE' => $dynaform->getDynType(), 'DYN_DESCRIPTION' => $dynaform->getDynDescription(), 'WIDTH' => $form->width, - //'ENABLETEMPLATE'=> $form->enableTemplate, - 'MODE' => $form->mode, 'PRINTDYNAFORM' => $form->printdynaform, 'ADJUSTGRIDSWIDTH' => $form->adjustgridswidth, 'NEXTSTEPSAVE' => $form->nextstepsave - ); - $tmp['Properties'] = $Properties; - self::_setTmpData($tmp); - } else { - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - $Properties = $tmp['Properties']; - if (!isset($Properties['ENABLETEMPLATE'])) { - $Properties['ENABLETEMPLATE'] = "0"; - } - $Properties['WIDTH'] = $form->width; - $Properties['MODE'] = $form->mode; - } - return $Properties; - } - - /** - * Set properties of the dynaForm - * - * @param file $A - * @param string $DYN_UID - * @param array $getFields - * @return array - */ - public function set_properties($A, $DYN_UID, $getFields) - { - try { - $post = array(); - parse_str($getFields, $post); - $Fields = $post['form']; - //if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0"; - $file = G::decrypt($A, URL_KEY); - $tmp = self::_getTmpData(); - if (!isset($tmp['useTmpCopy'])) { - $dynaform = new dynaform(); - $dynaform->update($Fields); - } else { - $tmp['Properties'] = $Fields; - self::_setTmpData($tmp); - } - $dynaform = new dynaFormHandler(PATH_DYNAFORM . "{$file}.xml"); - $dbc2 = new DBConnection(PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml'); - $ses2 = new DBSession($dbc2); - //if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0"; - - /* if (isset($Fields['ENABLETEMPLATE'])) { - $ses2->execute(G::replaceDataField("UPDATE . SET ENABLETEMPLATE = @@ENABLETEMPLATE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields)); - } */ - if (isset($Fields['DYN_TYPE'])) { - //$ses2->execute( G::replaceDataField( "UPDATE . SET TYPE = @@DYN_TYPE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); - $dynaform->modifyHeaderAttribute('type', $Fields['DYN_TYPE']); - } - if (isset($Fields['WIDTH'])) { - // $ses2->execute( G::replaceDataField( "UPDATE . SET WIDTH = @@WIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); - $dynaform->modifyHeaderAttribute('width', $Fields['WIDTH']); - //g::pr($dynaform->getHeaderAttribute('width')); - } - if (isset($Fields['MODE'])) { - // $ses2->execute( G::replaceDataField( "UPDATE . SET MODE = @@MODE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); - $dynaform->modifyHeaderAttribute('mode', $Fields['MODE']); - } - if (isset($Fields['NEXTSTEPSAVE'])) { - //$ses2->execute( G::replaceDataField( "UPDATE . SET NEXTSTEPSAVE = @@NEXTSTEPSAVE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); - $dynaform->modifyHeaderAttribute('nextstepsave', $Fields['NEXTSTEPSAVE']); - } - if (isset($Fields['PRINTDYNAFORM'])) { - //$ses2->execute( G::replaceDataField( "UPDATE . SET PRINTDYNAFORM = @@PRINTDYNAFORM WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); - $dynaform->modifyHeaderAttribute('printdynaform', $Fields['PRINTDYNAFORM']); - } - if (isset($Fields['ADJUSTGRIDSWIDTH'])) { - //$ses2->execute( G::replaceDataField( "UPDATE . SET ADJUSTGRIDSWIDTH = @@ADJUSTGRIDSWIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); - $dynaform->modifyHeaderAttribute('adjustgridswidth', $Fields['ADJUSTGRIDSWIDTH']); - } - - return 0; - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Get enable template - * - * @param object $A - * @return string - */ - public function get_enabletemplate($A) - { - $file = G::decrypt($A, URL_KEY); - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - return $form->enableTemplate; - } - - /** - * Set enable template - * - * @param object $A - * @param string $value - * @return string - */ - public function set_enabletemplate($A, $value) - { - $file = G::decrypt($A, URL_KEY); - $value = $value == "1" ? "1" : "0"; - // $dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' ); - // $ses2 = new DBSession( $dbc2 ); - // $ses2->execute( "UPDATE . SET ENABLETEMPLATE = '$value'" ); - - $dynaform = new dynaFormHandler(PATH_DYNAFORM . "{$file}.xml"); - $dynaform->modifyHeaderAttribute('enabletemplate', $value); - - return $value; - } - - /** - * Save a dynaForm - * - * @param object $A - * @param string $DYN_UID - * @return array - */ - public function save($A, $DYN_UID) - { - try { - $answer = 0; - $file = G::decrypt($A, URL_KEY); - $tmp = self::_getTmpData(); - if (isset($tmp['useTmpCopy'])) { - /* Save Register */ - $dynaform = new dynaform(); - $dynaform->update($tmp['Properties']); - /* Save file */ - $copy = implode('', file(PATH_DYNAFORM . $file . '.xml')); - /* - * added by krlos carlos/a/colosa.com - * in here we are validation if a xmlform has a submit action - */ - // if (!preg_match("/type=\"submit\"/",$copy) && !preg_match("/type=\"grid\"/",$copy) && !isset($_SESSION['submitAction']) ){ - if (!preg_match("/type=\"submit\"/", $copy) && !preg_match("/type=\"grid\"/", $copy)) { - // $_SESSION['submitAction'] = 1; - $answer = 'noSub'; - } - $copyHtml = false; - if (file_exists(PATH_DYNAFORM . $file . '.html')) { - $copyHtml = implode('', file(PATH_DYNAFORM . $file . '.html')); - } - $file = dynaformEditor::_getFilename($file); - $fcopy = fopen(PATH_DYNAFORM . $file . '.xml', "w"); - fwrite($fcopy, $copy); - fclose($fcopy); - if ($copyHtml) { - $fcopy = fopen(PATH_DYNAFORM . $file . '.html', "w"); - fwrite($fcopy, $copyHtml); - fclose($fcopy); - } - } else { - //throw new Exception("It should not come here unless you have disabled the temporary copy."); - } - return $answer; - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Close a dynaform - * - * @param object $A - * @return array - */ - public function close($A) - { - try { - /* - * we are unseting this variable. It's our control about to save the xmlfrom - */ - // unset($_SESSION['submitAction']); - $file = G::decrypt($A, URL_KEY); - //return(array('response'=>PATH_DYNAFORM . $file . '.xml')); - /* Delete the temporal copy */ - $tmp = self::_getTmpData(); - $xmlFile = PATH_DYNAFORM . $file . '.xml'; - $htmlFile = PATH_DYNAFORM . $file . '.html'; - //return(array('response'=>$tmp['useTmpCopy'])); - if (isset($tmp['useTmpCopy'])) { - //return(array('response'=>PATH_DYNAFORM . $file . '.xml')); - if ($file !== dynaformEditor::_getFilename($file)) { - // return(array('response'=>PATH_DYNAFORM . $file . '.xml')); - if (file_exists($xmlFile)) { - unlink($xmlFile); - } - if (file_exists($htmlFile)) { - unlink($htmlFile); - } - } - } - return 0; - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Checks if a dynaform was changed - * - * @param file $A - * @param string $DYN_UID - * @return array - */ - public function is_modified($A, $DYN_UID) - { - $file = G::decrypt($A, URL_KEY); - try { - /* Compare Properties */ - $dynaform = new dynaform(); - $dynaform->load($DYN_UID); - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - $sp = array('A' => $A, 'DYN_UID' => $dynaform->getDynUid(), 'PRO_UID' => $dynaform->getProUid(), 'DYN_TITLE' => $dynaform->getDynTitle(), 'DYN_TYPE' => $dynaform->getDynType(), 'DYN_DESCRIPTION' => $dynaform->getDynDescription(), 'WIDTH' => $form->width, 'ENABLETEMPLATE' => $form->enableTemplate, 'MODE' => $form->mode - ); - $P = self::get_properties($A, $DYN_UID); - if (!isset($P['DYN_TITLE'])) { - $P['DYN_TITLE'] = $sp['DYN_TITLE']; - } - if (!isset($P['DYN_TYPE'])) { - $P['DYN_TYPE'] = $sp['DYN_TYPE']; - } - if (!isset($P['DYN_DESCRIPTION'])) { - $P['DYN_DESCRIPTION'] = $sp['DYN_DESCRIPTION']; - } - if (!isset($P['WIDTH'])) { - $P['WIDTH'] = $sp['WIDTH']; - } - if (!isset($P['ENABLETEMPLATE'])) { - $P['ENABLETEMPLATE'] = $sp['ENABLETEMPLATE']; - } - if (!isset($P['MODE'])) { - $P['MODE'] = $sp['MODE']; - } - $modPro = ($sp['DYN_TITLE'] != $P['DYN_TITLE']) || ($sp['DYN_TYPE'] != $P['DYN_TYPE']) || ($sp['DYN_DESCRIPTION'] != $P['DYN_DESCRIPTION']); - /* || - ($sp['WIDTH']!=$P['WIDTH']) || - ($sp['ENABLETEMPLATE']!=$P['ENABLETEMPLATE']) || - ($sp['MODE']!=$P['MODE']) */ - /* Compare copies */ - $fileOrigen = dynaformEditor::_getFilename($file); - $copy = implode('', file(PATH_DYNAFORM . $file . '.xml')); - $origen = implode('', file(PATH_DYNAFORM . $fileOrigen . '.xml')); - $copyHTML = file_exists(PATH_DYNAFORM . $file . '.html') ? implode('', file(PATH_DYNAFORM . $file . '.html')) : false; - $origenHTML = file_exists(PATH_DYNAFORM . $fileOrigen . '.html') ? implode('', file(PATH_DYNAFORM . $fileOrigen . '.html')) : false; - $modFile = ($copy !== $origen) || ($origenHTML && ($copyHTML !== $origenHTML)); - //Return - //return array("*message"=>sprintf("%s, (%s= %s %s):", $modPro?"1":"0" , $modFile?"1":"0", ($copy!==$origen)?"1":"0" , ($origenHTML && ($copyHTML!==$origenHTML))?"1":"0" )); - //die("c'est fini"); - return $modPro || $modFile; - } catch (Exception $e) { - return (array) $e; - } - } -} +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +/** + * Created on 21/12/2007 + * Dynaform - Dynaform class + * + * @copyright 2007 COLOSA + * @author David Callizaya + */ +G::LoadSystem("webResource"); +G::LoadClass('toolBar'); +G::LoadClass('dynaFormField'); +require_once ('classes/model/Process.php'); +require_once ('classes/model/Dynaform.php'); +G::LoadClass('xmlDb'); +G::LoadSystem('dynaformhandler'); + +/** + * + * @package workflow.engine.classes + */ +class dynaformEditor extends WebResource +{ + + private $isOldCopy = false; + public $file = ''; + public $title = 'New Dynaform'; + public $dyn_uid = ''; + public $dyn_type = ''; + public $home = ''; + + /** + * Other Options for Editor: + * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))', + * top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', + * height: '3/4*(document.body.clientWidth-getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))*2)', + * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))' + * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))' + * + * Other Options for Toolbar: + * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))', + * top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', + */ + public $defaultConfig = array('Editor' => array('left' => '0', 'top' => '0', 'width' => 'document.body.clientWidth-4', 'height' => 'document.body.clientHeight-4'), + 'Toolbar' => array('left' => 'document.body.clientWidth-2-toolbar.clientWidth-24-3+7', 'top' => '52'), + 'FieldsList' => array('left' => '4+toolbar.clientWidth+24', 'top' => 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', 'width' => 244, 'height' => 400) + ); + public $panelConf = array('style' => array('title' => array('textAlign' => 'center')), + 'width' => 700, 'height' => 600, 'tabWidth' => 120, 'modal' => true, 'drag' => false, 'resize' => false, 'blinkToFront' => false + ); + + /** + * Constructor of the class dynaformEditor + * + * @param string $get + * @return void + */ + public function dynaformEditor($get) + { + $this->panelConf = array_merge($this->panelConf, $this->defaultConfig['Editor']); + //'title' => G::LoadTranslation('ID_DYNAFORM_EDITOR').' - ['.$this->title.']', + } + + /** + * Create the xml form default + * + * @param string $filename + * @return void + */ + public function _createDefaultXmlForm($fileName) + { + //Create the default Dynaform + $sampleForm = '' . "\n"; + $sampleForm .= '' . "\n"; + switch ($this->dyn_type) { + case "xmlform": + /* $sampleForm.='' . "\n" . + ' <en>Sample form</en>' . "\n" . + ''."\n"; + $sampleForm.='' . "\n" . + ' Submit' . "\n" . + ''."\n"; */ + break; + case "grid": + /* $sampleForm.='' . "\n" . + 'A' . "\n" . + ''."\n"; + $sampleForm.='' . "\n" . + 'B' . "\n" . + ''."\n"; */ + break; + } + $sampleForm .= ''; + G::verifyPath(dirname($fileName), true); + $fp = fopen($fileName, 'w'); + $sampleForm = str_replace('name=""', 'name="' . $this->_getFilename($this->file) . '"', $sampleForm); + fwrite($fp, $sampleForm); + fclose($fp); + } + + /** + * Prints the DynaformEditor + * + * @return void + */ + public function _render() + { + global $G_PUBLISH; + $script = ''; + + /* Start Block: Load (Create if doesn't exist) the xmlform */ + $Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($this->file, URL_KEY), 'DYN_UID' => $this->dyn_uid, 'PRO_UID' => $this->pro_uid, 'DYNAFORM_NAME' => $this->dyn_title, 'FILE' => $this->file, 'DYN_EDITOR' => $this->dyn_editor + ); + $_SESSION['Current_Dynafom']['Parameters'] = $Parameters; + + $XmlEditor = array('URL' => G::encrypt($this->file, URL_KEY), 'XML' => '' //$openDoc->getXml() + ); + $JSEditor = array('URL' => G::encrypt($this->file, URL_KEY) + ); + + $A = G::encrypt($this->file, URL_KEY); + + try { + $openDoc = new Xml_Document(); + $fileName = $this->home . $this->file . '.xml'; + if (file_exists($fileName)) { + $openDoc->parseXmlFile($fileName); + } else { + $this->_createDefaultXmlForm($fileName); + $openDoc->parseXmlFile($fileName); + } + //$form = new Form( $this->file , $this->home, SYS_LANG, true ); + $Properties = dynaformEditorAjax::get_properties($A, $this->dyn_uid); + /* Start Block: Prepare the XMLDB connection */ + define('DB_XMLDB_HOST', PATH_DYNAFORM . $this->file . '.xml'); + define('DB_XMLDB_USER', ''); + define('DB_XMLDB_PASS', ''); + define('DB_XMLDB_NAME', ''); + define('DB_XMLDB_TYPE', 'myxml'); + /* Start Block: Prepare the dynaformEditor */ + $G_PUBLISH = new Publisher(); + $sName = 'dynaformEditor'; + $G_PUBLISH->publisherId = $sName; + $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher->setTitle(G::LoadTranslation('ID_DYNAFORM_EDITOR') . ' - ' . $Properties['DYN_TITLE']); + $G_PUBLISH->AddContent('blank'); + $this->panelConf['title'] = ''; + $G_PUBLISH->AddContent('panel-init', 'mainPanel', $this->panelConf); + if ($Properties['DYN_TYPE'] == 'xmlform') { + $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', ''); + } else { + $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', ''); + } + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', 'display:none', $Parameters, '', ''); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', 'display:none', $XmlEditor, '', ''); + $G_PUBLISH->AddContent('blank'); + $i = 0; + $aFields = array(); + $aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char' + ); + $oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $this->file . '.xml', '', '', '', 'myxml')); + $oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"'); + $iMaximun = $oDataset->count(); + while ($aRow = $oDataset->Read()) { + $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => ($i > 0 ? G::LoadTranslation('ID_UP') : ''), 'DOWN' => ($i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : ''), 'row__' => ($i + 1) + ); + $i++; + break; + } + global $_DBArray; + $_DBArray['fields'] = $aFields; + $_SESSION['_DBArray'] = $_DBArray; + G::LoadClass('ArrayPeer'); + $oCriteria = new Criteria('dbarray'); + $oCriteria->setDBArrayTable('fields'); + /** + * *@Erik-> this is deprecated,. + * (unuseful) $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/fields_List', $oCriteria, $Parameters, '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');** + */ + $G_PUBLISH->AddContent('blank'); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', 'display:none', $JSEditor, '', ''); + } catch (Exception $e) { + + } + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', 'display:none', $Properties, '', ''); + //for showHide tab option @Neyek + $G_PUBLISH->AddContent('blank'); + $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PREVIEW"), $sName . '[3]', 'dynaformEditor.changeToPreview', 'dynaformEditor.saveCurrentView'); + $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_XML"), $sName . '[4]', 'dynaformEditor.changeToXmlCode', 'dynaformEditor.saveCurrentView'); + if ($Properties['DYN_TYPE'] != 'grid') { + $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_HTML"), $sName . '[5]', 'dynaformEditor.changeToHtmlCode', 'dynaformEditor.saveCurrentView'); + } + $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_FIELDS_LIST"), $sName . '[6]', 'dynaformEditor.changeToFieldsList', 'dynaformEditor.saveCurrentView'); + if ($Properties["DYN_TYPE"] != "grid") { + $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView'); + } + $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PROPERTIES"), $sName . '[8]', 'dynaformEditor.changeToProperties', 'dynaformEditor.saveCurrentView'); + + //for showHide tab option @Neyek + if ($Properties["DYN_TYPE"] != "grid") { + $G_PUBLISH->AddContent("panel-tab", G::LoadTranslation("ID_CONDITIONS_EDITOR"), $sName . "[9]", "dynaformEditor.changeToShowHide", "dynaformEditor.saveShowHide"); + } + + $G_PUBLISH->AddContent('panel-close'); + $oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js",2); + $oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js'); + //$oHeadPublisher->addScriptFile('/js/dveditor/core/dveditor.js'); + //$oHeadPublisher->addScriptFile('/codepress/codepress.js',1); + + $oHeadPublisher->addScriptFile('/js/codemirrorOld/js/codemirror.js',1); + + $oHeadPublisher->addScriptFile('/js/grid/core/grid.js'); + $oHeadPublisher->addScriptCode(' + var DYNAFORM_URL="' . $Parameters['URL'] . '"; + leimnud.event.add(window,"load",function(){ loadEditor(); }); + '); + $oHeadPublisher->addScriptCode(' var jsMeta;var __usernameLoggedDE__ = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";var __DYN_UID__ = "' . $this->dyn_uid . '";'); + + $arrayParameterAux = $Parameters; + $arrayParameterAux["DYNAFORM_NAME"] = base64_encode($arrayParameterAux["DYNAFORM_NAME"]); + $oHeadPublisher->addScriptCode('var dynaformEditorParams = \'' . serialize($arrayParameterAux) . '\';'); + + G::RenderPage("publish", 'blank'); + } + + /** + * Get the filename + * + * @param string $file + * @return string + */ + public function _getFilename($file) + { + return (strcasecmp(substr($file, - 5), '_tmp0') == 0) ? substr($file, 0, strlen($file) - 5) : $file; + } + + /** + * Set the temporal copy + * + * @param string $onOff + * @return void + */ + public function _setUseTemporalCopy($onOff) + { + $file = self::_getFilename($this->file); + if ($onOff) { + $this->file = $file . '_tmp0'; + self::_setTmpData(array('useTmpCopy' => true )); + if (!file_exists(PATH_DYNAFORM . $file . '.xml')) { + $this->_createDefaultXmlForm(PATH_DYNAFORM . $file . '.xml'); + } + //Creates a copy if it doesn't exist, else, use the old copy + if (!file_exists(PATH_DYNAFORM . $this->file . '.xml')) { + self::_copyFile(PATH_DYNAFORM . $file . '.xml', PATH_DYNAFORM . $this->file . '.xml'); + } + if (!file_exists(PATH_DYNAFORM . $this->file . '.html') && file_exists(PATH_DYNAFORM . $file . '.html')) { + self::_copyFile(PATH_DYNAFORM . $file . '.html', PATH_DYNAFORM . $this->file . '.html'); + } + } else { + $this->file = $file; + self::_setTmpData(array()); + } + } + + /** + * Set temporal data + * + * @param $data + * @return void + */ + public function _setTmpData($data) + { + G::verifyPath(PATH_C . 'dynEditor/', true); + $fp = fopen(PATH_C . 'dynEditor/' . session_id() . '.php', 'w'); + fwrite($fp, '$tmpData=unserialize(\'' . addcslashes(serialize($data), '\\\'') . '\');'); + fclose($fp); + } + + /** + * Get temporal data + * + * @param string $filename + * @return array + */ + public function _getTmpData() + { + $tmpData = array(); + $file = PATH_C . 'dynEditor/' . session_id() . '.php'; + if (file_exists($file)) { + eval(implode('', file($file))); + } + return $tmpData; + } + + /** + * Copy files + * + * @param file $from + * @param file $to + * @return void + */ + public function _copyFile($from, $to) + { + $copy = implode('', file($from)); + $fcopy = fopen($to, "w"); + fwrite($fcopy, $copy); + fclose($fcopy); + } +} + +interface iDynaformEditorAjax +{ + //public function render_preview($A); +} + +/** + * DynaformEditorAjax - DynaformEditorAjax class + * + * @package workflow.engine.classes + */ +class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax +{ + + /** + * Constructor of the class dynaformEditorAjax + * + * @param var $post + * @return void + */ + public function dynaformEditorAjax($post) + { + $this->_run($post); + } + + /** + * Function Run + * + * @param var $post + * @return void + */ + public function _run($post) + { + WebResource::WebResource($_SERVER['REQUEST_URI'], $post); + } + + /** + * Prints the DynaformEditorAjax + * + * @param object $A + * @return ob_get_clean + */ + public function render_preview($A) + { + ob_start(); + $file = G::decrypt($A, URL_KEY); + global $G_PUBLISH; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->publisherId = 'preview'; + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true, $G_PUBLISH->publisherId); + switch (basename($form->template, '.html')) { + case 'grid': + $template = 'grid'; + $aAux = array_keys($form->fields); + if (count($aAux) > 0) { + $aFields = (array_combine($aAux, $aAux)); + } else { + $aFields = $aAux; + } + if (is_array($aFields)) { + foreach ($aFields as $key => $val) { + $aFields[$key] = array(1 => "", 2 => "", 3 => "", 4 => "", 5 => ""); + } + } + break; + default: + $template = 'xmlform_' . $G_PUBLISH->publisherId; + $aFields = array('__DYNAFORM_OPTIONS' => array('PREVIOUS_STEP' => '#', 'NEXT_STEP' => '#', 'NEXT_STEP_LABEL' => G::loadTranslation('ID_NEXT_STEP'), 'PREVIOUS_ACTION' => 'return false;', 'NEXT_ACTION' => 'return false;' + ) + ); + } + $G_PUBLISH->AddContent('dynaform', $template, $file, '', $aFields, ''); + G::RenderPage('publish', 'raw'); + return ob_get_clean(); + } + + /** + * Prints the Dynaform in format HTML + * + * @param object $A + * @return array + */ + public function render_htmledit($A) + { + $script = ''; + $file = G::decrypt($A, URL_KEY); + ob_start(); + global $G_PUBLISH; + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->publisherId = ''; + $html = $this->get_htmlcode($A); + if (!is_string($html)) { + $error = $html; + $html = ''; + } else { + $error = 0; + } + $HtmlEditor = array('URL' => $A, 'HTML' => $html, 'DYN_UID' => $file ); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_HtmlEditor', '', $HtmlEditor, '', ''); + G::RenderPage("publish", 'raw'); + return array('error' => $error, 'html' => ob_get_clean() + ); + } + + /** + * Get the html code + * Loads the stored HTML or the default Template if + * it doesn't exist. + * + * @param object $A + * @return code html + */ + public function get_htmlcode($A) + { + try { + $script = null; + $fileTmp = G::decrypt($A, URL_KEY); + $form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true); + + //Navigation Bar + $form->fields = G::array_merges(array("__DYNAFORM_OPTIONS" => new XmlForm_Field_XmlMenu(new Xml_Node("__DYNAFORM_OPTIONS", "complete", "", array("type" => "xmlmenu", "xmlfile" => "gulliver/dynaforms_Options" + )), SYS_LANG, PATH_XMLFORM, $form) + ), $form->fields); + + //Loads the stored HTML or the default Template if + //it doesn't exist. + $filename = substr($form->fileName, 0, - 3) . ($form->type === "xmlform" ? "" : "." . $form->type) . "html"; + + if (!file_exists($filename)) { + $html = $form->printTemplate($form->template, $script); + } else { + $html = implode("", file($filename)); + } + + /* + * It adds the new fields automatically at the bottom of the form. + * TODO: �TOP OR BOTTOM? + * Improving detection algorithm of new fields. + * Current: Do not check the fields that have already been reviewed (saving) + * Already checked the temporary file dynaforms editor. + */ + $tmp = self::_getTmpData(); + if (!isset($tmp['OLD_FIELDS'])) { + $tmp['OLD_FIELDS'] = array(); //var_dump($html);die; + } + $aAux = explode('', $html); + foreach ($form->fields as $field) { + if ((strpos($html, '{$form.' . $field->name . '}') === false) && (strpos($html, '{$' . $field->name . '}') === false)) { + //Aparantly is new (but could be a deleted or non visible like private type fields) + switch (strtolower($field->type)) { + case 'private': + case 'phpvariable': + break; + default: + if (array_search($field->name, $tmp['OLD_FIELDS']) === false) { + //TOP + $aAux[0] .= '
{$' . $field->name . '}' . '{$form.' . $field->name . '}'; + //$html.='
{$'.$field->name.'}'.'{$form.'.$field->name.'}'; + //BOTTOM + //$html='{$'.$field->name.'}'.'{$form.'.$field->name.'}'.$html; + //$tmp['OLD_FIELDS'][]=$field->name; + } + } + } + } + self::_setTmpData($tmp); + //$html=str_replace('{$form_className}','formDefault', $html ); + $html = str_replace('{$form_className}', 'formDefault', $aAux[0] . ''); + + return $html; + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Restore the html code + * + * @param object $A + * @return code html + */ + public function restore_html($A) + { + $script = null; + $fileTmp = G::decrypt($A, URL_KEY); + $form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true); + + //Navigation Bar + $form->fields = G::array_merges(array("__DYNAFORM_OPTIONS" => new XmlForm_Field_XmlMenu(new Xml_Node("__DYNAFORM_OPTIONS", "complete", "", array("type" => "xmlmenu", "xmlfile" => "gulliver/dynaforms_Options" + )), SYS_LANG, PATH_XMLFORM, $form) + ), $form->fields); + + $form->enableTemplate = false; + $html = $form->printTemplate($form->template, $script); + $html = str_replace('{$form_className}', 'formDefault', $html); + if (file_exists(PATH_DYNAFORM . $fileTmp . '.html')) { + unlink(PATH_DYNAFORM . $fileTmp . '.html'); + } + $fp = fopen(PATH_DYNAFORM . $fileTmp . '.html', 'w'); + fwrite($fp, $html); + fclose($fp); + + return $html; + } + + /** + * Set the html code + * + * @param object $A + * @return array + */ + public function set_htmlcode($A, $htmlcode) + { + try { + $iOcurrences = preg_match_all('/\{\$.*?\}/im', $htmlcode, $matches); + if ($iOcurrences) { + if (isset($matches[0])) { + $tagsHtml = $matches[0]; + foreach ($tagsHtml as $value) { + $aTagVar = strip_tags($value); + if ($value != $aTagVar) { + $htmlcode = str_replace($value, $aTagVar, $htmlcode); + } + } + } + } + $file = G::decrypt($A, URL_KEY); + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + $filename = substr($form->fileName, 0, - 3) . ($form->type === 'xmlform' ? '' : '.' . $form->type) . 'html'; + $fp = fopen($filename, 'w'); + fwrite($fp, $htmlcode); + fclose($fp); + return 0; + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Get the xml code + * + * @param object $A + * @return array + */ + public function get_xmlcode($A) + { + try { + $file = G::decrypt($A, URL_KEY); + $xmlcode = implode('', file(PATH_DYNAFORM . $file . '.xml')); + return array("xmlcode" => $xmlcode, "error" => 0 + ); + } catch (Exception $e) { + return array("xmlcode" => "", "error" => (array) $e + ); + } + } + + /** + * Set the xml code + * + * @param object $A + * @param array $xmlcode + * @return string + */ + public function set_xmlcode($A, $xmlcode) + { + $xmlcode = urldecode($xmlcode); + $file = G::decrypt($A, URL_KEY); + $xmlcode = str_replace(' ', ' ', trim($xmlcode)); + $fp = fopen(PATH_DYNAFORM . $file . '.xml', 'w'); + fwrite($fp, $xmlcode); + fclose($fp); + return ""; + } + + /** + * Get the javascript code + * + * @param object $A + * @param string $fieldName + * @return array + */ + public function get_javascripts($A, $fieldName) + { + try { + $file = G::decrypt($A, URL_KEY); + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + $aOptions = array(); + $sCode = ''; + foreach ($form->fields as $name => $value) { + if (strcasecmp($value->type, "javascript") == 0) { + $aOptions[] = array('key' => $name, 'value' => $name + ); + if ($name == $fieldName) { + $sCode = $value->code; + } + } + } + return array('aOptions' => $aOptions, 'sCode' => $sCode + ); + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Set the javascript code + * + * @param object $A + * @param string $fieldName + * @param string $sCode + * @return array + */ + public function set_javascript($A, $fieldName, $sCode, $meta = '') + { + if ($fieldName == '___pm_boot_strap___') { + return 0; + } + + $sCode = urldecode($sCode); + try { + $sCode = rtrim($sCode); + $file = G::decrypt($A, URL_KEY); + /* $dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml' ,'','','','myxml' ); + $ses2 = new DBSession($dbc2); + $ses2->execute(G::replaceDataField("UPDATE dynaForm SET XMLNODE_VALUE = @@CODE WHERE XMLNODE_NAME = @@FIELDNAME ", array('FIELDNAME'=>$fieldName,'CODE'=>$sCode), "myxml" )); + */ + + G::LoadSystem('dynaformhandler'); + + $dynaform = new dynaFormHandler(PATH_DYNAFORM . "{$file}.xml"); + $dynaform->replace($fieldName, $fieldName, Array('type' => 'javascript', 'meta' => $meta, '#cdata' => $sCode + )); + + return 0; + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Get properties of the dynaForm + * + * @param file $A + * @param string $DYN_UID + * @return array + */ + public function get_properties($A, $DYN_UID) + { + $file = G::decrypt($A, URL_KEY); + $tmp = self::_getTmpData(); + if (!(isset($tmp['Properties']) && isset($tmp['useTmpCopy']))) { + $dynaform = new dynaform(); + $dynaform->load($DYN_UID); + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + $Properties = array('A' => $A, 'DYN_UID' => $dynaform->getDynUid(), 'PRO_UID' => $dynaform->getProUid(), 'DYN_TITLE' => $dynaform->getDynTitle(), 'DYN_TYPE' => $dynaform->getDynType(), 'DYN_DESCRIPTION' => $dynaform->getDynDescription(), 'WIDTH' => $form->width, + //'ENABLETEMPLATE'=> $form->enableTemplate, + 'MODE' => $form->mode, 'PRINTDYNAFORM' => $form->printdynaform, 'ADJUSTGRIDSWIDTH' => $form->adjustgridswidth, 'NEXTSTEPSAVE' => $form->nextstepsave + ); + $tmp['Properties'] = $Properties; + self::_setTmpData($tmp); + } else { + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + $Properties = $tmp['Properties']; + if (!isset($Properties['ENABLETEMPLATE'])) { + $Properties['ENABLETEMPLATE'] = "0"; + } + $Properties['WIDTH'] = $form->width; + $Properties['MODE'] = $form->mode; + } + return $Properties; + } + + /** + * Set properties of the dynaForm + * + * @param file $A + * @param string $DYN_UID + * @param array $getFields + * @return array + */ + public function set_properties($A, $DYN_UID, $getFields) + { + try { + $post = array(); + parse_str($getFields, $post); + $Fields = $post['form']; + //if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0"; + $file = G::decrypt($A, URL_KEY); + $tmp = self::_getTmpData(); + if (!isset($tmp['useTmpCopy'])) { + $dynaform = new dynaform(); + $dynaform->update($Fields); + } else { + $tmp['Properties'] = $Fields; + self::_setTmpData($tmp); + } + $dynaform = new dynaFormHandler(PATH_DYNAFORM . "{$file}.xml"); + $dbc2 = new DBConnection(PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml'); + $ses2 = new DBSession($dbc2); + //if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0"; + + /* if (isset($Fields['ENABLETEMPLATE'])) { + $ses2->execute(G::replaceDataField("UPDATE . SET ENABLETEMPLATE = @@ENABLETEMPLATE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields)); + } */ + if (isset($Fields['DYN_TYPE'])) { + //$ses2->execute( G::replaceDataField( "UPDATE . SET TYPE = @@DYN_TYPE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + $dynaform->modifyHeaderAttribute('type', $Fields['DYN_TYPE']); + } + if (isset($Fields['WIDTH'])) { + // $ses2->execute( G::replaceDataField( "UPDATE . SET WIDTH = @@WIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + $dynaform->modifyHeaderAttribute('width', $Fields['WIDTH']); + //g::pr($dynaform->getHeaderAttribute('width')); + } + if (isset($Fields['MODE'])) { + // $ses2->execute( G::replaceDataField( "UPDATE . SET MODE = @@MODE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + $dynaform->modifyHeaderAttribute('mode', $Fields['MODE']); + } + if (isset($Fields['NEXTSTEPSAVE'])) { + //$ses2->execute( G::replaceDataField( "UPDATE . SET NEXTSTEPSAVE = @@NEXTSTEPSAVE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + $dynaform->modifyHeaderAttribute('nextstepsave', $Fields['NEXTSTEPSAVE']); + } + if (isset($Fields['PRINTDYNAFORM'])) { + //$ses2->execute( G::replaceDataField( "UPDATE . SET PRINTDYNAFORM = @@PRINTDYNAFORM WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + $dynaform->modifyHeaderAttribute('printdynaform', $Fields['PRINTDYNAFORM']); + } + if (isset($Fields['ADJUSTGRIDSWIDTH'])) { + //$ses2->execute( G::replaceDataField( "UPDATE . SET ADJUSTGRIDSWIDTH = @@ADJUSTGRIDSWIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + $dynaform->modifyHeaderAttribute('adjustgridswidth', $Fields['ADJUSTGRIDSWIDTH']); + } + + return 0; + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Get enable template + * + * @param object $A + * @return string + */ + public function get_enabletemplate($A) + { + $file = G::decrypt($A, URL_KEY); + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + return $form->enableTemplate; + } + + /** + * Set enable template + * + * @param object $A + * @param string $value + * @return string + */ + public function set_enabletemplate($A, $value) + { + $file = G::decrypt($A, URL_KEY); + $value = $value == "1" ? "1" : "0"; + // $dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' ); + // $ses2 = new DBSession( $dbc2 ); + // $ses2->execute( "UPDATE . SET ENABLETEMPLATE = '$value'" ); + + $dynaform = new dynaFormHandler(PATH_DYNAFORM . "{$file}.xml"); + $dynaform->modifyHeaderAttribute('enabletemplate', $value); + + return $value; + } + + /** + * Save a dynaForm + * + * @param object $A + * @param string $DYN_UID + * @return array + */ + public function save($A, $DYN_UID) + { + try { + $answer = 0; + $file = G::decrypt($A, URL_KEY); + $tmp = self::_getTmpData(); + if (isset($tmp['Properties'])){ + $fileFirst = $tmp['Properties']['PRO_UID'].'/'.$tmp['Properties']['DYN_UID']; + } + if (isset($tmp['useTmpCopy'])) { + /* Save Register */ + $dynaform = new dynaform(); + $dynaform->update($tmp['Properties']); + /* Save file */ + $copyFirst = implode('', file(PATH_DYNAFORM . $fileFirst . '.xml')); + $copy = implode('', file(PATH_DYNAFORM . $file . '.xml')); + /*Check differences between XML*/ + $elementFirst = new SimpleXMLElement($copyFirst); + $elementCopy = new SimpleXMLElement($copy); + $desAdd = ''; + $desDel = ''; + //Check the new fields + foreach ($elementCopy as $key1 => $row1){ + $swAll = true; + foreach ($elementFirst as $key2 => $row2){ + if ($key1 == $key2){ + $swAll = false; + break; + } + } + if ($swAll){ + $desAdd .= $key1." "; + } + } + //Check the delete fields + foreach ($elementFirst as $key1 => $row1){ + $swAll = true; + foreach ($elementCopy as $key2 => $row2){ + if ($key1 == $key2){ + $swAll = false; + break; + } + } + if ($swAll){ + $desDel .= $key1." "; + } + } + + $mode = empty($tmp['Properties']['MODE'])? 'Determined by Fields' : $tmp['Properties']['MODE']; + $auditDescription = "Dynaform Title: ".$tmp['Properties']['DYN_TITLE'].", Type: ".$tmp['Properties']['DYN_TYPE'].", Description: ".$tmp['Properties']['DYN_DESCRIPTION'].", Mode: ".$mode; + if($desAdd != ''){ + $auditDescription .= ", Field(s) Add: ".$desAdd; + } + if($desDel != ''){ + $auditDescription .= ", Field(s) Delete: ".$desDel; + } + //Add Audit Log + G::auditLog("UpdateDynaform", $auditDescription); + + + /* + * added by krlos carlos/a/colosa.com + * in here we are validation if a xmlform has a submit action + */ + // if (!preg_match("/type=\"submit\"/",$copy) && !preg_match("/type=\"grid\"/",$copy) && !isset($_SESSION['submitAction']) ){ + if (!preg_match("/type=\"submit\"/", $copy) && !preg_match("/type=\"grid\"/", $copy)) { + // $_SESSION['submitAction'] = 1; + $answer = 'noSub'; + } + $copyHtml = false; + if (file_exists(PATH_DYNAFORM . $file . '.html')) { + $copyHtml = implode('', file(PATH_DYNAFORM . $file . '.html')); + } + $file = dynaformEditor::_getFilename($file); + $fcopy = fopen(PATH_DYNAFORM . $file . '.xml', "w"); + fwrite($fcopy, $copy); + fclose($fcopy); + if ($copyHtml) { + $fcopy = fopen(PATH_DYNAFORM . $file . '.html', "w"); + fwrite($fcopy, $copyHtml); + fclose($fcopy); + } + } else { + //throw new Exception("It should not come here unless you have disabled the temporary copy."); + } + return $answer; + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Close a dynaform + * + * @param object $A + * @return array + */ + public function close($A) + { + try { + /* + * we are unseting this variable. It's our control about to save the xmlfrom + */ + // unset($_SESSION['submitAction']); + $file = G::decrypt($A, URL_KEY); + //return(array('response'=>PATH_DYNAFORM . $file . '.xml')); + /* Delete the temporal copy */ + $tmp = self::_getTmpData(); + $xmlFile = PATH_DYNAFORM . $file . '.xml'; + $htmlFile = PATH_DYNAFORM . $file . '.html'; + //return(array('response'=>$tmp['useTmpCopy'])); + if (isset($tmp['useTmpCopy'])) { + //return(array('response'=>PATH_DYNAFORM . $file . '.xml')); + if ($file !== dynaformEditor::_getFilename($file)) { + // return(array('response'=>PATH_DYNAFORM . $file . '.xml')); + if (file_exists($xmlFile)) { + unlink($xmlFile); + } + if (file_exists($htmlFile)) { + unlink($htmlFile); + } + } + } + return 0; + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Checks if a dynaform was changed + * + * @param file $A + * @param string $DYN_UID + * @return array + */ + public function is_modified($A, $DYN_UID) + { + $file = G::decrypt($A, URL_KEY); + try { + /* Compare Properties */ + $dynaform = new dynaform(); + $dynaform->load($DYN_UID); + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + $sp = array('A' => $A, 'DYN_UID' => $dynaform->getDynUid(), 'PRO_UID' => $dynaform->getProUid(), 'DYN_TITLE' => $dynaform->getDynTitle(), 'DYN_TYPE' => $dynaform->getDynType(), 'DYN_DESCRIPTION' => $dynaform->getDynDescription(), 'WIDTH' => $form->width, 'ENABLETEMPLATE' => $form->enableTemplate, 'MODE' => $form->mode + ); + $P = self::get_properties($A, $DYN_UID); + if (!isset($P['DYN_TITLE'])) { + $P['DYN_TITLE'] = $sp['DYN_TITLE']; + } + if (!isset($P['DYN_TYPE'])) { + $P['DYN_TYPE'] = $sp['DYN_TYPE']; + } + if (!isset($P['DYN_DESCRIPTION'])) { + $P['DYN_DESCRIPTION'] = $sp['DYN_DESCRIPTION']; + } + if (!isset($P['WIDTH'])) { + $P['WIDTH'] = $sp['WIDTH']; + } + if (!isset($P['ENABLETEMPLATE'])) { + $P['ENABLETEMPLATE'] = $sp['ENABLETEMPLATE']; + } + if (!isset($P['MODE'])) { + $P['MODE'] = $sp['MODE']; + } + $modPro = ($sp['DYN_TITLE'] != $P['DYN_TITLE']) || ($sp['DYN_TYPE'] != $P['DYN_TYPE']) || ($sp['DYN_DESCRIPTION'] != $P['DYN_DESCRIPTION']); + /* || + ($sp['WIDTH']!=$P['WIDTH']) || + ($sp['ENABLETEMPLATE']!=$P['ENABLETEMPLATE']) || + ($sp['MODE']!=$P['MODE']) */ + /* Compare copies */ + $fileOrigen = dynaformEditor::_getFilename($file); + $copy = implode('', file(PATH_DYNAFORM . $file . '.xml')); + $origen = implode('', file(PATH_DYNAFORM . $fileOrigen . '.xml')); + $copyHTML = file_exists(PATH_DYNAFORM . $file . '.html') ? implode('', file(PATH_DYNAFORM . $file . '.html')) : false; + $origenHTML = file_exists(PATH_DYNAFORM . $fileOrigen . '.html') ? implode('', file(PATH_DYNAFORM . $fileOrigen . '.html')) : false; + $modFile = ($copy !== $origen) || ($origenHTML && ($copyHTML !== $origenHTML)); + //Return + //return array("*message"=>sprintf("%s, (%s= %s %s):", $modPro?"1":"0" , $modFile?"1":"0", ($copy!==$origen)?"1":"0" , ($origenHTML && ($copyHTML!==$origenHTML))?"1":"0" )); + //die("c'est fini"); + return $modPro || $modFile; + } catch (Exception $e) { + return (array) $e; + } + } + /* + Functionality: Funcion que convierte objecto en array + Parameters : Object $object que queremos convertir + Return: Array + */ + public function convertObjectToArray($object){ + if( !is_object( $object ) && !is_array( $object ) ){ + return $object; + } + if( is_object( $object ) ){ + $object = get_object_vars( $object ); + } + return array_map( 'objectToArray', $object ); + } +} diff --git a/workflow/engine/classes/model/Dynaform.php b/workflow/engine/classes/model/Dynaform.php index 69eecd8f5..e53466697 100755 --- a/workflow/engine/classes/model/Dynaform.php +++ b/workflow/engine/classes/model/Dynaform.php @@ -150,7 +150,7 @@ class Dynaform extends BaseDynaform * @return void */ - public function create ($aData) + public function create ($aData, $pmTableUid='') { if (! isset( $aData['PRO_UID'] )) { throw (new PropelException( 'The dynaform cannot be created. The PRO_UID is empty.' )); @@ -194,6 +194,17 @@ class Dynaform extends BaseDynaform } $con->commit(); + + //Add Audit Log + $mode = isset($aData['MODE'])? $aData['MODE'] : 'Determined by Fields'; + $description = ""; + if($pmTableUid!=''){ + $pmTable = AdditionalTablesPeer::retrieveByPK( $pmTableUid ); + $addTabName = $pmTable->getAddTabName(); + $description = "Create from a PM Table: ".$addTabName.", "; + } + G::auditLog("CreateDynaform", $description."Dynaform Title: ".$aData['DYN_TITLE'].", Type: ".$aData['DYN_TYPE'].", Description: ".$aData['DYN_DESCRIPTION'].", Mode: ".$mode); + $sXml = '' . "\n"; $sXml .= '' . "\n"; $sXml .= ''; @@ -232,7 +243,7 @@ class Dynaform extends BaseDynaform public function createFromPMTable ($aData, $pmTableUid) { - $this->create( $aData ); + $this->create( $aData , $pmTableUid); $aData['DYN_UID'] = $this->getDynUid(); //krumo(BasePeer::getFieldnames('Content')); $fields = array (); @@ -560,6 +571,9 @@ class Dynaform extends BaseDynaform } $res = $oPro->save(); $con->commit(); + //Add Audit Log + //G::auditLog("UpdateDynaform", "Dynaform Title: ".$aData['DYN_TITLE'].", Type: ".$aData['DYN_TYPE'].", Modified Fields "); + return $res; } else { foreach ($this->getValidationFailures() as $objValidationFailure) { @@ -591,9 +605,18 @@ class Dynaform extends BaseDynaform try { $oPro = DynaformPeer::retrieveByPK( $ProUid ); if (! is_null( $oPro )) { + $title = $oPro->getDynTitle(); + $type = $oPro->getDynType(); + $description = $oPro->getDynDescription(); + Content::removeContent( 'DYN_TITLE', '', $oPro->getDynUid() ); Content::removeContent( 'DYN_DESCRIPTION', '', $oPro->getDynUid() ); $iResult = $oPro->delete(); + + //Add Audit Log + //$mode = isset($ProUid['MODE'])? $ProUid['MODE'] : 'Determined by Fields'; + G::auditLog("DeleteDynaform", "Dynaform Title: ".$title.", Type: ".$type.", Description: ".$description); + if (file_exists( PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '.xml' )) { unlink( PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '.xml' ); } From 8ac2b53a4eeac63357a1451fdb973668e70d47c7 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Thu, 12 Feb 2015 16:08:51 -0400 Subject: [PATCH 021/155] I agree and corrected --- workflow/engine/methods/cases/cases_Open.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/workflow/engine/methods/cases/cases_Open.php b/workflow/engine/methods/cases/cases_Open.php index eaba5b836..f279a9bf6 100755 --- a/workflow/engine/methods/cases/cases_Open.php +++ b/workflow/engine/methods/cases/cases_Open.php @@ -77,7 +77,9 @@ try { $aFields = $oCase->loadCase( $sAppUid, $iDelIndex ); // g::pr($aFields); // die; - if (!isset($_SESSION['CURRENT_TASK']) && $_SESSION['CURRENT_TASK'] != ''){ + if (!isset($_SESSION['CURRENT_TASK'])) { + $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; + } else if ($_SESSION['CURRENT_TASK'] == '') { $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; } switch ($aFields['APP_STATUS']) { From cfcfaf26df95ed0d0a5952b246f74c424f644ac4 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Thu, 12 Feb 2015 17:34:52 -0400 Subject: [PATCH 022/155] I completed the issue with Conditions editor --- .../methods/dynaforms/conditionalShowHide_Ajax.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php b/workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php index 890d06f7e..cc9f7313a 100755 --- a/workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php +++ b/workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php @@ -113,9 +113,18 @@ try { require_once 'classes/model/FieldCondition.php'; $oFieldCondition = new FieldCondition(); $aDYN = $_SESSION['Current_Dynafom']['Parameters']; + //G::pr($aDYN); $_POST['FCD_UID'] = ($_POST['FCD_UID'] == '0') ? '' : $_POST['FCD_UID']; $aData = Array ('FCD_UID' => Isset( $_POST['FCD_UID'] ) ? $_POST['FCD_UID'] : '','FCD_FUNCTION' => $_POST['function'],'FCD_FIELDS' => $_POST['fields_selected'],'FCD_CONDITION' => $_POST['condition'],'FCD_EVENTS' => $_POST['events'],'FCD_EVENT_OWNERS' => $_POST['event_owner_selected'],'FCD_STATUS' => $_POST['enabled'],'FCD_DYN_UID' => $aDYN['DYN_UID']); $oFieldCondition->quickSave( $aData ); + //Add Audit Log + if(isset($_POST['enabled']) && $_POST['enabled'] == 1){ + $enable = 'enable'; + }else{ + $enable = 'disable'; + } + G::auditLog("ConditionsEditorDynaform", "Dynaform Title: " .$aDYN['DYNAFORM_NAME']. ", Condition Editor: [Function: ".$_POST['function']. ", Fields: ".$_POST['fields_selected']. ", Conditions: ".$_POST['condition']. ", Events: ".$_POST['events']. ", Event Owner: ".$_POST['event_owner_selected']. ", Status: ".$enable."]"); + break; case 'delete': require_once 'classes/model/FieldCondition.php'; From 88cfb2d04da290576353d6d6f2b1a63760e2c1d5 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Thu, 12 Feb 2015 17:41:32 -0400 Subject: [PATCH 023/155] I completed the issue with Conditions editor --- workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php | 1 - 1 file changed, 1 deletion(-) diff --git a/workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php b/workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php index cc9f7313a..f469227db 100755 --- a/workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php +++ b/workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php @@ -113,7 +113,6 @@ try { require_once 'classes/model/FieldCondition.php'; $oFieldCondition = new FieldCondition(); $aDYN = $_SESSION['Current_Dynafom']['Parameters']; - //G::pr($aDYN); $_POST['FCD_UID'] = ($_POST['FCD_UID'] == '0') ? '' : $_POST['FCD_UID']; $aData = Array ('FCD_UID' => Isset( $_POST['FCD_UID'] ) ? $_POST['FCD_UID'] : '','FCD_FUNCTION' => $_POST['function'],'FCD_FIELDS' => $_POST['fields_selected'],'FCD_CONDITION' => $_POST['condition'],'FCD_EVENTS' => $_POST['events'],'FCD_EVENT_OWNERS' => $_POST['event_owner_selected'],'FCD_STATUS' => $_POST['enabled'],'FCD_DYN_UID' => $aDYN['DYN_UID']); $oFieldCondition->quickSave( $aData ); From 1e436ae2a382013a8727bd5e2aea078887b5efe4 Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Fri, 13 Feb 2015 09:10:41 -0400 Subject: [PATCH 024/155] Correccion de listados en metodo GET --- workflow/engine/templates/cases/casesList.js | 1 + 1 file changed, 1 insertion(+) diff --git a/workflow/engine/templates/cases/casesList.js b/workflow/engine/templates/cases/casesList.js index 3a0922027..77c475fc5 100755 --- a/workflow/engine/templates/cases/casesList.js +++ b/workflow/engine/templates/cases/casesList.js @@ -741,6 +741,7 @@ Ext.onReady ( function() { read : urlProxy } /*----------------------------------********---------------------------------*/ + ,method: 'GET' ,headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + credentials.access_token From fcc5a23a2883abbf1911ad3900b3bc415369a623 Mon Sep 17 00:00:00 2001 From: dheeyi Date: Fri, 13 Feb 2015 10:28:08 -0400 Subject: [PATCH 025/155] =?UTF-8?q?PM-1378=20Cuando=20se=20pierde=20la=20s?= =?UTF-8?q?esi=C3=B3n=20el=20Case=20Tacker=20se=20lanza=20un=20Runtime=20E?= =?UTF-8?q?rror=20que=20indica=20"the=20row=20''=20in=20table=20CASE=5FTRA?= =?UTF-8?q?CKER=20doesn't=20exist!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Causa. Este tipo de error es generado por lo general cuando hacemos inicio de sesiones dobles desde un mismo navegador(Chrome, Firefox or IE) a un mismo server. Es decir en este caso asumo que se tenia abierto processamker(admin), y paralelamente en otro tab se tenia abierto Tracker. Lo cual acasiono que de alguna u otra manera se pisaran las sesiones. SolucióNo abrir dos sesiones haciendo llamada a un mismo server. Ademas si adiciono una nueva validacion. if (! isset( $_SESSION['PROCESS'] ) || ! isset( $_SESSION['APPLICATION'] ) ) { G::header( 'location: login' ); die; } --- workflow/engine/methods/tracker/tracker_DynaDocs.php | 1 + workflow/engine/methods/tracker/tracker_History.php | 1 + workflow/engine/methods/tracker/tracker_Messages.php | 1 + workflow/engine/methods/tracker/tracker_ViewMap.php | 1 + 4 files changed, 4 insertions(+) diff --git a/workflow/engine/methods/tracker/tracker_DynaDocs.php b/workflow/engine/methods/tracker/tracker_DynaDocs.php index 5d8280d06..5a7ab49c1 100755 --- a/workflow/engine/methods/tracker/tracker_DynaDocs.php +++ b/workflow/engine/methods/tracker/tracker_DynaDocs.php @@ -30,6 +30,7 @@ */ if (! isset( $_SESSION['PROCESS'] ) || ! isset( $_SESSION['APPLICATION'] )) { G::header( 'location: login' ); + die; } $G_MAIN_MENU = 'caseTracker'; $G_ID_MENU_SELECTED = 'DYNADOC'; diff --git a/workflow/engine/methods/tracker/tracker_History.php b/workflow/engine/methods/tracker/tracker_History.php index b81c5a37f..f608d532d 100755 --- a/workflow/engine/methods/tracker/tracker_History.php +++ b/workflow/engine/methods/tracker/tracker_History.php @@ -30,6 +30,7 @@ */ if (! isset( $_SESSION['PROCESS'] ) || ! isset( $_SESSION['APPLICATION'] ) ) { G::header( 'location: login' ); + die; } $G_MAIN_MENU = 'caseTracker'; diff --git a/workflow/engine/methods/tracker/tracker_Messages.php b/workflow/engine/methods/tracker/tracker_Messages.php index 8c7652d3a..9da5bfbd2 100755 --- a/workflow/engine/methods/tracker/tracker_Messages.php +++ b/workflow/engine/methods/tracker/tracker_Messages.php @@ -30,6 +30,7 @@ */ if (! isset( $_SESSION['PROCESS'] ) || ! isset( $_SESSION['APPLICATION'] )) { G::header( 'location: login' ); + die; } $G_MAIN_MENU = 'caseTracker'; $G_ID_MENU_SELECTED = 'MESSAGES'; diff --git a/workflow/engine/methods/tracker/tracker_ViewMap.php b/workflow/engine/methods/tracker/tracker_ViewMap.php index b3dff829b..013e3c772 100755 --- a/workflow/engine/methods/tracker/tracker_ViewMap.php +++ b/workflow/engine/methods/tracker/tracker_ViewMap.php @@ -31,6 +31,7 @@ require_once 'classes/model/Process.php'; if (! isset( $_SESSION['PROCESS'] ) || ! isset( $_SESSION['APPLICATION'] )) { G::header( 'location: login' ); + die; } $G_MAIN_MENU = 'caseTracker'; $G_ID_MENU_SELECTED = 'MAP'; From cb542015947fcf708851b191c90ea4774ded0f96 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Fri, 13 Feb 2015 11:29:24 -0400 Subject: [PATCH 026/155] I deleted the unused code --- workflow/engine/classes/model/Dynaform.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/workflow/engine/classes/model/Dynaform.php b/workflow/engine/classes/model/Dynaform.php index e53466697..ba413d9f7 100755 --- a/workflow/engine/classes/model/Dynaform.php +++ b/workflow/engine/classes/model/Dynaform.php @@ -571,9 +571,6 @@ class Dynaform extends BaseDynaform } $res = $oPro->save(); $con->commit(); - //Add Audit Log - //G::auditLog("UpdateDynaform", "Dynaform Title: ".$aData['DYN_TITLE'].", Type: ".$aData['DYN_TYPE'].", Modified Fields "); - return $res; } else { foreach ($this->getValidationFailures() as $objValidationFailure) { @@ -614,7 +611,6 @@ class Dynaform extends BaseDynaform $iResult = $oPro->delete(); //Add Audit Log - //$mode = isset($ProUid['MODE'])? $ProUid['MODE'] : 'Determined by Fields'; G::auditLog("DeleteDynaform", "Dynaform Title: ".$title.", Type: ".$type.", Description: ".$description); if (file_exists( PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '.xml' )) { From f03bc5088656524fa6fb66d8e5302b35f3f3d7ac Mon Sep 17 00:00:00 2001 From: "marcelo.cuiza" Date: Fri, 13 Feb 2015 13:36:33 -0400 Subject: [PATCH 027/155] PM-1585 Audit Log para todas las opciones del menu contextual del PROCESO --- .../engine/methods/events/eventsDelete.php | 18 +++- workflow/engine/methods/events/eventsSave.php | 4 + .../engine/methods/events/triggersSave.php | 15 +++ .../methods/processes/processes_Ajax.php | 101 +++++++++++++++++- .../processes_DeleteObjectPermission.php | 4 + .../methods/processes/processes_Save.php | 3 +- .../processes_SaveObjectPermission.php | 4 + .../methods/steps/steps_SupervisorAjax.php | 7 ++ .../engine/methods/tracker/tracker_Ajax.php | 9 ++ .../tracker/tracker_ConditionsSave.php | 5 + .../engine/methods/tracker/tracker_Save.php | 5 + 11 files changed, 168 insertions(+), 7 deletions(-) diff --git a/workflow/engine/methods/events/eventsDelete.php b/workflow/engine/methods/events/eventsDelete.php index 2c5933c3d..3adb131d0 100755 --- a/workflow/engine/methods/events/eventsDelete.php +++ b/workflow/engine/methods/events/eventsDelete.php @@ -28,8 +28,22 @@ if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) { die(); } +$k = new Criteria('workflow'); +$k->clearSelectColumns(); +$k->addSelectColumn(EventPeer::PRO_UID); +$k->add(EventPeer::EVN_UID, $_POST['EVN_UID'] ); +$rs = EventPeer::doSelectRS($k); +$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); +$rs->next(); +$row = $rs->getRow(); +$proUid = $row['PRO_UID']; + +$infoProcess = new Processes(); +$proFields = $infoProcess->serializeProcess($proUid); +$resultProcess = $infoProcess->saveSerializedProcess($proFields); +G::auditLog('Events','Delete event in process "'.$resultProcess['PRO_TITLE'].'"'); + $evnUid = $_POST['EVN_UID']; require_once 'classes/model/Event.php'; $oEvent = new Event(); -$oEvent->remove( $evnUid ); - +$oEvent->remove( $evnUid ); \ No newline at end of file diff --git a/workflow/engine/methods/events/eventsSave.php b/workflow/engine/methods/events/eventsSave.php index bd38f717a..4321fe608 100755 --- a/workflow/engine/methods/events/eventsSave.php +++ b/workflow/engine/methods/events/eventsSave.php @@ -59,6 +59,10 @@ if ($_POST['form']['EVN_UID'] == '') { */ $oEvent->update( $_POST['form'] ); } +$infoProcess = new Processes(); +$proFields = $infoProcess->serializeProcess($_POST['form']['PRO_UID']); +$resultProcess = $infoProcess->saveSerializedProcess($proFields); +G::auditLog('Events','Save intermediate message "'.$_POST['form']['EVN_DESCRIPTION'].'" in process "'.$resultProcess['PRO_TITLE'].'"'); function replaceQuotes ($aData) { diff --git a/workflow/engine/methods/events/triggersSave.php b/workflow/engine/methods/events/triggersSave.php index b9402984a..c42cfc12e 100755 --- a/workflow/engine/methods/events/triggersSave.php +++ b/workflow/engine/methods/events/triggersSave.php @@ -36,3 +36,18 @@ if ($_POST['form']['TRI_UID'] != '') { $oTrigger->update( $_POST['form'] ); +$k = new Criteria('workflow'); +$k->clearSelectColumns(); +$k->addSelectColumn(TriggersPeer::PRO_UID); +$k->add(TriggersPeer::TRI_UID, $_POST['form']['TRI_UID'] ); +$rs = TriggersPeer::doSelectRS($k); +$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); +$rs->next(); +$row = $rs->getRow(); +$proUid = $row['PRO_UID']; + +$infoProcess = new Processes(); +$proFields = $infoProcess->serializeProcess($proUid); +$resultProcess = $infoProcess->saveSerializedProcess($proFields); +G::auditLog('Events','Save event in process "'.$resultProcess['PRO_TITLE'].'"'); + diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index 7f70d7ddd..472ceef7c 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -42,17 +42,81 @@ try { if (isset($_REQUEST['data'])) { if($_REQUEST['action']=="addText"||$_REQUEST['action']=="updateText") { $oData = Bootstrap::json_decode($_REQUEST['data']); + $oDataAux = json_decode($_REQUEST['data'],true); } else { $oData = Bootstrap::json_decode(stripslashes($_REQUEST['data'])); + $oDataAux = json_decode(stripslashes($_REQUEST['data']),true); } //$oData = $oJSON->decode( stripslashes( $_REQUEST['data'] ) ); $sOutput = ''; $sTask = ''; + + if(array_key_exists('pro_uid', $oDataAux) || array_key_exists('uid', $oDataAux) || array_key_exists('PRO_UID', $oDataAux) || array_key_exists('UID', $oDataAux)) { + if(array_key_exists('pro_uid', $oDataAux) || array_key_exists('PRO_UID', $oDataAux)) { + if(array_key_exists('pro_uid', $oDataAux)) { + $proUid = $oDataAux['pro_uid']; + } else { + $proUid = $oDataAux['PRO_UID']; + } + } else { + $proUid = $oDataAux['uid']; + $uidAux = $proUid; + } + + G::LoadClass('processes'); + $infoProcess = new Processes(); + + if(!$infoProcess->processExists($proUid)) { + $oSL = new SwimlanesElements(); + if($oSL->swimlanesElementsExists($proUid)) { + $aFields = $oSL->load($proUid); + $proUid = $aFields['PRO_UID']; + } else { + $k = new Criteria('workflow'); + $k->clearSelectColumns(); + $k->addSelectColumn(TaskPeer::PRO_UID); + $k->add(TaskPeer::TAS_UID, $uidAux ); + $rs = TaskPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $proUid = $row['PRO_UID']; + } + } + $resultProcess = $infoProcess->getProcessRow($proUid); + } else { + if(array_key_exists('PU_UID', $oDataAux)) { + $c = new Criteria('workflow'); + $c->clearSelectColumns(); + $c->addSelectColumn(ProcessUserPeer::PRO_UID); + $c->add(ProcessUserPeer::PU_UID, $oData->PU_UID); + $oDataset = AppDelegationPeer::doSelectRS($c); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + $row = $oDataset->getRow(); + + G::LoadClass('processes'); + $infoProcess = new Processes(); + $resultProcess = $infoProcess->getProcessRow($row['PRO_UID']); + } + } } - + + if(isset($_REQUEST['pro_uid']) && !empty($_REQUEST['pro_uid']) || isset($_REQUEST['PRO_UID']) && !empty($_REQUEST['PRO_UID'])) { + if(isset($_REQUEST['pro_uid']) && !empty($_REQUEST['pro_uid'])) { + $proUid = $_REQUEST['pro_uid']; + } else { + $proUid = $_REQUEST['PRO_UID']; + } + G::LoadClass('processes'); + $infoProcess = new Processes(); + $resultProcess = $infoProcess->getProcessRow($proUid); + } + + //G::LoadClass( 'processMap' ); $oProcessMap = new processMap(new DBConnection()); - + switch ($_REQUEST['action']) { case 'load': $_SESSION['PROCESS'] = $oData->uid; @@ -85,6 +149,7 @@ try { break; case 'process_Export': include (PATH_METHODS . 'processes/processes_Export.php'); + G::auditLog('ExportProcess','Export Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'process_User': include (PATH_METHODS . 'processes/processes_User.php'); @@ -101,18 +166,25 @@ try { break; case 'webEntry_delete': $form = $_REQUEST; - unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . $form['FILENAME']); - unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace(".php", "Post", $form['FILENAME']) . ".php"); + if(file_exists(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . $form['FILENAME'])) { + unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . $form['FILENAME']); + } + if(file_exists(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace(".php", "Post", $form['FILENAME']) . ".php")) { + unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace(".php", "Post", $form['FILENAME']) . ".php"); + } $oProcessMap->webEntry($_REQUEST['PRO_UID']); + G::auditLog('WebEntry','Delete web entry in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'webEntry_new': $oProcessMap->webEntry_new($oData->PRO_UID); + G::auditLog('WebEntry','Save new web entry in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'assignProcessUser': $oProcessMap->assignProcessUser($oData->PRO_UID, $oData->USR_UID, $oData->TYPE_UID); G::LoadClass('processMap'); $oProcessMap = new ProcessMap(); $oProcessMap->listProcessesUser($oData->PRO_UID); + G::auditLog('AssignRole','Assign new supervisor in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'removeProcessUser': $oProcessMap->removeProcessUser($oData->PU_UID); @@ -122,6 +194,8 @@ try { break; } } + + G::auditLog('RemoveUser','Remove supervisor in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'supervisorDynaforms': $oProcessMap->supervisorDynaforms($oData->pro_uid); @@ -159,9 +233,11 @@ try { break; case 'addTask': $sOutput = $oProcessMap->addTask($oData->uid, $oData->position->x, $oData->position->y); + G::auditLog('AddTask','Add new task in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'addSubProcess': $sOutput = $oProcessMap->addSubProcess($oData->uid, $oData->position->x, $oData->position->y); + G::auditLog('AddSubProcess','Add new sub process in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'taskColor': $oTask->taskColor($oData->pro_uid, $oData->tas_uid); @@ -174,33 +250,44 @@ try { break; case 'saveTaskPosition': $sOutput = $oProcessMap->saveTaskPosition($oData->uid, $oData->position->x, $oData->position->y); + $oTask = new Task(); + $oTask->load($uidAux); + G::auditLog('SaveTaskPosition','Change task position ('.$oTask->getTasTitle().') in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'deleteTask': $sOutput = $oProcessMap->deleteTask($oData->tas_uid); break; case 'addGuide': $sOutput = $oProcessMap->addGuide($oData->uid, $oData->position, $oData->direction); + G::auditLog('Add'.ucwords($oDataAux['direction']).'Line','Add '.$oDataAux['direction'].' line in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'saveGuidePosition': $sOutput = $oProcessMap->saveGuidePosition($oData->uid, $oData->position, $oData->direction); + G::auditLog('SaveGuidePosition','Change '.$oData->direction.' line position in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'deleteGuide': $sOutput = $oProcessMap->deleteGuide($oData->uid); + G::auditLog('DeleteLine','Delete line in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'deleteGuides': $sOutput = $oProcessMap->deleteGuides($oData->pro_uid); + G::auditLog('DeleteLines','Delete all lines in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'addText': $sOutput = $oProcessMap->addText($oData->uid, $oData->label, $oData->position->x, $oData->position->y); + G::auditLog('AddText','Add new text ('.$oDataAux['label'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'updateText': $sOutput = $oProcessMap->updateText($oData->uid, $oData->label); + G::auditLog('UpdateText','Edit text ('.$oDataAux['label'].' ) in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'saveTextPosition': $sOutput = $oProcessMap->saveTextPosition($oData->uid, $oData->position->x, $oData->position->y); + G::auditLog('SaveTextPosition','Change text position in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'deleteText': $sOutput = $oProcessMap->deleteText($oData->uid); + G::auditLog('DeleteText','Delete text in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'dynaforms': $oProcessMap->dynaformsList($oData->pro_uid); @@ -326,9 +413,11 @@ try { case 'exploreDirectory': $_SESSION["PFMDirectory"] = $oData->main_directory; $oProcessMap->exploreDirectory($oData->pro_uid, $oData->main_directory, $oData->directory); + G::auditLog('ProcessFileManager','Upload template ('.$oData->main_directory.') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'deleteFile': $oProcessMap->deleteFile($oData->pro_uid, $oData->main_directory, $oData->directory, $oData->file); + G::auditLog('ProcessFileManager','Delete template ('.$oData->main_directory.': '.$oData->file.') in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'deleteDirectory': $oProcessMap->deleteDirectory($oData->pro_uid, $oData->main_directory, $oData->directory, $oData->dir_to_delete); @@ -440,9 +529,11 @@ try { switch ($sDir) { case 'mailTemplates': $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; + G::auditLog('ProcessFileManager','Edit template ('.$_REQUEST['filename'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'public': $sDirectory = PATH_DATA_PUBLIC . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; + G::auditLog('ProcessFileManager','Edit public template ('.$_REQUEST['filename'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; default: $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; @@ -530,9 +621,11 @@ try { switch ($sDir) { case 'mailTemplates': $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; + G::auditLog('ProcessFileManager','Save template ('.$_REQUEST['filename'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'public': $sDirectory = PATH_DATA_PUBLIC . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; + G::auditLog('ProcessFileManager','Save public template ('.$_REQUEST['filename'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; default: $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; diff --git a/workflow/engine/methods/processes/processes_DeleteObjectPermission.php b/workflow/engine/methods/processes/processes_DeleteObjectPermission.php index fd9f97a8e..15045f61a 100755 --- a/workflow/engine/methods/processes/processes_DeleteObjectPermission.php +++ b/workflow/engine/methods/processes/processes_DeleteObjectPermission.php @@ -58,3 +58,7 @@ try { $result->msg = $e->getMessage(); } print G::json_encode( $result ); + +$infoProcess = new Processes(); +$resultProcess = $infoProcess->getProcessRow($sProcessUID); +G::auditLog('DeletePermissions','Delete Permissions in Process "'.$resultProcess['PRO_TITLE'].'"'); diff --git a/workflow/engine/methods/processes/processes_Save.php b/workflow/engine/methods/processes/processes_Save.php index 60c6824f5..eef57ac1e 100755 --- a/workflow/engine/methods/processes/processes_Save.php +++ b/workflow/engine/methods/processes/processes_Save.php @@ -91,4 +91,5 @@ switch ($function) { } break; -} \ No newline at end of file +} +G::auditLog('EditProcess','Edit Process "'.$_POST['form']['PRO_TITLE'].'"'); \ No newline at end of file diff --git a/workflow/engine/methods/processes/processes_SaveObjectPermission.php b/workflow/engine/methods/processes/processes_SaveObjectPermission.php index 4557e01d5..e606bcfb9 100755 --- a/workflow/engine/methods/processes/processes_SaveObjectPermission.php +++ b/workflow/engine/methods/processes/processes_SaveObjectPermission.php @@ -76,3 +76,7 @@ $oOP->save(); G::LoadClass( 'processMap' ); $oProcessMap = new ProcessMap(); $oProcessMap->getObjectsPermissionsCriteria( $sValue['PRO_UID'] ); + +$infoProcess = new Processes(); +$resultProcess = $infoProcess->getProcessRow($sValue['PRO_UID']); +G::auditLog('ProcessPermissions','Add Permission "'.$sValue['OP_OBJ_TYPE'].'" in Process "'.$resultProcess['PRO_TITLE'].'"'); diff --git a/workflow/engine/methods/steps/steps_SupervisorAjax.php b/workflow/engine/methods/steps/steps_SupervisorAjax.php index e9039ee50..3edf84514 100755 --- a/workflow/engine/methods/steps/steps_SupervisorAjax.php +++ b/workflow/engine/methods/steps/steps_SupervisorAjax.php @@ -41,6 +41,9 @@ try { G::LoadClass( 'processMap' ); $oProcessMap = new ProcessMap(); + + $infoProcess = new Processes(); + $resultProcess = $infoProcess->getProcessRow($_POST['PRO_UID']); switch ($_POST['action']) { case 'availableSupervisorDynaforms': @@ -48,18 +51,22 @@ try { break; case 'assignSupervisorDynaform': $oProcessMap->assignSupervisorStep( $_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID'] ); + G::auditLog('AssignSupervisorDynaform','Assign Supervisor Dynaform in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'removeSupervisorDynaform': $oProcessMap->removeSupervisorStep( $_POST['STEP_UID'], $_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID'], $_POST['STEP_POSITION'] ); + G::auditLog('RemoveSupervisorDynaform','Remove Supervisor Dynaform in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'availableSupervisorInputs': $oProcessMap->availableSupervisorInputs( $_POST['PRO_UID'] ); break; case 'assignSupervisorInput': $oProcessMap->assignSupervisorStep( $_POST['PRO_UID'], 'INPUT_DOCUMENT', $_POST['INP_DOC_UID'] ); + G::auditLog('AssignSupervisorInput','Assign Supervisor Input in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'removeSupervisorInput': $oProcessMap->removeSupervisorStep( $_POST['STEP_UID'], $_POST['PRO_UID'], 'INPUT_DOCUMENT', $_POST['INP_DOC_UID'], $_POST['STEP_POSITION'] ); + G::auditLog('RemoveSupervisorInput','Remove Supervisor Input in Process "'.$resultProcess['PRO_TITLE'].'"'); break; } } catch (Exception $oException) { diff --git a/workflow/engine/methods/tracker/tracker_Ajax.php b/workflow/engine/methods/tracker/tracker_Ajax.php index 8551aeedc..484720438 100755 --- a/workflow/engine/methods/tracker/tracker_Ajax.php +++ b/workflow/engine/methods/tracker/tracker_Ajax.php @@ -25,6 +25,11 @@ try { if (isset( $_POST['form']['action'] )) { $_POST['action'] = $_POST['form']['action']; } + + $infoProcess = new Processes(); + $proFields = $infoProcess->serializeProcess($_POST['PRO_UID']); + $resultProcess = $infoProcess->saveSerializedProcess($proFields); + switch ($_POST['action']) { case 'availableCaseTrackerObjects': G::LoadClass( 'processMap' ); @@ -37,24 +42,28 @@ try { $cto_UID = $oProcessMap->assignCaseTrackerObject( $_POST['PRO_UID'], $_POST['OBJECT_TYPE'], $_POST['OBJECT_UID'] ); $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] ); echo $cto_UID; + G::auditLog('CaseTrackers','Assign Case Tracker Object ('.$_POST['OBJECT_TYPE'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'removeCaseTrackerObject': G::LoadClass( 'processMap' ); $oProcessMap = new ProcessMap(); $oProcessMap->removeCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] ); $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] ); + G::auditLog('CaseTrackers','Remove Case Tracker Object in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'upCaseTrackerObject': G::LoadClass( 'processMap' ); $oProcessMap = new ProcessMap(); $oProcessMap->upCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] ); $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] ); + G::auditLog('CaseTrackers','Move Up Case Tracker Object in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'downCaseTrackerObject': G::LoadClass( 'processMap' ); $oProcessMap = new ProcessMap(); $oProcessMap->downCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] ); $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] ); + G::auditLog('CaseTrackers','Move Down Case Tracker Object in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'editStagesMap': $oTemplatePower = new TemplatePower( PATH_TPL . 'tracker/stages_Map.html' ); diff --git a/workflow/engine/methods/tracker/tracker_ConditionsSave.php b/workflow/engine/methods/tracker/tracker_ConditionsSave.php index 4ef89a7bd..6fc66202a 100755 --- a/workflow/engine/methods/tracker/tracker_ConditionsSave.php +++ b/workflow/engine/methods/tracker/tracker_ConditionsSave.php @@ -48,6 +48,11 @@ try { $aFields = $oCaseTrackerObject->load( $value['CTO_UID'] ); $aFields['CTO_CONDITION'] = $value['CTO_CONDITION']; $oCaseTrackerObject->update( $aFields ); + + $infoProcess = new Processes(); + $proFields = $infoProcess->serializeProcess($value['PRO_UID']); + $resultProcess = $infoProcess->saveSerializedProcess($proFields); + G::auditLog('CaseTrackers','Save Condition Case Tracker Object ('.$value['CTO_CONDITION'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); } catch (Exception $oException) { die( $oException->getMessage() ); } diff --git a/workflow/engine/methods/tracker/tracker_Save.php b/workflow/engine/methods/tracker/tracker_Save.php index fcc27d712..7fafe2cd6 100755 --- a/workflow/engine/methods/tracker/tracker_Save.php +++ b/workflow/engine/methods/tracker/tracker_Save.php @@ -15,3 +15,8 @@ require_once 'classes/model/CaseTracker.php'; $oCaseTracker = new CaseTracker(); $oCaseTracker->update( $sValue ); +$infoProcess = new Processes(); +$proFields = $infoProcess->serializeProcess($sValue['PRO_UID']); +$resultProcess = $infoProcess->saveSerializedProcess($proFields); +G::auditLog('CaseTrackers','Save Case Tracker Properties ('.$sValue['CT_MAP_TYPE'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); + From 3ac5fdf9bafb530f257df1a9beddafdf6a872a6c Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Fri, 13 Feb 2015 14:57:00 -0400 Subject: [PATCH 028/155] I solved the issue PM-140 and PM-1547 --- workflow/engine/classes/class.derivation.php | 9 ++++++++- workflow/engine/methods/cases/cases_Step.php | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/workflow/engine/classes/class.derivation.php b/workflow/engine/classes/class.derivation.php index 9c3328886..7b5fc2b65 100755 --- a/workflow/engine/classes/class.derivation.php +++ b/workflow/engine/classes/class.derivation.php @@ -240,7 +240,14 @@ class Derivation //1. There is no rule if (count($arrayNextTask) == 0) { - throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_RULE")); + $c = new Criteria("workflow"); + $c->add(BpmnProcessPeer::PRJ_UID, $_SESSION['PROCESS']); + $res = BpmnProcessPeer::doSelect($c); + if( sizeof($res) == 0 ){ + throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_RULE")); + }else{ + throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_BPMN_RULE")); + } } //Return diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php index 0ff76c553..d1b8bc9b1 100755 --- a/workflow/engine/methods/cases/cases_Step.php +++ b/workflow/engine/methods/cases/cases_Step.php @@ -1019,7 +1019,16 @@ try { } //Add content content step - End } catch (Exception $e) { - G::SendTemporalMessage( G::LoadTranslation( 'ID_PROCESS_DEF_PROBLEM' ), 'error', 'string', 3, 100 ); + //Check if the process is BPMN + $c = new Criteria("workflow"); + $c->add(BpmnProcessPeer::PRJ_UID, $_SESSION['PROCESS']); + $res = BpmnProcessPeer::doSelect($c); + if( sizeof($res) == 0 ){ + G::SendTemporalMessage( G::LoadTranslation( 'ID_PROCESS_DEF_PROBLEM' ), 'error', 'string', 3, 100 ); + }else{ + G::SendTemporalMessage( G::LoadTranslation( 'ID_BPMN_PROCESS_DEF_PROBLEM' ), 'error', 'string', 3, 100 ); + } + $aMessage = array (); $aMessage['MESSAGE'] = $e->getMessage(); $G_PUBLISH = new Publisher(); From 1bc30c8fd1498174c8c214244a8f832096c19d86 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 13 Feb 2015 15:00:54 -0400 Subject: [PATCH 029/155] PM-1373 --- workflow/engine/templates/processes/main.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index 97717d73f..740c0c357 100755 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -587,7 +587,7 @@ function saveProcess() if ( typeof(winDesigner) == "undefined" || winDesigner.closed ){ winDesigner = window.open( "../designer?prj_uid="+resp.result.PRO_UID, - '_blank' + 'winDesigner' ); } else { PMExt.error( _('ID_FAILED'), _('PROCESS_ALREADY_OPENED')); @@ -648,7 +648,7 @@ editProcess = function(typeParam) if (typeof(winDesigner) == "undefined" || winDesigner.closed){ winDesigner = window.open( url, - '_blank' + 'winDesigner' ); } else { PMExt.error( _('ID_FAILED'), _('PROCESS_ALREADY_OPENED')); @@ -964,7 +964,7 @@ importProcessExistGroup = function() if (typeof(winDesigner) == "undefined" || winDesigner.closed){ winDesigner = window.open( "../designer?prj_uid=" + sNewProUid, - '_blank' + 'winDesigner' ); } else { PMExt.error( _('ID_FAILED'), _('PROCESS_ALREADY_OPENED')); @@ -1110,7 +1110,7 @@ importProcessExistProcess = function() if (typeof(winDesigner) == "undefined" || winDesigner.closed){ winDesigner = window.open( "../designer?prj_uid=" + sNewProUid, - '_blank' + 'winDesigner' ); } else { PMExt.error( _('ID_FAILED'), _('PROCESS_ALREADY_OPENED')); @@ -1248,7 +1248,7 @@ importProcess = function() if (typeof(winDesigner) == "undefined" || winDesigner.closed){ winDesigner = window.open( "../designer?prj_uid=" + sNewProUid, - '_blank' + 'winDesigner' ); } else { PMExt.error( _('ID_FAILED'), _('PROCESS_ALREADY_OPENED')); @@ -1564,3 +1564,7 @@ function enableDisableDebug() } +Ext.EventManager.on(window, 'beforeunload', function () { + if (winDesigner) + winDesigner.close(); +}); \ No newline at end of file From 400714e166a957486f4fa1e3c731ac5e63e2200c Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Fri, 13 Feb 2015 15:20:38 -0400 Subject: [PATCH 030/155] PM-FIXLANES. Se adiciona order al get de lanes, para asegurarse que siempre esten ordenados al dibujarse --- workflow/engine/classes/model/BpmnLane.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 workflow/engine/classes/model/BpmnLane.php diff --git a/workflow/engine/classes/model/BpmnLane.php b/workflow/engine/classes/model/BpmnLane.php old mode 100644 new mode 100755 index 4a4be18bc..41ec73f96 --- a/workflow/engine/classes/model/BpmnLane.php +++ b/workflow/engine/classes/model/BpmnLane.php @@ -78,7 +78,7 @@ class BpmnLane extends BaseBpmnLane { if (! is_null($prjUid)) { $c->add(BpmnLanePeer::PRJ_UID, $prjUid, Criteria::EQUAL); } - + $c->addAscendingOrderByColumn(BpmnBoundPeer::BOU_REL_POSITION); $rs = BpmnLanePeer::doSelectRS($c); $rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC); From d485b5a3f67e88c934b064b7f6ccdee4e9e9f265 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 13 Feb 2015 15:56:51 -0400 Subject: [PATCH 031/155] PM-1366 --- workflow/engine/templates/processes/main.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index 97717d73f..33d52b715 100755 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -476,6 +476,8 @@ Ext.onReady(function(){ function newProcess(params) { + if (winDesigner) + winDesigner.close(); params = typeof params == 'undefined' ? {type:'classicProject'} : params; // TODO this variable have hardcoded labels, it must be changed on the future @@ -589,6 +591,8 @@ function saveProcess() "../designer?prj_uid="+resp.result.PRO_UID, '_blank' ); + Ext.getCmp('newProjectWin').close(); + processesGrid.store.reload(); } else { PMExt.error( _('ID_FAILED'), _('PROCESS_ALREADY_OPENED')); } From ae4d111bfadc27bb17e38c8b2067d061c5750e88 Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Fri, 13 Feb 2015 16:15:31 -0400 Subject: [PATCH 032/155] BUG-16676 Default flow no tiene funcionalidad --- workflow/engine/classes/class.derivation.php | 10 ++++------ .../model/map/ListParticipatedLastMapBuilder.php | 2 +- workflow/engine/classes/model/om/BaseBpmnFlow.php | 14 +++++++------- workflow/engine/config/schema.xml | 2 +- workflow/engine/data/mysql/schema.sql | 2 +- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/workflow/engine/classes/class.derivation.php b/workflow/engine/classes/class.derivation.php index 9c3328886..de0c40c80 100755 --- a/workflow/engine/classes/class.derivation.php +++ b/workflow/engine/classes/class.derivation.php @@ -142,7 +142,6 @@ class Derivation $arrayNextTask = array(); $arrayNextTaskDefault = array(); - $i = 0; //SELECT * //FROM APP_DELEGATION AS A @@ -211,18 +210,17 @@ class Derivation } if ($flagContinue) { - $arrayNextTask[++$i] = $this->prepareInformationTask($arrayRouteData); + $arrayNextTask[] = $this->prepareInformationTask($arrayRouteData); } } if (count($arrayNextTask) == 0 && count($arrayNextTaskDefault) > 0) { - $arrayNextTask[++$i] = $this->prepareInformationTask($arrayNextTaskDefault); + $arrayNextTask[] = $this->prepareInformationTask($arrayNextTaskDefault); } //Check Task GATEWAYTOGATEWAY $arrayNextTaskBk = $arrayNextTask; $arrayNextTask = array(); - $i = 0; foreach ($arrayNextTaskBk as $value) { $arrayNextTaskData = $value; @@ -231,10 +229,10 @@ class Derivation $arrayAux = $this->prepareInformation($arrayData, $arrayNextTaskData["NEXT_TASK"]["TAS_UID"]); foreach ($arrayAux as $value2) { - $arrayNextTask[++$i] = $value2; + $arrayNextTask[] = $value2; } } else { - $arrayNextTask[++$i] = $arrayNextTaskData; + $arrayNextTask[] = $arrayNextTaskData; } } diff --git a/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php b/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php index 10a3e1bf3..78843fad8 100644 --- a/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php +++ b/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php @@ -81,7 +81,7 @@ class ListParticipatedLastMapBuilder $tMap->addColumn('APP_TAS_TITLE', 'AppTasTitle', 'string', CreoleTypes::VARCHAR, true, 255); - $tMap->addColumn('APP_STATUS', 'AppStatus', 'string', CreoleTypes::VARCHAR, true, 20); + $tMap->addColumn('APP_STATUS', 'AppStatus', 'string', CreoleTypes::VARCHAR, false, 20); $tMap->addColumn('DEL_INDEX', 'DelIndex', 'int', CreoleTypes::INTEGER, true, null); diff --git a/workflow/engine/classes/model/om/BaseBpmnFlow.php b/workflow/engine/classes/model/om/BaseBpmnFlow.php index 15f28a2ad..4badba254 100755 --- a/workflow/engine/classes/model/om/BaseBpmnFlow.php +++ b/workflow/engine/classes/model/om/BaseBpmnFlow.php @@ -141,7 +141,7 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent */ protected $flo_position = 0; - /** + /** * @var BpmnProject */ protected $aBpmnProject; @@ -365,7 +365,7 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent /** * Get the [flo_position] column value. - * + * * @return int */ public function getFloPosition() @@ -374,7 +374,7 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent return $this->flo_position; } - /* + /** * Set the value of [flo_uid] column. * * @param string $v new value @@ -780,7 +780,7 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent /** * Set the value of [flo_position] column. - * + * * @param int $v new value * @return void */ @@ -794,9 +794,9 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent } if ($this->flo_position !== $v || $v === 0) { - $this->flo_position = $v; - $this->modifiedColumns[] = BpmnFlowPeer::FLO_POSITION; - } + $this->flo_position = $v; + $this->modifiedColumns[] = BpmnFlowPeer::FLO_POSITION; + } } // setFloPosition() diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 411c38c86..6badf1c45 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -4015,7 +4015,7 @@ - + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index e034b44a1..79ea43eb2 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2263,7 +2263,7 @@ CREATE TABLE `LIST_PARTICIPATED_LAST` `APP_TITLE` VARCHAR(255) default '' NOT NULL, `APP_PRO_TITLE` VARCHAR(255) default '' NOT NULL, `APP_TAS_TITLE` VARCHAR(255) default '' NOT NULL, - `APP_STATUS` VARCHAR(20) default '0' NOT NULL, + `APP_STATUS` VARCHAR(20) default '0', `DEL_INDEX` INTEGER default 0 NOT NULL, `DEL_PREVIOUS_USR_UID` VARCHAR(32) default '', `DEL_PREVIOUS_USR_USERNAME` VARCHAR(100) default '', From 762f38ab7e6cd6f38608bcafc12e096355f6cc4b Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 13 Feb 2015 16:26:45 -0400 Subject: [PATCH 033/155] PM-1368 --- workflow/engine/templates/processes/main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index 740c0c357..c6f3a92b0 100755 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -1163,6 +1163,11 @@ importProcessExistProcess = function() importProcess = function() { + if (winDesigner) { + winDesigner.close(); + if (!winDesigner.closed) + return; + } var processFileType = importProcessGlobal.processFileType; var processFileTypeTitle = (processFileType == "pm") ? "" : " " + processFileType; From 0087164f0d46cde68d0266ec5404bba1cd8fc941 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Fri, 13 Feb 2015 16:30:11 -0400 Subject: [PATCH 034/155] I replace the code with a function isBpmnProcess --- workflow/engine/classes/class.derivation.php | 11 +++++------ workflow/engine/classes/model/Process.php | 13 +++++++++++++ workflow/engine/methods/cases/cases_Step.php | 11 ++++------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/workflow/engine/classes/class.derivation.php b/workflow/engine/classes/class.derivation.php index 7b5fc2b65..4950006a9 100755 --- a/workflow/engine/classes/class.derivation.php +++ b/workflow/engine/classes/class.derivation.php @@ -240,13 +240,12 @@ class Derivation //1. There is no rule if (count($arrayNextTask) == 0) { - $c = new Criteria("workflow"); - $c->add(BpmnProcessPeer::PRJ_UID, $_SESSION['PROCESS']); - $res = BpmnProcessPeer::doSelect($c); - if( sizeof($res) == 0 ){ - throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_RULE")); + $oProcess = new Process(); + $oProcessFieds = $oProcess->Load( $_SESSION['PROCESS'] ); + if(isset($oProcessFieds['PRO_BPMN']) && $oProcessFieds['PRO_BPMN'] == 1){ + throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_BPMN_RULE")); }else{ - throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_BPMN_RULE")); + throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_RULE")); } } diff --git a/workflow/engine/classes/model/Process.php b/workflow/engine/classes/model/Process.php index 32d67cc4d..ad4dd65c0 100755 --- a/workflow/engine/classes/model/Process.php +++ b/workflow/engine/classes/model/Process.php @@ -326,6 +326,8 @@ class Process extends BaseProcess } $aFields['PRO_DYNAFORMS'] = @unserialize( $aFields['PRO_DYNAFORMS'] ); + //Check if is BPMN process + $aFields['PRO_BPMN'] = $this->isBpmnProcess($ProUid); return $aFields; } else { @@ -1009,5 +1011,16 @@ class Process extends BaseProcess return 0; } } + + public function isBpmnProcess($proUid){ + $c = new Criteria("workflow"); + $c->add(BpmnProcessPeer::PRJ_UID, $proUid); + $res = BpmnProcessPeer::doSelect($c); + if( sizeof($res) == 0 ){ + return 0; + }else{ + return 1; + } + } } diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php index d1b8bc9b1..19d11f170 100755 --- a/workflow/engine/methods/cases/cases_Step.php +++ b/workflow/engine/methods/cases/cases_Step.php @@ -1019,14 +1019,11 @@ try { } //Add content content step - End } catch (Exception $e) { - //Check if the process is BPMN - $c = new Criteria("workflow"); - $c->add(BpmnProcessPeer::PRJ_UID, $_SESSION['PROCESS']); - $res = BpmnProcessPeer::doSelect($c); - if( sizeof($res) == 0 ){ - G::SendTemporalMessage( G::LoadTranslation( 'ID_PROCESS_DEF_PROBLEM' ), 'error', 'string', 3, 100 ); + //Check if the process is BPMN + if(isset($oProcessFieds['PRO_BPMN']) && $oProcessFieds['PRO_BPMN'] == 1){ + G::SendTemporalMessage( G::LoadTranslation( 'ID_BPMN_PROCESS_DEF_PROBLEM' ), 'error', 'string', 3, 100 ); }else{ - G::SendTemporalMessage( G::LoadTranslation( 'ID_BPMN_PROCESS_DEF_PROBLEM' ), 'error', 'string', 3, 100 ); + G::SendTemporalMessage( G::LoadTranslation( 'ID_PROCESS_DEF_PROBLEM' ), 'error', 'string', 3, 100 ); } $aMessage = array (); From b83718f29504d7ae30e401dc5e8df30f5f750845 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Fri, 13 Feb 2015 16:32:43 -0400 Subject: [PATCH 035/155] PM-939 "Support for Message-Event (Endpoints and Backend)" - Se han implementado los siguientes Endpoints: GET /api/1.0/{workspace}/project/{prj_uid}/message-event-definitions GET /api/1.0/{workspace}/project/{prj_uid}/message-event-definition/{msged_uid} GET /api/1.0/{workspace}/project/{prj_uid}/message-event-definition/event/{evn_uid} POST /api/1.0/{workspace}/project/{prj_uid}/message-event-definition PUT /api/1.0/{workspace}/project/{prj_uid}/message-event-definition/{msged_uid} DELETE /api/1.0/{workspace}/project/{prj_uid}/message-event-definition/{msged_uid} - Se han implementado los metodos necesarios/requeridos para el backend del DESIGNER para esta nueva funcionalidad --- .../classes/model/MessageApplication.php | 5 + .../classes/model/MessageApplicationPeer.php | 5 + .../classes/model/MessageEventDefinition.php | 5 + .../model/MessageEventDefinitionPeer.php | 5 + .../classes/model/MessageEventRelation.php | 5 + .../model/MessageEventRelationPeer.php | 5 + .../model/MessageEventTaskRelation.php | 5 + .../model/MessageEventTaskRelationPeer.php | 5 + .../map/MessageApplicationMapBuilder.php | 92 ++ .../map/MessageEventDefinitionMapBuilder.php | 84 ++ .../map/MessageEventRelationMapBuilder.php | 78 ++ .../MessageEventTaskRelationMapBuilder.php | 78 ++ .../classes/model/map/TaskMapBuilder.php | 4 +- .../model/om/BaseMessageApplication.php | 1088 +++++++++++++++++ .../model/om/BaseMessageApplicationPeer.php | 615 ++++++++++ .../model/om/BaseMessageEventDefinition.php | 858 +++++++++++++ .../om/BaseMessageEventDefinitionPeer.php | 597 +++++++++ .../model/om/BaseMessageEventRelation.php | 684 +++++++++++ .../model/om/BaseMessageEventRelationPeer.php | 582 +++++++++ .../model/om/BaseMessageEventTaskRelation.php | 684 +++++++++++ .../om/BaseMessageEventTaskRelationPeer.php | 582 +++++++++ workflow/engine/config/schema.xml | 92 +- workflow/engine/data/mysql/schema.sql | 76 +- .../BusinessModel/MessageEventDefinition.php | 706 +++++++++++ .../BusinessModel/MessageEventRelation.php | 408 +++++++ .../MessageEventTaskRelation.php | 352 ++++++ .../BusinessModel/WebEntryEvent.php | 6 +- .../Project/Adapter/BpmnWorkflow.php | 503 +++++++- .../engine/src/ProcessMaker/Project/Bpmn.php | 52 + .../src/ProcessMaker/Project/Workflow.php | 4 +- .../Api/Project/MessageEventDefinition.php | 134 ++ .../engine/src/ProcessMaker/Services/api.ini | 3 +- 32 files changed, 8344 insertions(+), 58 deletions(-) create mode 100644 workflow/engine/classes/model/MessageApplication.php create mode 100644 workflow/engine/classes/model/MessageApplicationPeer.php create mode 100644 workflow/engine/classes/model/MessageEventDefinition.php create mode 100644 workflow/engine/classes/model/MessageEventDefinitionPeer.php create mode 100644 workflow/engine/classes/model/MessageEventRelation.php create mode 100644 workflow/engine/classes/model/MessageEventRelationPeer.php create mode 100644 workflow/engine/classes/model/MessageEventTaskRelation.php create mode 100644 workflow/engine/classes/model/MessageEventTaskRelationPeer.php create mode 100644 workflow/engine/classes/model/map/MessageApplicationMapBuilder.php create mode 100644 workflow/engine/classes/model/map/MessageEventDefinitionMapBuilder.php create mode 100644 workflow/engine/classes/model/map/MessageEventRelationMapBuilder.php create mode 100644 workflow/engine/classes/model/map/MessageEventTaskRelationMapBuilder.php create mode 100644 workflow/engine/classes/model/om/BaseMessageApplication.php create mode 100644 workflow/engine/classes/model/om/BaseMessageApplicationPeer.php create mode 100644 workflow/engine/classes/model/om/BaseMessageEventDefinition.php create mode 100644 workflow/engine/classes/model/om/BaseMessageEventDefinitionPeer.php create mode 100644 workflow/engine/classes/model/om/BaseMessageEventRelation.php create mode 100644 workflow/engine/classes/model/om/BaseMessageEventRelationPeer.php create mode 100644 workflow/engine/classes/model/om/BaseMessageEventTaskRelation.php create mode 100644 workflow/engine/classes/model/om/BaseMessageEventTaskRelationPeer.php create mode 100644 workflow/engine/src/ProcessMaker/BusinessModel/MessageEventDefinition.php create mode 100644 workflow/engine/src/ProcessMaker/BusinessModel/MessageEventRelation.php create mode 100644 workflow/engine/src/ProcessMaker/BusinessModel/MessageEventTaskRelation.php create mode 100644 workflow/engine/src/ProcessMaker/Services/Api/Project/MessageEventDefinition.php diff --git a/workflow/engine/classes/model/MessageApplication.php b/workflow/engine/classes/model/MessageApplication.php new file mode 100644 index 000000000..197b3adf7 --- /dev/null +++ b/workflow/engine/classes/model/MessageApplication.php @@ -0,0 +1,5 @@ +dbMap !== null); + } + + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return $this->dbMap; + } + + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('workflow'); + + $tMap = $this->dbMap->addTable('MESSAGE_APPLICATION'); + $tMap->setPhpName('MessageApplication'); + + $tMap->setUseIdGenerator(false); + + $tMap->addPrimaryKey('MSGAPP_UID', 'MsgappUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('PRJ_UID', 'PrjUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('EVN_UID_THROW', 'EvnUidThrow', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('EVN_UID_CATCH', 'EvnUidCatch', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('MSGAPP_VARIABLES', 'MsgappVariables', 'string', CreoleTypes::LONGVARCHAR, true, null); + + $tMap->addColumn('MSGAPP_CORRELATION', 'MsgappCorrelation', 'string', CreoleTypes::VARCHAR, true, 512); + + $tMap->addColumn('MSGAPP_THROW_DATE', 'MsgappThrowDate', 'int', CreoleTypes::TIMESTAMP, true, null); + + $tMap->addColumn('MSGAPP_CATCH_DATE', 'MsgappCatchDate', 'int', CreoleTypes::TIMESTAMP, false, null); + + $tMap->addColumn('MSGAPP_STATUS', 'MsgappStatus', 'string', CreoleTypes::VARCHAR, true, 25); + + $tMap->addValidator('MSGAPP_STATUS', 'validValues', 'propel.validator.ValidValuesValidator', 'READ|UNREAD', 'Please enter a valid value for MSGAPP_STATUS'); + + } // doBuild() + +} // MessageApplicationMapBuilder diff --git a/workflow/engine/classes/model/map/MessageEventDefinitionMapBuilder.php b/workflow/engine/classes/model/map/MessageEventDefinitionMapBuilder.php new file mode 100644 index 000000000..c678de147 --- /dev/null +++ b/workflow/engine/classes/model/map/MessageEventDefinitionMapBuilder.php @@ -0,0 +1,84 @@ +dbMap !== null); + } + + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return $this->dbMap; + } + + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('workflow'); + + $tMap = $this->dbMap->addTable('MESSAGE_EVENT_DEFINITION'); + $tMap->setPhpName('MessageEventDefinition'); + + $tMap->setUseIdGenerator(false); + + $tMap->addPrimaryKey('MSGED_UID', 'MsgedUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('PRJ_UID', 'PrjUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('EVN_UID', 'EvnUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('MSGT_UID', 'MsgtUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('MSGED_USR_UID', 'MsgedUsrUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('MSGED_VARIABLES', 'MsgedVariables', 'string', CreoleTypes::LONGVARCHAR, true, null); + + $tMap->addColumn('MSGED_CORRELATION', 'MsgedCorrelation', 'string', CreoleTypes::VARCHAR, true, 512); + + } // doBuild() + +} // MessageEventDefinitionMapBuilder diff --git a/workflow/engine/classes/model/map/MessageEventRelationMapBuilder.php b/workflow/engine/classes/model/map/MessageEventRelationMapBuilder.php new file mode 100644 index 000000000..345a6f330 --- /dev/null +++ b/workflow/engine/classes/model/map/MessageEventRelationMapBuilder.php @@ -0,0 +1,78 @@ +dbMap !== null); + } + + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return $this->dbMap; + } + + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('workflow'); + + $tMap = $this->dbMap->addTable('MESSAGE_EVENT_RELATION'); + $tMap->setPhpName('MessageEventRelation'); + + $tMap->setUseIdGenerator(false); + + $tMap->addPrimaryKey('MSGER_UID', 'MsgerUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('PRJ_UID', 'PrjUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('EVN_UID_THROW', 'EvnUidThrow', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('EVN_UID_CATCH', 'EvnUidCatch', 'string', CreoleTypes::VARCHAR, true, 32); + + } // doBuild() + +} // MessageEventRelationMapBuilder diff --git a/workflow/engine/classes/model/map/MessageEventTaskRelationMapBuilder.php b/workflow/engine/classes/model/map/MessageEventTaskRelationMapBuilder.php new file mode 100644 index 000000000..24efa6433 --- /dev/null +++ b/workflow/engine/classes/model/map/MessageEventTaskRelationMapBuilder.php @@ -0,0 +1,78 @@ +dbMap !== null); + } + + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return $this->dbMap; + } + + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('workflow'); + + $tMap = $this->dbMap->addTable('MESSAGE_EVENT_TASK_RELATION'); + $tMap->setPhpName('MessageEventTaskRelation'); + + $tMap->setUseIdGenerator(false); + + $tMap->addPrimaryKey('MSGETR_UID', 'MsgetrUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('PRJ_UID', 'PrjUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('EVN_UID', 'EvnUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('TAS_UID', 'TasUid', 'string', CreoleTypes::VARCHAR, true, 32); + + } // doBuild() + +} // MessageEventTaskRelationMapBuilder diff --git a/workflow/engine/classes/model/map/TaskMapBuilder.php b/workflow/engine/classes/model/map/TaskMapBuilder.php index 6d3eeca67..2cc83e175 100755 --- a/workflow/engine/classes/model/map/TaskMapBuilder.php +++ b/workflow/engine/classes/model/map/TaskMapBuilder.php @@ -69,7 +69,7 @@ class TaskMapBuilder $tMap->addPrimaryKey('TAS_UID', 'TasUid', 'string', CreoleTypes::VARCHAR, true, 32); - $tMap->addColumn('TAS_TYPE', 'TasType', 'string', CreoleTypes::VARCHAR, true, 20); + $tMap->addColumn('TAS_TYPE', 'TasType', 'string', CreoleTypes::VARCHAR, true, 50); $tMap->addColumn('TAS_DURATION', 'TasDuration', 'double', CreoleTypes::DOUBLE, true, null); @@ -159,7 +159,7 @@ class TaskMapBuilder $tMap->addColumn('TAS_SELFSERVICE_EXECUTION', 'TasSelfserviceExecution', 'string', CreoleTypes::VARCHAR, false, 15); - $tMap->addValidator('TAS_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'NORMAL|ADHOC|SUBPROCESS|HIDDEN|GATEWAYTOGATEWAY|WEBENTRYEVENT', 'Please enter a valid value for TAS_TYPE'); + $tMap->addValidator('TAS_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'NORMAL|ADHOC|SUBPROCESS|HIDDEN|GATEWAYTOGATEWAY|WEBENTRYEVENT|START-MESSAGE-EVENT|END-MESSAGE-EVENT|INTERMEDIATE-START-MESSAGE-EVENT|INTERMEDIATE-END-MESSAGE-EVENT', 'Please enter a valid value for TAS_TYPE'); $tMap->addValidator('TAS_TIMEUNIT', 'validValues', 'propel.validator.ValidValuesValidator', 'MINUTES|HOURS|DAYS|WEEKS|MONTHS', 'Please select a valid value for TAS_TIMEUNIT.'); diff --git a/workflow/engine/classes/model/om/BaseMessageApplication.php b/workflow/engine/classes/model/om/BaseMessageApplication.php new file mode 100644 index 000000000..ff81a8d1a --- /dev/null +++ b/workflow/engine/classes/model/om/BaseMessageApplication.php @@ -0,0 +1,1088 @@ +msgapp_uid; + } + + /** + * Get the [app_uid] column value. + * + * @return string + */ + public function getAppUid() + { + + return $this->app_uid; + } + + /** + * Get the [prj_uid] column value. + * + * @return string + */ + public function getPrjUid() + { + + return $this->prj_uid; + } + + /** + * Get the [evn_uid_throw] column value. + * + * @return string + */ + public function getEvnUidThrow() + { + + return $this->evn_uid_throw; + } + + /** + * Get the [evn_uid_catch] column value. + * + * @return string + */ + public function getEvnUidCatch() + { + + return $this->evn_uid_catch; + } + + /** + * Get the [msgapp_variables] column value. + * + * @return string + */ + public function getMsgappVariables() + { + + return $this->msgapp_variables; + } + + /** + * Get the [msgapp_correlation] column value. + * + * @return string + */ + public function getMsgappCorrelation() + { + + return $this->msgapp_correlation; + } + + /** + * Get the [optionally formatted] [msgapp_throw_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getMsgappThrowDate($format = 'Y-m-d H:i:s') + { + + if ($this->msgapp_throw_date === null || $this->msgapp_throw_date === '') { + return null; + } elseif (!is_int($this->msgapp_throw_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->msgapp_throw_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [msgapp_throw_date] as date/time value: " . + var_export($this->msgapp_throw_date, true)); + } + } else { + $ts = $this->msgapp_throw_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [optionally formatted] [msgapp_catch_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getMsgappCatchDate($format = 'Y-m-d H:i:s') + { + + if ($this->msgapp_catch_date === null || $this->msgapp_catch_date === '') { + return null; + } elseif (!is_int($this->msgapp_catch_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->msgapp_catch_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [msgapp_catch_date] as date/time value: " . + var_export($this->msgapp_catch_date, true)); + } + } else { + $ts = $this->msgapp_catch_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [msgapp_status] column value. + * + * @return string + */ + public function getMsgappStatus() + { + + return $this->msgapp_status; + } + + /** + * Set the value of [msgapp_uid] column. + * + * @param string $v new value + * @return void + */ + public function setMsgappUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->msgapp_uid !== $v) { + $this->msgapp_uid = $v; + $this->modifiedColumns[] = MessageApplicationPeer::MSGAPP_UID; + } + + } // setMsgappUid() + + /** + * Set the value of [app_uid] column. + * + * @param string $v new value + * @return void + */ + public function setAppUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_uid !== $v) { + $this->app_uid = $v; + $this->modifiedColumns[] = MessageApplicationPeer::APP_UID; + } + + } // setAppUid() + + /** + * Set the value of [prj_uid] column. + * + * @param string $v new value + * @return void + */ + public function setPrjUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->prj_uid !== $v) { + $this->prj_uid = $v; + $this->modifiedColumns[] = MessageApplicationPeer::PRJ_UID; + } + + } // setPrjUid() + + /** + * Set the value of [evn_uid_throw] column. + * + * @param string $v new value + * @return void + */ + public function setEvnUidThrow($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->evn_uid_throw !== $v) { + $this->evn_uid_throw = $v; + $this->modifiedColumns[] = MessageApplicationPeer::EVN_UID_THROW; + } + + } // setEvnUidThrow() + + /** + * Set the value of [evn_uid_catch] column. + * + * @param string $v new value + * @return void + */ + public function setEvnUidCatch($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->evn_uid_catch !== $v) { + $this->evn_uid_catch = $v; + $this->modifiedColumns[] = MessageApplicationPeer::EVN_UID_CATCH; + } + + } // setEvnUidCatch() + + /** + * Set the value of [msgapp_variables] column. + * + * @param string $v new value + * @return void + */ + public function setMsgappVariables($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->msgapp_variables !== $v || $v === '') { + $this->msgapp_variables = $v; + $this->modifiedColumns[] = MessageApplicationPeer::MSGAPP_VARIABLES; + } + + } // setMsgappVariables() + + /** + * Set the value of [msgapp_correlation] column. + * + * @param string $v new value + * @return void + */ + public function setMsgappCorrelation($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->msgapp_correlation !== $v || $v === '') { + $this->msgapp_correlation = $v; + $this->modifiedColumns[] = MessageApplicationPeer::MSGAPP_CORRELATION; + } + + } // setMsgappCorrelation() + + /** + * Set the value of [msgapp_throw_date] column. + * + * @param int $v new value + * @return void + */ + public function setMsgappThrowDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [msgapp_throw_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->msgapp_throw_date !== $ts) { + $this->msgapp_throw_date = $ts; + $this->modifiedColumns[] = MessageApplicationPeer::MSGAPP_THROW_DATE; + } + + } // setMsgappThrowDate() + + /** + * Set the value of [msgapp_catch_date] column. + * + * @param int $v new value + * @return void + */ + public function setMsgappCatchDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [msgapp_catch_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->msgapp_catch_date !== $ts) { + $this->msgapp_catch_date = $ts; + $this->modifiedColumns[] = MessageApplicationPeer::MSGAPP_CATCH_DATE; + } + + } // setMsgappCatchDate() + + /** + * Set the value of [msgapp_status] column. + * + * @param string $v new value + * @return void + */ + public function setMsgappStatus($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->msgapp_status !== $v || $v === 'UNREAD') { + $this->msgapp_status = $v; + $this->modifiedColumns[] = MessageApplicationPeer::MSGAPP_STATUS; + } + + } // setMsgappStatus() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (1-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. + * @param int $startcol 1-based offset column which indicates which restultset column to start with. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->msgapp_uid = $rs->getString($startcol + 0); + + $this->app_uid = $rs->getString($startcol + 1); + + $this->prj_uid = $rs->getString($startcol + 2); + + $this->evn_uid_throw = $rs->getString($startcol + 3); + + $this->evn_uid_catch = $rs->getString($startcol + 4); + + $this->msgapp_variables = $rs->getString($startcol + 5); + + $this->msgapp_correlation = $rs->getString($startcol + 6); + + $this->msgapp_throw_date = $rs->getTimestamp($startcol + 7, null); + + $this->msgapp_catch_date = $rs->getTimestamp($startcol + 8, null); + + $this->msgapp_status = $rs->getString($startcol + 9); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 10; // 10 = MessageApplicationPeer::NUM_COLUMNS - MessageApplicationPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating MessageApplication object", $e); + } + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param Connection $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(MessageApplicationPeer::DATABASE_NAME); + } + + try { + $con->begin(); + MessageApplicationPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. If the object is new, + * it inserts it; otherwise an update is performed. This method + * wraps the doSave() worker method in a transaction. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update + * @throws PropelException + * @see doSave() + */ + public function save($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(MessageApplicationPeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring + * @throws PropelException + * @see save() + */ + protected function doSave($con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = MessageApplicationPeer::doInsert($this, $con); + $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which + // should always be true here (even though technically + // BasePeer::doInsert() can insert multiple rows). + + $this->setNew(false); + } else { + $affectedRows += MessageApplicationPeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; + array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = MessageApplicationPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = MessageApplicationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getMsgappUid(); + break; + case 1: + return $this->getAppUid(); + break; + case 2: + return $this->getPrjUid(); + break; + case 3: + return $this->getEvnUidThrow(); + break; + case 4: + return $this->getEvnUidCatch(); + break; + case 5: + return $this->getMsgappVariables(); + break; + case 6: + return $this->getMsgappCorrelation(); + break; + case 7: + return $this->getMsgappThrowDate(); + break; + case 8: + return $this->getMsgappCatchDate(); + break; + case 9: + return $this->getMsgappStatus(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = MessageApplicationPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getMsgappUid(), + $keys[1] => $this->getAppUid(), + $keys[2] => $this->getPrjUid(), + $keys[3] => $this->getEvnUidThrow(), + $keys[4] => $this->getEvnUidCatch(), + $keys[5] => $this->getMsgappVariables(), + $keys[6] => $this->getMsgappCorrelation(), + $keys[7] => $this->getMsgappThrowDate(), + $keys[8] => $this->getMsgappCatchDate(), + $keys[9] => $this->getMsgappStatus(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = MessageApplicationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setMsgappUid($value); + break; + case 1: + $this->setAppUid($value); + break; + case 2: + $this->setPrjUid($value); + break; + case 3: + $this->setEvnUidThrow($value); + break; + case 4: + $this->setEvnUidCatch($value); + break; + case 5: + $this->setMsgappVariables($value); + break; + case 6: + $this->setMsgappCorrelation($value); + break; + case 7: + $this->setMsgappThrowDate($value); + break; + case 8: + $this->setMsgappCatchDate($value); + break; + case 9: + $this->setMsgappStatus($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, + * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = MessageApplicationPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) { + $this->setMsgappUid($arr[$keys[0]]); + } + + if (array_key_exists($keys[1], $arr)) { + $this->setAppUid($arr[$keys[1]]); + } + + if (array_key_exists($keys[2], $arr)) { + $this->setPrjUid($arr[$keys[2]]); + } + + if (array_key_exists($keys[3], $arr)) { + $this->setEvnUidThrow($arr[$keys[3]]); + } + + if (array_key_exists($keys[4], $arr)) { + $this->setEvnUidCatch($arr[$keys[4]]); + } + + if (array_key_exists($keys[5], $arr)) { + $this->setMsgappVariables($arr[$keys[5]]); + } + + if (array_key_exists($keys[6], $arr)) { + $this->setMsgappCorrelation($arr[$keys[6]]); + } + + if (array_key_exists($keys[7], $arr)) { + $this->setMsgappThrowDate($arr[$keys[7]]); + } + + if (array_key_exists($keys[8], $arr)) { + $this->setMsgappCatchDate($arr[$keys[8]]); + } + + if (array_key_exists($keys[9], $arr)) { + $this->setMsgappStatus($arr[$keys[9]]); + } + + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(MessageApplicationPeer::DATABASE_NAME); + + if ($this->isColumnModified(MessageApplicationPeer::MSGAPP_UID)) { + $criteria->add(MessageApplicationPeer::MSGAPP_UID, $this->msgapp_uid); + } + + if ($this->isColumnModified(MessageApplicationPeer::APP_UID)) { + $criteria->add(MessageApplicationPeer::APP_UID, $this->app_uid); + } + + if ($this->isColumnModified(MessageApplicationPeer::PRJ_UID)) { + $criteria->add(MessageApplicationPeer::PRJ_UID, $this->prj_uid); + } + + if ($this->isColumnModified(MessageApplicationPeer::EVN_UID_THROW)) { + $criteria->add(MessageApplicationPeer::EVN_UID_THROW, $this->evn_uid_throw); + } + + if ($this->isColumnModified(MessageApplicationPeer::EVN_UID_CATCH)) { + $criteria->add(MessageApplicationPeer::EVN_UID_CATCH, $this->evn_uid_catch); + } + + if ($this->isColumnModified(MessageApplicationPeer::MSGAPP_VARIABLES)) { + $criteria->add(MessageApplicationPeer::MSGAPP_VARIABLES, $this->msgapp_variables); + } + + if ($this->isColumnModified(MessageApplicationPeer::MSGAPP_CORRELATION)) { + $criteria->add(MessageApplicationPeer::MSGAPP_CORRELATION, $this->msgapp_correlation); + } + + if ($this->isColumnModified(MessageApplicationPeer::MSGAPP_THROW_DATE)) { + $criteria->add(MessageApplicationPeer::MSGAPP_THROW_DATE, $this->msgapp_throw_date); + } + + if ($this->isColumnModified(MessageApplicationPeer::MSGAPP_CATCH_DATE)) { + $criteria->add(MessageApplicationPeer::MSGAPP_CATCH_DATE, $this->msgapp_catch_date); + } + + if ($this->isColumnModified(MessageApplicationPeer::MSGAPP_STATUS)) { + $criteria->add(MessageApplicationPeer::MSGAPP_STATUS, $this->msgapp_status); + } + + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(MessageApplicationPeer::DATABASE_NAME); + + $criteria->add(MessageApplicationPeer::MSGAPP_UID, $this->msgapp_uid); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getMsgappUid(); + } + + /** + * Generic method to set the primary key (msgapp_uid column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setMsgappUid($key); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of MessageApplication (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setAppUid($this->app_uid); + + $copyObj->setPrjUid($this->prj_uid); + + $copyObj->setEvnUidThrow($this->evn_uid_throw); + + $copyObj->setEvnUidCatch($this->evn_uid_catch); + + $copyObj->setMsgappVariables($this->msgapp_variables); + + $copyObj->setMsgappCorrelation($this->msgapp_correlation); + + $copyObj->setMsgappThrowDate($this->msgapp_throw_date); + + $copyObj->setMsgappCatchDate($this->msgapp_catch_date); + + $copyObj->setMsgappStatus($this->msgapp_status); + + + $copyObj->setNew(true); + + $copyObj->setMsgappUid(NULL); // this is a pkey column, so set to default value + + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return MessageApplication Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return MessageApplicationPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new MessageApplicationPeer(); + } + return self::$peer; + } +} + diff --git a/workflow/engine/classes/model/om/BaseMessageApplicationPeer.php b/workflow/engine/classes/model/om/BaseMessageApplicationPeer.php new file mode 100644 index 000000000..f33bad125 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseMessageApplicationPeer.php @@ -0,0 +1,615 @@ + array ('MsgappUid', 'AppUid', 'PrjUid', 'EvnUidThrow', 'EvnUidCatch', 'MsgappVariables', 'MsgappCorrelation', 'MsgappThrowDate', 'MsgappCatchDate', 'MsgappStatus', ), + BasePeer::TYPE_COLNAME => array (MessageApplicationPeer::MSGAPP_UID, MessageApplicationPeer::APP_UID, MessageApplicationPeer::PRJ_UID, MessageApplicationPeer::EVN_UID_THROW, MessageApplicationPeer::EVN_UID_CATCH, MessageApplicationPeer::MSGAPP_VARIABLES, MessageApplicationPeer::MSGAPP_CORRELATION, MessageApplicationPeer::MSGAPP_THROW_DATE, MessageApplicationPeer::MSGAPP_CATCH_DATE, MessageApplicationPeer::MSGAPP_STATUS, ), + BasePeer::TYPE_FIELDNAME => array ('MSGAPP_UID', 'APP_UID', 'PRJ_UID', 'EVN_UID_THROW', 'EVN_UID_CATCH', 'MSGAPP_VARIABLES', 'MSGAPP_CORRELATION', 'MSGAPP_THROW_DATE', 'MSGAPP_CATCH_DATE', 'MSGAPP_STATUS', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('MsgappUid' => 0, 'AppUid' => 1, 'PrjUid' => 2, 'EvnUidThrow' => 3, 'EvnUidCatch' => 4, 'MsgappVariables' => 5, 'MsgappCorrelation' => 6, 'MsgappThrowDate' => 7, 'MsgappCatchDate' => 8, 'MsgappStatus' => 9, ), + BasePeer::TYPE_COLNAME => array (MessageApplicationPeer::MSGAPP_UID => 0, MessageApplicationPeer::APP_UID => 1, MessageApplicationPeer::PRJ_UID => 2, MessageApplicationPeer::EVN_UID_THROW => 3, MessageApplicationPeer::EVN_UID_CATCH => 4, MessageApplicationPeer::MSGAPP_VARIABLES => 5, MessageApplicationPeer::MSGAPP_CORRELATION => 6, MessageApplicationPeer::MSGAPP_THROW_DATE => 7, MessageApplicationPeer::MSGAPP_CATCH_DATE => 8, MessageApplicationPeer::MSGAPP_STATUS => 9, ), + BasePeer::TYPE_FIELDNAME => array ('MSGAPP_UID' => 0, 'APP_UID' => 1, 'PRJ_UID' => 2, 'EVN_UID_THROW' => 3, 'EVN_UID_CATCH' => 4, 'MSGAPP_VARIABLES' => 5, 'MSGAPP_CORRELATION' => 6, 'MSGAPP_THROW_DATE' => 7, 'MSGAPP_CATCH_DATE' => 8, 'MSGAPP_STATUS' => 9, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) + ); + + /** + * @return MapBuilder the map builder for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getMapBuilder() + { + include_once 'classes/model/map/MessageApplicationMapBuilder.php'; + return BasePeer::getMapBuilder('classes.model.map.MessageApplicationMapBuilder'); + } + /** + * Gets a map (hash) of PHP names to DB column names. + * + * @return array The PHP to DB name map for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. + */ + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = MessageApplicationPeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. MessageApplicationPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(MessageApplicationPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param criteria object containing the columns to add. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(MessageApplicationPeer::MSGAPP_UID); + + $criteria->addSelectColumn(MessageApplicationPeer::APP_UID); + + $criteria->addSelectColumn(MessageApplicationPeer::PRJ_UID); + + $criteria->addSelectColumn(MessageApplicationPeer::EVN_UID_THROW); + + $criteria->addSelectColumn(MessageApplicationPeer::EVN_UID_CATCH); + + $criteria->addSelectColumn(MessageApplicationPeer::MSGAPP_VARIABLES); + + $criteria->addSelectColumn(MessageApplicationPeer::MSGAPP_CORRELATION); + + $criteria->addSelectColumn(MessageApplicationPeer::MSGAPP_THROW_DATE); + + $criteria->addSelectColumn(MessageApplicationPeer::MSGAPP_CATCH_DATE); + + $criteria->addSelectColumn(MessageApplicationPeer::MSGAPP_STATUS); + + } + + const COUNT = 'COUNT(MESSAGE_APPLICATION.MSGAPP_UID)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT MESSAGE_APPLICATION.MSGAPP_UID)'; + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). + * @param Connection $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(MessageApplicationPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(MessageApplicationPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach ($criteria->getGroupByColumns() as $column) { + $criteria->addSelectColumn($column); + } + + $rs = MessageApplicationPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return MessageApplication + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = MessageApplicationPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, $con = null) + { + return MessageApplicationPeer::populateObjects(MessageApplicationPeer::doSelectRS($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() + * method to get a ResultSet. + * + * Use this method directly if you want to just get the resultset + * (instead of an array of objects). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return ResultSet The resultset object with numerically-indexed fields. + * @see BasePeer::doSelect() + */ + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + MessageApplicationPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + return BasePeer::doSelect($criteria, $con); + } + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = MessageApplicationPeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while ($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * The class that the Peer will make instances of. + * + * This uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @return string path.to.ClassName + */ + public static function getOMClass() + { + return MessageApplicationPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a MessageApplication or Criteria object. + * + * @param mixed $values Criteria or MessageApplication object containing data that is used to create the INSERT statement. + * @param Connection $con the connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from MessageApplication object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a MessageApplication or Criteria object. + * + * @param mixed $values Criteria or MessageApplication object containing data create the UPDATE statement. + * @param Connection $con The connection to use (specify Connection exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(MessageApplicationPeer::MSGAPP_UID); + $selectCriteria->add(MessageApplicationPeer::MSGAPP_UID, $criteria->remove(MessageApplicationPeer::MSGAPP_UID), $comparison); + + } else { + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the MESSAGE_APPLICATION table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(MessageApplicationPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a MessageApplication or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or MessageApplication object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param Connection $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(MessageApplicationPeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof MessageApplication) { + + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(MessageApplicationPeer::MSGAPP_UID, (array) $values, Criteria::IN); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given MessageApplication object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param MessageApplication $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(MessageApplication $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(MessageApplicationPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(MessageApplicationPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + if ($obj->isNew() || $obj->isColumnModified(MessageApplicationPeer::MSGAPP_STATUS)) + $columns[MessageApplicationPeer::MSGAPP_STATUS] = $obj->getMsgappStatus(); + + } + + return BasePeer::doValidate(MessageApplicationPeer::DATABASE_NAME, MessageApplicationPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param mixed $pk the primary key. + * @param Connection $con the connection to use + * @return MessageApplication + */ + public static function retrieveByPK($pk, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $criteria = new Criteria(MessageApplicationPeer::DATABASE_NAME); + + $criteria->add(MessageApplicationPeer::MSGAPP_UID, $pk); + + + $v = MessageApplicationPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(); + $criteria->add(MessageApplicationPeer::MSGAPP_UID, $pks, Criteria::IN); + $objs = MessageApplicationPeer::doSelect($criteria, $con); + } + return $objs; + } +} + + +// static code to register the map builder for this Peer with the main Propel class +if (Propel::isInit()) { + // the MapBuilder classes register themselves with Propel during initialization + // so we need to load them here. + try { + BaseMessageApplicationPeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + // even if Propel is not yet initialized, the map builder class can be registered + // now and then it will be loaded when Propel initializes. + require_once 'classes/model/map/MessageApplicationMapBuilder.php'; + Propel::registerMapBuilder('classes.model.map.MessageApplicationMapBuilder'); +} + diff --git a/workflow/engine/classes/model/om/BaseMessageEventDefinition.php b/workflow/engine/classes/model/om/BaseMessageEventDefinition.php new file mode 100644 index 000000000..49002de41 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseMessageEventDefinition.php @@ -0,0 +1,858 @@ +msged_uid; + } + + /** + * Get the [prj_uid] column value. + * + * @return string + */ + public function getPrjUid() + { + + return $this->prj_uid; + } + + /** + * Get the [evn_uid] column value. + * + * @return string + */ + public function getEvnUid() + { + + return $this->evn_uid; + } + + /** + * Get the [msgt_uid] column value. + * + * @return string + */ + public function getMsgtUid() + { + + return $this->msgt_uid; + } + + /** + * Get the [msged_usr_uid] column value. + * + * @return string + */ + public function getMsgedUsrUid() + { + + return $this->msged_usr_uid; + } + + /** + * Get the [msged_variables] column value. + * + * @return string + */ + public function getMsgedVariables() + { + + return $this->msged_variables; + } + + /** + * Get the [msged_correlation] column value. + * + * @return string + */ + public function getMsgedCorrelation() + { + + return $this->msged_correlation; + } + + /** + * Set the value of [msged_uid] column. + * + * @param string $v new value + * @return void + */ + public function setMsgedUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->msged_uid !== $v) { + $this->msged_uid = $v; + $this->modifiedColumns[] = MessageEventDefinitionPeer::MSGED_UID; + } + + } // setMsgedUid() + + /** + * Set the value of [prj_uid] column. + * + * @param string $v new value + * @return void + */ + public function setPrjUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->prj_uid !== $v) { + $this->prj_uid = $v; + $this->modifiedColumns[] = MessageEventDefinitionPeer::PRJ_UID; + } + + } // setPrjUid() + + /** + * Set the value of [evn_uid] column. + * + * @param string $v new value + * @return void + */ + public function setEvnUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->evn_uid !== $v) { + $this->evn_uid = $v; + $this->modifiedColumns[] = MessageEventDefinitionPeer::EVN_UID; + } + + } // setEvnUid() + + /** + * Set the value of [msgt_uid] column. + * + * @param string $v new value + * @return void + */ + public function setMsgtUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->msgt_uid !== $v || $v === '') { + $this->msgt_uid = $v; + $this->modifiedColumns[] = MessageEventDefinitionPeer::MSGT_UID; + } + + } // setMsgtUid() + + /** + * Set the value of [msged_usr_uid] column. + * + * @param string $v new value + * @return void + */ + public function setMsgedUsrUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->msged_usr_uid !== $v || $v === '') { + $this->msged_usr_uid = $v; + $this->modifiedColumns[] = MessageEventDefinitionPeer::MSGED_USR_UID; + } + + } // setMsgedUsrUid() + + /** + * Set the value of [msged_variables] column. + * + * @param string $v new value + * @return void + */ + public function setMsgedVariables($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->msged_variables !== $v || $v === '') { + $this->msged_variables = $v; + $this->modifiedColumns[] = MessageEventDefinitionPeer::MSGED_VARIABLES; + } + + } // setMsgedVariables() + + /** + * Set the value of [msged_correlation] column. + * + * @param string $v new value + * @return void + */ + public function setMsgedCorrelation($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->msged_correlation !== $v || $v === '') { + $this->msged_correlation = $v; + $this->modifiedColumns[] = MessageEventDefinitionPeer::MSGED_CORRELATION; + } + + } // setMsgedCorrelation() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (1-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. + * @param int $startcol 1-based offset column which indicates which restultset column to start with. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->msged_uid = $rs->getString($startcol + 0); + + $this->prj_uid = $rs->getString($startcol + 1); + + $this->evn_uid = $rs->getString($startcol + 2); + + $this->msgt_uid = $rs->getString($startcol + 3); + + $this->msged_usr_uid = $rs->getString($startcol + 4); + + $this->msged_variables = $rs->getString($startcol + 5); + + $this->msged_correlation = $rs->getString($startcol + 6); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 7; // 7 = MessageEventDefinitionPeer::NUM_COLUMNS - MessageEventDefinitionPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating MessageEventDefinition object", $e); + } + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param Connection $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(MessageEventDefinitionPeer::DATABASE_NAME); + } + + try { + $con->begin(); + MessageEventDefinitionPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. If the object is new, + * it inserts it; otherwise an update is performed. This method + * wraps the doSave() worker method in a transaction. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update + * @throws PropelException + * @see doSave() + */ + public function save($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(MessageEventDefinitionPeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring + * @throws PropelException + * @see save() + */ + protected function doSave($con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = MessageEventDefinitionPeer::doInsert($this, $con); + $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which + // should always be true here (even though technically + // BasePeer::doInsert() can insert multiple rows). + + $this->setNew(false); + } else { + $affectedRows += MessageEventDefinitionPeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; + array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = MessageEventDefinitionPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = MessageEventDefinitionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getMsgedUid(); + break; + case 1: + return $this->getPrjUid(); + break; + case 2: + return $this->getEvnUid(); + break; + case 3: + return $this->getMsgtUid(); + break; + case 4: + return $this->getMsgedUsrUid(); + break; + case 5: + return $this->getMsgedVariables(); + break; + case 6: + return $this->getMsgedCorrelation(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = MessageEventDefinitionPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getMsgedUid(), + $keys[1] => $this->getPrjUid(), + $keys[2] => $this->getEvnUid(), + $keys[3] => $this->getMsgtUid(), + $keys[4] => $this->getMsgedUsrUid(), + $keys[5] => $this->getMsgedVariables(), + $keys[6] => $this->getMsgedCorrelation(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = MessageEventDefinitionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setMsgedUid($value); + break; + case 1: + $this->setPrjUid($value); + break; + case 2: + $this->setEvnUid($value); + break; + case 3: + $this->setMsgtUid($value); + break; + case 4: + $this->setMsgedUsrUid($value); + break; + case 5: + $this->setMsgedVariables($value); + break; + case 6: + $this->setMsgedCorrelation($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, + * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = MessageEventDefinitionPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) { + $this->setMsgedUid($arr[$keys[0]]); + } + + if (array_key_exists($keys[1], $arr)) { + $this->setPrjUid($arr[$keys[1]]); + } + + if (array_key_exists($keys[2], $arr)) { + $this->setEvnUid($arr[$keys[2]]); + } + + if (array_key_exists($keys[3], $arr)) { + $this->setMsgtUid($arr[$keys[3]]); + } + + if (array_key_exists($keys[4], $arr)) { + $this->setMsgedUsrUid($arr[$keys[4]]); + } + + if (array_key_exists($keys[5], $arr)) { + $this->setMsgedVariables($arr[$keys[5]]); + } + + if (array_key_exists($keys[6], $arr)) { + $this->setMsgedCorrelation($arr[$keys[6]]); + } + + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(MessageEventDefinitionPeer::DATABASE_NAME); + + if ($this->isColumnModified(MessageEventDefinitionPeer::MSGED_UID)) { + $criteria->add(MessageEventDefinitionPeer::MSGED_UID, $this->msged_uid); + } + + if ($this->isColumnModified(MessageEventDefinitionPeer::PRJ_UID)) { + $criteria->add(MessageEventDefinitionPeer::PRJ_UID, $this->prj_uid); + } + + if ($this->isColumnModified(MessageEventDefinitionPeer::EVN_UID)) { + $criteria->add(MessageEventDefinitionPeer::EVN_UID, $this->evn_uid); + } + + if ($this->isColumnModified(MessageEventDefinitionPeer::MSGT_UID)) { + $criteria->add(MessageEventDefinitionPeer::MSGT_UID, $this->msgt_uid); + } + + if ($this->isColumnModified(MessageEventDefinitionPeer::MSGED_USR_UID)) { + $criteria->add(MessageEventDefinitionPeer::MSGED_USR_UID, $this->msged_usr_uid); + } + + if ($this->isColumnModified(MessageEventDefinitionPeer::MSGED_VARIABLES)) { + $criteria->add(MessageEventDefinitionPeer::MSGED_VARIABLES, $this->msged_variables); + } + + if ($this->isColumnModified(MessageEventDefinitionPeer::MSGED_CORRELATION)) { + $criteria->add(MessageEventDefinitionPeer::MSGED_CORRELATION, $this->msged_correlation); + } + + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(MessageEventDefinitionPeer::DATABASE_NAME); + + $criteria->add(MessageEventDefinitionPeer::MSGED_UID, $this->msged_uid); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getMsgedUid(); + } + + /** + * Generic method to set the primary key (msged_uid column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setMsgedUid($key); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of MessageEventDefinition (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setPrjUid($this->prj_uid); + + $copyObj->setEvnUid($this->evn_uid); + + $copyObj->setMsgtUid($this->msgt_uid); + + $copyObj->setMsgedUsrUid($this->msged_usr_uid); + + $copyObj->setMsgedVariables($this->msged_variables); + + $copyObj->setMsgedCorrelation($this->msged_correlation); + + + $copyObj->setNew(true); + + $copyObj->setMsgedUid(NULL); // this is a pkey column, so set to default value + + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return MessageEventDefinition Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return MessageEventDefinitionPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new MessageEventDefinitionPeer(); + } + return self::$peer; + } +} + diff --git a/workflow/engine/classes/model/om/BaseMessageEventDefinitionPeer.php b/workflow/engine/classes/model/om/BaseMessageEventDefinitionPeer.php new file mode 100644 index 000000000..98db053f4 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseMessageEventDefinitionPeer.php @@ -0,0 +1,597 @@ + array ('MsgedUid', 'PrjUid', 'EvnUid', 'MsgtUid', 'MsgedUsrUid', 'MsgedVariables', 'MsgedCorrelation', ), + BasePeer::TYPE_COLNAME => array (MessageEventDefinitionPeer::MSGED_UID, MessageEventDefinitionPeer::PRJ_UID, MessageEventDefinitionPeer::EVN_UID, MessageEventDefinitionPeer::MSGT_UID, MessageEventDefinitionPeer::MSGED_USR_UID, MessageEventDefinitionPeer::MSGED_VARIABLES, MessageEventDefinitionPeer::MSGED_CORRELATION, ), + BasePeer::TYPE_FIELDNAME => array ('MSGED_UID', 'PRJ_UID', 'EVN_UID', 'MSGT_UID', 'MSGED_USR_UID', 'MSGED_VARIABLES', 'MSGED_CORRELATION', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('MsgedUid' => 0, 'PrjUid' => 1, 'EvnUid' => 2, 'MsgtUid' => 3, 'MsgedUsrUid' => 4, 'MsgedVariables' => 5, 'MsgedCorrelation' => 6, ), + BasePeer::TYPE_COLNAME => array (MessageEventDefinitionPeer::MSGED_UID => 0, MessageEventDefinitionPeer::PRJ_UID => 1, MessageEventDefinitionPeer::EVN_UID => 2, MessageEventDefinitionPeer::MSGT_UID => 3, MessageEventDefinitionPeer::MSGED_USR_UID => 4, MessageEventDefinitionPeer::MSGED_VARIABLES => 5, MessageEventDefinitionPeer::MSGED_CORRELATION => 6, ), + BasePeer::TYPE_FIELDNAME => array ('MSGED_UID' => 0, 'PRJ_UID' => 1, 'EVN_UID' => 2, 'MSGT_UID' => 3, 'MSGED_USR_UID' => 4, 'MSGED_VARIABLES' => 5, 'MSGED_CORRELATION' => 6, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) + ); + + /** + * @return MapBuilder the map builder for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getMapBuilder() + { + include_once 'classes/model/map/MessageEventDefinitionMapBuilder.php'; + return BasePeer::getMapBuilder('classes.model.map.MessageEventDefinitionMapBuilder'); + } + /** + * Gets a map (hash) of PHP names to DB column names. + * + * @return array The PHP to DB name map for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. + */ + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = MessageEventDefinitionPeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. MessageEventDefinitionPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(MessageEventDefinitionPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param criteria object containing the columns to add. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(MessageEventDefinitionPeer::MSGED_UID); + + $criteria->addSelectColumn(MessageEventDefinitionPeer::PRJ_UID); + + $criteria->addSelectColumn(MessageEventDefinitionPeer::EVN_UID); + + $criteria->addSelectColumn(MessageEventDefinitionPeer::MSGT_UID); + + $criteria->addSelectColumn(MessageEventDefinitionPeer::MSGED_USR_UID); + + $criteria->addSelectColumn(MessageEventDefinitionPeer::MSGED_VARIABLES); + + $criteria->addSelectColumn(MessageEventDefinitionPeer::MSGED_CORRELATION); + + } + + const COUNT = 'COUNT(MESSAGE_EVENT_DEFINITION.MSGED_UID)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT MESSAGE_EVENT_DEFINITION.MSGED_UID)'; + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). + * @param Connection $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(MessageEventDefinitionPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(MessageEventDefinitionPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach ($criteria->getGroupByColumns() as $column) { + $criteria->addSelectColumn($column); + } + + $rs = MessageEventDefinitionPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return MessageEventDefinition + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = MessageEventDefinitionPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, $con = null) + { + return MessageEventDefinitionPeer::populateObjects(MessageEventDefinitionPeer::doSelectRS($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() + * method to get a ResultSet. + * + * Use this method directly if you want to just get the resultset + * (instead of an array of objects). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return ResultSet The resultset object with numerically-indexed fields. + * @see BasePeer::doSelect() + */ + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + MessageEventDefinitionPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + return BasePeer::doSelect($criteria, $con); + } + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = MessageEventDefinitionPeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while ($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * The class that the Peer will make instances of. + * + * This uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @return string path.to.ClassName + */ + public static function getOMClass() + { + return MessageEventDefinitionPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a MessageEventDefinition or Criteria object. + * + * @param mixed $values Criteria or MessageEventDefinition object containing data that is used to create the INSERT statement. + * @param Connection $con the connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from MessageEventDefinition object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a MessageEventDefinition or Criteria object. + * + * @param mixed $values Criteria or MessageEventDefinition object containing data create the UPDATE statement. + * @param Connection $con The connection to use (specify Connection exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(MessageEventDefinitionPeer::MSGED_UID); + $selectCriteria->add(MessageEventDefinitionPeer::MSGED_UID, $criteria->remove(MessageEventDefinitionPeer::MSGED_UID), $comparison); + + } else { + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the MESSAGE_EVENT_DEFINITION table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(MessageEventDefinitionPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a MessageEventDefinition or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or MessageEventDefinition object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param Connection $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(MessageEventDefinitionPeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof MessageEventDefinition) { + + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(MessageEventDefinitionPeer::MSGED_UID, (array) $values, Criteria::IN); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given MessageEventDefinition object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param MessageEventDefinition $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(MessageEventDefinition $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(MessageEventDefinitionPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(MessageEventDefinitionPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(MessageEventDefinitionPeer::DATABASE_NAME, MessageEventDefinitionPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param mixed $pk the primary key. + * @param Connection $con the connection to use + * @return MessageEventDefinition + */ + public static function retrieveByPK($pk, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $criteria = new Criteria(MessageEventDefinitionPeer::DATABASE_NAME); + + $criteria->add(MessageEventDefinitionPeer::MSGED_UID, $pk); + + + $v = MessageEventDefinitionPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(); + $criteria->add(MessageEventDefinitionPeer::MSGED_UID, $pks, Criteria::IN); + $objs = MessageEventDefinitionPeer::doSelect($criteria, $con); + } + return $objs; + } +} + + +// static code to register the map builder for this Peer with the main Propel class +if (Propel::isInit()) { + // the MapBuilder classes register themselves with Propel during initialization + // so we need to load them here. + try { + BaseMessageEventDefinitionPeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + // even if Propel is not yet initialized, the map builder class can be registered + // now and then it will be loaded when Propel initializes. + require_once 'classes/model/map/MessageEventDefinitionMapBuilder.php'; + Propel::registerMapBuilder('classes.model.map.MessageEventDefinitionMapBuilder'); +} + diff --git a/workflow/engine/classes/model/om/BaseMessageEventRelation.php b/workflow/engine/classes/model/om/BaseMessageEventRelation.php new file mode 100644 index 000000000..90f850e22 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseMessageEventRelation.php @@ -0,0 +1,684 @@ +msger_uid; + } + + /** + * Get the [prj_uid] column value. + * + * @return string + */ + public function getPrjUid() + { + + return $this->prj_uid; + } + + /** + * Get the [evn_uid_throw] column value. + * + * @return string + */ + public function getEvnUidThrow() + { + + return $this->evn_uid_throw; + } + + /** + * Get the [evn_uid_catch] column value. + * + * @return string + */ + public function getEvnUidCatch() + { + + return $this->evn_uid_catch; + } + + /** + * Set the value of [msger_uid] column. + * + * @param string $v new value + * @return void + */ + public function setMsgerUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->msger_uid !== $v) { + $this->msger_uid = $v; + $this->modifiedColumns[] = MessageEventRelationPeer::MSGER_UID; + } + + } // setMsgerUid() + + /** + * Set the value of [prj_uid] column. + * + * @param string $v new value + * @return void + */ + public function setPrjUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->prj_uid !== $v) { + $this->prj_uid = $v; + $this->modifiedColumns[] = MessageEventRelationPeer::PRJ_UID; + } + + } // setPrjUid() + + /** + * Set the value of [evn_uid_throw] column. + * + * @param string $v new value + * @return void + */ + public function setEvnUidThrow($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->evn_uid_throw !== $v) { + $this->evn_uid_throw = $v; + $this->modifiedColumns[] = MessageEventRelationPeer::EVN_UID_THROW; + } + + } // setEvnUidThrow() + + /** + * Set the value of [evn_uid_catch] column. + * + * @param string $v new value + * @return void + */ + public function setEvnUidCatch($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->evn_uid_catch !== $v) { + $this->evn_uid_catch = $v; + $this->modifiedColumns[] = MessageEventRelationPeer::EVN_UID_CATCH; + } + + } // setEvnUidCatch() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (1-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. + * @param int $startcol 1-based offset column which indicates which restultset column to start with. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->msger_uid = $rs->getString($startcol + 0); + + $this->prj_uid = $rs->getString($startcol + 1); + + $this->evn_uid_throw = $rs->getString($startcol + 2); + + $this->evn_uid_catch = $rs->getString($startcol + 3); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = MessageEventRelationPeer::NUM_COLUMNS - MessageEventRelationPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating MessageEventRelation object", $e); + } + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param Connection $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(MessageEventRelationPeer::DATABASE_NAME); + } + + try { + $con->begin(); + MessageEventRelationPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. If the object is new, + * it inserts it; otherwise an update is performed. This method + * wraps the doSave() worker method in a transaction. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update + * @throws PropelException + * @see doSave() + */ + public function save($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(MessageEventRelationPeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring + * @throws PropelException + * @see save() + */ + protected function doSave($con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = MessageEventRelationPeer::doInsert($this, $con); + $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which + // should always be true here (even though technically + // BasePeer::doInsert() can insert multiple rows). + + $this->setNew(false); + } else { + $affectedRows += MessageEventRelationPeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; + array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = MessageEventRelationPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = MessageEventRelationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getMsgerUid(); + break; + case 1: + return $this->getPrjUid(); + break; + case 2: + return $this->getEvnUidThrow(); + break; + case 3: + return $this->getEvnUidCatch(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = MessageEventRelationPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getMsgerUid(), + $keys[1] => $this->getPrjUid(), + $keys[2] => $this->getEvnUidThrow(), + $keys[3] => $this->getEvnUidCatch(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = MessageEventRelationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setMsgerUid($value); + break; + case 1: + $this->setPrjUid($value); + break; + case 2: + $this->setEvnUidThrow($value); + break; + case 3: + $this->setEvnUidCatch($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, + * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = MessageEventRelationPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) { + $this->setMsgerUid($arr[$keys[0]]); + } + + if (array_key_exists($keys[1], $arr)) { + $this->setPrjUid($arr[$keys[1]]); + } + + if (array_key_exists($keys[2], $arr)) { + $this->setEvnUidThrow($arr[$keys[2]]); + } + + if (array_key_exists($keys[3], $arr)) { + $this->setEvnUidCatch($arr[$keys[3]]); + } + + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(MessageEventRelationPeer::DATABASE_NAME); + + if ($this->isColumnModified(MessageEventRelationPeer::MSGER_UID)) { + $criteria->add(MessageEventRelationPeer::MSGER_UID, $this->msger_uid); + } + + if ($this->isColumnModified(MessageEventRelationPeer::PRJ_UID)) { + $criteria->add(MessageEventRelationPeer::PRJ_UID, $this->prj_uid); + } + + if ($this->isColumnModified(MessageEventRelationPeer::EVN_UID_THROW)) { + $criteria->add(MessageEventRelationPeer::EVN_UID_THROW, $this->evn_uid_throw); + } + + if ($this->isColumnModified(MessageEventRelationPeer::EVN_UID_CATCH)) { + $criteria->add(MessageEventRelationPeer::EVN_UID_CATCH, $this->evn_uid_catch); + } + + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(MessageEventRelationPeer::DATABASE_NAME); + + $criteria->add(MessageEventRelationPeer::MSGER_UID, $this->msger_uid); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getMsgerUid(); + } + + /** + * Generic method to set the primary key (msger_uid column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setMsgerUid($key); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of MessageEventRelation (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setPrjUid($this->prj_uid); + + $copyObj->setEvnUidThrow($this->evn_uid_throw); + + $copyObj->setEvnUidCatch($this->evn_uid_catch); + + + $copyObj->setNew(true); + + $copyObj->setMsgerUid(NULL); // this is a pkey column, so set to default value + + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return MessageEventRelation Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return MessageEventRelationPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new MessageEventRelationPeer(); + } + return self::$peer; + } +} + diff --git a/workflow/engine/classes/model/om/BaseMessageEventRelationPeer.php b/workflow/engine/classes/model/om/BaseMessageEventRelationPeer.php new file mode 100644 index 000000000..379fa84c9 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseMessageEventRelationPeer.php @@ -0,0 +1,582 @@ + array ('MsgerUid', 'PrjUid', 'EvnUidThrow', 'EvnUidCatch', ), + BasePeer::TYPE_COLNAME => array (MessageEventRelationPeer::MSGER_UID, MessageEventRelationPeer::PRJ_UID, MessageEventRelationPeer::EVN_UID_THROW, MessageEventRelationPeer::EVN_UID_CATCH, ), + BasePeer::TYPE_FIELDNAME => array ('MSGER_UID', 'PRJ_UID', 'EVN_UID_THROW', 'EVN_UID_CATCH', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('MsgerUid' => 0, 'PrjUid' => 1, 'EvnUidThrow' => 2, 'EvnUidCatch' => 3, ), + BasePeer::TYPE_COLNAME => array (MessageEventRelationPeer::MSGER_UID => 0, MessageEventRelationPeer::PRJ_UID => 1, MessageEventRelationPeer::EVN_UID_THROW => 2, MessageEventRelationPeer::EVN_UID_CATCH => 3, ), + BasePeer::TYPE_FIELDNAME => array ('MSGER_UID' => 0, 'PRJ_UID' => 1, 'EVN_UID_THROW' => 2, 'EVN_UID_CATCH' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * @return MapBuilder the map builder for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getMapBuilder() + { + include_once 'classes/model/map/MessageEventRelationMapBuilder.php'; + return BasePeer::getMapBuilder('classes.model.map.MessageEventRelationMapBuilder'); + } + /** + * Gets a map (hash) of PHP names to DB column names. + * + * @return array The PHP to DB name map for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. + */ + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = MessageEventRelationPeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. MessageEventRelationPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(MessageEventRelationPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param criteria object containing the columns to add. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(MessageEventRelationPeer::MSGER_UID); + + $criteria->addSelectColumn(MessageEventRelationPeer::PRJ_UID); + + $criteria->addSelectColumn(MessageEventRelationPeer::EVN_UID_THROW); + + $criteria->addSelectColumn(MessageEventRelationPeer::EVN_UID_CATCH); + + } + + const COUNT = 'COUNT(MESSAGE_EVENT_RELATION.MSGER_UID)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT MESSAGE_EVENT_RELATION.MSGER_UID)'; + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). + * @param Connection $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(MessageEventRelationPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(MessageEventRelationPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach ($criteria->getGroupByColumns() as $column) { + $criteria->addSelectColumn($column); + } + + $rs = MessageEventRelationPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return MessageEventRelation + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = MessageEventRelationPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, $con = null) + { + return MessageEventRelationPeer::populateObjects(MessageEventRelationPeer::doSelectRS($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() + * method to get a ResultSet. + * + * Use this method directly if you want to just get the resultset + * (instead of an array of objects). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return ResultSet The resultset object with numerically-indexed fields. + * @see BasePeer::doSelect() + */ + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + MessageEventRelationPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + return BasePeer::doSelect($criteria, $con); + } + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = MessageEventRelationPeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while ($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * The class that the Peer will make instances of. + * + * This uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @return string path.to.ClassName + */ + public static function getOMClass() + { + return MessageEventRelationPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a MessageEventRelation or Criteria object. + * + * @param mixed $values Criteria or MessageEventRelation object containing data that is used to create the INSERT statement. + * @param Connection $con the connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from MessageEventRelation object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a MessageEventRelation or Criteria object. + * + * @param mixed $values Criteria or MessageEventRelation object containing data create the UPDATE statement. + * @param Connection $con The connection to use (specify Connection exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(MessageEventRelationPeer::MSGER_UID); + $selectCriteria->add(MessageEventRelationPeer::MSGER_UID, $criteria->remove(MessageEventRelationPeer::MSGER_UID), $comparison); + + } else { + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the MESSAGE_EVENT_RELATION table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(MessageEventRelationPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a MessageEventRelation or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or MessageEventRelation object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param Connection $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(MessageEventRelationPeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof MessageEventRelation) { + + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(MessageEventRelationPeer::MSGER_UID, (array) $values, Criteria::IN); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given MessageEventRelation object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param MessageEventRelation $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(MessageEventRelation $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(MessageEventRelationPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(MessageEventRelationPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(MessageEventRelationPeer::DATABASE_NAME, MessageEventRelationPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param mixed $pk the primary key. + * @param Connection $con the connection to use + * @return MessageEventRelation + */ + public static function retrieveByPK($pk, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $criteria = new Criteria(MessageEventRelationPeer::DATABASE_NAME); + + $criteria->add(MessageEventRelationPeer::MSGER_UID, $pk); + + + $v = MessageEventRelationPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(); + $criteria->add(MessageEventRelationPeer::MSGER_UID, $pks, Criteria::IN); + $objs = MessageEventRelationPeer::doSelect($criteria, $con); + } + return $objs; + } +} + + +// static code to register the map builder for this Peer with the main Propel class +if (Propel::isInit()) { + // the MapBuilder classes register themselves with Propel during initialization + // so we need to load them here. + try { + BaseMessageEventRelationPeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + // even if Propel is not yet initialized, the map builder class can be registered + // now and then it will be loaded when Propel initializes. + require_once 'classes/model/map/MessageEventRelationMapBuilder.php'; + Propel::registerMapBuilder('classes.model.map.MessageEventRelationMapBuilder'); +} + diff --git a/workflow/engine/classes/model/om/BaseMessageEventTaskRelation.php b/workflow/engine/classes/model/om/BaseMessageEventTaskRelation.php new file mode 100644 index 000000000..44208e082 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseMessageEventTaskRelation.php @@ -0,0 +1,684 @@ +msgetr_uid; + } + + /** + * Get the [prj_uid] column value. + * + * @return string + */ + public function getPrjUid() + { + + return $this->prj_uid; + } + + /** + * Get the [evn_uid] column value. + * + * @return string + */ + public function getEvnUid() + { + + return $this->evn_uid; + } + + /** + * Get the [tas_uid] column value. + * + * @return string + */ + public function getTasUid() + { + + return $this->tas_uid; + } + + /** + * Set the value of [msgetr_uid] column. + * + * @param string $v new value + * @return void + */ + public function setMsgetrUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->msgetr_uid !== $v) { + $this->msgetr_uid = $v; + $this->modifiedColumns[] = MessageEventTaskRelationPeer::MSGETR_UID; + } + + } // setMsgetrUid() + + /** + * Set the value of [prj_uid] column. + * + * @param string $v new value + * @return void + */ + public function setPrjUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->prj_uid !== $v) { + $this->prj_uid = $v; + $this->modifiedColumns[] = MessageEventTaskRelationPeer::PRJ_UID; + } + + } // setPrjUid() + + /** + * Set the value of [evn_uid] column. + * + * @param string $v new value + * @return void + */ + public function setEvnUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->evn_uid !== $v) { + $this->evn_uid = $v; + $this->modifiedColumns[] = MessageEventTaskRelationPeer::EVN_UID; + } + + } // setEvnUid() + + /** + * Set the value of [tas_uid] column. + * + * @param string $v new value + * @return void + */ + public function setTasUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->tas_uid !== $v) { + $this->tas_uid = $v; + $this->modifiedColumns[] = MessageEventTaskRelationPeer::TAS_UID; + } + + } // setTasUid() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (1-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. + * @param int $startcol 1-based offset column which indicates which restultset column to start with. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->msgetr_uid = $rs->getString($startcol + 0); + + $this->prj_uid = $rs->getString($startcol + 1); + + $this->evn_uid = $rs->getString($startcol + 2); + + $this->tas_uid = $rs->getString($startcol + 3); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = MessageEventTaskRelationPeer::NUM_COLUMNS - MessageEventTaskRelationPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating MessageEventTaskRelation object", $e); + } + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param Connection $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(MessageEventTaskRelationPeer::DATABASE_NAME); + } + + try { + $con->begin(); + MessageEventTaskRelationPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. If the object is new, + * it inserts it; otherwise an update is performed. This method + * wraps the doSave() worker method in a transaction. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update + * @throws PropelException + * @see doSave() + */ + public function save($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(MessageEventTaskRelationPeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring + * @throws PropelException + * @see save() + */ + protected function doSave($con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = MessageEventTaskRelationPeer::doInsert($this, $con); + $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which + // should always be true here (even though technically + // BasePeer::doInsert() can insert multiple rows). + + $this->setNew(false); + } else { + $affectedRows += MessageEventTaskRelationPeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; + array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = MessageEventTaskRelationPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = MessageEventTaskRelationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getMsgetrUid(); + break; + case 1: + return $this->getPrjUid(); + break; + case 2: + return $this->getEvnUid(); + break; + case 3: + return $this->getTasUid(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = MessageEventTaskRelationPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getMsgetrUid(), + $keys[1] => $this->getPrjUid(), + $keys[2] => $this->getEvnUid(), + $keys[3] => $this->getTasUid(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = MessageEventTaskRelationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setMsgetrUid($value); + break; + case 1: + $this->setPrjUid($value); + break; + case 2: + $this->setEvnUid($value); + break; + case 3: + $this->setTasUid($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, + * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = MessageEventTaskRelationPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) { + $this->setMsgetrUid($arr[$keys[0]]); + } + + if (array_key_exists($keys[1], $arr)) { + $this->setPrjUid($arr[$keys[1]]); + } + + if (array_key_exists($keys[2], $arr)) { + $this->setEvnUid($arr[$keys[2]]); + } + + if (array_key_exists($keys[3], $arr)) { + $this->setTasUid($arr[$keys[3]]); + } + + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(MessageEventTaskRelationPeer::DATABASE_NAME); + + if ($this->isColumnModified(MessageEventTaskRelationPeer::MSGETR_UID)) { + $criteria->add(MessageEventTaskRelationPeer::MSGETR_UID, $this->msgetr_uid); + } + + if ($this->isColumnModified(MessageEventTaskRelationPeer::PRJ_UID)) { + $criteria->add(MessageEventTaskRelationPeer::PRJ_UID, $this->prj_uid); + } + + if ($this->isColumnModified(MessageEventTaskRelationPeer::EVN_UID)) { + $criteria->add(MessageEventTaskRelationPeer::EVN_UID, $this->evn_uid); + } + + if ($this->isColumnModified(MessageEventTaskRelationPeer::TAS_UID)) { + $criteria->add(MessageEventTaskRelationPeer::TAS_UID, $this->tas_uid); + } + + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(MessageEventTaskRelationPeer::DATABASE_NAME); + + $criteria->add(MessageEventTaskRelationPeer::MSGETR_UID, $this->msgetr_uid); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getMsgetrUid(); + } + + /** + * Generic method to set the primary key (msgetr_uid column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setMsgetrUid($key); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of MessageEventTaskRelation (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setPrjUid($this->prj_uid); + + $copyObj->setEvnUid($this->evn_uid); + + $copyObj->setTasUid($this->tas_uid); + + + $copyObj->setNew(true); + + $copyObj->setMsgetrUid(NULL); // this is a pkey column, so set to default value + + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return MessageEventTaskRelation Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return MessageEventTaskRelationPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new MessageEventTaskRelationPeer(); + } + return self::$peer; + } +} + diff --git a/workflow/engine/classes/model/om/BaseMessageEventTaskRelationPeer.php b/workflow/engine/classes/model/om/BaseMessageEventTaskRelationPeer.php new file mode 100644 index 000000000..d5a6f62d9 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseMessageEventTaskRelationPeer.php @@ -0,0 +1,582 @@ + array ('MsgetrUid', 'PrjUid', 'EvnUid', 'TasUid', ), + BasePeer::TYPE_COLNAME => array (MessageEventTaskRelationPeer::MSGETR_UID, MessageEventTaskRelationPeer::PRJ_UID, MessageEventTaskRelationPeer::EVN_UID, MessageEventTaskRelationPeer::TAS_UID, ), + BasePeer::TYPE_FIELDNAME => array ('MSGETR_UID', 'PRJ_UID', 'EVN_UID', 'TAS_UID', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('MsgetrUid' => 0, 'PrjUid' => 1, 'EvnUid' => 2, 'TasUid' => 3, ), + BasePeer::TYPE_COLNAME => array (MessageEventTaskRelationPeer::MSGETR_UID => 0, MessageEventTaskRelationPeer::PRJ_UID => 1, MessageEventTaskRelationPeer::EVN_UID => 2, MessageEventTaskRelationPeer::TAS_UID => 3, ), + BasePeer::TYPE_FIELDNAME => array ('MSGETR_UID' => 0, 'PRJ_UID' => 1, 'EVN_UID' => 2, 'TAS_UID' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * @return MapBuilder the map builder for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getMapBuilder() + { + include_once 'classes/model/map/MessageEventTaskRelationMapBuilder.php'; + return BasePeer::getMapBuilder('classes.model.map.MessageEventTaskRelationMapBuilder'); + } + /** + * Gets a map (hash) of PHP names to DB column names. + * + * @return array The PHP to DB name map for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. + */ + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = MessageEventTaskRelationPeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. MessageEventTaskRelationPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(MessageEventTaskRelationPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param criteria object containing the columns to add. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(MessageEventTaskRelationPeer::MSGETR_UID); + + $criteria->addSelectColumn(MessageEventTaskRelationPeer::PRJ_UID); + + $criteria->addSelectColumn(MessageEventTaskRelationPeer::EVN_UID); + + $criteria->addSelectColumn(MessageEventTaskRelationPeer::TAS_UID); + + } + + const COUNT = 'COUNT(MESSAGE_EVENT_TASK_RELATION.MSGETR_UID)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT MESSAGE_EVENT_TASK_RELATION.MSGETR_UID)'; + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). + * @param Connection $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(MessageEventTaskRelationPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(MessageEventTaskRelationPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach ($criteria->getGroupByColumns() as $column) { + $criteria->addSelectColumn($column); + } + + $rs = MessageEventTaskRelationPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return MessageEventTaskRelation + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = MessageEventTaskRelationPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, $con = null) + { + return MessageEventTaskRelationPeer::populateObjects(MessageEventTaskRelationPeer::doSelectRS($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() + * method to get a ResultSet. + * + * Use this method directly if you want to just get the resultset + * (instead of an array of objects). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return ResultSet The resultset object with numerically-indexed fields. + * @see BasePeer::doSelect() + */ + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + MessageEventTaskRelationPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + return BasePeer::doSelect($criteria, $con); + } + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = MessageEventTaskRelationPeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while ($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * The class that the Peer will make instances of. + * + * This uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @return string path.to.ClassName + */ + public static function getOMClass() + { + return MessageEventTaskRelationPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a MessageEventTaskRelation or Criteria object. + * + * @param mixed $values Criteria or MessageEventTaskRelation object containing data that is used to create the INSERT statement. + * @param Connection $con the connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from MessageEventTaskRelation object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a MessageEventTaskRelation or Criteria object. + * + * @param mixed $values Criteria or MessageEventTaskRelation object containing data create the UPDATE statement. + * @param Connection $con The connection to use (specify Connection exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(MessageEventTaskRelationPeer::MSGETR_UID); + $selectCriteria->add(MessageEventTaskRelationPeer::MSGETR_UID, $criteria->remove(MessageEventTaskRelationPeer::MSGETR_UID), $comparison); + + } else { + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the MESSAGE_EVENT_TASK_RELATION table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(MessageEventTaskRelationPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a MessageEventTaskRelation or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or MessageEventTaskRelation object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param Connection $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(MessageEventTaskRelationPeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof MessageEventTaskRelation) { + + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(MessageEventTaskRelationPeer::MSGETR_UID, (array) $values, Criteria::IN); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given MessageEventTaskRelation object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param MessageEventTaskRelation $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(MessageEventTaskRelation $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(MessageEventTaskRelationPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(MessageEventTaskRelationPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(MessageEventTaskRelationPeer::DATABASE_NAME, MessageEventTaskRelationPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param mixed $pk the primary key. + * @param Connection $con the connection to use + * @return MessageEventTaskRelation + */ + public static function retrieveByPK($pk, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $criteria = new Criteria(MessageEventTaskRelationPeer::DATABASE_NAME); + + $criteria->add(MessageEventTaskRelationPeer::MSGETR_UID, $pk); + + + $v = MessageEventTaskRelationPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(); + $criteria->add(MessageEventTaskRelationPeer::MSGETR_UID, $pks, Criteria::IN); + $objs = MessageEventTaskRelationPeer::doSelect($criteria, $con); + } + return $objs; + } +} + + +// static code to register the map builder for this Peer with the main Propel class +if (Propel::isInit()) { + // the MapBuilder classes register themselves with Propel during initialization + // so we need to load them here. + try { + BaseMessageEventTaskRelationPeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + // even if Propel is not yet initialized, the map builder class can be registered + // now and then it will be loaded when Propel initializes. + require_once 'classes/model/map/MessageEventTaskRelationMapBuilder.php'; + Propel::registerMapBuilder('classes.model.map.MessageEventTaskRelationMapBuilder'); +} + diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 411c38c86..b5ebe8129 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -1201,7 +1201,7 @@ - + @@ -1248,7 +1248,7 @@ - + @@ -4368,5 +4368,93 @@
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index e034b44a1..bb4595bdb 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -568,7 +568,7 @@ CREATE TABLE `TASK` ( `PRO_UID` VARCHAR(32) default '' NOT NULL, `TAS_UID` VARCHAR(32) default '' NOT NULL, - `TAS_TYPE` VARCHAR(20) default 'NORMAL' NOT NULL, + `TAS_TYPE` VARCHAR(50) default 'NORMAL' NOT NULL, `TAS_DURATION` DOUBLE default 0 NOT NULL, `TAS_DELAY_TYPE` VARCHAR(30) default '' NOT NULL, `TAS_TEMPORIZER` DOUBLE default 0 NOT NULL, @@ -2521,3 +2521,77 @@ CREATE TABLE `WEB_ENTRY_EVENT` )ENGINE=InnoDB DEFAULT CHARSET='utf8'; # This restores the fkey checks, after having unset them earlier SET FOREIGN_KEY_CHECKS = 1; + +#----------------------------------------------------------------------------- +#-- MESSAGE_EVENT_DEFINITION +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS MESSAGE_EVENT_DEFINITION; + +CREATE TABLE MESSAGE_EVENT_DEFINITION +( + MSGED_UID VARCHAR(32) NOT NULL, + PRJ_UID VARCHAR(32) NOT NULL, + EVN_UID VARCHAR(32) NOT NULL, + MSGT_UID VARCHAR(32) NOT NULL DEFAULT '', + MSGED_USR_UID VARCHAR(32) NOT NULL DEFAULT '', + MSGED_VARIABLES MEDIUMTEXT NOT NULL DEFAULT '', + MSGED_CORRELATION VARCHAR(512) NOT NULL DEFAULT '', + + PRIMARY KEY (MSGED_UID) +) ENGINE=InnoDB DEFAULT CHARSET='utf8'; + +#----------------------------------------------------------------------------- +#-- MESSAGE_EVENT_RELATION +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS MESSAGE_EVENT_RELATION; + +CREATE TABLE MESSAGE_EVENT_RELATION +( + MSGER_UID VARCHAR(32) NOT NULL, + PRJ_UID VARCHAR(32) NOT NULL, + EVN_UID_THROW VARCHAR(32) NOT NULL, + EVN_UID_CATCH VARCHAR(32) NOT NULL, + + PRIMARY KEY (MSGER_UID) +) ENGINE=InnoDB DEFAULT CHARSET='utf8'; + +#----------------------------------------------------------------------------- +#-- MESSAGE_EVENT_TASK_RELATION +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS MESSAGE_EVENT_TASK_RELATION; + +CREATE TABLE MESSAGE_EVENT_TASK_RELATION +( + MSGETR_UID VARCHAR(32) NOT NULL, + PRJ_UID VARCHAR(32) NOT NULL, + EVN_UID VARCHAR(32) NOT NULL, + TAS_UID VARCHAR(32) NOT NULL, + + PRIMARY KEY (MSGETR_UID) +) ENGINE=InnoDB DEFAULT CHARSET='utf8'; + +#----------------------------------------------------------------------------- +#-- MESSAGE_APPLICATION +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS MESSAGE_APPLICATION; + +CREATE TABLE MESSAGE_APPLICATION +( + MSGAPP_UID VARCHAR(32) NOT NULL, + APP_UID VARCHAR(32) NOT NULL, + PRJ_UID VARCHAR(32) NOT NULL, + EVN_UID_THROW VARCHAR(32) NOT NULL, + EVN_UID_CATCH VARCHAR(32) NOT NULL, + MSGAPP_VARIABLES MEDIUMTEXT NOT NULL DEFAULT '', + MSGAPP_CORRELATION VARCHAR(512) NOT NULL DEFAULT '', + MSGAPP_THROW_DATE DATETIME NOT NULL, + MSGAPP_CATCH_DATE DATETIME, + MSGAPP_STATUS VARCHAR(25) NOT NULL DEFAULT 'UNREAD', + + PRIMARY KEY (MSGAPP_UID) +) ENGINE=InnoDB DEFAULT CHARSET='utf8'; + diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/MessageEventDefinition.php b/workflow/engine/src/ProcessMaker/BusinessModel/MessageEventDefinition.php new file mode 100644 index 000000000..95543e2b4 --- /dev/null +++ b/workflow/engine/src/ProcessMaker/BusinessModel/MessageEventDefinition.php @@ -0,0 +1,706 @@ + array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "messageEventDefinitionUid"), + + "PRJ_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "projectUid"), + "EVN_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "eventUid"), + "MSGT_UID" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "messageTypeUid"), + "MSGED_USR_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "messageEventDefinitionUserUid"), + "MSGED_VARIABLES" => array("type" => "array", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "messageEventDefinitionVariables"), + "MSGED_CORRELATION" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "messageEventDefinitionCorrelation") + ); + + private $formatFieldNameInUppercase = true; + + private $arrayFieldNameForException = array(); + + /** + * Constructor of the class + * + * return void + */ + public function __construct() + { + try { + foreach ($this->arrayFieldDefinition as $key => $value) { + $this->arrayFieldNameForException[$value["fieldNameAux"]] = $key; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set the format of the fields name (uppercase, lowercase) + * + * @param bool $flag Value that set the format + * + * return void + */ + public function setFormatFieldNameInUppercase($flag) + { + try { + $this->formatFieldNameInUppercase = $flag; + + $this->setArrayFieldNameForException($this->arrayFieldNameForException); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set exception messages for fields + * + * @param array $arrayData Data with the fields + * + * return void + */ + public function setArrayFieldNameForException(array $arrayData) + { + try { + foreach ($arrayData as $key => $value) { + $this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get the name of the field according to the format + * + * @param string $fieldName Field name + * + * return string Return the field name according the format + */ + public function getFieldNameByFormatFieldName($fieldName) + { + try { + return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if exists the Message-Event-Definition + * + * @param string $messageEventDefinitionUid Unique id of Message-Event-Definition + * + * return bool Return true if exists the Message-Event-Definition, false otherwise + */ + public function exists($messageEventDefinitionUid) + { + try { + $obj = \MessageEventDefinitionPeer::retrieveByPK($messageEventDefinitionUid); + + return (!is_null($obj))? true : false; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if exists the Event of a Message-Event-Definition + * + * @param string $projectUid Unique id of Project + * @param string $eventUid Unique id of Event + * @param string $messageEventDefinitionUidToExclude Unique id of Message-Event-Definition to exclude + * + * return bool Return true if exists the Event of a Message-Event-Definition, false otherwise + */ + public function existsEvent($projectUid, $eventUid, $messageEventDefinitionUidToExclude = "") + { + try { + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_UID); + $criteria->add(\MessageEventDefinitionPeer::PRJ_UID, $projectUid, \Criteria::EQUAL); + + if ($messageEventDefinitionUidToExclude != "") { + $criteria->add(\MessageEventDefinitionPeer::MSGED_UID, $messageEventDefinitionUidToExclude, \Criteria::NOT_EQUAL); + } + + $criteria->add(\MessageEventDefinitionPeer::EVN_UID, $eventUid, \Criteria::EQUAL); + + $rsCriteria = \MessageEventDefinitionPeer::doSelectRS($criteria); + + return ($rsCriteria->next())? true : false; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if does not exists the Message-Event-Definition + * + * @param string $messageEventDefinitionUid Unique id of Message-Event-Definition + * @param string $fieldNameForException Field name for the exception + * + * return void Throw exception if does not exists the Message-Event-Definition + */ + public function throwExceptionIfNotExistsMessageEventDefinition($messageEventDefinitionUid, $fieldNameForException) + { + try { + if (!$this->exists($messageEventDefinitionUid)) { + throw new \Exception(\G::LoadTranslation("ID_MESSAGE_EVENT_DEFINITION_DOES_NOT_EXIST", array($fieldNameForException, $messageEventDefinitionUid))); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if is registered the Event + * + * @param string $projectUid Unique id of Project + * @param string $eventUid Unique id of Event + * @param string $fieldNameForException Field name for the exception + * @param string $messageEventDefinitionUidToExclude Unique id of Message-Event-Definition to exclude + * + * return void Throw exception if is registered the Event + */ + public function throwExceptionIfEventIsRegistered($projectUid, $eventUid, $fieldNameForException, $messageEventDefinitionUidToExclude = "") + { + try { + if ($this->existsEvent($projectUid, $eventUid, $messageEventDefinitionUidToExclude)) { + throw new \Exception(\G::LoadTranslation("ID_MESSAGE_EVENT_DEFINITION_ALREADY_REGISTERED", array($fieldNameForException, $eventUid))); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Validate the data if they are invalid (INSERT and UPDATE) + * + * @param string $messageEventDefinitionUid Unique id of Message-Event-Definition + * @param string $projectUid Unique id of Project + * @param array $arrayData Data + * + * return void Throw exception if data has an invalid value + */ + public function throwExceptionIfDataIsInvalid($messageEventDefinitionUid, $projectUid, array $arrayData) + { + try { + //Set variables + $arrayMessageEventDefinitionData = ($messageEventDefinitionUid == "")? array() : $this->getMessageEventDefinition($messageEventDefinitionUid, true); + $flagInsert = ($messageEventDefinitionUid == "")? true : false; + + $arrayFinalData = array_merge($arrayMessageEventDefinitionData, $arrayData); + + //Verify data - Field definition + $process = new \ProcessMaker\BusinessModel\Process(); + $messageType = new \ProcessMaker\BusinessModel\MessageType(); + + $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert); + + //Verify data + if (isset($arrayData["EVN_UID"])) { + $this->throwExceptionIfEventIsRegistered($projectUid, $arrayData["EVN_UID"], $this->arrayFieldNameForException["eventUid"], $messageEventDefinitionUid); + } + + if (isset($arrayData["EVN_UID"])) { + $arrayEventType = array("START", "END", "INTERMEDIATE"); + $arrayEventMarker = array("MESSAGETHROW", "MESSAGECATCH"); + + $bpmnEvent = \BpmnEventPeer::retrieveByPK($arrayData["EVN_UID"]); + + if (is_null($bpmnEvent)) { + throw new \Exception(\G::LoadTranslation("ID_EVENT_NOT_EXIST", array($this->arrayFieldNameForException["eventUid"], $arrayData["EVN_UID"]))); + } + + if (!in_array($bpmnEvent->getEvnType(), $arrayEventType) || !in_array($bpmnEvent->getEvnMarker(), $arrayEventMarker)) { + throw new \Exception(\G::LoadTranslation("ID_EVENT_NOT_IS_MESSAGE_EVENT", array($this->arrayFieldNameForException["eventUid"], $arrayData["EVN_UID"]))); + } + } + + if (isset($arrayData["MSGT_UID"]) && $arrayData["MSGT_UID"] . "" != "") { + if (!$messageType->exists($arrayData["MSGT_UID"])) { + throw new \Exception(\G::LoadTranslation("ID_MESSAGE_TYPE_NOT_EXIST", array($this->arrayFieldNameForException["messageTypeUid"], $arrayData["MSGT_UID"]))); + } + } + + $flagCheckData = false; + $flagCheckData = (isset($arrayData["MSGT_UID"]) && $arrayData["MSGT_UID"] . "" != "")? true : $flagCheckData; + $flagCheckData = (isset($arrayData["MSGED_VARIABLES"]))? true : $flagCheckData; + + if ($flagCheckData && $arrayFinalData["MSGT_UID"] . "" != "") { + $arrayMessageTypeVariable = array(); + + $arrayMessageTypeData = $messageType->getMessageType($arrayFinalData["MSGT_UID"], true); + + foreach ($arrayMessageTypeData["MSGT_VARIABLES"] as $value) { + $arrayMessageTypeVariable[$value["MSGTV_NAME"]] = $value["MSGTV_DEFAULT_VALUE"]; + } + + if (count($arrayMessageTypeVariable) != count($arrayFinalData["MSGED_VARIABLES"]) || count(array_diff_key($arrayMessageTypeVariable, $arrayFinalData["MSGED_VARIABLES"])) > 0) { + throw new \Exception(\G::LoadTranslation("ID_MESSAGE_EVENT_DEFINITION_VARIABLES_DO_NOT_MEET_DEFINITION")); + } + } + + if (isset($arrayData["MSGED_USR_UID"])) { + $process->throwExceptionIfNotExistsUser($arrayData["MSGED_USR_UID"], $this->arrayFieldNameForException["messageEventDefinitionUserUid"]); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Create Message-Event-Definition for a Project + * + * @param string $projectUid Unique id of Project + * @param array $arrayData Data + * + * return array Return data of the new Message-Event-Definition created + */ + public function create($projectUid, array $arrayData) + { + try { + //Verify data + $process = new \ProcessMaker\BusinessModel\Process(); + $validator = new \ProcessMaker\BusinessModel\Validator(); + + $validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData"); + $validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData"); + + //Set data + $arrayData = array_change_key_case($arrayData, CASE_UPPER); + + unset($arrayData["MSGED_UID"]); + unset($arrayData["PRJ_UID"]); + + //Verify data + $process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]); + + $this->throwExceptionIfDataIsInvalid("", $projectUid, $arrayData); + + //Create + $cnn = \Propel::getConnection("workflow"); + + try { + $messageEventDefinition = new \MessageEventDefinition(); + + if (!isset($arrayData["MSGT_UID"]) || $arrayData["MSGT_UID"] . "" == "") { + $arrayData["MSGT_UID"] = ""; + $arrayData["MSGED_VARIABLES"] = array(); + } + + if (!isset($arrayData["MSGED_VARIABLES"])) { + $arrayData["MSGED_VARIABLES"] = array(); + } + + $messageEventDefinitionUid = \ProcessMaker\Util\Common::generateUID(); + + $messageEventDefinition->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME); + + $messageEventDefinition->setMsgedUid($messageEventDefinitionUid); + $messageEventDefinition->setPrjUid($projectUid); + + if (isset($arrayData["MSGED_VARIABLES"])) { + $messageEventDefinition->setMsgedVariables(serialize($arrayData["MSGED_VARIABLES"])); + } + + if ($messageEventDefinition->validate()) { + $cnn->begin(); + + $result = $messageEventDefinition->save(); + + $cnn->commit(); + + //Task - User + if (isset($arrayData["MSGED_USR_UID"])) { + $bpmnEvent = \BpmnEventPeer::retrieveByPK($arrayData["EVN_UID"]); + + //Event - START-MESSAGE-EVENT + if (is_null($bpmnEvent) && $bpmnEvent->getEvnType() == "START" && $bpmnEvent->getEvnMarker() == "MESSAGECATCH") { + //Message-Event-Task-Relation - Get Task + $messageEventTaskRelation = new \ProcessMaker\BusinessModel\MessageEventTaskRelation(); + + $arrayMessageEventTaskRelationData = $messageEventTaskRelation->getMessageEventTaskRelationWhere( + array( + \MessageEventTaskRelationPeer::PRJ_UID => $projectUid, + \MessageEventTaskRelationPeer::EVN_UID => $bpmnEvent->getEvnUid() + ), + true + ); + + if (!is_null($arrayMessageEventTaskRelationData)) { + //Assign + $task = new \Tasks(); + + $result = $task->assignUser($arrayMessageEventTaskRelationData["TAS_UID"], $arrayData["MSGED_USR_UID"], 1); + } + } + } + + //Return + return $this->getMessageEventDefinition($messageEventDefinitionUid); + } else { + $msg = ""; + + foreach ($messageEventDefinition->getValidationFailures() as $validationFailure) { + $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); + } + + throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : "")); + } + } catch (\Exception $e) { + $cnn->rollback(); + + throw $e; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Update Message-Event-Definition + * + * @param string $messageEventDefinitionUid Unique id of Message-Event-Definition + * @param array $arrayData Data + * + * return array Return data of the Message-Event-Definition updated + */ + public function update($messageEventDefinitionUid, array $arrayData) + { + try { + //Verify data + $process = new \ProcessMaker\BusinessModel\Process(); + $validator = new \ProcessMaker\BusinessModel\Validator(); + + $validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData"); + $validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData"); + + //Set data + $arrayData = array_change_key_case($arrayData, CASE_UPPER); + $arrayDataBackup = $arrayData; + + unset($arrayData["MSGED_UID"]); + unset($arrayData["PRJ_UID"]); + + //Set variables + $arrayMessageEventDefinitionData = $this->getMessageEventDefinition($messageEventDefinitionUid, true); + + //Verify data + $this->throwExceptionIfNotExistsMessageEventDefinition($messageEventDefinitionUid, $this->arrayFieldNameForException["messageEventDefinitionUid"]); + + $this->throwExceptionIfDataIsInvalid($messageEventDefinitionUid, $arrayMessageEventDefinitionData["PRJ_UID"], $arrayData); + + //Update + $cnn = \Propel::getConnection("workflow"); + + try { + $messageEventDefinition = \MessageEventDefinitionPeer::retrieveByPK($messageEventDefinitionUid); + + if (isset($arrayData["MSGT_UID"]) && $arrayData["MSGT_UID"] . "" == "") { + $arrayData["MSGED_VARIABLES"] = array(); + } + + $messageEventDefinition->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME); + + if (isset($arrayData["MSGED_VARIABLES"])) { + $messageEventDefinition->setMsgedVariables(serialize($arrayData["MSGED_VARIABLES"])); + } + + if ($messageEventDefinition->validate()) { + $cnn->begin(); + + $result = $messageEventDefinition->save(); + + $cnn->commit(); + + //Task - User + if (isset($arrayData["MSGED_USR_UID"]) && $arrayData["MSGED_USR_UID"] != $arrayMessageEventDefinitionData["MSGED_USR_UID"]) { + $bpmnEvent = \BpmnEventPeer::retrieveByPK($arrayMessageEventDefinitionData["EVN_UID"]); + + //Event - START-MESSAGE-EVENT + if (is_null($bpmnEvent) && $bpmnEvent->getEvnType() == "START" && $bpmnEvent->getEvnMarker() == "MESSAGECATCH") { + //Message-Event-Task-Relation - Get Task + $messageEventTaskRelation = new \ProcessMaker\BusinessModel\MessageEventTaskRelation(); + + $arrayMessageEventTaskRelationData = $messageEventTaskRelation->getMessageEventTaskRelationWhere( + array( + \MessageEventTaskRelationPeer::PRJ_UID => $arrayMessageEventDefinitionData["PRJ_UID"], + \MessageEventTaskRelationPeer::EVN_UID => $bpmnEvent->getEvnUid() + ), + true + ); + + if (!is_null($arrayMessageEventTaskRelationData)) { + //Unassign + $taskUser = new \TaskUser(); + + $criteria = new \Criteria("workflow"); + + $criteria->add(\TaskUserPeer::TAS_UID, $arrayMessageEventTaskRelationData["TAS_UID"]); + + $rsCriteria = \TaskUserPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + $result = $taskUser->remove($row["TAS_UID"], $row["USR_UID"], $row["TU_TYPE"], $row["TU_RELATION"]); + } + + //Assign + $task = new \Tasks(); + + $result = $task->assignUser($arrayMessageEventTaskRelationData["TAS_UID"], $arrayData["MSGED_USR_UID"], 1); + } + } + } + + //Return + $arrayData = $arrayDataBackup; + + if (!$this->formatFieldNameInUppercase) { + $arrayData = array_change_key_case($arrayData, CASE_LOWER); + } + + return $arrayData; + } else { + $msg = ""; + + foreach ($messageEventDefinition->getValidationFailures() as $validationFailure) { + $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); + } + + throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . (($msg != "")? "\n" . $msg : "")); + } + } catch (\Exception $e) { + $cnn->rollback(); + + throw $e; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Delete Message-Event-Definition + * + * @param string $messageEventDefinitionUid Unique id of Message-Event-Definition + * + * return void + */ + public function delete($messageEventDefinitionUid) + { + try { + //Verify data + $this->throwExceptionIfNotExistsMessageEventDefinition($messageEventDefinitionUid, $this->arrayFieldNameForException["messageEventDefinitionUid"]); + + //Delete + $criteria = new \Criteria("workflow"); + + $criteria->add(\MessageEventDefinitionPeer::MSGED_UID, $messageEventDefinitionUid, \Criteria::EQUAL); + + $result = \MessageEventDefinitionPeer::doDelete($criteria); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set Message-Event-Definition-Variables by Message-Type for a record + * + * @param array $record Record + * + * return array Return the record + */ + public function setMessageEventDefinitionVariablesForRecordByMessageType(array $record) + { + try { + $record["MSGED_VARIABLES"] = ($record["MSGED_VARIABLES"] . "" != "")? unserialize($record["MSGED_VARIABLES"]) : array(); + + if ($record["MSGT_UID"] . "" != "") { + $arrayMessageTypeVariable = array(); + + $messageType = new \ProcessMaker\BusinessModel\MessageType(); + + if ($messageType->exists($record["MSGT_UID"])) { + $arrayMessageTypeData = $messageType->getMessageType($record["MSGT_UID"], true); + + foreach ($arrayMessageTypeData["MSGT_VARIABLES"] as $value) { + $arrayMessageTypeVariable[$value["MSGTV_NAME"]] = (isset($record["MSGED_VARIABLES"][$value["MSGTV_NAME"]]))? $record["MSGED_VARIABLES"][$value["MSGTV_NAME"]] : $value["MSGTV_DEFAULT_VALUE"]; + } + } + + $record["MSGED_VARIABLES"] = $arrayMessageTypeVariable; + } + + //Return + return $record; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get criteria for Message-Event-Definition + * + * return object + */ + public function getMessageEventDefinitionCriteria() + { + try { + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_UID); + $criteria->addSelectColumn(\MessageEventDefinitionPeer::PRJ_UID); + $criteria->addSelectColumn(\MessageEventDefinitionPeer::EVN_UID); + $criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGT_UID); + $criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_USR_UID); + $criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_VARIABLES); + $criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_CORRELATION); + + return $criteria; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a Message-Event-Definition from a record + * + * @param array $record Record + * + * return array Return an array with data Message-Event-Definition + */ + public function getMessageEventDefinitionDataFromRecord(array $record) + { + try { + return array( + $this->getFieldNameByFormatFieldName("MSGED_UID") => $record["MSGED_UID"], + $this->getFieldNameByFormatFieldName("EVN_UID") => $record["EVN_UID"], + $this->getFieldNameByFormatFieldName("MSGT_UID") => $record["MSGT_UID"] . "", + $this->getFieldNameByFormatFieldName("MSGED_USR_UID") => $record["MSGED_USR_UID"] . "", + $this->getFieldNameByFormatFieldName("MSGED_VARIABLES") => $record["MSGED_VARIABLES"], + $this->getFieldNameByFormatFieldName("MSGED_CORRELATION") => $record["MSGED_CORRELATION"] . "" + ); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get all Message-Event-Definitions + * + * @param string $projectUid Unique id of Project + * + * return array Return an array with all Message-Event-Definitions + */ + public function getMessageEventDefinitions($projectUid) + { + try { + $arrayMessageEventDefinition = array(); + + //Verify data + $process = new \ProcessMaker\BusinessModel\Process(); + + $process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]); + + //Get data + $criteria = $this->getMessageEventDefinitionCriteria(); + + $criteria->add(\MessageEventDefinitionPeer::PRJ_UID, $projectUid, \Criteria::EQUAL); + + $rsCriteria = \MessageEventDefinitionPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $this->setMessageEventDefinitionVariablesForRecordByMessageType($rsCriteria->getRow()); + + $arrayMessageEventDefinition[] = $this->getMessageEventDefinitionDataFromRecord($row); + } + + //Return + return $arrayMessageEventDefinition; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a Message-Event-Definition + * + * @param string $messageEventDefinitionUid Unique id of Message-Event-Definition + * @param bool $flagGetRecord Value that set the getting + * + * return array Return an array with data of a Message-Event-Definition + */ + public function getMessageEventDefinition($messageEventDefinitionUid, $flagGetRecord = false) + { + try { + //Verify data + $this->throwExceptionIfNotExistsMessageEventDefinition($messageEventDefinitionUid, $this->arrayFieldNameForException["messageEventDefinitionUid"]); + + //Get data + $criteria = $this->getMessageEventDefinitionCriteria(); + + $criteria->add(\MessageEventDefinitionPeer::MSGED_UID, $messageEventDefinitionUid, \Criteria::EQUAL); + + $rsCriteria = \MessageEventDefinitionPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + $rsCriteria->next(); + + $row = $this->setMessageEventDefinitionVariablesForRecordByMessageType($rsCriteria->getRow()); + + //Return + return (!$flagGetRecord)? $this->getMessageEventDefinitionDataFromRecord($row) : $row; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a Message-Event-Definition by unique id of Event + * + * @param string $projectUid Unique id of Project + * @param string $eventUid Unique id of Event + * @param bool $flagGetRecord Value that set the getting + * + * return array Return an array with data of a Message-Event-Definition by unique id of Event + */ + public function getMessageEventDefinitionByEvent($projectUid, $eventUid, $flagGetRecord = false) + { + try { + //Verify data + $process = new \ProcessMaker\BusinessModel\Process(); + + $process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]); + + if (!$this->existsEvent($projectUid, $eventUid)) { + throw new \Exception(\G::LoadTranslation("ID_MESSAGE_EVENT_DEFINITION_DOES_NOT_IS_REGISTERED", array($this->arrayFieldNameForException["eventUid"], $eventUid))); + } + + //Get data + $criteria = $this->getMessageEventDefinitionCriteria(); + + $criteria->add(\MessageEventDefinitionPeer::PRJ_UID, $projectUid, \Criteria::EQUAL); + $criteria->add(\MessageEventDefinitionPeer::EVN_UID, $eventUid, \Criteria::EQUAL); + + $rsCriteria = \MessageEventDefinitionPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + $rsCriteria->next(); + + $row = $this->setMessageEventDefinitionVariablesForRecordByMessageType($rsCriteria->getRow()); + + //Return + return (!$flagGetRecord)? $this->getMessageEventDefinitionDataFromRecord($row) : $row; + } catch (\Exception $e) { + throw $e; + } + } +} + diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/MessageEventRelation.php b/workflow/engine/src/ProcessMaker/BusinessModel/MessageEventRelation.php new file mode 100644 index 000000000..ac81b1fec --- /dev/null +++ b/workflow/engine/src/ProcessMaker/BusinessModel/MessageEventRelation.php @@ -0,0 +1,408 @@ + array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "messageEventRelationUid"), + + "PRJ_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "projectUid"), + "EVN_UID_THROW" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "eventUidThrow"), + "EVN_UID_CATCH" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "eventUidCatch") + ); + + private $formatFieldNameInUppercase = true; + + private $arrayFieldNameForException = array(); + + /** + * Constructor of the class + * + * return void + */ + public function __construct() + { + try { + foreach ($this->arrayFieldDefinition as $key => $value) { + $this->arrayFieldNameForException[$value["fieldNameAux"]] = $key; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set the format of the fields name (uppercase, lowercase) + * + * @param bool $flag Value that set the format + * + * return void + */ + public function setFormatFieldNameInUppercase($flag) + { + try { + $this->formatFieldNameInUppercase = $flag; + + $this->setArrayFieldNameForException($this->arrayFieldNameForException); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set exception messages for fields + * + * @param array $arrayData Data with the fields + * + * return void + */ + public function setArrayFieldNameForException(array $arrayData) + { + try { + foreach ($arrayData as $key => $value) { + $this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get the name of the field according to the format + * + * @param string $fieldName Field name + * + * return string Return the field name according the format + */ + public function getFieldNameByFormatFieldName($fieldName) + { + try { + return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if exists the Message-Event-Relation + * + * @param string $messageEventRelationUid Unique id of Message-Event-Relation + * + * return bool Return true if exists the Message-Event-Relation, false otherwise + */ + public function exists($messageEventRelationUid) + { + try { + $obj = \MessageEventRelationPeer::retrieveByPK($messageEventRelationUid); + + return (!is_null($obj))? true : false; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if exists the Event-Relation of a Message-Event-Relation + * + * @param string $projectUid Unique id of Project + * @param string $eventUidThrow Unique id of Event (throw) + * @param string $eventUidCatch Unique id of Event (catch) + * @param string $messageEventRelationUidToExclude Unique id of Message-Event-Relation to exclude + * + * return bool Return true if exists the Event-Relation of a Message-Event-Relation, false otherwise + */ + public function existsEventRelation($projectUid, $eventUidThrow, $eventUidCatch, $messageEventRelationUidToExclude = "") + { + try { + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\MessageEventRelationPeer::MSGER_UID); + $criteria->add(\MessageEventRelationPeer::PRJ_UID, $projectUid, \Criteria::EQUAL); + + if ($messageEventRelationUidToExclude != "") { + $criteria->add(\MessageEventRelationPeer::MSGER_UID, $messageEventRelationUidToExclude, \Criteria::NOT_EQUAL); + } + + $criteria->add(\MessageEventRelationPeer::EVN_UID_THROW, $eventUidThrow, \Criteria::EQUAL); + $criteria->add(\MessageEventRelationPeer::EVN_UID_CATCH, $eventUidCatch, \Criteria::EQUAL); + + $rsCriteria = \MessageEventRelationPeer::doSelectRS($criteria); + + return ($rsCriteria->next())? true : false; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if does not exists the Message-Event-Relation + * + * @param string $messageEventRelationUid Unique id of Message-Event-Relation + * @param string $fieldNameForException Field name for the exception + * + * return void Throw exception if does not exists the Message-Event-Relation + */ + public function throwExceptionIfNotExistsMessageEventRelation($messageEventRelationUid, $fieldNameForException) + { + try { + if (!$this->exists($messageEventRelationUid)) { + throw new \Exception(\G::LoadTranslation("ID_MESSAGE_EVENT_RELATION_DOES_NOT_EXIST", array($fieldNameForException, $messageEventRelationUid))); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if is registered the Event-Relation + * + * @param string $projectUid Unique id of Project + * @param string $eventUidThrow Unique id of Event (throw) + * @param string $eventUidCatch Unique id of Event (catch) + * @param string $messageEventRelationUidToExclude Unique id of Message-Event-Relation to exclude + * + * return void Throw exception if is registered the Event-Relation + */ + public function throwExceptionIfEventRelationIsRegistered($projectUid, $eventUidThrow, $eventUidCatch, $messageEventRelationUidToExclude = "") + { + try { + if ($this->existsEventRelation($projectUid, $eventUidThrow, $eventUidCatch, $messageEventRelationUidToExclude)) { + throw new \Exception(\G::LoadTranslation("ID_MESSAGE_EVENT_RELATION_ALREADY_REGISTERED")); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Validate the data if they are invalid (INSERT and UPDATE) + * + * @param string $messageEventRelationUid Unique id of Message-Event-Relation + * @param string $projectUid Unique id of Project + * @param array $arrayData Data + * + * return void Throw exception if data has an invalid value + */ + public function throwExceptionIfDataIsInvalid($messageEventRelationUid, $projectUid, array $arrayData) + { + try { + //Set variables + $arrayMessageEventRelationData = ($messageEventRelationUid == "")? array() : $this->getMessageEventRelation($messageEventRelationUid, true); + $flagInsert = ($messageEventRelationUid == "")? true : false; + + $arrayFinalData = array_merge($arrayMessageEventRelationData, $arrayData); + + //Verify data - Field definition + $process = new \ProcessMaker\BusinessModel\Process(); + + $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert); + + //Verify data + if (isset($arrayData["EVN_UID_THROW"]) || isset($arrayData["EVN_UID_CATCH"])) { + $this->throwExceptionIfEventRelationIsRegistered($projectUid, $arrayFinalData["EVN_UID_THROW"], $arrayFinalData["EVN_UID_CATCH"], $messageEventRelationUid); + } + + if (isset($arrayData["EVN_UID_THROW"]) || isset($arrayData["EVN_UID_CATCH"])) { + //Flow + $bpmnFlow = \BpmnFlow::findOneBy(array( + \BpmnFlowPeer::FLO_TYPE => "MESSAGE", + \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $arrayFinalData["EVN_UID_THROW"], + \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnEvent", + \BpmnFlowPeer::FLO_ELEMENT_DEST => $arrayFinalData["EVN_UID_CATCH"], + \BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE => "bpmnEvent" + )); + + if (is_null($bpmnFlow)) { + throw new \Exception(\G::LoadTranslation( + "ID_MESSAGE_EVENT_RELATION_DOES_NOT_EXIST_MESSAGE_FLOW", + array( + $this->arrayFieldNameForException["eventUidThrow"], $arrayFinalData["EVN_UID_THROW"], + $this->arrayFieldNameForException["eventUidCatch"], $arrayFinalData["EVN_UID_CATCH"] + ) + )); + } + + //Check and validate Message Flow + $bpmn = new \ProcessMaker\Project\Bpmn(); + + $bpmn->throwExceptionFlowIfIsAnInvalidMessageFlow(array( + "FLO_TYPE" => "MESSAGE", + "FLO_ELEMENT_ORIGIN" => $arrayFinalData["EVN_UID_THROW"], + "FLO_ELEMENT_ORIGIN_TYPE" => "bpmnEvent", + "FLO_ELEMENT_DEST" => $arrayFinalData["EVN_UID_CATCH"], + "FLO_ELEMENT_DEST_TYPE" => "bpmnEvent" + )); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Create Message-Event-Relation for a Project + * + * @param string $projectUid Unique id of Project + * @param array $arrayData Data + * + * return array Return data of the new Message-Event-Relation created + */ + public function create($projectUid, array $arrayData) + { + try { + //Verify data + $process = new \ProcessMaker\BusinessModel\Process(); + $validator = new \ProcessMaker\BusinessModel\Validator(); + + $validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData"); + $validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData"); + + //Set data + $arrayData = array_change_key_case($arrayData, CASE_UPPER); + + unset($arrayData["MSGER_UID"]); + unset($arrayData["PRJ_UID"]); + + //Verify data + $process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]); + + $this->throwExceptionIfDataIsInvalid("", $projectUid, $arrayData); + + //Create + $cnn = \Propel::getConnection("workflow"); + + try { + $messageEventRelation = new \MessageEventRelation(); + + $messageEventRelationUid = \ProcessMaker\Util\Common::generateUID(); + + $messageEventRelation->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME); + + $messageEventRelation->setMsgerUid($messageEventRelationUid); + $messageEventRelation->setPrjUid($projectUid); + + if ($messageEventRelation->validate()) { + $cnn->begin(); + + $result = $messageEventRelation->save(); + + $cnn->commit(); + + //Return + return $this->getMessageEventRelation($messageEventRelationUid); + } else { + $msg = ""; + + foreach ($messageEventRelation->getValidationFailures() as $validationFailure) { + $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); + } + + throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : "")); + } + } catch (\Exception $e) { + $cnn->rollback(); + + throw $e; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Delete Message-Event-Relation + * + * @param array $arrayCondition Conditions + * + * return void + */ + public function deleteWhere(array $arrayCondition) + { + try { + //Delete + $criteria = new \Criteria("workflow"); + + foreach ($arrayCondition as $key => $value) { + $criteria->add($key, $value, \Criteria::EQUAL); + } + + $result = \MessageEventRelationPeer::doDelete($criteria); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get criteria for Message-Event-Relation + * + * return object + */ + public function getMessageEventRelationCriteria() + { + try { + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\MessageEventRelationPeer::MSGER_UID); + $criteria->addSelectColumn(\MessageEventRelationPeer::PRJ_UID); + $criteria->addSelectColumn(\MessageEventRelationPeer::EVN_UID_THROW); + $criteria->addSelectColumn(\MessageEventRelationPeer::EVN_UID_CATCH); + + return $criteria; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a Message-Event-Relation from a record + * + * @param array $record Record + * + * return array Return an array with data Message-Event-Relation + */ + public function getMessageEventRelationDataFromRecord(array $record) + { + try { + return array( + $this->getFieldNameByFormatFieldName("MSGER_UID") => $record["MSGER_UID"], + $this->getFieldNameByFormatFieldName("EVN_UID_THROW") => $record["EVN_UID_THROW"], + $this->getFieldNameByFormatFieldName("EVN_UID_CATCH") => $record["EVN_UID_CATCH"] + ); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a Message-Event-Relation + * + * @param string $messageEventRelationUid Unique id of Message-Event-Relation + * @param bool $flagGetRecord Value that set the getting + * + * return array Return an array with data of a Message-Event-Relation + */ + public function getMessageEventRelation($messageEventRelationUid, $flagGetRecord = false) + { + try { + //Verify data + $this->throwExceptionIfNotExistsMessageEventRelation($messageEventRelationUid, $this->arrayFieldNameForException["messageEventRelationUid"]); + + //Get data + $criteria = $this->getMessageEventRelationCriteria(); + + $criteria->add(\MessageEventRelationPeer::MSGER_UID, $messageEventRelationUid, \Criteria::EQUAL); + + $rsCriteria = \MessageEventRelationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + $rsCriteria->next(); + + $row = $rsCriteria->getRow(); + + //Return + return (!$flagGetRecord)? $this->getMessageEventRelationDataFromRecord($row) : $row; + } catch (\Exception $e) { + throw $e; + } + } +} + diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/MessageEventTaskRelation.php b/workflow/engine/src/ProcessMaker/BusinessModel/MessageEventTaskRelation.php new file mode 100644 index 000000000..dda7620de --- /dev/null +++ b/workflow/engine/src/ProcessMaker/BusinessModel/MessageEventTaskRelation.php @@ -0,0 +1,352 @@ + array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "messageEventTaskRelationUid"), + + "PRJ_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "projectUid"), + "EVN_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "eventUid"), + "TAS_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "taskUid") + ); + + private $formatFieldNameInUppercase = true; + + private $arrayFieldNameForException = array(); + + /** + * Constructor of the class + * + * return void + */ + public function __construct() + { + try { + foreach ($this->arrayFieldDefinition as $key => $value) { + $this->arrayFieldNameForException[$value["fieldNameAux"]] = $key; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set the format of the fields name (uppercase, lowercase) + * + * @param bool $flag Value that set the format + * + * return void + */ + public function setFormatFieldNameInUppercase($flag) + { + try { + $this->formatFieldNameInUppercase = $flag; + + $this->setArrayFieldNameForException($this->arrayFieldNameForException); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set exception messages for fields + * + * @param array $arrayData Data with the fields + * + * return void + */ + public function setArrayFieldNameForException(array $arrayData) + { + try { + foreach ($arrayData as $key => $value) { + $this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get the name of the field according to the format + * + * @param string $fieldName Field name + * + * return string Return the field name according the format + */ + public function getFieldNameByFormatFieldName($fieldName) + { + try { + return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if exists the Message-Event-Task-Relation + * + * @param string $messageEventTaskRelationUid Unique id of Message-Event-Task-Relation + * + * return bool Return true if exists the Message-Event-Task-Relation, false otherwise + */ + public function exists($messageEventTaskRelationUid) + { + try { + $obj = \MessageEventTaskRelationPeer::retrieveByPK($messageEventTaskRelationUid); + + return (!is_null($obj))? true : false; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if does not exists the Message-Event-Task-Relation + * + * @param string $messageEventTaskRelationUid Unique id of Message-Event-Task-Relation + * @param string $fieldNameForException Field name for the exception + * + * return void Throw exception if does not exists the Message-Event-Task-Relation + */ + public function throwExceptionIfNotExistsMessageEventTaskRelation($messageEventTaskRelationUid, $fieldNameForException) + { + try { + if (!$this->exists($messageEventTaskRelationUid)) { + throw new \Exception(\G::LoadTranslation("ID_MESSAGE_EVENT_TASK_RELATION_DOES_NOT_EXIST", array($fieldNameForException, $messageEventTaskRelationUid))); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Validate the data if they are invalid (INSERT and UPDATE) + * + * @param string $messageEventTaskRelationUid Unique id of Message-Event-Task-Relation + * @param string $projectUid Unique id of Project + * @param array $arrayData Data + * + * return void Throw exception if data has an invalid value + */ + public function throwExceptionIfDataIsInvalid($messageEventTaskRelationUid, $projectUid, array $arrayData) + { + try { + //Set variables + $arrayMessageEventTaskRelationData = ($messageEventTaskRelationUid == "")? array() : $this->getMessageEventTaskRelation($messageEventTaskRelationUid, true); + $flagInsert = ($messageEventTaskRelationUid == "")? true : false; + + $arrayFinalData = array_merge($arrayMessageEventTaskRelationData, $arrayData); + + //Verify data - Field definition + $process = new \ProcessMaker\BusinessModel\Process(); + + $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Create Message-Event-Task-Relation for a Project + * + * @param string $projectUid Unique id of Project + * @param array $arrayData Data + * + * return array Return data of the new Message-Event-Task-Relation created + */ + public function create($projectUid, array $arrayData) + { + try { + //Verify data + $process = new \ProcessMaker\BusinessModel\Process(); + $validator = new \ProcessMaker\BusinessModel\Validator(); + + $validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData"); + $validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData"); + + //Set data + $arrayData = array_change_key_case($arrayData, CASE_UPPER); + + unset($arrayData["MSGETR_UID"]); + unset($arrayData["PRJ_UID"]); + + //Verify data + $process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]); + + $this->throwExceptionIfDataIsInvalid("", $projectUid, $arrayData); + + //Create + $cnn = \Propel::getConnection("workflow"); + + try { + $messageEventTaskRelation = new \MessageEventTaskRelation(); + + $messageEventTaskRelationUid = \ProcessMaker\Util\Common::generateUID(); + + $messageEventTaskRelation->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME); + + $messageEventTaskRelation->setMsgetrUid($messageEventTaskRelationUid); + $messageEventTaskRelation->setPrjUid($projectUid); + + if ($messageEventTaskRelation->validate()) { + $cnn->begin(); + + $result = $messageEventTaskRelation->save(); + + $cnn->commit(); + + //Return + return $this->getMessageEventTaskRelation($messageEventTaskRelationUid); + } else { + $msg = ""; + + foreach ($messageEventTaskRelation->getValidationFailures() as $validationFailure) { + $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); + } + + throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : "")); + } + } catch (\Exception $e) { + $cnn->rollback(); + + throw $e; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Delete Message-Event-Task-Relation + * + * @param array $arrayCondition Conditions + * + * return void + */ + public function deleteWhere(array $arrayCondition) + { + try { + //Delete + $criteria = new \Criteria("workflow"); + + foreach ($arrayCondition as $key => $value) { + $criteria->add($key, $value, \Criteria::EQUAL); + } + + $result = \MessageEventTaskRelationPeer::doDelete($criteria); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get criteria for Message-Event-Task-Relation + * + * return object + */ + public function getMessageEventTaskRelationCriteria() + { + try { + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\MessageEventTaskRelationPeer::MSGETR_UID); + $criteria->addSelectColumn(\MessageEventTaskRelationPeer::PRJ_UID); + $criteria->addSelectColumn(\MessageEventTaskRelationPeer::EVN_UID); + $criteria->addSelectColumn(\MessageEventTaskRelationPeer::TAS_UID); + + return $criteria; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a Message-Event-Task-Relation from a record + * + * @param array $record Record + * + * return array Return an array with data Message-Event-Task-Relation + */ + public function getMessageEventTaskRelationDataFromRecord(array $record) + { + try { + return array( + $this->getFieldNameByFormatFieldName("MSGETR_UID") => $record["MSGETR_UID"], + $this->getFieldNameByFormatFieldName("EVN_UID") => $record["EVN_UID"], + $this->getFieldNameByFormatFieldName("TAS_UID") => $record["TAS_UID"] + ); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a Message-Event-Task-Relation + * + * @param string $messageEventTaskRelationUid Unique id of Message-Event-Task-Relation + * @param bool $flagGetRecord Value that set the getting + * + * return array Return an array with data of a Message-Event-Task-Relation + */ + public function getMessageEventTaskRelation($messageEventTaskRelationUid, $flagGetRecord = false) + { + try { + //Verify data + $this->throwExceptionIfNotExistsMessageEventTaskRelation($messageEventTaskRelationUid, $this->arrayFieldNameForException["messageEventTaskRelationUid"]); + + //Get data + $criteria = $this->getMessageEventTaskRelationCriteria(); + + $criteria->add(\MessageEventTaskRelationPeer::MSGETR_UID, $messageEventTaskRelationUid, \Criteria::EQUAL); + + $rsCriteria = \MessageEventTaskRelationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + $rsCriteria->next(); + + $row = $rsCriteria->getRow(); + + //Return + return (!$flagGetRecord)? $this->getMessageEventTaskRelationDataFromRecord($row) : $row; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a Message-Event-Task-Relation + * + * @param array $arrayCondition Conditions + * @param bool $flagGetRecord Value that set the getting + * + * return array Return an array with data of a Message-Event-Task-Relation + */ + public function getMessageEventTaskRelationWhere(array $arrayCondition, $flagGetRecord = false) + { + try { + //Get data + $criteria = $this->getMessageEventTaskRelationCriteria(); + + foreach ($arrayCondition as $key => $value) { + $criteria->add($key, $value, \Criteria::EQUAL); + } + + $rsCriteria = \MessageEventTaskRelationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + if ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + //Return + return (!$flagGetRecord)? $this->getMessageEventTaskRelationDataFromRecord($row) : $row; + } else { + //Return + return null; + } + } catch (\Exception $e) { + throw $e; + } + } +} + diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php index ae8557cce..c45cdb087 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php @@ -359,9 +359,11 @@ class WebEntryEvent //Task $task = new \Task(); + $prefix = "wee-"; + $this->webEntryEventWebEntryTaskUid = $task->create( array( - "TAS_UID" => \ProcessMaker\Util\Common::generateUID(), + "TAS_UID" => $prefix . substr(\ProcessMaker\Util\Common::generateUID(), (32 - strlen($prefix)) * -1), "PRO_UID" => $projectUid, "TAS_TYPE" => "WEBENTRYEVENT", "TAS_TITLE" => "WEBENTRYEVENT", @@ -765,6 +767,8 @@ class WebEntryEvent throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . (($msg != "")? "\n" . $msg : "")); } } catch (\Exception $e) { + $cnn->rollback(); + $this->deleteWebEntry($this->webEntryEventWebEntryUid, $this->webEntryEventWebEntryTaskUid); throw $e; diff --git a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php index e2bb094a0..996af7a58 100755 --- a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php +++ b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php @@ -22,6 +22,15 @@ class BpmnWorkflow extends Project\Bpmn const BPMN_GATEWAY_INCLUSIVE = "INCLUSIVE"; const BPMN_GATEWAY_EXCLUSIVE = "EXCLUSIVE"; + private $arrayTaskAttribute = array( + "gateway-to-gateway" => array("type" => "GATEWAYTOGATEWAY", "prefix" => "gtg-"), + "start-message-event" => array("type" => "START-MESSAGE-EVENT", "prefix" => "sme-"), + "end-message-event" => array("type" => "END-MESSAGE-EVENT", "prefix" => "eme-"), + "intermediate-start-message-event" => array("type" => "INTERMEDIATE-START-MESSAGE-EVENT", "prefix" => "isme-"), + "intermediate-end-message-event" => array("type" => "INTERMEDIATE-END-MESSAGE-EVENT", "prefix" => "ieme-") + ); + + private $arrayMessageEventTaskRelation = array(); /** * OVERRIDES @@ -247,18 +256,19 @@ class BpmnWorkflow extends Project\Bpmn //WebEntry-Event - Update $this->updateWebEntryEventByEvent($data["FLO_ELEMENT_ORIGIN"], array("ACT_UID" => $data["FLO_ELEMENT_DEST"])); break; + case "bpmnEvent": + $messageEventRelationUid = $this->createMessageEventRelationByBpmnFlow(\BpmnFlowPeer::retrieveByPK($floUid)); + break; } break; case "bpmnActivity": switch ($data["FLO_ELEMENT_DEST_TYPE"]) { case "bpmnEvent": - $actUid = $data["FLO_ELEMENT_ORIGIN"]; - $evnUid = $data["FLO_ELEMENT_DEST"]; - $event = \BpmnEventPeer::retrieveByPK($evnUid); + $event = \BpmnEventPeer::retrieveByPK($data["FLO_ELEMENT_DEST"]); // setting as end task - if ($event && $event->getEvnType() == "END") { - $this->wp->setEndTask($actUid); + if (!is_null($event) && $event->getEvnType() == "END" && $event->getEvnMarker() == "EMPTY") { + $this->wp->setEndTask($data["FLO_ELEMENT_ORIGIN"]); } break; } @@ -306,7 +316,7 @@ class BpmnWorkflow extends Project\Bpmn ) { $event = \BpmnEventPeer::retrieveByPK($flowBefore->getFloElementDest()); - if (!is_null($event) && $event->getEvnType() == "END") { + if (!is_null($event) && $event->getEvnType() == "END" && $event->getEvnMarker() == "EMPTY") { //Remove as end task $this->wp->setEndTask($flowBefore->getFloElementOrigin(), false); @@ -322,7 +332,7 @@ class BpmnWorkflow extends Project\Bpmn ) { $event = \BpmnEventPeer::retrieveByPK($flowBefore->getFloElementDest()); - if (!is_null($event) && $event->getEvnType() == "END") { + if (!is_null($event) && $event->getEvnType() == "END" && $event->getEvnMarker() == "EMPTY") { //Remove as end task $this->wp->setEndTask($flowBefore->getFloElementOrigin(), false); } @@ -336,6 +346,27 @@ class BpmnWorkflow extends Project\Bpmn ) { $this->wp->removeRouteFromTo($flowBefore->getFloElementOrigin(), $flowBefore->getFloElementDest()); } + + //Verify case: Event1(message) -> Event2(message) -----Update-to----> Event(message) -> Event(message) + if ($flowBefore->getFloType() == "MESSAGE" && + $flowBefore->getFloElementOriginType() == "bpmnEvent" && $flowBefore->getFloElementDestType() == "bpmnEvent" + ) { + //Delete Message-Event-Relation + $messageEventRelation = new \ProcessMaker\BusinessModel\MessageEventRelation(); + + $messageEventRelation->deleteWhere(array( + \MessageEventRelationPeer::PRJ_UID => $flowBefore->getPrjUid(), + \MessageEventRelationPeer::EVN_UID_THROW => $flowBefore->getFloElementOrigin(), + \MessageEventRelationPeer::EVN_UID_CATCH => $flowBefore->getFloElementDest() + )); + + //Create Message-Event-Relation + if ($flowCurrent->getFloType() == "MESSAGE" && + $flowCurrent->getFloElementOriginType() == "bpmnEvent" && $flowCurrent->getFloElementDestType() == "bpmnEvent" + ) { + $messageEventRelationUid = $this->createMessageEventRelationByBpmnFlow($flowCurrent); + } + } } public function removeFlow($floUid) @@ -379,7 +410,7 @@ class BpmnWorkflow extends Project\Bpmn // => find the corresponding task and unset it as start task $event = \BpmnEventPeer::retrieveByPK($flow->getFloElementDest()); - if (! is_null($event) && $event->getEvnType() == "END") { + if (!is_null($event) && $event->getEvnType() == "END" && $event->getEvnMarker() == "EMPTY") { $activity = \BpmnActivityPeer::retrieveByPK($flow->getFloElementOrigin()); if (! is_null($activity)) { @@ -396,6 +427,23 @@ class BpmnWorkflow extends Project\Bpmn break; } break; + case "bpmnEvent": + switch ($flow->getFloElementDestType()) { + //Event1 -> Event2 + case "bpmnEvent": + if ($flow->getFloType() == "MESSAGE") { + //Delete Message-Event-Relation + $messageEventRelation = new \ProcessMaker\BusinessModel\MessageEventRelation(); + + $messageEventRelation->deleteWhere(array( + \MessageEventRelationPeer::PRJ_UID => $flow->getPrjUid(), + \MessageEventRelationPeer::EVN_UID_THROW => $flow->getFloElementOrigin(), + \MessageEventRelationPeer::EVN_UID_CATCH => $flow->getFloElementDest() + )); + } + break; + } + break; } } @@ -411,12 +459,12 @@ class BpmnWorkflow extends Project\Bpmn $eventUid = parent::addEvent($data); $event = \BpmnEventPeer::retrieveByPK($eventUid); - //Delete case scheduler + // create case scheduler if ($event && $event->getEvnMarker() == "TIMER" && $event->getEvnType() == "START") { $this->wp->addCaseScheduler($eventUid); } - //Delete WebEntry-Event + // create web entry if ($event && $event->getEvnMarker() == "MESSAGE" && $event->getEvnType() == "START") { $this->wp->addWebEntry($eventUid); } @@ -428,19 +476,63 @@ class BpmnWorkflow extends Project\Bpmn { $event = \BpmnEventPeer::retrieveByPK($eventUid); - // delete case scheduler + //Delete case scheduler if ($event && $event->getEvnMarker() == "TIMER" && $event->getEvnType() == "START") { $this->wp->removeCaseScheduler($eventUid); } - // delete web entry - if (!is_null($event) && $event->getEvnType() == "START") { - $webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent(); + if (!is_null($event)) { + //WebEntry-Event - Delete + if ($event->getEvnType() == "START") { + $webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent(); - if ($webEntryEvent->existsEvent($event->getPrjUid(), $eventUid)) { - $arrayWebEntryEventData = $webEntryEvent->getWebEntryEventByEvent($event->getPrjUid(), $eventUid, true); + if ($webEntryEvent->existsEvent($event->getPrjUid(), $eventUid)) { + $arrayWebEntryEventData = $webEntryEvent->getWebEntryEventByEvent($event->getPrjUid(), $eventUid, true); - $webEntryEvent->delete($arrayWebEntryEventData["WEE_UID"]); + $webEntryEvent->delete($arrayWebEntryEventData["WEE_UID"]); + } + } + + //Message-Event-Definition - Delete + $arrayEventType = array("START", "END", "INTERMEDIATE"); + $arrayEventMarker = array("MESSAGETHROW", "MESSAGECATCH"); + + if (!is_null($event) && + in_array($event->getEvnType(), $arrayEventType) && in_array($event->getEvnMarker(), $arrayEventMarker) + ) { + $messageEventDefinition = new \ProcessMaker\BusinessModel\MessageEventDefinition(); + + if ($messageEventDefinition->existsEvent($event->getPrjUid(), $eventUid)) { + $arrayMessageEventDefinitionData = $messageEventDefinition->getMessageEventDefinitionByEvent($event->getPrjUid(), $eventUid, true); + + $messageEventDefinition->delete($arrayMessageEventDefinitionData["MSGED_UID"]); + } + } + + //Message-Event-Task-Relation - Delete + $messageEventTaskRelation = new \ProcessMaker\BusinessModel\MessageEventTaskRelation(); + + $arrayMessageEventTaskRelationData = $messageEventTaskRelation->getMessageEventTaskRelationWhere( + array( + \MessageEventTaskRelationPeer::PRJ_UID => $event->getPrjUid(), + \MessageEventTaskRelationPeer::EVN_UID => $event->getEvnUid() + ), + true + ); + + if (!is_null($arrayMessageEventTaskRelationData)) { + //Task - Delete + $arrayTaskData = $this->wp->getTask($arrayMessageEventTaskRelationData["TAS_UID"]); + + if (!is_null($arrayTaskData)) { + $this->wp->removeTask($arrayMessageEventTaskRelationData["TAS_UID"]); + } + + //Message-Event-Task-Relation - Delete + $messageEventTaskRelation->deleteWhere(array(\MessageEventTaskRelationPeer::MSGETR_UID => $arrayMessageEventTaskRelationData["MSGETR_UID"])); + + //Array - Delete element + unset($this->arrayMessageEventTaskRelation[$eventUid]); } } @@ -462,6 +554,84 @@ class BpmnWorkflow extends Project\Bpmn //} } + public function createTaskByElement($elementUid, $elementType, $key) + { + try { + if (isset($this->arrayMessageEventTaskRelation[$elementUid])) { + $taskUid = $this->arrayMessageEventTaskRelation[$elementUid]; + } else { + $taskPosX = 0; + $taskPosY = 0; + + $flow = \BpmnFlow::findOneBy(array( + \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $elementUid, + \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => $elementType + )); + + if (!is_null($flow)) { + $arrayFlowData = $flow->toArray(); + + $taskPosX = (int)($arrayFlowData["FLO_X1"]); + $taskPosY = (int)($arrayFlowData["FLO_Y1"]); + } else { + $flow = \BpmnFlow::findOneBy(array( + \BpmnFlowPeer::FLO_ELEMENT_DEST => $elementUid, + \BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE => $elementType + )); + + if (!is_null($flow)) { + $arrayFlowData = $flow->toArray(); + + $taskPosX = (int)($arrayFlowData["FLO_X2"]); + $taskPosY = (int)($arrayFlowData["FLO_Y2"]); + } + } + + $prefix = $this->arrayTaskAttribute[$key]["prefix"]; + $taskType = $this->arrayTaskAttribute[$key]["type"]; + + $taskUid = $this->wp->addTask(array( + "TAS_UID" => $prefix . substr(Util\Common::generateUID(), (32 - strlen($prefix)) * -1), + "TAS_TYPE" => $taskType, + "TAS_TITLE" => $taskType, + "TAS_POSX" => $taskPosX, + "TAS_POSY" => $taskPosY + )); + + if ($elementType == "bpmnEvent" && + in_array($key, array("start-message-event", "end-message-event", "intermediate-start-message-event")) + ) { + if ($key == "intermediate-start-message-event") { + //Task - User + //Assign to admin + $task = new \Tasks(); + + $result = $task->assignUser($taskUid, "00000000000000000000000000000001", 1); + } + + //Message-Event-Task-Relation - Create + $messageEventTaskRelation = new \ProcessMaker\BusinessModel\MessageEventTaskRelation(); + + $arrayResult = $messageEventTaskRelation->create( + $this->wp->getUid(), + array( + "EVN_UID" => $elementUid, + "TAS_UID" => $taskUid + ) + ); + + //Array - Add element + $this->arrayMessageEventTaskRelation[$elementUid] = $taskUid; + } + } + + //Return + return $taskUid; + } catch (\Exception $e) { + throw $e; + } + } + public function mapBpmnGatewayToWorkflowRoutes($activityUid, $gatewayUid) { try { @@ -509,16 +679,17 @@ class BpmnWorkflow extends Project\Bpmn break; } - $arrayGatewayFlowData = \BpmnFlow::findAllBy(array( - \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $gatewayUid, + //Flows + $arrayFlow = \BpmnFlow::findAllBy(array( + \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $gatewayUid, \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnGateway" )); - if ($arrayGatewayFlowData > 0) { + if ($arrayFlow > 0) { $this->wp->resetTaskRoutes($activityUid); } - foreach ($arrayGatewayFlowData as $value) { + foreach ($arrayFlow as $value) { $arrayFlowData = $value->toArray(); $routeDefault = (array_key_exists("FLO_TYPE", $arrayFlowData) && $arrayFlowData["FLO_TYPE"] == "DEFAULT")? 1 : 0; @@ -526,37 +697,59 @@ class BpmnWorkflow extends Project\Bpmn switch ($arrayFlowData["FLO_ELEMENT_DEST_TYPE"]) { case "bpmnActivity": - case "bpmnEvent": //Gateway ----> Activity - //Gateway ----> Event - if ($arrayFlowData["FLO_ELEMENT_DEST_TYPE"] == "bpmnEvent") { - $event = \BpmnEventPeer::retrieveByPK($arrayFlowData["FLO_ELEMENT_DEST"]); - - if ($event->getEvnType() == "END") { - $result = $this->wp->addRoute($activityUid, -1, $routeType, $routeCondition, $routeDefault); - } - } else { - $result = $this->wp->addRoute($activityUid, $arrayFlowData["FLO_ELEMENT_DEST"], $routeType, $routeCondition, $routeDefault); - } + $result = $this->wp->addRoute($activityUid, $arrayFlowData["FLO_ELEMENT_DEST"], $routeType, $routeCondition, $routeDefault); break; case "bpmnGateway": //Gateway ----> Gateway - $taskUid = $this->wp->addTask(array( - "TAS_TYPE" => "GATEWAYTOGATEWAY", - "TAS_TITLE" => "GATEWAYTOGATEWAY", - "TAS_POSX" => (int)($arrayFlowData["FLO_X1"]), - "TAS_POSY" => (int)($arrayFlowData["FLO_Y1"]) - )); + $taskUid = $this->createTaskByElement( + $gatewayUid, + "bpmnGateway", + "gateway-to-gateway" + ); $result = $this->wp->addRoute($activityUid, $taskUid, $routeType, $routeCondition, $routeDefault); $this->mapBpmnGatewayToWorkflowRoutes($taskUid, $arrayFlowData["FLO_ELEMENT_DEST"]); break; + case "bpmnEvent": + //Gateway ----> Event + $event = \BpmnEventPeer::retrieveByPK($arrayFlowData["FLO_ELEMENT_DEST"]); + + if (!is_null($event)) { + switch ($event->getEvnType()) { + case "START": + throw new \LogicException("Incorrect design" . PHP_EOL . "Given: bpmnGateway -> " . $arrayFlowData["FLO_ELEMENT_DEST_TYPE"]); + break; + case "END": + //$event->getEvnMarker(): EMPTY or MESSAGETHROW + switch ($event->getEvnMarker()) { + case "EMPTY": + $result = $this->wp->addRoute($activityUid, -1, $routeType, $routeCondition, $routeDefault); + break; + case "MESSAGETHROW": + $taskUid = $this->createTaskByElement( + $event->getEvnUid(), + "bpmnEvent", + "end-message-event" + ); + + $result = $this->wp->addRoute($activityUid, $taskUid, $routeType, $routeCondition, $routeDefault); + $result = $this->wp->addRoute($taskUid, -1, "SEQUENTIAL"); + break; + } + break; + case "INTERMEDIATE": + $this->mapBpmnEventToWorkflowRoutes($activityUid, $arrayFlowData["FLO_ELEMENT_DEST"], $routeType, $routeCondition, $routeDefault); + break; + } + } + break; default: - //For processmaker is only allowed flows between: "gateway -> activity", "gateway -> gateway" + //For ProcessMaker is only allowed flows between: "gateway -> activity", "gateway -> gateway", "gateway -> event" //any another flow is considered invalid throw new \LogicException( - "For ProcessMaker is only allowed flows between: \"gateway -> activity\", \"gateway -> gateway\" " . PHP_EOL . + "For ProcessMaker is only allowed flows between: \"gateway -> activity\", \"gateway -> gateway\", \"gateway -> event\"" . PHP_EOL . "Given: bpmnGateway -> " . $arrayFlowData["FLO_ELEMENT_DEST_TYPE"] ); } @@ -566,29 +759,192 @@ class BpmnWorkflow extends Project\Bpmn } } + public function mapBpmnEventToWorkflowRoutes($activityUid, $eventUid, $routeType = "SEQUENTIAL", $routeCondition = "", $routeDefault = 0) + { + try { + $arrayEventData = \BpmnEvent::findOneBy(\BpmnEventPeer::EVN_UID, $eventUid)->toArray(); + + $arrayEventType = array("START", "INTERMEDIATE"); + $arrayEventMarker = array("MESSAGETHROW", "MESSAGECATCH"); + + if (!is_null($arrayEventData) && + in_array($arrayEventData["EVN_TYPE"], $arrayEventType) && in_array($arrayEventData["EVN_MARKER"], $arrayEventMarker) + ) { + //Event - INTERMEDIATE-START-MESSAGE-EVENT + if ($arrayEventData["EVN_TYPE"] == "INTERMEDIATE" && $arrayEventData["EVN_MARKER"] == "MESSAGECATCH") { + $taskUid = $this->createTaskByElement( + $eventUid, + "bpmnEvent", + "intermediate-start-message-event" + ); + + $result = $this->wp->addRoute($activityUid, $taskUid, $routeType, $routeCondition, $routeDefault); + + $activityUid = $taskUid; + } + + //Flows + $arrayFlow = \BpmnFlow::findAllBy(array( + \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $eventUid, + \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnEvent" + )); + + foreach ($arrayFlow as $value) { + $arrayFlowData = $value->toArray(); + + switch ($arrayFlowData["FLO_ELEMENT_DEST_TYPE"]) { + case "bpmnActivity": + //Event ----> Activity + $result = $this->wp->addRoute($activityUid, $arrayFlowData["FLO_ELEMENT_DEST"], "SEQUENTIAL"); + break; + case "bpmnGateway": + //Event ----> Gateway + $this->mapBpmnGatewayToWorkflowRoutes($activityUid, $arrayFlowData["FLO_ELEMENT_DEST"]); + break; + case "bpmnEvent": + //Event ----> Event + $event = \BpmnEventPeer::retrieveByPK($arrayFlowData["FLO_ELEMENT_DEST"]); + + if (!is_null($event)) { + switch ($event->getEvnType()) { + case "START": + throw new \LogicException("Incorrect design" . PHP_EOL . "Given: bpmnEvent -> " . $arrayFlowData["FLO_ELEMENT_DEST_TYPE"]); + break; + case "END": + //$event->getEvnMarker(): EMPTY or MESSAGETHROW + switch ($event->getEvnMarker()) { + case "EMPTY": + $result = $this->wp->addRoute($activityUid, -1, "SEQUENTIAL"); + break; + case "MESSAGETHROW": + $taskUid = $this->createTaskByElement( + $event->getEvnUid(), + "bpmnEvent", + "end-message-event" + ); + + $result = $this->wp->addRoute($activityUid, $taskUid, "SEQUENTIAL"); + $result = $this->wp->addRoute($taskUid, -1, "SEQUENTIAL"); + break; + } + break; + case "INTERMEDIATE": + $this->mapBpmnEventToWorkflowRoutes($activityUid, $arrayFlowData["FLO_ELEMENT_DEST"]); + break; + } + } + break; + default: + //For ProcessMaker is only allowed flows between: "event -> activity", "event -> gateway", "event -> event" + //any another flow is considered invalid + throw new \LogicException( + "For ProcessMaker is only allowed flows between: \"event -> activity\", \"event -> gateway\", \"event -> event\"" . PHP_EOL . + "Given: bpmnEvent -> " . $arrayFlowData["FLO_ELEMENT_DEST_TYPE"] + ); + } + } + } + } catch (\Exception $e) { + throw $e; + } + } + public function mapBpmnFlowsToWorkflowRoutes() { - $this->wp->deleteTaskGatewayToGateway($this->wp->getUid()); + //Task - Delete dummies + $this->wp->deleteTaskByArrayType( + $this->wp->getUid(), + array( + $this->arrayTaskAttribute["gateway-to-gateway"]["type"] + ) + ); - $activities = $this->getActivities(); + //Activities + foreach ($this->getActivities() as $value) { + $activity = $value; - foreach ($activities as $activity) { - $flows = \BpmnFlow::findAllBy(array( - \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $activity["ACT_UID"], + //Flows + $arrayFlow = \BpmnFlow::findAllBy(array( + \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $activity["ACT_UID"], \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnActivity" )); - foreach ($flows as $flow) { + foreach ($arrayFlow as $value2) { + $flow = $value2; + switch ($flow->getFloElementDestType()) { case "bpmnActivity": - // (activity -> activity) + //Activity -> Activity $this->wp->addRoute($activity["ACT_UID"], $flow->getFloElementDest(), "SEQUENTIAL"); break; case "bpmnGateway": - // (activity -> gateway) - // we must find the related flows: gateway -> + //Activity -> Gateway + //We must find the related flows: gateway -> $this->mapBpmnGatewayToWorkflowRoutes($activity["ACT_UID"], $flow->getFloElementDest()); break; + case "bpmnEvent": + //Activity -> Event + $event = \BpmnEventPeer::retrieveByPK($flow->getFloElementDest()); + + if (!is_null($event)) { + switch ($event->getEvnType()) { + case "START": + throw new \LogicException("Incorrect design" . PHP_EOL . "Given: bpmnActivity -> " . $flow->getFloElementDestType()); + break; + case "END": + //$event->getEvnMarker(): EMPTY or MESSAGETHROW + switch ($event->getEvnMarker()) { + case "EMPTY": + //This it's already implemented + break; + case "MESSAGETHROW": + $taskUid = $this->createTaskByElement( + $event->getEvnUid(), + "bpmnEvent", + "end-message-event" + ); + + $result = $this->wp->addRoute($activity["ACT_UID"], $taskUid, "SEQUENTIAL"); + $result = $this->wp->addRoute($taskUid, -1, "SEQUENTIAL"); + break; + } + break; + case "INTERMEDIATE": + $this->mapBpmnEventToWorkflowRoutes($activity["ACT_UID"], $flow->getFloElementDest()); + break; + } + } + break; + } + } + } + + //Events - Message-Event + $arrayEventType = array("START", "END", "INTERMEDIATE"); + $arrayEventMarker = array("MESSAGETHROW", "MESSAGECATCH"); + + foreach ($this->getEvents() as $value) { + $event = $value; + + if (!isset($this->arrayMessageEventTaskRelation[$event["EVN_UID"]]) && + in_array($event["EVN_TYPE"], $arrayEventType) && in_array($event["EVN_MARKER"], $arrayEventMarker) + ) { + switch ($event["EVN_TYPE"]) { + case "START": + $taskUid = $this->createTaskByElement( + $event["EVN_UID"], + "bpmnEvent", + "start-message-event" + ); + + $this->wp->setStartTask($taskUid); + + $this->mapBpmnEventToWorkflowRoutes($taskUid, $event["EVN_UID"]); + break; + case "END": + break; + case "INTERMEDIATE": + break; } } } @@ -789,6 +1145,27 @@ class BpmnWorkflow extends Project\Bpmn $bwp->update($projectRecord); + //Array - Set empty + $bwp->arrayMessageEventTaskRelation = array(); + + //Message-Event-Task-Relation - Get all records + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\MessageEventTaskRelationPeer::EVN_UID); + $criteria->addSelectColumn(\MessageEventTaskRelationPeer::TAS_UID); + + $criteria->add(\MessageEventTaskRelationPeer::PRJ_UID, $bwp->wp->getUid(), \Criteria::EQUAL); + + $rsCriteria = \MessageEventTaskRelationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + //Array - Add element + $bwp->arrayMessageEventTaskRelation[$row["EVN_UID"]] = $row["TAS_UID"]; + } + /* * Diagram's Laneset Handling */ @@ -1356,5 +1733,33 @@ class BpmnWorkflow extends Project\Bpmn throw $e; } } + + public function createMessageEventRelationByBpmnFlow(\BpmnFlow $bpmnFlow) + { + try { + $messageEventRelationUid = ""; + + if ($bpmnFlow->getFloType() == "MESSAGE" && + $bpmnFlow->getFloElementOriginType() == "bpmnEvent" && $bpmnFlow->getFloElementDestType() == "bpmnEvent" + ) { + $messageEventRelation = new \ProcessMaker\BusinessModel\MessageEventRelation(); + + $arrayResult = $messageEventRelation->create( + $bpmnFlow->getPrjUid(), + array( + "EVN_UID_THROW" => $bpmnFlow->getFloElementOrigin(), + "EVN_UID_CATCH" => $bpmnFlow->getFloElementDest() + ) + ); + + $messageEventRelationUid = $arrayResult["MSGER_UID"]; + } + + //Return + return $messageEventRelationUid; + } catch (\Exception $e) { + throw $e; + } + } } diff --git a/workflow/engine/src/ProcessMaker/Project/Bpmn.php b/workflow/engine/src/ProcessMaker/Project/Bpmn.php index fb06a0b64..5903db89e 100755 --- a/workflow/engine/src/ProcessMaker/Project/Bpmn.php +++ b/workflow/engine/src/ProcessMaker/Project/Bpmn.php @@ -625,12 +625,53 @@ class Bpmn extends Handler } } + public function throwExceptionFlowIfIsAnInvalidMessageFlow(array $bpmnFlow) + { + try { + if ($bpmnFlow["FLO_TYPE"] == "MESSAGE" && + $bpmnFlow["FLO_ELEMENT_ORIGIN_TYPE"] == "bpmnEvent" && $bpmnFlow["FLO_ELEMENT_DEST_TYPE"] == "bpmnEvent" + ) { + $flagValid = true; + + $arrayEventType = array("START", "END", "INTERMEDIATE"); + + $arrayAux = array( + array("eventUid" => $bpmnFlow["FLO_ELEMENT_ORIGIN"], "eventMarker" => "MESSAGETHROW"), + array("eventUid" => $bpmnFlow["FLO_ELEMENT_DEST"], "eventMarker" => "MESSAGECATCH") + ); + + foreach ($arrayAux as $value) { + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\BpmnEventPeer::EVN_UID); + $criteria->add(\BpmnEventPeer::EVN_UID, $value["eventUid"], \Criteria::EQUAL); + $criteria->add(\BpmnEventPeer::EVN_TYPE, $arrayEventType, \Criteria::IN); + $criteria->add(\BpmnEventPeer::EVN_MARKER, $value["eventMarker"], \Criteria::EQUAL); + + $rsCriteria = \BpmnEventPeer::doSelectRS($criteria); + + if (!$rsCriteria->next()) { + $flagValid = false; + break; + } + } + + if (!$flagValid) { + throw new \RuntimeException("Invalid Message Flow."); + } + } + } catch (\Exception $e) { + throw $e; + } + } + public function addFlow($data) { self::log("Add Flow with data: ", $data); // setting defaults $data['FLO_UID'] = array_key_exists('FLO_UID', $data) ? $data['FLO_UID'] : Common::generateUID(); + if (array_key_exists('FLO_STATE', $data)) { $data['FLO_STATE'] = is_array($data['FLO_STATE']) ? json_encode($data['FLO_STATE']) : $data['FLO_STATE']; } @@ -680,17 +721,23 @@ class Bpmn extends Handler )); } + //Check and validate Message Flow + $this->throwExceptionFlowIfIsAnInvalidMessageFlow($data); + + //Create $flow = new Flow(); $flow->fromArray($data, BasePeer::TYPE_FIELDNAME); $flow->setPrjUid($this->getUid()); $flow->setDiaUid($this->getDiagram("object")->getDiaUid()); $flow->setFloPosition($this->getFlowNextPosition($data["FLO_UID"], $data["FLO_TYPE"], $data["FLO_ELEMENT_ORIGIN"])); $flow->save(); + self::log("Add Flow Success!"); return $flow->getFloUid(); } catch (\Exception $e) { self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString()); + throw $e; } } @@ -703,7 +750,12 @@ class Bpmn extends Handler if (array_key_exists('FLO_STATE', $data)) { $data['FLO_STATE'] = is_array($data['FLO_STATE']) ? json_encode($data['FLO_STATE']) : $data['FLO_STATE']; } + try { + //Check and validate Message Flow + $this->throwExceptionFlowIfIsAnInvalidMessageFlow($data); + + //Update $flow = FlowPeer::retrieveByPk($floUid); $flow->fromArray($data); $flow->save(); diff --git a/workflow/engine/src/ProcessMaker/Project/Workflow.php b/workflow/engine/src/ProcessMaker/Project/Workflow.php index 322911913..c86a4c369 100755 --- a/workflow/engine/src/ProcessMaker/Project/Workflow.php +++ b/workflow/engine/src/ProcessMaker/Project/Workflow.php @@ -1236,7 +1236,7 @@ class Workflow extends Handler } } - public function deleteTaskGatewayToGateway($processUid) + public function deleteTaskByArrayType($processUid, array $arrayTaskType) { try { $task = new \Tasks(); @@ -1245,7 +1245,7 @@ class Workflow extends Handler $criteria->addSelectColumn(\TaskPeer::TAS_UID); $criteria->add(\TaskPeer::PRO_UID, $processUid, \Criteria::EQUAL); - $criteria->add(\TaskPeer::TAS_TYPE, "GATEWAYTOGATEWAY", \Criteria::EQUAL); + $criteria->add(\TaskPeer::TAS_TYPE, $arrayTaskType, \Criteria::IN); $rsCriteria = \TaskPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/MessageEventDefinition.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/MessageEventDefinition.php new file mode 100644 index 000000000..b6ddc236b --- /dev/null +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/MessageEventDefinition.php @@ -0,0 +1,134 @@ +messageEventDefinition = new \ProcessMaker\BusinessModel\MessageEventDefinition(); + + $this->messageEventDefinition->setFormatFieldNameInUppercase(false); + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } + + /** + * @url GET /:prj_uid/message-event-definitions + * + * @param string $prj_uid {@min 32}{@max 32} + */ + public function doGetMessageEventDefinitions($prj_uid) + { + try { + $response = $this->messageEventDefinition->getMessageEventDefinitions($prj_uid); + + return $response; + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } + + /** + * @url GET /:prj_uid/message-event-definition/:msged_uid + * + * @param string $prj_uid {@min 32}{@max 32} + * @param string $msged_uid {@min 32}{@max 32} + */ + public function doGetMessageEventDefinition($prj_uid, $msged_uid) + { + try { + $response = $this->messageEventDefinition->getMessageEventDefinition($msged_uid); + + return $response; + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } + + /** + * @url GET /:prj_uid/message-event-definition/event/:evn_uid + * + * @param string $prj_uid {@min 32}{@max 32} + * @param string $evn_uid {@min 32}{@max 32} + */ + public function doGetMessageEventDefinitionEvent($prj_uid, $evn_uid) + { + try { + $response = $this->messageEventDefinition->getMessageEventDefinitionByEvent($prj_uid, $evn_uid); + + return $response; + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } + + /** + * @url POST /:prj_uid/message-event-definition + * + * @param string $prj_uid {@min 32}{@max 32} + * @param array $request_data + * + * @status 201 + */ + public function doPostMessageEventDefinition($prj_uid, array $request_data) + { + try { + $arrayData = $this->messageEventDefinition->create($prj_uid, $request_data); + + $response = $arrayData; + + return $response; + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } + + /** + * @url PUT /:prj_uid/message-event-definition/:msged_uid + * + * @param string $prj_uid {@min 32}{@max 32} + * @param string $msged_uid {@min 32}{@max 32} + * @param array $request_data + */ + public function doPutMessageEventDefinition($prj_uid, $msged_uid, array $request_data) + { + try { + $arrayData = $this->messageEventDefinition->update($msged_uid, $request_data); + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } + + /** + * @url DELETE /:prj_uid/message-event-definition/:msged_uid + * + * @param string $prj_uid {@min 32}{@max 32} + * @param string $msged_uid {@min 32}{@max 32} + */ + public function doDeleteMessageEventDefinition($prj_uid, $msged_uid) + { + try { + $this->messageEventDefinition->delete($msged_uid); + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } +} + diff --git a/workflow/engine/src/ProcessMaker/Services/api.ini b/workflow/engine/src/ProcessMaker/Services/api.ini index bc877b2ec..5b54edbaf 100644 --- a/workflow/engine/src/ProcessMaker/Services/api.ini +++ b/workflow/engine/src/ProcessMaker/Services/api.ini @@ -39,7 +39,8 @@ debug = 1 process-variable = "ProcessMaker\Services\Api\Project\Variable" message-type = "ProcessMaker\Services\Api\Project\MessageType" message-type-variable = "ProcessMaker\Services\Api\Project\MessageType\Variable" - web-entry-event = "ProcessMaker\Services\Api\Project\WebEntryEvent" + web-entry-event = "ProcessMaker\Services\Api\Project\WebEntryEvent" + message-event-definition = "ProcessMaker\Services\Api\Project\MessageEventDefinition" [alias: projects] project = "ProcessMaker\Services\Api\Project" From fa7f8290bd9ecb1c1cec8a6a1dafa5001b173bfa Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Fri, 13 Feb 2015 16:33:22 -0400 Subject: [PATCH 036/155] I added some comments --- workflow/engine/classes/model/Process.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/workflow/engine/classes/model/Process.php b/workflow/engine/classes/model/Process.php index ad4dd65c0..0cf034466 100755 --- a/workflow/engine/classes/model/Process.php +++ b/workflow/engine/classes/model/Process.php @@ -1011,7 +1011,12 @@ class Process extends BaseProcess return 0; } } - + /** + * Check is the Process is BPMN. + * + * @param string $ProUid the uid of the Prolication + * @return int 1 if is BPMN process or 0 if a Normal process + */ public function isBpmnProcess($proUid){ $c = new Criteria("workflow"); $c->add(BpmnProcessPeer::PRJ_UID, $proUid); From ef672d1b0ddea18663f64c43ac027963a79bc625 Mon Sep 17 00:00:00 2001 From: jonathan Date: Wed, 18 Feb 2015 09:50:29 -0400 Subject: [PATCH 037/155] update view pmdynaforms in web entry --- Rakefile | 2 +- workflow/engine/classes/class.pmDynaform.php | 111 +++++++++++------- .../js/cases/core/webentry_pmdynaform.js | 89 ++++++++++++++ .../ProcessMaker/BusinessModel/WebEntry.php | 10 +- .../templates/cases/WebEntry_Pmdynaform.html | 49 ++++++++ 5 files changed, 216 insertions(+), 45 deletions(-) create mode 100644 workflow/engine/js/cases/core/webentry_pmdynaform.js create mode 100644 workflow/engine/templates/cases/WebEntry_Pmdynaform.html diff --git a/Rakefile b/Rakefile index 6794d1e2e..a43a131b5 100644 --- a/Rakefile +++ b/Rakefile @@ -192,7 +192,7 @@ def buildPmdynaform(homeDir, targetDir, mode) template += s end - htmlTemplates=["cases_Step_Pmdynaform.html","cases_Step_Pmdynaform_Preview.html","cases_Step_Pmdynaform_View.html"] + htmlTemplates=["cases_Step_Pmdynaform.html","cases_Step_Pmdynaform_Preview.html","cases_Step_Pmdynaform_View.html","WebEntry_Pmdynaform.html"] htmlTemplates.each do |htmlTemplate| FileUtils.cp("#{Dir.pwd}/workflow/engine/templates/cases/#{htmlTemplate}", "#{pmdynaformDir}/build/#{htmlTemplate}") diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index d45c6f9d1..6a7893d55 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -19,65 +19,67 @@ class pmDynaform public $variables = array(); public function __construct($dyn_uid, $app_data) - { + { $this->dyn_uid = $dyn_uid; $this->app_data = $app_data; $this->getDynaform(); - + //items $dynContent = G::json_decode($this->record["DYN_CONTENT"]); if (isset($dynContent->items)) { $this->items = $dynContent->items[0]->items; } + if($app_data != array()){ + //data + $cases = new \ProcessMaker\BusinessModel\Cases(); + $this->data = $cases->getCaseVariables($app_data["APPLICATION"]); + + //variables + $this->variables = array(); + + $a = new Criteria("workflow"); + $a->addSelectColumn(ProcessVariablesPeer::VAR_NAME); + $a->addSelectColumn(ProcessVariablesPeer::VAR_SQL); + $a->addSelectColumn(ProcessVariablesPeer::VAR_ACCEPTED_VALUES); + $a->addSelectColumn(ProcessVariablesPeer::VAR_DBCONNECTION); - //data - $cases = new \ProcessMaker\BusinessModel\Cases(); - $this->data = $cases->getCaseVariables($app_data["APPLICATION"]); - - //variables - $this->variables = array(); - - $a = new Criteria("workflow"); - $a->addSelectColumn(ProcessVariablesPeer::VAR_NAME); - $a->addSelectColumn(ProcessVariablesPeer::VAR_SQL); - $a->addSelectColumn(ProcessVariablesPeer::VAR_ACCEPTED_VALUES); - $a->addSelectColumn(ProcessVariablesPeer::VAR_DBCONNECTION); + $c3 = $a->getNewCriterion(ProcessVariablesPeer::VAR_ACCEPTED_VALUES, "", Criteria::ALT_NOT_EQUAL); + $c2 = $a->getNewCriterion(ProcessVariablesPeer::VAR_ACCEPTED_VALUES, "[]", Criteria::ALT_NOT_EQUAL); + $c2->addAnd($c3); - $c3 = $a->getNewCriterion(ProcessVariablesPeer::VAR_ACCEPTED_VALUES, "", Criteria::ALT_NOT_EQUAL); - $c2 = $a->getNewCriterion(ProcessVariablesPeer::VAR_ACCEPTED_VALUES, "[]", Criteria::ALT_NOT_EQUAL); - $c2->addAnd($c3); + $c4 = $a->getNewCriterion(ProcessVariablesPeer::PRJ_UID, $this->app_data["PROCESS"], Criteria::EQUAL); - $c4 = $a->getNewCriterion(ProcessVariablesPeer::PRJ_UID, $this->app_data["PROCESS"], Criteria::EQUAL); + $c1 = $a->getNewCriterion(ProcessVariablesPeer::VAR_SQL, "", Criteria::ALT_NOT_EQUAL); + $c1->addOr($c2); + $c1->addAnd($c4); - $c1 = $a->getNewCriterion(ProcessVariablesPeer::VAR_SQL, "", Criteria::ALT_NOT_EQUAL); - $c1->addOr($c2); - $c1->addAnd($c4); + $a->add($c1); - $a->add($c1); + $ds = ProcessPeer::doSelectRS($a); + $ds->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $ds = ProcessPeer::doSelectRS($a); - $ds->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - while ($ds->next()) { - $row = $ds->getRow(); - //options - $rows2 = json_decode($row["VAR_ACCEPTED_VALUES"]); - $n = count($rows2); - for ($i = 0; $i < $n; $i++) { - $rows2[$i] = array($rows2[$i]->keyValue, $rows2[$i]->value); - } - //query - $arrayVariable = array(); - if ($row["VAR_DBCONNECTION"] !== "none") { - $cnn = Propel::getConnection($row["VAR_DBCONNECTION"]); - $stmt = $cnn->createStatement(); - $rs = $stmt->executeQuery(\G::replaceDataField($row["VAR_SQL"], $arrayVariable), \ResultSet::FETCHMODE_NUM); - while ($rs->next()) { - array_push($rows2, $rs->getRow()); + while ($ds->next()) { + $row = $ds->getRow(); + //options + $rows2 = json_decode($row["VAR_ACCEPTED_VALUES"]); + $n = count($rows2); + for ($i = 0; $i < $n; $i++) { + $rows2[$i] = array($rows2[$i]->keyValue, $rows2[$i]->value); } + //query + $arrayVariable = array(); + if ($row["VAR_DBCONNECTION"] !== "none") { + $cnn = Propel::getConnection($row["VAR_DBCONNECTION"]); + $stmt = $cnn->createStatement(); + $rs = $stmt->executeQuery(\G::replaceDataField($row["VAR_SQL"], $arrayVariable), \ResultSet::FETCHMODE_NUM); + while ($rs->next()) { + array_push($rows2, $rs->getRow()); + } + } + $this->variables[$row["VAR_NAME"]] = $rows2; } - $this->variables[$row["VAR_NAME"]] = $rows2; } + } public function getDynaform() @@ -94,7 +96,7 @@ class pmDynaform $ds = ProcessPeer::doSelectRS($a); $ds->setFetchmode(ResultSet::FETCHMODE_ASSOC); $ds->next(); - $row = $ds->getRow(); + $row = $ds->getRow(); $this->record = isset($row) ? $row : null; return $this->record; @@ -243,6 +245,29 @@ class pmDynaform exit(); } + public function printWebEntry() + { + ob_clean(); + $a = $this->clientToken(); + $clientToken = array( + "accessToken" => $a["access_token"], + "expiresIn" => $a["expires_in"], + "tokenType" => $a["token_type"], + "scope" => $a["scope"], + "refreshToken" => $a["refresh_token"], + "clientId" => $a["client_id"], + "clientSecret" => $a["client_secret"] + ); + $file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/WebEntry_Pmdynaform.html'); + $file = str_replace("{JSON_DATA}", $this->record["DYN_CONTENT"], $file); + $file = str_replace("{DYN_UID}", $this->dyn_uid, $file); + $file = str_replace("{PRJ_UID}",$this->record["PRO_UID"], $file); + $file = str_replace("{WORKSPACE}", SYS_SYS, $file); + $file = str_replace("{credentials}", json_encode($clientToken), $file); + echo $file; + exit(); + } + private function clientToken() { $client = $this->getClientCredentials(); diff --git a/workflow/engine/js/cases/core/webentry_pmdynaform.js b/workflow/engine/js/cases/core/webentry_pmdynaform.js new file mode 100644 index 000000000..33843f102 --- /dev/null +++ b/workflow/engine/js/cases/core/webentry_pmdynaform.js @@ -0,0 +1,89 @@ +function dynaFormChanged(frm) { + for (var i1 = 0; i1 <= frm.elements.length - 1; i1++) { + if ((frm.elements[i1].type === "radio" || frm.elements[i1].type === "checkbox") && (frm.elements[i1].checked !== frm.elements[i1].defaultChecked)) { + return true; + } + if ((frm.elements[i1].type === "textarea" || frm.elements[i1].type === "text" || frm.elements[i1].type === "file") && (frm.elements[i1].value !== frm.elements[i1].defaultValue)) { + return true; + } + if (frm.elements[i1].tagName.toLowerCase() === "select") { + var selectDefaultValue = frm.elements[i1].value; + for (var i2 = 0; i2 <= frm.elements[i1].options.length - 1; i2++) { + if (frm.elements[i1].options[i2].defaultSelected) { + selectDefaultValue = frm.elements[i1].options[i2].value; + break; + } + } + if (frm.elements[i1].value !== selectDefaultValue) { + return true; + } + } + } + return false; +} +$(window).load(function () { + if ((navigator.userAgent.indexOf("MSIE") !== -1) || (navigator.userAgent.indexOf("Trident") !== -1)) { + document.body.innerHTML = "
Responsive Dynaforms are not supported in this browser.
"; + return; + } + var data = jsondata; + window.project = new PMDynaform.core.Project({ + data: data, + keys: { + server: location.host, + projectId: prj_uid, + workspace: workspace + }, + token: credentials, + submitRest: false + }); + new PMDynaform.core.Proxy({ + url: "http://" + window.project.keys.server + "/" + window.project.keys.apiName + "/" + window.project.keys.apiVersion + "/" + window.project.keys.workspace + "/cases/" + app_uid + "/variables", + method: 'GET', + data: {}, + keys: window.project.token, + successCallback: function (xhr, response) { + window.project.setData2(response); + } + }); + + var type = document.createElement("input"); + type.type = "hidden"; + type.name = "TYPE"; + type.value = "ASSIGN_TASK"; + var uid = document.createElement("input"); + uid.type = "hidden"; + uid.name = "UID"; + uid.value = dyn_uid; + var position = document.createElement("input"); + position.type = "hidden"; + position.name = "POSITION"; + position.value = "10000"; + var action = document.createElement("input"); + action.type = "hidden"; + action.name = "ACTION"; + action.value = "ASSIGN"; + var dynaformname = document.createElement("input"); + dynaformname.type = "hidden"; + dynaformname.name = "__DynaformName__"; + dynaformname.value = __DynaformName__; + var appuid = document.createElement("input"); + appuid.type = "hidden"; + appuid.name = "APP_UID"; + appuid.value = app_uid; + var form = document.getElementsByTagName("form")[0]; + form.action = "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid; + form.method = "post"; + form.appendChild(type); + form.appendChild(uid); + form.appendChild(position); + form.appendChild(action); + form.appendChild(dynaformname); + form.appendChild(appuid); + + var dyn_forward = document.getElementById("dyn_forward"); + dyn_forward.onclick = function () { + form.submit(); + return false; + }; +}); \ No newline at end of file diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php index ed8d7bdd3..7a580ca33 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php @@ -395,9 +395,17 @@ class WebEntry $fileContent .= "\$_SESSION[\"PROCESS\"] = \"" . $processUid . "\";\n"; $fileContent .= "\$_SESSION[\"CURRENT_DYN_UID\"] = \"" . $dynaFormUid . "\";\n"; $fileContent .= "\$G_PUBLISH = new Publisher();\n"; + + + $fileContent .= "G::LoadClass('pmDynaform');\n"; + $fileContent .= "\$a = new pmDynaform('".$arrayWebEntryData["DYN_UID"]."', array());\n"; + $fileContent .= "if(\$a->isResponsive()){"; + $fileContent .= "\$a->printWebEntry();"; + $fileContent .= "}else {"; $fileContent .= "\$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . "/" . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n"; $fileContent .= "G::RenderPage(\"publish\", \"blank\");"; - + $fileContent .= "}"; + file_put_contents($pathDataPublicProcess . PATH_SEP . $fileName . ".php", $fileContent); //Creating the second file, the post file who receive the post form. diff --git a/workflow/engine/templates/cases/WebEntry_Pmdynaform.html b/workflow/engine/templates/cases/WebEntry_Pmdynaform.html new file mode 100644 index 000000000..2d4c02a3a --- /dev/null +++ b/workflow/engine/templates/cases/WebEntry_Pmdynaform.html @@ -0,0 +1,49 @@ + + + + PMDynaform + + + + + + + + + + + + + +
+ ###TEMPLATES### + + + + + + + + +
+
+   + + +   + + Next Step + +
+ + From 20fe1192ad400e5891167f4a2d652b1133644035 Mon Sep 17 00:00:00 2001 From: "marcelo.cuiza" Date: Wed, 18 Feb 2015 11:10:12 -0400 Subject: [PATCH 038/155] PM-1585 Audit Log para todas las opciones del menu contextual del PROCESO --- workflow/engine/methods/events/eventsDelete.php | 7 +++---- workflow/engine/methods/events/eventsSave.php | 2 +- workflow/engine/methods/events/triggersSave.php | 7 +++---- .../engine/methods/processes/processes_Ajax.php | 12 +++++++++--- .../processes_DeleteObjectPermission.php | 2 +- .../processes/processes_webEntryGenerate.php | 9 +++++++-- .../engine/methods/steps/steps_SupervisorAjax.php | 8 ++++---- workflow/engine/methods/tracker/tracker_Ajax.php | 15 +++++++-------- .../methods/tracker/tracker_ConditionsSave.php | 7 +++---- workflow/engine/methods/tracker/tracker_Save.php | 14 ++++++++++---- 10 files changed, 48 insertions(+), 35 deletions(-) diff --git a/workflow/engine/methods/events/eventsDelete.php b/workflow/engine/methods/events/eventsDelete.php index 3adb131d0..33af91bfe 100755 --- a/workflow/engine/methods/events/eventsDelete.php +++ b/workflow/engine/methods/events/eventsDelete.php @@ -38,10 +38,9 @@ $rs->next(); $row = $rs->getRow(); $proUid = $row['PRO_UID']; -$infoProcess = new Processes(); -$proFields = $infoProcess->serializeProcess($proUid); -$resultProcess = $infoProcess->saveSerializedProcess($proFields); -G::auditLog('Events','Delete event in process "'.$resultProcess['PRO_TITLE'].'"'); +$infoProcess = new Process(); +$resultProcess = $infoProcess->load($proUid); +G::auditLog('Events','Delete event ('.$_POST['EVN_UID'].') in process "'.$resultProcess['PRO_TITLE'].'"'); $evnUid = $_POST['EVN_UID']; require_once 'classes/model/Event.php'; diff --git a/workflow/engine/methods/events/eventsSave.php b/workflow/engine/methods/events/eventsSave.php index 4321fe608..ad8bf2ef5 100755 --- a/workflow/engine/methods/events/eventsSave.php +++ b/workflow/engine/methods/events/eventsSave.php @@ -62,7 +62,7 @@ if ($_POST['form']['EVN_UID'] == '') { $infoProcess = new Processes(); $proFields = $infoProcess->serializeProcess($_POST['form']['PRO_UID']); $resultProcess = $infoProcess->saveSerializedProcess($proFields); -G::auditLog('Events','Save intermediate message "'.$_POST['form']['EVN_DESCRIPTION'].'" in process "'.$resultProcess['PRO_TITLE'].'"'); +G::auditLog('Events','Save intermediate message ('.$_POST['form']['EVN_UID'].') in process "'.$resultProcess['PRO_TITLE'].'"'); function replaceQuotes ($aData) { diff --git a/workflow/engine/methods/events/triggersSave.php b/workflow/engine/methods/events/triggersSave.php index c42cfc12e..7e602d9d1 100755 --- a/workflow/engine/methods/events/triggersSave.php +++ b/workflow/engine/methods/events/triggersSave.php @@ -46,8 +46,7 @@ $rs->next(); $row = $rs->getRow(); $proUid = $row['PRO_UID']; -$infoProcess = new Processes(); -$proFields = $infoProcess->serializeProcess($proUid); -$resultProcess = $infoProcess->saveSerializedProcess($proFields); -G::auditLog('Events','Save event in process "'.$resultProcess['PRO_TITLE'].'"'); +$infoProcess = new Process(); +$resultProcess = $infoProcess->load($proUid); +G::auditLog('Events','Save event ('.$_POST['form']['TRI_UID'].') in process "'.$resultProcess['PRO_TITLE'].'"'); diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index 472ceef7c..045923573 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -113,7 +113,14 @@ try { $resultProcess = $infoProcess->getProcessRow($proUid); } - + if($proUid != "") { + $valuesProcess['PRO_UID'] = $proUid; + $valuesProcess['PRO_UPDATE_DATE'] = date("Y-m-d H:m:i"); + G::LoadClass('processes'); + $infoProcess = new Processes(); + $resultProcess = $infoProcess->updateProcessRow($valuesProcess); + $resultProcess = $infoProcess->getProcessRow($proUid); + } //G::LoadClass( 'processMap' ); $oProcessMap = new processMap(new DBConnection()); @@ -173,11 +180,10 @@ try { unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace(".php", "Post", $form['FILENAME']) . ".php"); } $oProcessMap->webEntry($_REQUEST['PRO_UID']); - G::auditLog('WebEntry','Delete web entry in process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('WebEntry','Delete web entry ('.$form['FILENAME'].') in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'webEntry_new': $oProcessMap->webEntry_new($oData->PRO_UID); - G::auditLog('WebEntry','Save new web entry in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'assignProcessUser': $oProcessMap->assignProcessUser($oData->PRO_UID, $oData->USR_UID, $oData->TYPE_UID); diff --git a/workflow/engine/methods/processes/processes_DeleteObjectPermission.php b/workflow/engine/methods/processes/processes_DeleteObjectPermission.php index 15045f61a..40e52145c 100755 --- a/workflow/engine/methods/processes/processes_DeleteObjectPermission.php +++ b/workflow/engine/methods/processes/processes_DeleteObjectPermission.php @@ -61,4 +61,4 @@ print G::json_encode( $result ); $infoProcess = new Processes(); $resultProcess = $infoProcess->getProcessRow($sProcessUID); -G::auditLog('DeletePermissions','Delete Permissions in Process "'.$resultProcess['PRO_TITLE'].'"'); +G::auditLog('DeletePermissions','Delete Permissions ('.$_GET['OP_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); diff --git a/workflow/engine/methods/processes/processes_webEntryGenerate.php b/workflow/engine/methods/processes/processes_webEntryGenerate.php index 8909bc3a8..78680d1ac 100755 --- a/workflow/engine/methods/processes/processes_webEntryGenerate.php +++ b/workflow/engine/methods/processes/processes_webEntryGenerate.php @@ -38,6 +38,9 @@ try { $http = 'http://'; $sContent = ''; + + $infoProcess = new Process(); + $resultProcess = $infoProcess->load($sPRO_UID); if ($withWS) { //creating sys.info; @@ -73,6 +76,8 @@ try { $template->assign( 'wsUser', $sWS_USER ); $template->assign( 'wsPass', Bootstrap::hashPassword($sWS_PASS, '', true) ); $template->assign( 'wsRoundRobin', $sWS_ROUNDROBIN ); + + G::auditLog('WebEntry','Generate web entry with web services ('.$dynTitle.'.php) in process "'.$resultProcess['PRO_TITLE'].'"'); if ($sWE_USR == "2") { $template->assign( 'USR_VAR', "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;" ); @@ -118,8 +123,7 @@ try { $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; print $link; //print "\n $link "; - - + } else { $G_FORM = new Form( $sPRO_UID . '/' . $sDYNAFORM, PATH_DYNAFORM, SYS_LANG, false ); $G_FORM->action = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/cases_StartExternal.php'; @@ -159,6 +163,7 @@ try { } print_r( '' ); + G::auditLog('WebEntry','Generate web entry with single HTML (dynaform uid: '.$sDYNAFORM.') in process "'.$resultProcess['PRO_TITLE'].'"'); } } catch (Exception $e) { diff --git a/workflow/engine/methods/steps/steps_SupervisorAjax.php b/workflow/engine/methods/steps/steps_SupervisorAjax.php index 3edf84514..b5d2a912f 100755 --- a/workflow/engine/methods/steps/steps_SupervisorAjax.php +++ b/workflow/engine/methods/steps/steps_SupervisorAjax.php @@ -51,22 +51,22 @@ try { break; case 'assignSupervisorDynaform': $oProcessMap->assignSupervisorStep( $_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID'] ); - G::auditLog('AssignSupervisorDynaform','Assign Supervisor Dynaform in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('AssignSupervisorDynaform','Assign Supervisor Dynaform ('.$_POST['DYN_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'removeSupervisorDynaform': $oProcessMap->removeSupervisorStep( $_POST['STEP_UID'], $_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID'], $_POST['STEP_POSITION'] ); - G::auditLog('RemoveSupervisorDynaform','Remove Supervisor Dynaform in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('RemoveSupervisorDynaform','Remove Supervisor Dynaform ('.$_POST['DYN_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'availableSupervisorInputs': $oProcessMap->availableSupervisorInputs( $_POST['PRO_UID'] ); break; case 'assignSupervisorInput': $oProcessMap->assignSupervisorStep( $_POST['PRO_UID'], 'INPUT_DOCUMENT', $_POST['INP_DOC_UID'] ); - G::auditLog('AssignSupervisorInput','Assign Supervisor Input in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('AssignSupervisorInput','Assign Supervisor Input ('.$_POST['INP_DOC_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'removeSupervisorInput': $oProcessMap->removeSupervisorStep( $_POST['STEP_UID'], $_POST['PRO_UID'], 'INPUT_DOCUMENT', $_POST['INP_DOC_UID'], $_POST['STEP_POSITION'] ); - G::auditLog('RemoveSupervisorInput','Remove Supervisor Input in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('RemoveSupervisorInput','Remove Supervisor Input ('.$_POST['INP_DOC_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; } } catch (Exception $oException) { diff --git a/workflow/engine/methods/tracker/tracker_Ajax.php b/workflow/engine/methods/tracker/tracker_Ajax.php index 484720438..1c574c3ba 100755 --- a/workflow/engine/methods/tracker/tracker_Ajax.php +++ b/workflow/engine/methods/tracker/tracker_Ajax.php @@ -25,10 +25,9 @@ try { if (isset( $_POST['form']['action'] )) { $_POST['action'] = $_POST['form']['action']; } - - $infoProcess = new Processes(); - $proFields = $infoProcess->serializeProcess($_POST['PRO_UID']); - $resultProcess = $infoProcess->saveSerializedProcess($proFields); + + $infoProcess = new Process(); + $resultProcess = $infoProcess->load($_POST['PRO_UID']); switch ($_POST['action']) { case 'availableCaseTrackerObjects': @@ -42,28 +41,28 @@ try { $cto_UID = $oProcessMap->assignCaseTrackerObject( $_POST['PRO_UID'], $_POST['OBJECT_TYPE'], $_POST['OBJECT_UID'] ); $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] ); echo $cto_UID; - G::auditLog('CaseTrackers','Assign Case Tracker Object ('.$_POST['OBJECT_TYPE'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('CaseTrackers','Assign Case Tracker Object ('.$cto_UID.' - '.$_POST['OBJECT_TYPE'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'removeCaseTrackerObject': G::LoadClass( 'processMap' ); $oProcessMap = new ProcessMap(); $oProcessMap->removeCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] ); $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] ); - G::auditLog('CaseTrackers','Remove Case Tracker Object in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('CaseTrackers','Remove Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'upCaseTrackerObject': G::LoadClass( 'processMap' ); $oProcessMap = new ProcessMap(); $oProcessMap->upCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] ); $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] ); - G::auditLog('CaseTrackers','Move Up Case Tracker Object in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('CaseTrackers','Move Up Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'downCaseTrackerObject': G::LoadClass( 'processMap' ); $oProcessMap = new ProcessMap(); $oProcessMap->downCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] ); $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] ); - G::auditLog('CaseTrackers','Move Down Case Tracker Object in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('CaseTrackers','Move Down Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'editStagesMap': $oTemplatePower = new TemplatePower( PATH_TPL . 'tracker/stages_Map.html' ); diff --git a/workflow/engine/methods/tracker/tracker_ConditionsSave.php b/workflow/engine/methods/tracker/tracker_ConditionsSave.php index 6fc66202a..b41818d64 100755 --- a/workflow/engine/methods/tracker/tracker_ConditionsSave.php +++ b/workflow/engine/methods/tracker/tracker_ConditionsSave.php @@ -49,10 +49,9 @@ try { $aFields['CTO_CONDITION'] = $value['CTO_CONDITION']; $oCaseTrackerObject->update( $aFields ); - $infoProcess = new Processes(); - $proFields = $infoProcess->serializeProcess($value['PRO_UID']); - $resultProcess = $infoProcess->saveSerializedProcess($proFields); - G::auditLog('CaseTrackers','Save Condition Case Tracker Object ('.$value['CTO_CONDITION'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); + $infoProcess = new Process(); + $resultProcess = $infoProcess->load($value['PRO_UID']); + G::auditLog('CaseTrackers','Save Condition Case Tracker Object ('.$value['CTO_UID'].', condition: '.$value['CTO_CONDITION'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); } catch (Exception $oException) { die( $oException->getMessage() ); } diff --git a/workflow/engine/methods/tracker/tracker_Save.php b/workflow/engine/methods/tracker/tracker_Save.php index 7fafe2cd6..4e6e40dd6 100755 --- a/workflow/engine/methods/tracker/tracker_Save.php +++ b/workflow/engine/methods/tracker/tracker_Save.php @@ -15,8 +15,14 @@ require_once 'classes/model/CaseTracker.php'; $oCaseTracker = new CaseTracker(); $oCaseTracker->update( $sValue ); -$infoProcess = new Processes(); -$proFields = $infoProcess->serializeProcess($sValue['PRO_UID']); -$resultProcess = $infoProcess->saveSerializedProcess($proFields); -G::auditLog('CaseTrackers','Save Case Tracker Properties ('.$sValue['CT_MAP_TYPE'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); +$infoProcess = new Process(); +$resultProcess = $infoProcess->load($sValue['PRO_UID']); + +if($sValue['CT_DERIVATION_HISTORY'] == 1) { + $type[] = "Routing History"; +} +if($sValue['CT_MESSAGE_HISTORY'] == 1) { + $type[] = "Messages History"; +} +G::auditLog('CaseTrackers','Save Case Tracker Properties ('.$sValue['CT_MAP_TYPE'].' - '.implode(', ',$type).') in Process "'.$resultProcess['PRO_TITLE'].'"'); From 48ce569e3a972ed1c442d982fab59d89a5baccdf Mon Sep 17 00:00:00 2001 From: "marcelo.cuiza" Date: Wed, 18 Feb 2015 11:16:21 -0400 Subject: [PATCH 039/155] PM-1585 Audit Log para todas las opciones del menu contextual del PROCESO --- workflow/engine/methods/processes/processes_Ajax.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index 045923573..88c73acc6 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -42,10 +42,12 @@ try { if (isset($_REQUEST['data'])) { if($_REQUEST['action']=="addText"||$_REQUEST['action']=="updateText") { $oData = Bootstrap::json_decode($_REQUEST['data']); - $oDataAux = json_decode($_REQUEST['data'],true); + $oDataAux = G::json_decode($_REQUEST['data']); + $oDataAux = (array)$oDataAux; } else { $oData = Bootstrap::json_decode(stripslashes($_REQUEST['data'])); - $oDataAux = json_decode(stripslashes($_REQUEST['data']),true); + $oDataAux = G::json_decode(stripslashes($_REQUEST['data'])); + $oDataAux = (array)$oDataAux; } //$oData = $oJSON->decode( stripslashes( $_REQUEST['data'] ) ); $sOutput = ''; From bd192772fe13a68b156fe94d7350d8a2e4b81d62 Mon Sep 17 00:00:00 2001 From: dheeyi Date: Wed, 18 Feb 2015 12:22:27 -0400 Subject: [PATCH 040/155] PM-1583 Audit Log para Routing Rules, Start Event, End Event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Causa. Solo se tiene un auditLog para la seccion ADMIN. SolucióSe utiliza el metodo auditLog(), misma que es utilizado en la seccion ADMIN, mas especificamente se crea un auditlog para la seccion "Routing Rules" del Diseñr. --- .../engine/methods/patterns/patterns_Ajax.php | 212 ++++++++++++--- .../methods/processes/processes_Ajax.php | 242 +++++++++++++++++- workflow/engine/methods/tasks/tasks_Ajax.php | 13 + 3 files changed, 437 insertions(+), 30 deletions(-) diff --git a/workflow/engine/methods/patterns/patterns_Ajax.php b/workflow/engine/methods/patterns/patterns_Ajax.php index a4dd11346..dde6e728c 100755 --- a/workflow/engine/methods/patterns/patterns_Ajax.php +++ b/workflow/engine/methods/patterns/patterns_Ajax.php @@ -34,31 +34,54 @@ $oTasks = new Tasks(); $rou_id = 0; switch ($aData['action']) { case 'savePattern': - //if ($aData['ROU_TYPE'] != $aData['ROU_TYPE_OLD']) - //{ + //if ($aData['ROU_TYPE'] != $aData['ROU_TYPE_OLD']) + //{ $oTasks->deleteAllRoutesOfTask( $aData['PROCESS'], $aData['TASK'] ); - //} + //} require_once 'classes/model/Route.php'; $oRoute = new Route(); switch ($aData['ROU_TYPE']) { case 'SEQUENTIAL': - case 'SEC-JOIN': - /*if ($aData['ROU_UID'] != '') - { - $aFields['ROU_UID'] = $aData['ROU_UID']; - }*/ + case 'SEC-JOIN': + /*if ($aData['ROU_UID'] != '') + { + $aFields['ROU_UID'] = $aData['ROU_UID']; + }*/ $aFields['PRO_UID'] = $aData['PROCESS']; $aFields['TAS_UID'] = $aData['TASK']; $aFields['ROU_NEXT_TASK'] = $aData['ROU_NEXT_TASK']; $aFields['ROU_TYPE'] = $aData['ROU_TYPE']; - //$aFields['ROU_TO_LAST_USER'] = $aData['ROU_TO_LAST_USER']; + //$aFields['ROU_TO_LAST_USER'] = $aData['ROU_TO_LAST_USER']; $rou_id = $oRoute->create( $aFields ); break; case 'SELECT': + $tasksAffected=''; + $sType = 'SELECT'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $aData['TASK'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleTask = $row['CON_VALUE']; foreach ($aData['GRID_SELECT_TYPE'] as $iKey => $aRow) { - /*if ($aRow['ROU_UID'] != '') - { - $aFields['ROU_UID'] = $aRow['ROU_UID']; + $sType = 'SELECT'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $aRow['ROU_NEXT_TASK'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleNextTask = $row['CON_VALUE']; + /*if ($aRow['ROU_UID'] != '') + { + $aFields['ROU_UID'] = $aRow['ROU_UID']; }*/ $aFields['PRO_UID'] = $aData['PROCESS']; $aFields['TAS_UID'] = $aData['TASK']; @@ -66,16 +89,57 @@ switch ($aData['action']) { $aFields['ROU_CASE'] = $iKey; $aFields['ROU_TYPE'] = $aData['ROU_TYPE']; $aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION']; - //$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER']; + //$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER']; $rou_id = $oRoute->create( $aFields ); + if ($aRow['ROU_NEXT_TASK']=='-1') { + $tasksAffected.='From -> '.$titleTask.' To End Procces Condition -> '.$aFields['ROU_CONDITION'].' ; '; + }else{ + $tasksAffected.='From -> '.$titleTask.' To -> '.$titleNextTask.' Condition -> '.$aFields['ROU_CONDITION'].' ; '; + } unset( $aFields ); } + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $k->add(ContentPeer::CON_ID, $aData['PROCESS'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleProcess = $row['CON_VALUE']; + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' ACTION : '.$aData['ROU_TYPE'].' Save Pattern DETAILS: ROU_TYPE_OLD -> '.$aData['ROU_TYPE_OLD']. ' ROU_TYPE_NEW ->'.$aData['ROU_TYPE']. ' '.$tasksAffected); break; - case 'EVALUATE': - foreach ($aData['GRID_EVALUATE_TYPE'] as $iKey => $aRow) { - /*if ($aRow['ROU_UID'] != '') - { - $aFields['ROU_UID'] = $aRow['ROU_UID']; + case 'EVALUATE': + $tasksAffected=''; + $sType = 'SELECT'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $aData['TASK'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleTask = $row['CON_VALUE']; + + foreach ($aData['GRID_EVALUATE_TYPE'] as $iKey => $aRow) { + $sType = 'SELECT'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $aRow['ROU_NEXT_TASK'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleNextTask = $row['CON_VALUE']; + + /*if ($aRow['ROU_UID'] != '') + { + $aFields['ROU_UID'] = $aRow['ROU_UID']; }*/ $aFields['PRO_UID'] = $aData['PROCESS']; $aFields['TAS_UID'] = $aData['TASK']; @@ -83,31 +147,105 @@ switch ($aData['action']) { $aFields['ROU_CASE'] = $iKey; $aFields['ROU_TYPE'] = $aData['ROU_TYPE']; $aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION']; - //$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER']; - $rou_id = $oRoute->create( $aFields ); - unset( $aFields ); + //$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER']; + $rou_id = $oRoute->create( $aFields ); + if ($aRow['ROU_NEXT_TASK']=='-1') { + $tasksAffected.='From -> '.$titleTask.' To End Procces Condition -> '.$aFields['ROU_CONDITION'].' ; '; + }else{ + $tasksAffected.='From -> '.$titleTask.' To -> '.$titleNextTask.' Condition -> '.$aFields['ROU_CONDITION'].' ; '; + } + unset( $aFields ); } + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $k->add(ContentPeer::CON_ID, $aData['PROCESS'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleProcess = $row['CON_VALUE']; + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' ACTION : '.$aData['ROU_TYPE'].' Save Pattern DETAILS: ROU_TYPE_OLD -> '.$aData['ROU_TYPE_OLD']. ' ROU_TYPE_NEW ->'.$aData['ROU_TYPE']. ' '.$tasksAffected); break; case 'PARALLEL': + $tasksAffected=''; + $sType = 'SELECT'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $aData['TASK'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleTask = $row['CON_VALUE']; foreach ($aData['GRID_PARALLEL_TYPE'] as $iKey => $aRow) { - /*if ($aRow['ROU_UID'] != '') - { - $aFields['ROU_UID'] = $aRow['ROU_UID']; + $sType = 'SELECT'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $aRow['ROU_NEXT_TASK'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleNextTask = $row['CON_VALUE']; + /*if ($aRow['ROU_UID'] != '') + { + $aFields['ROU_UID'] = $aRow['ROU_UID']; }*/ $aFields['PRO_UID'] = $aData['PROCESS']; $aFields['TAS_UID'] = $aData['TASK']; $aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK']; $aFields['ROU_CASE'] = $iKey; $aFields['ROU_TYPE'] = $aData['ROU_TYPE']; - $rou_id = $oRoute->create( $aFields ); + $rou_id = $oRoute->create( $aFields ); + $tasksAffected.='From -> '.$titleTask.' To -> '.$titleNextTask.' ; '; unset( $aFields ); } + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $k->add(ContentPeer::CON_ID, $aData['PROCESS'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleProcess = $row['CON_VALUE']; + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' ACTION : '.$aData['ROU_TYPE'].' Save Pattern DETAILS: ROU_TYPE_OLD -> '.$aData['ROU_TYPE_OLD']. ' ROU_TYPE_NEW ->'.$aData['ROU_TYPE']. ' '.$tasksAffected); break; case 'PARALLEL-BY-EVALUATION': + $tasksAffected=''; + $sType = 'SELECT'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $aData['TASK'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleTask = $row['CON_VALUE']; foreach ($aData['GRID_PARALLEL_EVALUATION_TYPE'] as $iKey => $aRow) { - /*if ($aRow['ROU_UID'] != '') - { - $aFields['ROU_UID'] = $aRow['ROU_UID']; + $sType = 'SELECT'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $aRow['ROU_NEXT_TASK'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleNextTask = $row['CON_VALUE']; + /*if ($aRow['ROU_UID'] != '') + { + $aFields['ROU_UID'] = $aRow['ROU_UID']; }*/ $aFields['PRO_UID'] = $aData['PROCESS']; @@ -119,10 +257,26 @@ switch ($aData['action']) { if (isset( $aRow['ROU_OPTIONAL'] ) && trim( $aRow['ROU_OPTIONAL'] ) != '' && ($aRow['ROU_OPTIONAL'] === 'TRUE' || $aRow['ROU_OPTIONAL'] === 'FALSE')) $aFields['ROU_OPTIONAL'] = $aRow['ROU_OPTIONAL']; $rou_id = $oRoute->create( $aFields ); + if ($aRow['ROU_NEXT_TASK']=='-1') { + $tasksAffected.='From -> '.$titleTask.' To End Procces Condition -> '.$aFields['ROU_CONDITION'].' ; '; + }else{ + $tasksAffected.='From -> '.$titleTask.' To -> '.$titleNextTask.' Condition -> '.$aFields['ROU_CONDITION'].' ; '; + } unset( $aFields ); } + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $k->add(ContentPeer::CON_ID, $aData['PROCESS'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleProcess = $row['CON_VALUE']; + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' ACTION : '.$aData['ROU_TYPE'].' Save Pattern DETAILS: ROU_TYPE_OLD -> '.$aData['ROU_TYPE_OLD']. ' ROU_TYPE_NEW ->'.$aData['ROU_TYPE']. ' '.$tasksAffected); break; - case 'DISCRIMINATOR': //Girish ->Added to save changes, while editing the route + case 'DISCRIMINATOR': //Girish ->Added to save changes, while editing the route foreach ($aData['GRID_DISCRIMINATOR_TYPE'] as $iKey => $aRow) { $aFields['PRO_UID'] = $aData['PROCESS']; $aFields['TAS_UID'] = $aData['TASK']; diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index 7f70d7ddd..6c5a486a1 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -48,7 +48,7 @@ try { //$oData = $oJSON->decode( stripslashes( $_REQUEST['data'] ) ); $sOutput = ''; $sTask = ''; - } + } //G::LoadClass( 'processMap' ); $oProcessMap = new processMap(new DBConnection()); @@ -263,25 +263,265 @@ try { case 'saveNewPattern': switch ($oData->type) { case 0: + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->pro_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleProcess = $row['CON_VALUE']; + $sType = 'SEQUENTIAL'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->tas_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleTask = $row['CON_VALUE']; + + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->next_task ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleNextTask = $row['CON_VALUE']; + if ($titleNextTask=='') { + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' ACTION : END OF PROCESS Task Name -> '.$titleTask); + }else{ + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' ACTION : SEQUENTIAL from -> '.$titleTask. ' To ->'.$titleNextTask); + } break; case 1: + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->pro_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleProcess = $row['CON_VALUE']; + $sType = 'SELECT'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->tas_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleTask = $row['CON_VALUE']; + + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->next_task ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleNextTask = $row['CON_VALUE']; + G::auditLog("DerivationRule","PROCESS NAME : ".$titleProcess." ACTION : SELECT from -> ".$titleTask. " To ->".$titleNextTask); break; case 2: + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->pro_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleProcess = $row['CON_VALUE']; + $sType = 'EVALUATE'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->tas_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleTask = $row['CON_VALUE']; + + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->next_task ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleNextTask = $row['CON_VALUE']; + + G::auditLog("DerivationRule","PROCESS NAME : ".$titleProcess." ACTION : EVALUATE from -> ".$titleTask. " To ->".$titleNextTask); break; case 3: + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->pro_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleProcess = $row['CON_VALUE']; + $sType = 'PARALLEL'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->tas_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleTask = $row['CON_VALUE']; + + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->next_task ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleNextTask = $row['CON_VALUE']; + + G::auditLog("DerivationRule","PROCESS NAME : ".$titleProcess." ACTION : PARALLEL from -> ".$titleTask. " To ->".$titleNextTask); break; case 4: + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->pro_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleProcess = $row['CON_VALUE']; + $sType = 'PARALLEL-BY-EVALUATION'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->tas_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleTask = $row['CON_VALUE']; + + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->next_task ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleNextTask = $row['CON_VALUE']; + + G::auditLog("DerivationRule","PROCESS NAME : ".$titleProcess." ACTION : PARALLEL-BY-EVALUATION from -> ".$titleTask. " To ->".$titleNextTask); break; case 5: + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->pro_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleProcess = $row['CON_VALUE']; + $sType = 'SEC-JOIN'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->tas_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleTask = $row['CON_VALUE']; + + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->next_task ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleNextTask = $row['CON_VALUE']; + + G::auditLog("DerivationRule","PROCESS NAME : ".$titleProcess." ACTION : SEC-JOIN from -> ".$titleTask. " To ->".$titleNextTask); break; case 8: + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->pro_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleProcess = $row['CON_VALUE']; + $sType = 'DISCRIMINATOR'; + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->tas_uid ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleTask = $row['CON_VALUE']; + + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $oData->next_task ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleNextTask = $row['CON_VALUE']; + + G::auditLog("DerivationRule","PROCESS NAME : ".$titleProcess." ACTION : DISCRIMINATOR from -> ".$titleTask. " To ->".$titleNextTask); break; } if (($oData->type != 0) && ($oData->type != 5) && ($oData->type != 8)) { diff --git a/workflow/engine/methods/tasks/tasks_Ajax.php b/workflow/engine/methods/tasks/tasks_Ajax.php index 1215d5410..14b0ee56c 100755 --- a/workflow/engine/methods/tasks/tasks_Ajax.php +++ b/workflow/engine/methods/tasks/tasks_Ajax.php @@ -34,6 +34,19 @@ try { switch ($sAction) { case "saveTaskData": + $k = new Criteria('william'); + $k->clearSelectColumns(); + $k->addSelectColumn(ContentPeer::CON_VALUE); + $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $k->add(ContentPeer::CON_ID, $aData['TAS_UID'] ); + $rs = ContentPeer::doSelectRS($k); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $titleTask = $row['CON_VALUE']; + + G::auditLog("DerivationRule","STARTING PROCESS Task Name -> ".$titleTask); + require_once ("classes/model/Task.php"); $response = array (); From 1ec4bb52bf8ca7d43c04a2b01fddea6d5bcfc2bb Mon Sep 17 00:00:00 2001 From: "marcelo.cuiza" Date: Wed, 18 Feb 2015 15:14:34 -0400 Subject: [PATCH 041/155] PM-1555 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No se puede realizar la importacióe templates en Process Files Manager. El problema se presentaba solamente en windows, al momento de extraer el nombre del archivo del path, se lo hacia en base a la separacion por el caracter "/", caracter que en windows es distinto Se agrego una validacion, preguntando siempre que si el path contiene el caracter de windows, este sea remplazado por el convencional --- .../engine/src/ProcessMaker/BusinessModel/FilesManager.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/FilesManager.php b/workflow/engine/src/ProcessMaker/BusinessModel/FilesManager.php index 2953a3ba1..c8a8830fe 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/FilesManager.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/FilesManager.php @@ -275,6 +275,10 @@ class FilesManager $_FILES['prf_file']['name'] = $_FILES['prf_file']['name'].$extention; } $file = end(explode("/",$path)); + if(strpos($file,"\\") > 0) { + $file = str_replace('\\', '/', $file); + $file = end(explode("/",$file)); + } $path = str_replace($file,'',$path); if ($file == $_FILES['prf_file']['name']) { if ($_FILES['prf_file']['error'] != 1) { From d728c2f01da35f641d940434af07c0dd986938a6 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Wed, 18 Feb 2015 15:35:50 -0400 Subject: [PATCH 042/155] I solved the issue PM-1582 --- .../engine/classes/model/CaseScheduler.php | 47 + workflow/engine/classes/model/DbSource.php | 10 + .../engine/classes/model/InputDocument.php | 63 + .../engine/classes/model/OutputDocument.php | 2319 +++++++++-------- workflow/engine/classes/model/Triggers.php | 17 +- .../engine/methods/triggers/triggers_Save.php | 18 +- 6 files changed, 1343 insertions(+), 1131 deletions(-) diff --git a/workflow/engine/classes/model/CaseScheduler.php b/workflow/engine/classes/model/CaseScheduler.php index 5da738c85..05ec7dda7 100755 --- a/workflow/engine/classes/model/CaseScheduler.php +++ b/workflow/engine/classes/model/CaseScheduler.php @@ -53,6 +53,28 @@ class CaseScheduler extends BaseCaseScheduler throw ($e); } $con->commit(); + + //Add Audit Log + switch ($aData['SCH_OPTION']) { + case '1': + $perform = 'Daily'; + break; + case '2': + $perform = 'Weekly'; + break; + case '3': + $perform = 'Monthly'; + break; + case '4': + $perform = 'One time only'; + break; + case '5': + $perform = 'Every'; + break; + + } + G::auditLog("CreateCaseScheduler", "Scheduler Name: ".$aData['SCH_NAME'].", Task: ".$aData['TAS_UID'].", Perform this task: ".$perform.", Start Date: ".$aData['SCH_START_DATE'].", End Date: ".$aData['SCH_END_DATE'].", Execution time : ".$aData['SCH_START_TIME']); + return $result; } catch (Exception $e) { $con->rollback(); @@ -70,6 +92,27 @@ class CaseScheduler extends BaseCaseScheduler if ($this->validate()) { $result = $this->save(); $con->commit(); + + //Add Audit Log + switch ($fields['SCH_OPTION']){ + case '1': + $perform = 'Daily'; + break; + case '2': + $perform = 'Weekly'; + break; + case '3': + $perform = 'Monthly'; + break; + case '4': + $perform = 'One time only'; + break; + case '5': + $perform = 'Every'; + break; + } + G::auditLog("UpdateCaseScheduler", "Scheduler Name: ".$fields['SCH_NAME'].", Task: ".$fields['TAS_UID'].", Perform this task: ".$perform.", Start Date: ".$fields['SCH_START_DATE'].", End Date: ".$fields['SCH_END_DATE'].", Execution time : ".$fields['SCH_START_TIME']); + return $result; } else { $con->rollback(); @@ -87,8 +130,12 @@ class CaseScheduler extends BaseCaseScheduler try { $oCaseScheduler = CaseSchedulerPeer::retrieveByPK( $SchUid ); if (! is_null( $oCaseScheduler )) { + $fields = $this->Load( $SchUid ); $iResult = $oCaseScheduler->delete(); $con->commit(); + //Add Audit Log + G::auditLog("DeleteCaseScheduler", "Scheduler Name: ".$fields['SCH_NAME'].", Task: ".$fields['TAS_UID']); + return $iResult; } else { throw (new Exception( 'This row doesn\'t exist!' )); diff --git a/workflow/engine/classes/model/DbSource.php b/workflow/engine/classes/model/DbSource.php index 35acb7d12..d6766fbcf 100755 --- a/workflow/engine/classes/model/DbSource.php +++ b/workflow/engine/classes/model/DbSource.php @@ -141,6 +141,9 @@ class DbSource extends BaseDbSource if ($this->validate()) { $result = $this->save(); $con->commit(); + //Add Audit Log + G::auditLog("UpdateDatabaseConnection", "Connection Uid: ".$fields['DBS_UID'].", Connection Engine: ".$fields['DBS_TYPE'].", Connection Encode: ".$fields['DBS_ENCODE'].", Connection Server: ".$fields['DBS_SERVER'].", Connection Database: ".$fields['DBS_DATABASE_NAME'].", Connection Port: ".$fields['DBS_PORT']); + return $result; } else { $con->rollback(); @@ -156,6 +159,7 @@ class DbSource extends BaseDbSource { $con = Propel::getConnection(DbSourcePeer::DATABASE_NAME); try { + $fields = $this->load($DbsUid, $ProUID); $con->begin(); $this->setDbsUid($DbsUid); $this->setProUid($ProUID); @@ -167,6 +171,9 @@ class DbSource extends BaseDbSource } $result = $this->delete(); $con->commit(); + //Add Audit Log + G::auditLog("DeleteDatabaseConnection", "Connection Uid: ".$DbsUid.", Connection Engine: ".$fields['DBS_TYPE'].", Connection Database: ".$fields['DBS_DATABASE_NAME']); + return $result; } catch (exception $e) { $con->rollback(); @@ -196,6 +203,9 @@ class DbSource extends BaseDbSource throw ($e); } $con->commit(); + //Add Audit Log + G::auditLog("CreateDatabaseConnection", "Connection Uid: ".$aData['DBS_UID'].", Connection Engine: ".$aData['DBS_TYPE'].", Connection Encode: ".$aData['DBS_ENCODE'].", Connection Server: ".$aData['DBS_SERVER'].", Connection Database: ".$aData['DBS_DATABASE_NAME'].", Connection Port: ".$aData['DBS_PORT']); + return $this->getDbsUid(); } catch (exception $e) { $con->rollback(); diff --git a/workflow/engine/classes/model/InputDocument.php b/workflow/engine/classes/model/InputDocument.php index 23615c7f6..b19036ad8 100755 --- a/workflow/engine/classes/model/InputDocument.php +++ b/workflow/engine/classes/model/InputDocument.php @@ -126,6 +126,34 @@ class InputDocument extends BaseInputDocument } $iResult = $oInputDocument->save(); $oConnection->commit(); + //Add Audit Log + switch ($aData['INP_DOC_FORM_NEEDED']){ + case 'VIRTUAL': + $docType = 'Digital'; + break; + case 'REAL': + $docType = 'Printed'; + break; + case 'VREAL': + $docType = 'Digital/Printed'; + break; + } + if(isset($aData['INP_DOC_VERSIONING']) && $aData['INP_DOC_VERSIONING'] == 1){ + $enableVersion = 'Yes'; + }else{ + $enableVersion = 'No'; + } + $description = "Input Document Title: ".$aData['INP_DOC_TITLE'].", Input Document Uid: ".$aData['INP_DOC_UID'].", Document Type: ".$docType; + if(!empty($aData['INP_DOC_DESCRIPTION'])){ + $description .= ", Description: ".$aData['INP_DOC_DESCRIPTION']; + } + if(!empty($aData['INP_DOC_DESTINATION_PATH'])){ + $description .= ", Destination Path: ".$aData['INP_DOC_DESTINATION_PATH']; + } + $inputDocMaxFileSize = $aData['INP_DOC_MAX_FILESIZE']? $aData['INP_DOC_MAX_FILESIZE'].' '.$aData['INP_DOC_MAX_FILESIZE_UNIT'] : "256 MB"; + $description .= ", Extensions: ".$aData['INP_DOC_TYPE_FILE'].", Maximum Input Document file size: ".$inputDocMaxFileSize; + G::auditLog("CreateInputDocument", $description); + return $aData['INP_DOC_UID']; } else { $sMessage = ''; @@ -165,6 +193,34 @@ class InputDocument extends BaseInputDocument } $iResult = $oInputDocument->save(); $oConnection->commit(); + //Add Audit Log + switch ($aData['INP_DOC_FORM_NEEDED']){ + case 'VIRTUAL': + $docType = 'Digital'; + break; + case 'REAL': + $docType = 'Printed'; + break; + case 'VREAL': + $docType = 'Digital/Printed'; + break; + } + if(isset($aData['INP_DOC_VERSIONING']) && $aData['INP_DOC_VERSIONING'] == 1){ + $enableVersion = 'Yes'; + }else{ + $enableVersion = 'No'; + } + $description = "Input Document Title: ".$aData['INP_DOC_TITLE'].", Input Document Uid: ".$aData['INP_DOC_UID'].", Document Type: ".$docType; + if(!empty($aData['INP_DOC_DESCRIPTION'])){ + $description .= ", Description: ".$aData['INP_DOC_DESCRIPTION']; + } + if(!empty($aData['INP_DOC_DESTINATION_PATH'])){ + $description .= ", Destination Path: ".$aData['INP_DOC_DESTINATION_PATH']; + } + $inputDocMaxFileSize = $aData['INP_DOC_MAX_FILESIZE']? $aData['INP_DOC_MAX_FILESIZE'].' '.$aData['INP_DOC_MAX_FILESIZE_UNIT'] : "256 MB"; + $description .= ", Extensions: ".$aData['INP_DOC_TYPE_FILE'].", Maximum Input Document file size: ".$inputDocMaxFileSize; + G::auditLog("UpdateInputDocument", $description); + return $iResult; } else { $sMessage = ''; @@ -196,11 +252,18 @@ class InputDocument extends BaseInputDocument try { $oInputDocument = InputDocumentPeer::retrieveByPK( $sInpDocUid ); if (! is_null( $oInputDocument )) { + $nameInput = $this->getInpDocTitle(); + $descInput = $this->getInpDocDescription(); $oConnection->begin(); Content::removeContent( 'INP_DOC_TITLE', '', $oInputDocument->getInpDocUid() ); Content::removeContent( 'INP_DOC_DESCRIPTION', '', $oInputDocument->getInpDocUid() ); $iResult = $oInputDocument->delete(); $oConnection->commit(); + //Add Audit Log + $nameInput = $this->getInpDocTitle(); + $descInput = $this->getInpDocDescription(); + G::auditLog("DeleteInputDocument", "Input Document Name: ".$nameInput.", Input Document Uid: ".$sInpDocUid.", Description: ".$descInput); + return $iResult; } else { throw (new Exception( 'This row doesn\'t exist!' )); diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index bfd361304..f8a78f680 100755 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -1,1127 +1,1192 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -//require_once ("classes/model/om/BaseOutputDocument.php"); -//require_once ("classes/model/Content.php"); - -/** - * Skeleton subclass for representing a row from the 'OUTPUT_DOCUMENT' table. - * - * - * - * You should add additional methods to this class to meet the - * application requirements. This class will only be generated as - * long as it does not already exist in the output directory. - * - * @package workflow.engine.classes.model - */ -class OutputDocument extends BaseOutputDocument -{ - - /** - * This value goes in the content table - * @var string - */ - protected $out_doc_title = ''; - - /** - * This value goes in the content table - * @var string - */ - protected $out_doc_description = ''; - - /** - * This value goes in the content table - * @var string - */ - protected $out_doc_filename = ''; - - /** - * This value goes in the content table - * @var string - */ - protected $out_doc_template = ''; - - public function __construct() - { - $javaInput = PATH_C . 'javaBridgePM' . PATH_SEP . 'input' . PATH_SEP; - $javaOutput = PATH_C . 'javaBridgePM' . PATH_SEP . 'output' . PATH_SEP; - - G::mk_dir($javaInput); - G::mk_dir($javaOutput); - } - - public function getByUid($sOutDocUid) - { - try { - $oOutputDocument = OutputDocumentPeer::retrieveByPK($sOutDocUid); - - if (is_null($oOutputDocument)) { - return false; - } - - $aFields = $oOutputDocument->toArray(BasePeer::TYPE_FIELDNAME); - $aFields['OUT_DOC_TITLE'] = $oOutputDocument->getOutDocTitle(); - $aFields['OUT_DOC_DESCRIPTION'] = $oOutputDocument->getOutDocDescription(); - $aFields['OUT_DOC_FILENAME'] = $oOutputDocument->getOutDocFilename(); - $aFields['OUT_DOC_TEMPLATE'] = $oOutputDocument->getOutDocTemplate(); - $this->fromArray($aFields, BasePeer::TYPE_FIELDNAME); - - return $aFields; - } catch (Exception $oError) { - throw ($oError); - } - } - - /* - * Load the application document registry - * @param string $sAppDocUid - * @return variant - */ - - public function load($sOutDocUid) - { - try { - $oOutputDocument = OutputDocumentPeer::retrieveByPK($sOutDocUid); - - if (!is_null($oOutputDocument)) { - $aFields = $oOutputDocument->toArray(BasePeer::TYPE_FIELDNAME); - $aFields['OUT_DOC_TITLE'] = $oOutputDocument->getOutDocTitle(); - $aFields['PRO_UID'] = $oOutputDocument->getProUid(); - $aFields['OUT_DOC_DESCRIPTION'] = $oOutputDocument->getOutDocDescription(); - $aFields['OUT_DOC_FILENAME'] = $oOutputDocument->getOutDocFilename(); - $aFields['OUT_DOC_TEMPLATE'] = $oOutputDocument->getOutDocTemplate(); - $this->fromArray($aFields, BasePeer::TYPE_FIELDNAME); - - return $aFields; - } else { - throw(new Exception('This row doesn\'t exist!')); - } - } catch (Exception $oError) { - throw ($oError); - } - } - - /** - * Create the application document registry - * @param array $aData - * @return string - * */ - public function create($aData) - { - $oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME); - - try { - if (isset($aData['OUT_DOC_UID']) && $aData['OUT_DOC_UID'] == '') { - unset($aData['OUT_DOC_UID']); - } - - if (!isset($aData['OUT_DOC_UID'])) { - $aData['OUT_DOC_UID'] = G::generateUniqueID(); - } - - if (!isset($aData['OUT_DOC_GENERATE'])) { - $aData['OUT_DOC_GENERATE'] = 'BOTH'; - } else { - if ($aData['OUT_DOC_GENERATE'] == '') { - $aData['OUT_DOC_GENERATE'] = 'BOTH'; - } - } - - $oOutputDocument = new OutputDocument(); - $oOutputDocument->fromArray($aData, BasePeer::TYPE_FIELDNAME); - - if ($oOutputDocument->validate()) { - $oConnection->begin(); - - if (isset($aData['OUT_DOC_TITLE'])) { - $oOutputDocument->setOutDocTitle($aData['OUT_DOC_TITLE']); - } - - if (isset($aData['OUT_DOC_DESCRIPTION'])) { - $oOutputDocument->setOutDocDescription($aData['OUT_DOC_DESCRIPTION']); - } - - $oOutputDocument->setOutDocFilename($aData['OUT_DOC_FILENAME']); - - if (isset($aData['OUT_DOC_TEMPLATE'])) { - $oOutputDocument->setOutDocTemplate($aData['OUT_DOC_TEMPLATE']); - } - - $iResult = $oOutputDocument->save(); - $oConnection->commit(); - - return $aData['OUT_DOC_UID']; - } else { - $sMessage = ''; - $aValidationFailures = $oOutputDocument->getValidationFailures(); - - foreach ($aValidationFailures as $oValidationFailure) { - $sMessage .= $oValidationFailure->getMessage() . '
'; - } - - throw (new Exception('The registry cannot be created!
' . $sMessage)); - } - } catch (Exception $oError) { - $oConnection->rollback(); - - throw ($oError); - } - } - - /** - * Update the application document registry - * @param array $aData - * @return string - * */ - public function update($aData) - { - $oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME); - - try { - $oOutputDocument = OutputDocumentPeer::retrieveByPK($aData['OUT_DOC_UID']); - - if (!is_null($oOutputDocument)) { - $oOutputDocument->fromArray($aData, BasePeer::TYPE_FIELDNAME); - - if ($oOutputDocument->validate()) { - $oConnection->begin(); - - if (isset($aData['OUT_DOC_TITLE'])) { - $oOutputDocument->setOutDocTitle($aData['OUT_DOC_TITLE']); - } - - if (isset($aData['OUT_DOC_DESCRIPTION'])) { - $oOutputDocument->setOutDocDescription($aData['OUT_DOC_DESCRIPTION']); - } - - if (isset($aData['OUT_DOC_FILENAME'])) { - $oOutputDocument->setOutDocFilename($aData['OUT_DOC_FILENAME']); - } - - if (isset($aData['OUT_DOC_TEMPLATE'])) { - $oOutputDocument->setOutDocTemplate($aData['OUT_DOC_TEMPLATE']); - } - - $iResult = $oOutputDocument->save(); - $oConnection->commit(); - - return $iResult; - } else { - $sMessage = ''; - $aValidationFailures = $oOutputDocument->getValidationFailures(); - - foreach ($aValidationFailures as $oValidationFailure) { - $sMessage .= $oValidationFailure->getMessage() . '
'; - } - - throw (new Exception('The registry cannot be updated!
' . $sMessage)); - } - } else { - throw (new Exception('This row doesn\'t exist!')); - } - } catch (Exception $oError) { - $oConnection->rollback(); - - throw ($oError); - } - } - - /** - * Remove the application document registry - * @param array $aData - * @return string - * */ - public function remove($sOutDocUid) - { - $oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME); - - try { - $oOutputDocument = OutputDocumentPeer::retrieveByPK($sOutDocUid); - - if (!is_null($oOutputDocument)) { - $oConnection->begin(); - Content::removeContent('OUT_DOC_TITLE', '', $oOutputDocument->getOutDocUid()); - Content::removeContent('OUT_DOC_DESCRIPTION', '', $oOutputDocument->getOutDocUid()); - Content::removeContent('OUT_DOC_FILENAME', '', $oOutputDocument->getOutDocUid()); - Content::removeContent('OUT_DOC_TEMPLATE', '', $oOutputDocument->getOutDocUid()); - $iResult = $oOutputDocument->delete(); - $oConnection->commit(); - - return $iResult; - } else { - throw (new Exception('This row doesn\'t exist!')); - } - } catch (Exception $oError) { - $oConnection->rollback(); - - throw ($oError); - } - } - - /** - * Get the [out_doc_title] column value. - * @return string - */ - public function getOutDocTitle() - { - if ($this->out_doc_title == '') { - try { - $this->out_doc_title = Content::load( - 'OUT_DOC_TITLE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en') - ); - } catch (Exception $oError) { - throw ($oError); - } - } - - return $this->out_doc_title; - } - - /** - * Set the [out_doc_title] column value. - * - * @param string $sValue new value - * @return void - */ - public function setOutDocTitle($sValue) - { - if ($sValue !== null && !is_string($sValue)) { - $sValue = (string) $sValue; - } - - if ($this->out_doc_title !== $sValue || $sValue === '') { - try { - $this->out_doc_title = $sValue; - - $iResult = Content::addContent( - 'OUT_DOC_TITLE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_title - ); - } catch (Exception $oError) { - $this->out_doc_title = ''; - - throw ($oError); - } - } - } - - /** - * Get the [out_doc_comment] column value. - * @return string - */ - public function getOutDocDescription() - { - if ($this->out_doc_description == '') { - try { - $this->out_doc_description = Content::load( - 'OUT_DOC_DESCRIPTION', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en') - ); - } catch (Exception $oError) { - throw ($oError); - } - } - - return $this->out_doc_description; - } - - /** - * Set the [out_doc_comment] column value. - * - * @param string $sValue new value - * @return void - */ - public function setOutDocDescription($sValue) - { - if ($sValue !== null && !is_string($sValue)) { - $sValue = (string) $sValue; - } - - if ($this->out_doc_description !== $sValue || $sValue === '') { - try { - $this->out_doc_description = $sValue; - - $iResult = Content::addContent( - 'OUT_DOC_DESCRIPTION', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_description - ); - } catch (Exception $oError) { - $this->out_doc_description = ''; - - throw ($oError); - } - } - } - - /** - * Get the [out_doc_filename] column value. - * @return string - */ - public function getOutDocFilename() - { - if ($this->out_doc_filename == '') { - try { - $this->out_doc_filename = Content::load( - 'OUT_DOC_FILENAME', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en') - ); - } catch (Exception $oError) { - throw ($oError); - } - } - - return $this->out_doc_filename; - } - - /** - * Set the [out_doc_filename] column value. - * - * @param string $sValue new value - * @return void - */ - public function setOutDocFilename($sValue) - { - if ($sValue !== null && !is_string($sValue)) { - $sValue = (string) $sValue; - } - - if ($this->out_doc_filename !== $sValue || $sValue === '') { - try { - $this->out_doc_filename = $sValue; - - $iResult = Content::addContent( - 'OUT_DOC_FILENAME', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_filename - ); - } catch (Exception $oError) { - $this->out_doc_filename = ''; - - throw ($oError); - } - } - } - - /** - * Get the [out_doc_template] column value. - * @return string - */ - public function getOutDocTemplate() - { - if ($this->out_doc_template == '') { - try { - $this->out_doc_template = Content::load( - 'OUT_DOC_TEMPLATE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en') - ); - } catch (Exception $oError) { - throw ($oError); - } - } - - return $this->out_doc_template; - } - - /** - * Set the [out_doc_template] column value. - * - * @param string $sValue new value - * @return void - */ - public function setOutDocTemplate($sValue) - { - if ($sValue !== null && !is_string($sValue)) { - $sValue = (string) $sValue; - } - - if ($this->out_doc_template !== $sValue || $sValue === '') { - try { - $this->out_doc_template = $sValue; - - $iResult = Content::addContent( - 'OUT_DOC_TEMPLATE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_template - ); - } catch (Exception $oError) { - $this->out_doc_template = ''; - - throw ($oError); - } - } - } - - /* - * Generate the output document - * @param string $sUID - * @param array $aFields - * @param string $sPath - * @return variant - */ - - public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array()) - { - if (($sUID != '') && is_array($aFields) && ($sPath != '')) { - $sContent = G::replaceDataGridField($sContent, $aFields); - - G::verifyPath($sPath, true); - - //Start - Create .doc - $oFile = fopen($sPath . $sFilename . '.doc', 'wb'); - - $size = array(); - $size["Letter"] = "216mm 279mm"; - $size["Legal"] = "216mm 357mm"; - $size["Executive"] = "184mm 267mm"; - $size["B5"] = "182mm 257mm"; - $size["Folio"] = "216mm 330mm"; - $size["A0Oversize"] = "882mm 1247mm"; - $size["A0"] = "841mm 1189mm"; - $size["A1"] = "594mm 841mm"; - $size["A2"] = "420mm 594mm"; - $size["A3"] = "297mm 420mm"; - $size["A4"] = "210mm 297mm"; - $size["A5"] = "148mm 210mm"; - $size["A6"] = "105mm 148mm"; - $size["A7"] = "74mm 105mm"; - $size["A8"] = "52mm 74mm"; - $size["A9"] = "37mm 52mm"; - $size["A10"] = "26mm 37mm"; - $size["Screenshot640"] = "640mm 480mm"; - $size["Screenshot800"] = "800mm 600mm"; - $size["Screenshot1024"] = "1024mm 768mm"; - - $sizeLandscape["Letter"] = "279mm 216mm"; - $sizeLandscape["Legal"] = "357mm 216mm"; - $sizeLandscape["Executive"] = "267mm 184mm"; - $sizeLandscape["B5"] = "257mm 182mm"; - $sizeLandscape["Folio"] = "330mm 216mm"; - $sizeLandscape["A0Oversize"] = "1247mm 882mm"; - $sizeLandscape["A0"] = "1189mm 841mm"; - $sizeLandscape["A1"] = "841mm 594mm"; - $sizeLandscape["A2"] = "594mm 420mm"; - $sizeLandscape["A3"] = "420mm 297mm"; - $sizeLandscape["A4"] = "297mm 210mm"; - $sizeLandscape["A5"] = "210mm 148mm"; - $sizeLandscape["A6"] = "148mm 105mm"; - $sizeLandscape["A7"] = "105mm 74mm"; - $sizeLandscape["A8"] = "74mm 52mm"; - $sizeLandscape["A9"] = "52mm 37mm"; - $sizeLandscape["A10"] = "37mm 26mm"; - $sizeLandscape["Screenshot640"] = "480mm 640mm"; - $sizeLandscape["Screenshot800"] = "600mm 800mm"; - $sizeLandscape["Screenshot1024"] = "768mm 1024mm"; - - if (!isset($aProperties['media'])) { - $aProperties['media'] = 'Letter'; - } - - if ($sLandscape) { - $media = $sizeLandscape[$aProperties['media']]; - } else { - $media = $size[$aProperties['media']]; - } - - $marginLeft = '15'; - - if (isset($aProperties['margins']['left'])) { - $marginLeft = $aProperties['margins']['left']; - } - - $marginRight = '15'; - - if (isset($aProperties['margins']['right'])) { - $marginRight = $aProperties['margins']['right']; - } - - $marginTop = '15'; - - if (isset($aProperties['margins']['top'])) { - $marginTop = $aProperties['margins']['top']; - } - - $marginBottom = '15'; - - if (isset($aProperties['margins']['bottom'])) { - $marginBottom = $aProperties['margins']['bottom']; - } - - fwrite($oFile, ' - - - - - - - - - - - -
'); - - fwrite($oFile, $sContent); - fwrite($oFile, "\n
\n\n"); - fclose($oFile); - /* End - Create .doc */ - - if ($sTypeDocToGener == 'BOTH' || $sTypeDocToGener == 'PDF') { - $oFile = fopen($sPath . $sFilename . '.html', 'wb'); - fwrite($oFile, $sContent); - fclose($oFile); - /* Start - Create .pdf */ - if (isset($aProperties['report_generator'])) { - switch ($aProperties['report_generator']) { - case 'TCPDF': - $this->generateTcpdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties); - break; - case 'HTML2PDF': - default: - $this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties); - break; - } - } else { - $this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties); - } - } - //end if $sTypeDocToGener - /* End - Create .pdf */ - } else { - return PEAR::raiseError( - null, G_ERROR_USER_UID, null, null, 'You tried to call to a generate method without send the Output Document UID, fields to use and the file path!', 'G_Error', true - ); - } - } - - public function generateHtml2pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array()) - { - - // define("MAX_FREE_FRACTION", 1); - define('PATH_OUTPUT_FILE_DIRECTORY', PATH_HTML . 'files/' . $_SESSION['APPLICATION'] . '/outdocs/'); - G::verifyPath(PATH_OUTPUT_FILE_DIRECTORY, true); - - require_once(PATH_THIRDPARTY . 'html2pdf/html2pdf.class.php'); - - // define Save file - $sOutput = 2; - $sOrientation = ($sLandscape == false) ? 'P' : 'L'; - $sLang = (defined('SYS_LANG')) ? SYS_LANG : 'en'; - $sMedia = $aProperties['media']; - // margin define - define("MINIMAL_MARGIN", 15); - $marges = array(MINIMAL_MARGIN, MINIMAL_MARGIN, MINIMAL_MARGIN, MINIMAL_MARGIN); - if (isset($aProperties['margins'])) { - // Default marges (left, top, right, bottom) - $margins = $aProperties['margins']; - $margins['left'] = ($margins['left'] > 0) ? $margins['left'] : MINIMAL_MARGIN; - $margins['top'] = ($margins['top'] > 0) ? $margins['top'] : MINIMAL_MARGIN; - $margins['right'] = ($margins['right'] > 0) ? $margins['right'] : MINIMAL_MARGIN; - $margins['bottom'] = ($margins['bottom'] > 0) ? $margins['bottom'] : MINIMAL_MARGIN; - $marges = array($margins['left'], $margins['top'], $margins['right'], $margins['bottom']); - } - - $html2pdf = new HTML2PDF($sOrientation, $sMedia, $sLang, true, 'UTF-8', $marges); - - $html2pdf->pdf->SetAuthor($aFields['USR_USERNAME']); - $html2pdf->pdf->SetTitle('Processmaker'); - $html2pdf->pdf->SetSubject($sFilename); - $html2pdf->pdf->SetCompression(true); - - //$html2pdf->pdf->SetKeywords('HTML2PDF, TCPDF, processmaker'); - - if (isset($aProperties['pdfSecurity'])) { - $pdfSecurity = $aProperties['pdfSecurity']; - $userPass = G::decrypt($pdfSecurity['openPassword'], $sUID); - $ownerPass = ($pdfSecurity['ownerPassword'] != '') ? G::decrypt($pdfSecurity['ownerPassword'], $sUID) : null; - $permissions = explode("|", $pdfSecurity['permissions']); - $html2pdf->pdf->SetProtection($permissions, $userPass, $ownerPass); - } - - $html2pdf->setTestTdInOnePage(false); - $html2pdf->setTestIsImage(false); - $html2pdf->setTestIsDeprecated(false); - - $html2pdf->writeHTML($html2pdf->getHtmlFromPage($sContent)); - - switch ($sOutput) { - case 0: - // Vrew browser - $html2pdf->Output($sPath . $sFilename . '.pdf', 'I'); - break; - case 1: - // Donwnload - $html2pdf->Output($sPath . $sFilename . '.pdf', 'D'); - break; - case 2: - // Save file - $html2pdf->Output($sPath . $sFilename . '.pdf', 'F'); - break; - } - - copy($sPath . $sFilename . '.html', PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html'); - - copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf'); - unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf'); - unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html'); - } - - public function generateTcpdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array()) - { - require_once (PATH_THIRDPARTY . "tcpdf" . PATH_SEP . "config" . PATH_SEP . "lang" . PATH_SEP . "eng.php"); - require_once (PATH_THIRDPARTY . "tcpdf" . PATH_SEP . "tcpdf.php"); - - $nrt = array("\n", "\r", "\t"); - $nrthtml = array("(n /)", "(r /)", "(t /)"); - - $strContentAux = str_replace($nrt, $nrthtml, $sContent); - $sContent = null; - - while (preg_match("/^(.*)]*)>(.*)$/i", $strContentAux, $arrayMatch)) { - $str = trim($arrayMatch[2]); - $strAttribute = null; - - if (!empty($str)) { - $strAux = $str; - $str = null; - - while (preg_match("/^(.*)([\"'].*[\"'])(.*)$/", $strAux, $arrayMatch2)) { - $strAux = $arrayMatch2[1]; - $str = str_replace(" ", "__SPACE__", $arrayMatch2[2]) . $arrayMatch2[3] . $str; - } - - $str = $strAux . $str; - - //Get attributes - $strStyle = null; - $array = explode(" ", $str); - - foreach ($array as $value) { - $arrayAux = explode("=", $value); - - if (isset($arrayAux[1])) { - $a = trim($arrayAux[0]); - $v = trim(str_replace(array("__SPACE__", "\"", "'"), array(" ", null, null), $arrayAux[1])); - - switch (strtolower($a)) { - case "color": - $strStyle = $strStyle . "color: $v;"; - break; - case "face": - $strStyle = $strStyle . "font-family: $v;"; - break; - case "size": - $arrayPt = array(0, 8, 10, 12, 14, 18, 24, 36); - $strStyle = $strStyle . "font-size: " . $arrayPt[intval($v)] . "pt;"; - break; - case "style": - $strStyle = $strStyle . "$v;"; - break; - default: - $strAttribute = $strAttribute . " $a=\"$v\""; - break; - } - } - } - - if ($strStyle != null) { - $strAttribute = $strAttribute . " style=\"$strStyle\""; - } - } - - $strContentAux = $arrayMatch[1]; - $sContent = "" . $arrayMatch[3] . $sContent; - } - - $sContent = $strContentAux . $sContent; - - $sContent = str_ireplace("", "", $sContent); - - $sContent = str_replace($nrthtml, $nrt, $sContent); - - $sContent = str_replace("margin-left", "text-indent", $sContent); - - // define Save file - $sOutput = 2; - $sOrientation = ($sLandscape == false) ? PDF_PAGE_ORIENTATION : 'L'; - $sMedia = (isset($aProperties['media'])) ? $aProperties['media'] : PDF_PAGE_FORMAT; - $sLang = (defined('SYS_LANG')) ? SYS_LANG : 'en'; - - // create new PDF document - $pdf = new TCPDF($sOrientation, PDF_UNIT, $sMedia, true, 'UTF-8', false); - - // set document information - $pdf->SetCreator(PDF_CREATOR); - $pdf->SetAuthor($aFields['USR_USERNAME']); - $pdf->SetTitle('Processmaker'); - $pdf->SetSubject($sFilename); - $pdf->SetCompression(true); - - $margins = $aProperties['margins']; - $margins["left"] = ($margins["left"] >= 0) ? $margins["left"] : PDF_MARGIN_LEFT; - $margins["top"] = ($margins["top"] >= 0) ? $margins["top"] : PDF_MARGIN_TOP; - $margins["right"] = ($margins["right"] >= 0) ? $margins["right"] : PDF_MARGIN_RIGHT; - $margins["bottom"] = ($margins["bottom"] >= 0) ? $margins["bottom"] : PDF_MARGIN_BOTTOM; - - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - $pdf->SetLeftMargin($margins['left']); - $pdf->SetTopMargin($margins['top']); - $pdf->SetRightMargin($margins['right']); - $pdf->SetAutoPageBreak(true, $margins['bottom']); - - $oServerConf = &serverConf::getSingleton(); - - // set some language dependent data: - $lg = array(); - $lg['a_meta_charset'] = 'UTF-8'; - $lg['a_meta_dir'] = ($oServerConf->isRtl($sLang)) ? 'rtl' : 'ltr'; - $lg['a_meta_language'] = $sLang; - $lg['w_page'] = 'page'; - - //set some language-dependent strings - $pdf->setLanguageArray($lg); - - if (isset($aProperties['pdfSecurity'])) { - $tcpdfPermissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'); - $pdfSecurity = $aProperties['pdfSecurity']; - $userPass = G::decrypt($pdfSecurity['openPassword'], $sUID); - $ownerPass = ($pdfSecurity['ownerPassword'] != '') ? G::decrypt($pdfSecurity['ownerPassword'], $sUID) : null; - $permissions = explode("|", $pdfSecurity['permissions']); - $permissions = array_diff($tcpdfPermissions, $permissions); - $pdf->SetProtection($permissions, $userPass, $ownerPass); - } - // --------------------------------------------------------- - // set default font subsetting mode - $pdf->setFontSubsetting(true); - - // Set font - // dejavusans is a UTF-8 Unicode font, if you only need to - // print standard ASCII chars, you can use core fonts like - // helvetica or times to reduce file size. - //$pdf->SetFont('dejavusans', '', 14, '', true); - // Detect chinese, japanese, thai - if (preg_match('/[\x{30FF}\x{3040}-\x{309F}\x{4E00}-\x{9FFF}\x{0E00}-\x{0E7F}]/u', $sContent, $matches)) { - $fileArialunittf = PATH_THIRDPARTY . "tcpdf" . PATH_SEP . "fonts" . PATH_SEP . "arialuni.ttf"; - - $pdf->SetFont((!file_exists($fileArialunittf))? "kozminproregular" : $pdf->addTTFfont($fileArialunittf, "TrueTypeUnicode", "", 32)); - } - - // Add a page - // This method has several options, check the source code documentation for more information. - $pdf->AddPage(); - - // set text shadow effect - //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal')); - // Print text using writeHTMLCell() - // $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true); - if (mb_detect_encoding($sContent) == 'UTF-8') { - $sContent = mb_convert_encoding($sContent, 'HTML-ENTITIES', 'UTF-8'); - } - $doc = new DOMDocument('1.0', 'UTF-8'); - if ($sContent != '') { - $doc->loadHtml($sContent); - } - $pdf->writeHTML($doc->saveXML(), false, false, false, false, ''); - // --------------------------------------------------------- - // Close and output PDF document - // This method has several options, check the source code documentation for more information. - //$pdf->Output('example_00.pdf', 'I'); - //$pdf->Output('/home/hector/processmaker/example_00.pdf', 'D'); - switch ($sOutput) { - case 0: - // Vrew browser - $pdf->Output($sPath . $sFilename . '.pdf', 'I'); - break; - case 1: - // Donwnload - $pdf->Output($sPath . $sFilename . '.pdf', 'D'); - break; - case 2: - // Save file - $pdf->Output($sPath . $sFilename . '.pdf', 'F'); - break; - } - } - - public function generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array()) - { - - define("MAX_FREE_FRACTION", 1); - define('PATH_OUTPUT_FILE_DIRECTORY', PATH_HTML . 'files/' . $_SESSION['APPLICATION'] . '/outdocs/'); - G::verifyPath(PATH_OUTPUT_FILE_DIRECTORY, true); - require_once (PATH_THIRDPARTY . 'html2ps_pdf/config.inc.php'); - require_once (PATH_THIRDPARTY . 'html2ps_pdf/pipeline.factory.class.php'); - - parse_config_file(PATH_THIRDPARTY . 'html2ps_pdf/html2ps.config'); - - $GLOBALS['g_config'] = array( - 'cssmedia' => 'screen', - 'media' => 'Letter', - 'scalepoints' => false, - 'renderimages' => true, - 'renderfields' => true, - 'renderforms' => false, - 'pslevel' => 3, - 'renderlinks' => true, - 'pagewidth' => 800, - 'landscape' => $sLandscape, - 'method' => 'fpdf', - 'margins' => array('left' => 15, 'right' => 15, 'top' => 15, 'bottom' => 15,), - 'encoding' => (version_compare(PHP_VERSION, '5.4.0', '<') ? '' : 'utf-8'), - 'ps2pdf' => false, - 'compress' => true, - 'output' => 2, - 'pdfversion' => '1.3', - 'transparency_workaround' => false, - 'imagequality_workaround' => false, - 'draw_page_border' => isset($_REQUEST['pageborder']), - 'debugbox' => false, - 'html2xhtml' => true, - 'mode' => 'html', - 'smartpagebreak' => true - ); - - $GLOBALS['g_config'] = array_merge($GLOBALS['g_config'], $aProperties); - $g_media = Media::predefined($GLOBALS['g_config']['media']); - $g_media->set_landscape($GLOBALS['g_config']['landscape']); - $g_media->set_margins($GLOBALS['g_config']['margins']); - $g_media->set_pixels($GLOBALS['g_config']['pagewidth']); - - - if (isset($GLOBALS['g_config']['pdfSecurity'])) { - if (isset($GLOBALS['g_config']['pdfSecurity']['openPassword']) && - $GLOBALS['g_config']['pdfSecurity']['openPassword'] != "" - ) { - $GLOBALS['g_config']['pdfSecurity']['openPassword'] = G::decrypt( - $GLOBALS['g_config']['pdfSecurity']['openPassword'], $sUID - ); - } - - if (isset($GLOBALS['g_config']['pdfSecurity']['ownerPassword']) && - $GLOBALS['g_config']['pdfSecurity']['ownerPassword'] != "" - ) { - $GLOBALS['g_config']['pdfSecurity']['ownerPassword'] = G::decrypt( - $GLOBALS['g_config']['pdfSecurity']['ownerPassword'], $sUID - ); - } - - $g_media->set_security($GLOBALS['g_config']['pdfSecurity']); - - require_once (HTML2PS_DIR . 'pdf.fpdf.encryption.php'); - } - - $pipeline = new Pipeline(); - - if (extension_loaded('curl')) { - require_once (HTML2PS_DIR . 'fetcher.url.curl.class.php'); - - $pipeline->fetchers = array(new FetcherURLCurl()); - - if (isset($proxy)) { - if ($proxy != '') { - $pipeline->fetchers[0]->set_proxy($proxy); - } - } - } else { - require_once (HTML2PS_DIR . 'fetcher.url.class.php'); - $pipeline->fetchers[] = new FetcherURL(); - } - - $pipeline->data_filters[] = new DataFilterDoctype(); - $pipeline->data_filters[] = new DataFilterUTF8($GLOBALS['g_config']['encoding']); - - if ($GLOBALS['g_config']['html2xhtml']) { - $pipeline->data_filters[] = new DataFilterHTML2XHTML(); - } else { - $pipeline->data_filters[] = new DataFilterXHTML2XHTML(); - } - - $pipeline->parser = new ParserXHTML(); - $pipeline->pre_tree_filters = array(); - $header_html = ''; - $footer_html = ''; - $filter = new PreTreeFilterHeaderFooter($header_html, $footer_html); - $pipeline->pre_tree_filters[] = $filter; - - if ($GLOBALS['g_config']['renderfields']) { - $pipeline->pre_tree_filters[] = new PreTreeFilterHTML2PSFields(); - } - - if ($GLOBALS['g_config']['method'] === 'ps') { - $pipeline->layout_engine = new LayoutEnginePS(); - } else { - $pipeline->layout_engine = new LayoutEngineDefault(); - } - - $pipeline->post_tree_filters = array(); - - if ($GLOBALS['g_config']['pslevel'] == 3) { - $image_encoder = new PSL3ImageEncoderStream(); - } else { - $image_encoder = new PSL2ImageEncoderStream(); - } - - switch ($GLOBALS['g_config']['method']) { - case 'fastps': - if ($GLOBALS['g_config']['pslevel'] == 3) { - $pipeline->output_driver = new OutputDriverFastPS($image_encoder); - } else { - $pipeline->output_driver = new OutputDriverFastPSLevel2($image_encoder); - } - break; - case 'pdflib': - $pipeline->output_driver = new OutputDriverPDFLIB16($GLOBALS['g_config']['pdfversion']); - break; - case 'fpdf': - $pipeline->output_driver = new OutputDriverFPDF(); - break; - case 'png': - $pipeline->output_driver = new OutputDriverPNG(); - break; - case 'pcl': - $pipeline->output_driver = new OutputDriverPCL(); - break; - default: - die('Unknown output method'); - } - - if (isset($GLOBALS['g_config']['watermarkhtml'])) { - $watermark_text = $GLOBALS['g_config']['watermarkhtml']; - } else { - $watermark_text = ''; - } - - $pipeline->output_driver->set_watermark($watermark_text); - - if ($watermark_text != '') { - $dispatcher = & $pipeline->getDispatcher(); - } - - if ($GLOBALS['g_config']['debugbox']) { - $pipeline->output_driver->set_debug_boxes(true); - } - - if ($GLOBALS['g_config']['draw_page_border']) { - $pipeline->output_driver->set_show_page_border(true); - } - - if ($GLOBALS['g_config']['ps2pdf']) { - $pipeline->output_filters[] = new OutputFilterPS2PDF($GLOBALS['g_config']['pdfversion']); - } - - if ($GLOBALS['g_config']['compress'] && $GLOBALS['g_config']['method'] == 'fastps') { - $pipeline->output_filters[] = new OutputFilterGZip(); - } - - if (!isset($GLOBALS['g_config']['process_mode'])) { - $GLOBALS['g_config']['process_mode'] = ''; - } - - if ($GLOBALS['g_config']['process_mode'] == 'batch') { - $filename = 'batch'; - } else { - $filename = $sFilename; - } - - switch ($GLOBALS['g_config']['output']) { - case 0: - $pipeline->destination = new DestinationBrowser($filename); - break; - case 1: - $pipeline->destination = new DestinationDownload($filename); - break; - case 2: - $pipeline->destination = new DestinationFile($filename); - break; - } - - copy($sPath . $sFilename . '.html', PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html'); - try { - $status = $pipeline->process(((isset($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/files/' . $_SESSION['APPLICATION'] . '/outdocs/' . $sFilename . '.html', $g_media); - copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf'); - unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf'); - unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html'); - } catch (Exception $e) { - if ($e->getMessage() == 'ID_OUTPUT_NOT_GENERATE') { - include_once 'classes/model/AppDocument.php'; - $dataDocument = explode('_', $sFilename); - if (!isset($dataDocument[1])) { - $dataDocument[1] = 1; - } - $oAppDocument = new AppDocument(); - $oAppDocument->remove($dataDocument[0], $dataDocument[1]); - G::SendTemporalMessage(G::LoadTranslation('ID_OUTPUT_NOT_GENERATE'), 'Error'); - } - } - } - - /** - * verify if Output row specified in [sUid] exists. - * - * @param string $sUid the uid of the Prolication - */ - public function OutputExists($sUid) - { - $con = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME); - - try { - $oObj = OutputDocumentPeer::retrieveByPk($sUid); - - if (is_object($oObj) && get_class($oObj) == 'OutputDocument') { - return true; - } else { - return false; - } - } catch (Exception $oError) { - throw ($oError); - } - } -} - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */ +//require_once ("classes/model/om/BaseOutputDocument.php"); +//require_once ("classes/model/Content.php"); + +/** + * Skeleton subclass for representing a row from the 'OUTPUT_DOCUMENT' table. + * + * + * + * You should add additional methods to this class to meet the + * application requirements. This class will only be generated as + * long as it does not already exist in the output directory. + * + * @package workflow.engine.classes.model + */ +class OutputDocument extends BaseOutputDocument +{ + + /** + * This value goes in the content table + * @var string + */ + protected $out_doc_title = ''; + + /** + * This value goes in the content table + * @var string + */ + protected $out_doc_description = ''; + + /** + * This value goes in the content table + * @var string + */ + protected $out_doc_filename = ''; + + /** + * This value goes in the content table + * @var string + */ + protected $out_doc_template = ''; + + public function __construct() + { + $javaInput = PATH_C . 'javaBridgePM' . PATH_SEP . 'input' . PATH_SEP; + $javaOutput = PATH_C . 'javaBridgePM' . PATH_SEP . 'output' . PATH_SEP; + + G::mk_dir($javaInput); + G::mk_dir($javaOutput); + } + + public function getByUid($sOutDocUid) + { + try { + $oOutputDocument = OutputDocumentPeer::retrieveByPK($sOutDocUid); + + if (is_null($oOutputDocument)) { + return false; + } + + $aFields = $oOutputDocument->toArray(BasePeer::TYPE_FIELDNAME); + $aFields['OUT_DOC_TITLE'] = $oOutputDocument->getOutDocTitle(); + $aFields['OUT_DOC_DESCRIPTION'] = $oOutputDocument->getOutDocDescription(); + $aFields['OUT_DOC_FILENAME'] = $oOutputDocument->getOutDocFilename(); + $aFields['OUT_DOC_TEMPLATE'] = $oOutputDocument->getOutDocTemplate(); + $this->fromArray($aFields, BasePeer::TYPE_FIELDNAME); + + return $aFields; + } catch (Exception $oError) { + throw ($oError); + } + } + + /* + * Load the application document registry + * @param string $sAppDocUid + * @return variant + */ + + public function load($sOutDocUid) + { + try { + $oOutputDocument = OutputDocumentPeer::retrieveByPK($sOutDocUid); + + if (!is_null($oOutputDocument)) { + $aFields = $oOutputDocument->toArray(BasePeer::TYPE_FIELDNAME); + $aFields['OUT_DOC_TITLE'] = $oOutputDocument->getOutDocTitle(); + $aFields['PRO_UID'] = $oOutputDocument->getProUid(); + $aFields['OUT_DOC_DESCRIPTION'] = $oOutputDocument->getOutDocDescription(); + $aFields['OUT_DOC_FILENAME'] = $oOutputDocument->getOutDocFilename(); + $aFields['OUT_DOC_TEMPLATE'] = $oOutputDocument->getOutDocTemplate(); + $this->fromArray($aFields, BasePeer::TYPE_FIELDNAME); + + return $aFields; + } else { + throw(new Exception('This row doesn\'t exist!')); + } + } catch (Exception $oError) { + throw ($oError); + } + } + + /** + * Create the application document registry + * @param array $aData + * @return string + * */ + public function create($aData) + { + $oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME); + + try { + if (isset($aData['OUT_DOC_UID']) && $aData['OUT_DOC_UID'] == '') { + unset($aData['OUT_DOC_UID']); + } + + if (!isset($aData['OUT_DOC_UID'])) { + $aData['OUT_DOC_UID'] = G::generateUniqueID(); + } + + if (!isset($aData['OUT_DOC_GENERATE'])) { + $aData['OUT_DOC_GENERATE'] = 'BOTH'; + } else { + if ($aData['OUT_DOC_GENERATE'] == '') { + $aData['OUT_DOC_GENERATE'] = 'BOTH'; + } + } + + $oOutputDocument = new OutputDocument(); + $oOutputDocument->fromArray($aData, BasePeer::TYPE_FIELDNAME); + + if ($oOutputDocument->validate()) { + $oConnection->begin(); + + if (isset($aData['OUT_DOC_TITLE'])) { + $oOutputDocument->setOutDocTitle($aData['OUT_DOC_TITLE']); + } + + if (isset($aData['OUT_DOC_DESCRIPTION'])) { + $oOutputDocument->setOutDocDescription($aData['OUT_DOC_DESCRIPTION']); + } + + $oOutputDocument->setOutDocFilename($aData['OUT_DOC_FILENAME']); + + if (isset($aData['OUT_DOC_TEMPLATE'])) { + $oOutputDocument->setOutDocTemplate($aData['OUT_DOC_TEMPLATE']); + } + + $iResult = $oOutputDocument->save(); + $oConnection->commit(); + //Add Audit Log + $description = "Output Document Name: ".$aData['OUT_DOC_TITLE'].", Output Document Uid: ".$aData['OUT_DOC_UID'].", Filename generated: ".$aData['OUT_DOC_FILENAME']; + if(!empty($aData['OUT_DOC_DESCRIPTION'])){ + $description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION']; + } + $description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'].", Output Document to Generate: ".$aData['OUT_DOC_GENERATE']; + if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){ + $pdfSecurity = 'Disabled'; + }else{ + $pdfSecurity = 'Enabled'; + } + $description .= ", PDF Security: ".$pdfSecurity; + if(!empty($aData['OUT_DOC_VERSIONING'])){ + $description .= ", Enable Versioning: Yes"; + } + if(!empty($aData['OUT_DOC_DESTINATION_PATH'])){ + $description .= ", Destination Path: ".$aData['OUT_DOC_DESTINATION_PATH']; + } + if(!empty($aData['OUT_DOC_TAGS'])){ + $description .= ", Tags: ".$aData['OUT_DOC_TAGS']; + } + if($aData['OUT_DOC_OPEN_TYPE']==0){ + $genLink = 'Open the file'; + }else{ + $genLink = 'Download the file'; + } + $description .= ", By clicking on the generated file link: ".$genLink; + G::auditLog("CreateOuputDocument", $description); + + return $aData['OUT_DOC_UID']; + } else { + $sMessage = ''; + $aValidationFailures = $oOutputDocument->getValidationFailures(); + + foreach ($aValidationFailures as $oValidationFailure) { + $sMessage .= $oValidationFailure->getMessage() . '
'; + } + + throw (new Exception('The registry cannot be created!
' . $sMessage)); + } + } catch (Exception $oError) { + $oConnection->rollback(); + + throw ($oError); + } + } + + /** + * Update the application document registry + * @param array $aData + * @return string + * */ + public function update($aData) + { + $oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME); + + try { + $oOutputDocument = OutputDocumentPeer::retrieveByPK($aData['OUT_DOC_UID']); + + if (!is_null($oOutputDocument)) { + $oOutputDocument->fromArray($aData, BasePeer::TYPE_FIELDNAME); + + if ($oOutputDocument->validate()) { + $oConnection->begin(); + + if (isset($aData['OUT_DOC_TITLE'])) { + $oOutputDocument->setOutDocTitle($aData['OUT_DOC_TITLE']); + } + + if (isset($aData['OUT_DOC_DESCRIPTION'])) { + $oOutputDocument->setOutDocDescription($aData['OUT_DOC_DESCRIPTION']); + } + + if (isset($aData['OUT_DOC_FILENAME'])) { + $oOutputDocument->setOutDocFilename($aData['OUT_DOC_FILENAME']); + } + + if (isset($aData['OUT_DOC_TEMPLATE'])) { + $oOutputDocument->setOutDocTemplate($aData['OUT_DOC_TEMPLATE']); + } + + $iResult = $oOutputDocument->save(); + $oConnection->commit(); + //Add Audit Log + $description = "Output Document Name: ".$aData['OUT_DOC_TITLE'].", Output Document Uid: ".$aData['OUT_DOC_UID'].", Filename generated: ".$aData['OUT_DOC_FILENAME']; + if(!empty($aData['OUT_DOC_DESCRIPTION'])){ + $description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION']; + } + $description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'].", Output Document to Generate: ".$aData['OUT_DOC_GENERATE']; + if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){ + $pdfSecurity = 'Disabled'; + }else{ + $pdfSecurity = 'Enabled'; + } + $description .= ", PDF Security: ".$pdfSecurity; + if(!empty($aData['OUT_DOC_VERSIONING'])){ + $description .= ", Enable Versioning: Yes"; + } + if(!empty($aData['OUT_DOC_DESTINATION_PATH'])){ + $description .= ", Destination Path: ".$aData['OUT_DOC_DESTINATION_PATH']; + } + if(!empty($aData['OUT_DOC_TAGS'])){ + $description .= ", Tags: ".$aData['OUT_DOC_TAGS']; + } + if($aData['OUT_DOC_OPEN_TYPE']==0){ + $genLink = 'Open the file'; + }else{ + $genLink = 'Download the file'; + } + $description .= ", By clicking on the generated file link: ".$genLink; + if (isset($aData['OUT_DOC_TEMPLATE'])) { + $description .= ", [EDIT TEMPLATE]"; + } + G::auditLog("UpdateOuputDocument", $description); + + + return $iResult; + } else { + $sMessage = ''; + $aValidationFailures = $oOutputDocument->getValidationFailures(); + + foreach ($aValidationFailures as $oValidationFailure) { + $sMessage .= $oValidationFailure->getMessage() . '
'; + } + + throw (new Exception('The registry cannot be updated!
' . $sMessage)); + } + } else { + throw (new Exception('This row doesn\'t exist!')); + } + } catch (Exception $oError) { + $oConnection->rollback(); + + throw ($oError); + } + } + + /** + * Remove the application document registry + * @param array $aData + * @return string + * */ + public function remove($sOutDocUid) + { + $oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME); + + try { + $oOutputDocument = OutputDocumentPeer::retrieveByPK($sOutDocUid); + + if (!is_null($oOutputDocument)) { + $outputName = $this->getOutDocTitle(); + $outputDesc = $this->getOutDocDescription(); + $outputFile = $this->getOutDocFilename(); + $oConnection->begin(); + Content::removeContent('OUT_DOC_TITLE', '', $oOutputDocument->getOutDocUid()); + Content::removeContent('OUT_DOC_DESCRIPTION', '', $oOutputDocument->getOutDocUid()); + Content::removeContent('OUT_DOC_FILENAME', '', $oOutputDocument->getOutDocUid()); + Content::removeContent('OUT_DOC_TEMPLATE', '', $oOutputDocument->getOutDocUid()); + $iResult = $oOutputDocument->delete(); + $oConnection->commit(); + //Add Audit Log + G::auditLog("DeleteOuputDocument", "Output Document Name: ".$outputName.", Output Document Uid: ".$sOutDocUid.", Description: ".$outputDesc.", Filename generated: ".$outputFile); + + return $iResult; + } else { + throw (new Exception('This row doesn\'t exist!')); + } + } catch (Exception $oError) { + $oConnection->rollback(); + + throw ($oError); + } + } + + /** + * Get the [out_doc_title] column value. + * @return string + */ + public function getOutDocTitle() + { + if ($this->out_doc_title == '') { + try { + $this->out_doc_title = Content::load( + 'OUT_DOC_TITLE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en') + ); + } catch (Exception $oError) { + throw ($oError); + } + } + + return $this->out_doc_title; + } + + /** + * Set the [out_doc_title] column value. + * + * @param string $sValue new value + * @return void + */ + public function setOutDocTitle($sValue) + { + if ($sValue !== null && !is_string($sValue)) { + $sValue = (string) $sValue; + } + + if ($this->out_doc_title !== $sValue || $sValue === '') { + try { + $this->out_doc_title = $sValue; + + $iResult = Content::addContent( + 'OUT_DOC_TITLE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_title + ); + } catch (Exception $oError) { + $this->out_doc_title = ''; + + throw ($oError); + } + } + } + + /** + * Get the [out_doc_comment] column value. + * @return string + */ + public function getOutDocDescription() + { + if ($this->out_doc_description == '') { + try { + $this->out_doc_description = Content::load( + 'OUT_DOC_DESCRIPTION', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en') + ); + } catch (Exception $oError) { + throw ($oError); + } + } + + return $this->out_doc_description; + } + + /** + * Set the [out_doc_comment] column value. + * + * @param string $sValue new value + * @return void + */ + public function setOutDocDescription($sValue) + { + if ($sValue !== null && !is_string($sValue)) { + $sValue = (string) $sValue; + } + + if ($this->out_doc_description !== $sValue || $sValue === '') { + try { + $this->out_doc_description = $sValue; + + $iResult = Content::addContent( + 'OUT_DOC_DESCRIPTION', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_description + ); + } catch (Exception $oError) { + $this->out_doc_description = ''; + + throw ($oError); + } + } + } + + /** + * Get the [out_doc_filename] column value. + * @return string + */ + public function getOutDocFilename() + { + if ($this->out_doc_filename == '') { + try { + $this->out_doc_filename = Content::load( + 'OUT_DOC_FILENAME', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en') + ); + } catch (Exception $oError) { + throw ($oError); + } + } + + return $this->out_doc_filename; + } + + /** + * Set the [out_doc_filename] column value. + * + * @param string $sValue new value + * @return void + */ + public function setOutDocFilename($sValue) + { + if ($sValue !== null && !is_string($sValue)) { + $sValue = (string) $sValue; + } + + if ($this->out_doc_filename !== $sValue || $sValue === '') { + try { + $this->out_doc_filename = $sValue; + + $iResult = Content::addContent( + 'OUT_DOC_FILENAME', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_filename + ); + } catch (Exception $oError) { + $this->out_doc_filename = ''; + + throw ($oError); + } + } + } + + /** + * Get the [out_doc_template] column value. + * @return string + */ + public function getOutDocTemplate() + { + if ($this->out_doc_template == '') { + try { + $this->out_doc_template = Content::load( + 'OUT_DOC_TEMPLATE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en') + ); + } catch (Exception $oError) { + throw ($oError); + } + } + + return $this->out_doc_template; + } + + /** + * Set the [out_doc_template] column value. + * + * @param string $sValue new value + * @return void + */ + public function setOutDocTemplate($sValue) + { + if ($sValue !== null && !is_string($sValue)) { + $sValue = (string) $sValue; + } + + if ($this->out_doc_template !== $sValue || $sValue === '') { + try { + $this->out_doc_template = $sValue; + + $iResult = Content::addContent( + 'OUT_DOC_TEMPLATE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_template + ); + } catch (Exception $oError) { + $this->out_doc_template = ''; + + throw ($oError); + } + } + } + + /* + * Generate the output document + * @param string $sUID + * @param array $aFields + * @param string $sPath + * @return variant + */ + + public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array()) + { + if (($sUID != '') && is_array($aFields) && ($sPath != '')) { + $sContent = G::replaceDataGridField($sContent, $aFields); + + G::verifyPath($sPath, true); + + //Start - Create .doc + $oFile = fopen($sPath . $sFilename . '.doc', 'wb'); + + $size = array(); + $size["Letter"] = "216mm 279mm"; + $size["Legal"] = "216mm 357mm"; + $size["Executive"] = "184mm 267mm"; + $size["B5"] = "182mm 257mm"; + $size["Folio"] = "216mm 330mm"; + $size["A0Oversize"] = "882mm 1247mm"; + $size["A0"] = "841mm 1189mm"; + $size["A1"] = "594mm 841mm"; + $size["A2"] = "420mm 594mm"; + $size["A3"] = "297mm 420mm"; + $size["A4"] = "210mm 297mm"; + $size["A5"] = "148mm 210mm"; + $size["A6"] = "105mm 148mm"; + $size["A7"] = "74mm 105mm"; + $size["A8"] = "52mm 74mm"; + $size["A9"] = "37mm 52mm"; + $size["A10"] = "26mm 37mm"; + $size["Screenshot640"] = "640mm 480mm"; + $size["Screenshot800"] = "800mm 600mm"; + $size["Screenshot1024"] = "1024mm 768mm"; + + $sizeLandscape["Letter"] = "279mm 216mm"; + $sizeLandscape["Legal"] = "357mm 216mm"; + $sizeLandscape["Executive"] = "267mm 184mm"; + $sizeLandscape["B5"] = "257mm 182mm"; + $sizeLandscape["Folio"] = "330mm 216mm"; + $sizeLandscape["A0Oversize"] = "1247mm 882mm"; + $sizeLandscape["A0"] = "1189mm 841mm"; + $sizeLandscape["A1"] = "841mm 594mm"; + $sizeLandscape["A2"] = "594mm 420mm"; + $sizeLandscape["A3"] = "420mm 297mm"; + $sizeLandscape["A4"] = "297mm 210mm"; + $sizeLandscape["A5"] = "210mm 148mm"; + $sizeLandscape["A6"] = "148mm 105mm"; + $sizeLandscape["A7"] = "105mm 74mm"; + $sizeLandscape["A8"] = "74mm 52mm"; + $sizeLandscape["A9"] = "52mm 37mm"; + $sizeLandscape["A10"] = "37mm 26mm"; + $sizeLandscape["Screenshot640"] = "480mm 640mm"; + $sizeLandscape["Screenshot800"] = "600mm 800mm"; + $sizeLandscape["Screenshot1024"] = "768mm 1024mm"; + + if (!isset($aProperties['media'])) { + $aProperties['media'] = 'Letter'; + } + + if ($sLandscape) { + $media = $sizeLandscape[$aProperties['media']]; + } else { + $media = $size[$aProperties['media']]; + } + + $marginLeft = '15'; + + if (isset($aProperties['margins']['left'])) { + $marginLeft = $aProperties['margins']['left']; + } + + $marginRight = '15'; + + if (isset($aProperties['margins']['right'])) { + $marginRight = $aProperties['margins']['right']; + } + + $marginTop = '15'; + + if (isset($aProperties['margins']['top'])) { + $marginTop = $aProperties['margins']['top']; + } + + $marginBottom = '15'; + + if (isset($aProperties['margins']['bottom'])) { + $marginBottom = $aProperties['margins']['bottom']; + } + + fwrite($oFile, ' + + + + + + + + + + + +
'); + + fwrite($oFile, $sContent); + fwrite($oFile, "\n
\n\n"); + fclose($oFile); + /* End - Create .doc */ + + if ($sTypeDocToGener == 'BOTH' || $sTypeDocToGener == 'PDF') { + $oFile = fopen($sPath . $sFilename . '.html', 'wb'); + fwrite($oFile, $sContent); + fclose($oFile); + /* Start - Create .pdf */ + if (isset($aProperties['report_generator'])) { + switch ($aProperties['report_generator']) { + case 'TCPDF': + $this->generateTcpdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties); + break; + case 'HTML2PDF': + default: + $this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties); + break; + } + } else { + $this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties); + } + } + //end if $sTypeDocToGener + /* End - Create .pdf */ + } else { + return PEAR::raiseError( + null, G_ERROR_USER_UID, null, null, 'You tried to call to a generate method without send the Output Document UID, fields to use and the file path!', 'G_Error', true + ); + } + } + + public function generateHtml2pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array()) + { + + // define("MAX_FREE_FRACTION", 1); + define('PATH_OUTPUT_FILE_DIRECTORY', PATH_HTML . 'files/' . $_SESSION['APPLICATION'] . '/outdocs/'); + G::verifyPath(PATH_OUTPUT_FILE_DIRECTORY, true); + + require_once(PATH_THIRDPARTY . 'html2pdf/html2pdf.class.php'); + + // define Save file + $sOutput = 2; + $sOrientation = ($sLandscape == false) ? 'P' : 'L'; + $sLang = (defined('SYS_LANG')) ? SYS_LANG : 'en'; + $sMedia = $aProperties['media']; + // margin define + define("MINIMAL_MARGIN", 15); + $marges = array(MINIMAL_MARGIN, MINIMAL_MARGIN, MINIMAL_MARGIN, MINIMAL_MARGIN); + if (isset($aProperties['margins'])) { + // Default marges (left, top, right, bottom) + $margins = $aProperties['margins']; + $margins['left'] = ($margins['left'] > 0) ? $margins['left'] : MINIMAL_MARGIN; + $margins['top'] = ($margins['top'] > 0) ? $margins['top'] : MINIMAL_MARGIN; + $margins['right'] = ($margins['right'] > 0) ? $margins['right'] : MINIMAL_MARGIN; + $margins['bottom'] = ($margins['bottom'] > 0) ? $margins['bottom'] : MINIMAL_MARGIN; + $marges = array($margins['left'], $margins['top'], $margins['right'], $margins['bottom']); + } + + $html2pdf = new HTML2PDF($sOrientation, $sMedia, $sLang, true, 'UTF-8', $marges); + + $html2pdf->pdf->SetAuthor($aFields['USR_USERNAME']); + $html2pdf->pdf->SetTitle('Processmaker'); + $html2pdf->pdf->SetSubject($sFilename); + $html2pdf->pdf->SetCompression(true); + + //$html2pdf->pdf->SetKeywords('HTML2PDF, TCPDF, processmaker'); + + if (isset($aProperties['pdfSecurity'])) { + $pdfSecurity = $aProperties['pdfSecurity']; + $userPass = G::decrypt($pdfSecurity['openPassword'], $sUID); + $ownerPass = ($pdfSecurity['ownerPassword'] != '') ? G::decrypt($pdfSecurity['ownerPassword'], $sUID) : null; + $permissions = explode("|", $pdfSecurity['permissions']); + $html2pdf->pdf->SetProtection($permissions, $userPass, $ownerPass); + } + + $html2pdf->setTestTdInOnePage(false); + $html2pdf->setTestIsImage(false); + $html2pdf->setTestIsDeprecated(false); + + $html2pdf->writeHTML($html2pdf->getHtmlFromPage($sContent)); + + switch ($sOutput) { + case 0: + // Vrew browser + $html2pdf->Output($sPath . $sFilename . '.pdf', 'I'); + break; + case 1: + // Donwnload + $html2pdf->Output($sPath . $sFilename . '.pdf', 'D'); + break; + case 2: + // Save file + $html2pdf->Output($sPath . $sFilename . '.pdf', 'F'); + break; + } + + copy($sPath . $sFilename . '.html', PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html'); + + copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf'); + unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf'); + unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html'); + } + + public function generateTcpdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array()) + { + require_once (PATH_THIRDPARTY . "tcpdf" . PATH_SEP . "config" . PATH_SEP . "lang" . PATH_SEP . "eng.php"); + require_once (PATH_THIRDPARTY . "tcpdf" . PATH_SEP . "tcpdf.php"); + + $nrt = array("\n", "\r", "\t"); + $nrthtml = array("(n /)", "(r /)", "(t /)"); + + $strContentAux = str_replace($nrt, $nrthtml, $sContent); + $sContent = null; + + while (preg_match("/^(.*)]*)>(.*)$/i", $strContentAux, $arrayMatch)) { + $str = trim($arrayMatch[2]); + $strAttribute = null; + + if (!empty($str)) { + $strAux = $str; + $str = null; + + while (preg_match("/^(.*)([\"'].*[\"'])(.*)$/", $strAux, $arrayMatch2)) { + $strAux = $arrayMatch2[1]; + $str = str_replace(" ", "__SPACE__", $arrayMatch2[2]) . $arrayMatch2[3] . $str; + } + + $str = $strAux . $str; + + //Get attributes + $strStyle = null; + $array = explode(" ", $str); + + foreach ($array as $value) { + $arrayAux = explode("=", $value); + + if (isset($arrayAux[1])) { + $a = trim($arrayAux[0]); + $v = trim(str_replace(array("__SPACE__", "\"", "'"), array(" ", null, null), $arrayAux[1])); + + switch (strtolower($a)) { + case "color": + $strStyle = $strStyle . "color: $v;"; + break; + case "face": + $strStyle = $strStyle . "font-family: $v;"; + break; + case "size": + $arrayPt = array(0, 8, 10, 12, 14, 18, 24, 36); + $strStyle = $strStyle . "font-size: " . $arrayPt[intval($v)] . "pt;"; + break; + case "style": + $strStyle = $strStyle . "$v;"; + break; + default: + $strAttribute = $strAttribute . " $a=\"$v\""; + break; + } + } + } + + if ($strStyle != null) { + $strAttribute = $strAttribute . " style=\"$strStyle\""; + } + } + + $strContentAux = $arrayMatch[1]; + $sContent = "" . $arrayMatch[3] . $sContent; + } + + $sContent = $strContentAux . $sContent; + + $sContent = str_ireplace("", "", $sContent); + + $sContent = str_replace($nrthtml, $nrt, $sContent); + + $sContent = str_replace("margin-left", "text-indent", $sContent); + + // define Save file + $sOutput = 2; + $sOrientation = ($sLandscape == false) ? PDF_PAGE_ORIENTATION : 'L'; + $sMedia = (isset($aProperties['media'])) ? $aProperties['media'] : PDF_PAGE_FORMAT; + $sLang = (defined('SYS_LANG')) ? SYS_LANG : 'en'; + + // create new PDF document + $pdf = new TCPDF($sOrientation, PDF_UNIT, $sMedia, true, 'UTF-8', false); + + // set document information + $pdf->SetCreator(PDF_CREATOR); + $pdf->SetAuthor($aFields['USR_USERNAME']); + $pdf->SetTitle('Processmaker'); + $pdf->SetSubject($sFilename); + $pdf->SetCompression(true); + + $margins = $aProperties['margins']; + $margins["left"] = ($margins["left"] >= 0) ? $margins["left"] : PDF_MARGIN_LEFT; + $margins["top"] = ($margins["top"] >= 0) ? $margins["top"] : PDF_MARGIN_TOP; + $margins["right"] = ($margins["right"] >= 0) ? $margins["right"] : PDF_MARGIN_RIGHT; + $margins["bottom"] = ($margins["bottom"] >= 0) ? $margins["bottom"] : PDF_MARGIN_BOTTOM; + + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + $pdf->SetLeftMargin($margins['left']); + $pdf->SetTopMargin($margins['top']); + $pdf->SetRightMargin($margins['right']); + $pdf->SetAutoPageBreak(true, $margins['bottom']); + + $oServerConf = &serverConf::getSingleton(); + + // set some language dependent data: + $lg = array(); + $lg['a_meta_charset'] = 'UTF-8'; + $lg['a_meta_dir'] = ($oServerConf->isRtl($sLang)) ? 'rtl' : 'ltr'; + $lg['a_meta_language'] = $sLang; + $lg['w_page'] = 'page'; + + //set some language-dependent strings + $pdf->setLanguageArray($lg); + + if (isset($aProperties['pdfSecurity'])) { + $tcpdfPermissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'); + $pdfSecurity = $aProperties['pdfSecurity']; + $userPass = G::decrypt($pdfSecurity['openPassword'], $sUID); + $ownerPass = ($pdfSecurity['ownerPassword'] != '') ? G::decrypt($pdfSecurity['ownerPassword'], $sUID) : null; + $permissions = explode("|", $pdfSecurity['permissions']); + $permissions = array_diff($tcpdfPermissions, $permissions); + $pdf->SetProtection($permissions, $userPass, $ownerPass); + } + // --------------------------------------------------------- + // set default font subsetting mode + $pdf->setFontSubsetting(true); + + // Set font + // dejavusans is a UTF-8 Unicode font, if you only need to + // print standard ASCII chars, you can use core fonts like + // helvetica or times to reduce file size. + //$pdf->SetFont('dejavusans', '', 14, '', true); + // Detect chinese, japanese, thai + if (preg_match('/[\x{30FF}\x{3040}-\x{309F}\x{4E00}-\x{9FFF}\x{0E00}-\x{0E7F}]/u', $sContent, $matches)) { + $fileArialunittf = PATH_THIRDPARTY . "tcpdf" . PATH_SEP . "fonts" . PATH_SEP . "arialuni.ttf"; + + $pdf->SetFont((!file_exists($fileArialunittf))? "kozminproregular" : $pdf->addTTFfont($fileArialunittf, "TrueTypeUnicode", "", 32)); + } + + // Add a page + // This method has several options, check the source code documentation for more information. + $pdf->AddPage(); + + // set text shadow effect + //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal')); + // Print text using writeHTMLCell() + // $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true); + if (mb_detect_encoding($sContent) == 'UTF-8') { + $sContent = mb_convert_encoding($sContent, 'HTML-ENTITIES', 'UTF-8'); + } + $doc = new DOMDocument('1.0', 'UTF-8'); + if ($sContent != '') { + $doc->loadHtml($sContent); + } + $pdf->writeHTML($doc->saveXML(), false, false, false, false, ''); + // --------------------------------------------------------- + // Close and output PDF document + // This method has several options, check the source code documentation for more information. + //$pdf->Output('example_00.pdf', 'I'); + //$pdf->Output('/home/hector/processmaker/example_00.pdf', 'D'); + switch ($sOutput) { + case 0: + // Vrew browser + $pdf->Output($sPath . $sFilename . '.pdf', 'I'); + break; + case 1: + // Donwnload + $pdf->Output($sPath . $sFilename . '.pdf', 'D'); + break; + case 2: + // Save file + $pdf->Output($sPath . $sFilename . '.pdf', 'F'); + break; + } + } + + public function generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array()) + { + + define("MAX_FREE_FRACTION", 1); + define('PATH_OUTPUT_FILE_DIRECTORY', PATH_HTML . 'files/' . $_SESSION['APPLICATION'] . '/outdocs/'); + G::verifyPath(PATH_OUTPUT_FILE_DIRECTORY, true); + require_once (PATH_THIRDPARTY . 'html2ps_pdf/config.inc.php'); + require_once (PATH_THIRDPARTY . 'html2ps_pdf/pipeline.factory.class.php'); + + parse_config_file(PATH_THIRDPARTY . 'html2ps_pdf/html2ps.config'); + + $GLOBALS['g_config'] = array( + 'cssmedia' => 'screen', + 'media' => 'Letter', + 'scalepoints' => false, + 'renderimages' => true, + 'renderfields' => true, + 'renderforms' => false, + 'pslevel' => 3, + 'renderlinks' => true, + 'pagewidth' => 800, + 'landscape' => $sLandscape, + 'method' => 'fpdf', + 'margins' => array('left' => 15, 'right' => 15, 'top' => 15, 'bottom' => 15,), + 'encoding' => (version_compare(PHP_VERSION, '5.4.0', '<') ? '' : 'utf-8'), + 'ps2pdf' => false, + 'compress' => true, + 'output' => 2, + 'pdfversion' => '1.3', + 'transparency_workaround' => false, + 'imagequality_workaround' => false, + 'draw_page_border' => isset($_REQUEST['pageborder']), + 'debugbox' => false, + 'html2xhtml' => true, + 'mode' => 'html', + 'smartpagebreak' => true + ); + + $GLOBALS['g_config'] = array_merge($GLOBALS['g_config'], $aProperties); + $g_media = Media::predefined($GLOBALS['g_config']['media']); + $g_media->set_landscape($GLOBALS['g_config']['landscape']); + $g_media->set_margins($GLOBALS['g_config']['margins']); + $g_media->set_pixels($GLOBALS['g_config']['pagewidth']); + + + if (isset($GLOBALS['g_config']['pdfSecurity'])) { + if (isset($GLOBALS['g_config']['pdfSecurity']['openPassword']) && + $GLOBALS['g_config']['pdfSecurity']['openPassword'] != "" + ) { + $GLOBALS['g_config']['pdfSecurity']['openPassword'] = G::decrypt( + $GLOBALS['g_config']['pdfSecurity']['openPassword'], $sUID + ); + } + + if (isset($GLOBALS['g_config']['pdfSecurity']['ownerPassword']) && + $GLOBALS['g_config']['pdfSecurity']['ownerPassword'] != "" + ) { + $GLOBALS['g_config']['pdfSecurity']['ownerPassword'] = G::decrypt( + $GLOBALS['g_config']['pdfSecurity']['ownerPassword'], $sUID + ); + } + + $g_media->set_security($GLOBALS['g_config']['pdfSecurity']); + + require_once (HTML2PS_DIR . 'pdf.fpdf.encryption.php'); + } + + $pipeline = new Pipeline(); + + if (extension_loaded('curl')) { + require_once (HTML2PS_DIR . 'fetcher.url.curl.class.php'); + + $pipeline->fetchers = array(new FetcherURLCurl()); + + if (isset($proxy)) { + if ($proxy != '') { + $pipeline->fetchers[0]->set_proxy($proxy); + } + } + } else { + require_once (HTML2PS_DIR . 'fetcher.url.class.php'); + $pipeline->fetchers[] = new FetcherURL(); + } + + $pipeline->data_filters[] = new DataFilterDoctype(); + $pipeline->data_filters[] = new DataFilterUTF8($GLOBALS['g_config']['encoding']); + + if ($GLOBALS['g_config']['html2xhtml']) { + $pipeline->data_filters[] = new DataFilterHTML2XHTML(); + } else { + $pipeline->data_filters[] = new DataFilterXHTML2XHTML(); + } + + $pipeline->parser = new ParserXHTML(); + $pipeline->pre_tree_filters = array(); + $header_html = ''; + $footer_html = ''; + $filter = new PreTreeFilterHeaderFooter($header_html, $footer_html); + $pipeline->pre_tree_filters[] = $filter; + + if ($GLOBALS['g_config']['renderfields']) { + $pipeline->pre_tree_filters[] = new PreTreeFilterHTML2PSFields(); + } + + if ($GLOBALS['g_config']['method'] === 'ps') { + $pipeline->layout_engine = new LayoutEnginePS(); + } else { + $pipeline->layout_engine = new LayoutEngineDefault(); + } + + $pipeline->post_tree_filters = array(); + + if ($GLOBALS['g_config']['pslevel'] == 3) { + $image_encoder = new PSL3ImageEncoderStream(); + } else { + $image_encoder = new PSL2ImageEncoderStream(); + } + + switch ($GLOBALS['g_config']['method']) { + case 'fastps': + if ($GLOBALS['g_config']['pslevel'] == 3) { + $pipeline->output_driver = new OutputDriverFastPS($image_encoder); + } else { + $pipeline->output_driver = new OutputDriverFastPSLevel2($image_encoder); + } + break; + case 'pdflib': + $pipeline->output_driver = new OutputDriverPDFLIB16($GLOBALS['g_config']['pdfversion']); + break; + case 'fpdf': + $pipeline->output_driver = new OutputDriverFPDF(); + break; + case 'png': + $pipeline->output_driver = new OutputDriverPNG(); + break; + case 'pcl': + $pipeline->output_driver = new OutputDriverPCL(); + break; + default: + die('Unknown output method'); + } + + if (isset($GLOBALS['g_config']['watermarkhtml'])) { + $watermark_text = $GLOBALS['g_config']['watermarkhtml']; + } else { + $watermark_text = ''; + } + + $pipeline->output_driver->set_watermark($watermark_text); + + if ($watermark_text != '') { + $dispatcher = & $pipeline->getDispatcher(); + } + + if ($GLOBALS['g_config']['debugbox']) { + $pipeline->output_driver->set_debug_boxes(true); + } + + if ($GLOBALS['g_config']['draw_page_border']) { + $pipeline->output_driver->set_show_page_border(true); + } + + if ($GLOBALS['g_config']['ps2pdf']) { + $pipeline->output_filters[] = new OutputFilterPS2PDF($GLOBALS['g_config']['pdfversion']); + } + + if ($GLOBALS['g_config']['compress'] && $GLOBALS['g_config']['method'] == 'fastps') { + $pipeline->output_filters[] = new OutputFilterGZip(); + } + + if (!isset($GLOBALS['g_config']['process_mode'])) { + $GLOBALS['g_config']['process_mode'] = ''; + } + + if ($GLOBALS['g_config']['process_mode'] == 'batch') { + $filename = 'batch'; + } else { + $filename = $sFilename; + } + + switch ($GLOBALS['g_config']['output']) { + case 0: + $pipeline->destination = new DestinationBrowser($filename); + break; + case 1: + $pipeline->destination = new DestinationDownload($filename); + break; + case 2: + $pipeline->destination = new DestinationFile($filename); + break; + } + + copy($sPath . $sFilename . '.html', PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html'); + try { + $status = $pipeline->process(((isset($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/files/' . $_SESSION['APPLICATION'] . '/outdocs/' . $sFilename . '.html', $g_media); + copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf'); + unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf'); + unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html'); + } catch (Exception $e) { + if ($e->getMessage() == 'ID_OUTPUT_NOT_GENERATE') { + include_once 'classes/model/AppDocument.php'; + $dataDocument = explode('_', $sFilename); + if (!isset($dataDocument[1])) { + $dataDocument[1] = 1; + } + $oAppDocument = new AppDocument(); + $oAppDocument->remove($dataDocument[0], $dataDocument[1]); + G::SendTemporalMessage(G::LoadTranslation('ID_OUTPUT_NOT_GENERATE'), 'Error'); + } + } + } + + /** + * verify if Output row specified in [sUid] exists. + * + * @param string $sUid the uid of the Prolication + */ + public function OutputExists($sUid) + { + $con = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME); + + try { + $oObj = OutputDocumentPeer::retrieveByPk($sUid); + + if (is_object($oObj) && get_class($oObj) == 'OutputDocument') { + return true; + } else { + return false; + } + } catch (Exception $oError) { + throw ($oError); + } + } +} + diff --git a/workflow/engine/classes/model/Triggers.php b/workflow/engine/classes/model/Triggers.php index d0d6a09e0..13321d6d0 100755 --- a/workflow/engine/classes/model/Triggers.php +++ b/workflow/engine/classes/model/Triggers.php @@ -155,7 +155,7 @@ class Triggers extends BaseTriggers } else { $this->setTriUid($aData['TRI_UID'] ); } - + $triggerUid = $this->getTriUid(); $this->setProUid($aData['PRO_UID']); $this->setTriType("SCRIPT"); @@ -183,6 +183,13 @@ class Triggers extends BaseTriggers } $result=$this->save(); $con->commit(); + //Add Audit Log + $description = "Trigger Name: ".$aData['TRI_TITLE'].", Trigger Uid: ".$triggerUid; + if (isset ( $aData['TRI_DESCRIPTION'] )) { + $description .= ", Description: ".$aData['TRI_DESCRIPTION']; + } + G::auditLog("CreateTrigger", $description); + return $result; } else { $con->rollback(); @@ -233,10 +240,18 @@ class Triggers extends BaseTriggers $con->begin(); $oTri = TriggersPeer::retrieveByPK( $TriUid ); if (!is_null($oTri)) { + $triggerName = $this->getTriTitle(); + $triggerDesc = $this->getTriDescription(); Content::removeContent( 'TRI_TITLE', '', $this->getTriUid()); Content::removeContent( 'TRI_DESCRIPTION', '', $this->getTriUid()); $result = $oTri->delete(); $con->commit(); + //Add Audit Log + $description = "Trigger Name: ".$triggerName.", Trigger Uid: ".$TriUid; + if (isset ( $triggerDesc )) { + $description .= ", Description: ".$triggerDesc; + } + G::auditLog("DeleteTrigger", $description); } return $result; } catch (Exception $e) { diff --git a/workflow/engine/methods/triggers/triggers_Save.php b/workflow/engine/methods/triggers/triggers_Save.php index a36d7ed6c..b7abc6627 100755 --- a/workflow/engine/methods/triggers/triggers_Save.php +++ b/workflow/engine/methods/triggers/triggers_Save.php @@ -101,15 +101,27 @@ if (isset( $sfunction ) && $sfunction == 'lookforNameTrigger') { } /*----------------------------------********---------------------------------*/ } - + $swCreate = true; if ($value['TRI_UID'] != '') { $oTrigger->load( $value['TRI_UID'] ); } else { $oTrigger->create( $value ); $value['TRI_UID'] = $oTrigger->getTriUid(); - } - //print_r($_POST['form']);die; + $swCreate = false; + } $oTrigger->update( $value ); + if($swCreate){ + //Add Audit Log + $fields = $oTrigger->load( $value['TRI_UID'] ); + $description = "Trigger Name: ".$fields['TRI_TITLE'].", Trigger Uid: ".$value['TRI_UID']; + if (isset ( $fields['TRI_DESCRIPTION'] )) { + $description .= ", Description: ".$fields['TRI_DESCRIPTION']; + } + if (isset($value["TRI_WEBBOT"])) { + $description .= ", [EDIT CODE]"; + } + G::auditLog("UpdateTrigger", $description); + } //if (! isset( $_POST['mode'] )) { // $oProcessMap->triggersList( $value['PRO_UID'] ); From 67115f62e1f6e069dcec0d5ca8260546fdfef98f Mon Sep 17 00:00:00 2001 From: jonathan Date: Wed, 18 Feb 2015 15:36:20 -0400 Subject: [PATCH 043/155] web entry - update last observations, and add post in submit --- workflow/engine/classes/class.pmDynaform.php | 30 +++++++++++++------ .../js/cases/core/cases_Step_Pmdynaform.js | 2 +- .../js/cases/core/webentry_pmdynaform.js | 23 +++++++------- .../ProcessMaker/BusinessModel/WebEntry.php | 2 +- .../templates/cases/WebEntry_Pmdynaform.html | 4 +++ .../cases/cases_Step_Pmdynaform.html | 1 + 6 files changed, 38 insertions(+), 24 deletions(-) diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 6a7893d55..8b1b05123 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -17,8 +17,9 @@ class pmDynaform public $items = array(); public $data = array(); public $variables = array(); + public $arrayFieldRequired = array(); - public function __construct($dyn_uid, $app_data) + public function __construct($dyn_uid, $app_data = array()) { $this->dyn_uid = $dyn_uid; $this->app_data = $app_data; @@ -27,9 +28,16 @@ class pmDynaform //items $dynContent = G::json_decode($this->record["DYN_CONTENT"]); if (isset($dynContent->items)) { - $this->items = $dynContent->items[0]->items; + $this->items = $dynContent->items[0]->items; + for($i=0; $iitems); $i++){ + for($j=0; $jitems[$i]); $j++){ + if($this->items[$i][$j]->required == 1){ + array_push($this->arrayFieldRequired, $this->items[$i][$j]->name); + } + } + } } - if($app_data != array()){ + if(!empty($app_data)){ //data $cases = new \ProcessMaker\BusinessModel\Cases(); $this->data = $cases->getCaseVariables($app_data["APPLICATION"]); @@ -61,7 +69,7 @@ class pmDynaform while ($ds->next()) { $row = $ds->getRow(); //options - $rows2 = json_decode($row["VAR_ACCEPTED_VALUES"]); + $rows2 = G::json_decode($row["VAR_ACCEPTED_VALUES"]); $n = count($rows2); for ($i = 0; $i < $n; $i++) { $rows2[$i] = array($rows2[$i]->keyValue, $rows2[$i]->value); @@ -240,12 +248,13 @@ class pmDynaform $file = str_replace("{PRJ_UID}", $this->app_data["PROCESS"], $file); $file = str_replace("{STEP_MODE}", $step_mode, $file); $file = str_replace("{WORKSPACE}", $this->app_data["SYS_SYS"], $file); - $file = str_replace("{credentials}", json_encode($clientToken), $file); + $file = str_replace("{PORT}", $_SERVER["SERVER_PORT"] , $file); + $file = str_replace("{credentials}", G::json_encode($clientToken), $file); echo $file; exit(); } - public function printWebEntry() + public function printWebEntry($filename) { ob_clean(); $a = $this->clientToken(); @@ -263,11 +272,14 @@ class pmDynaform $file = str_replace("{DYN_UID}", $this->dyn_uid, $file); $file = str_replace("{PRJ_UID}",$this->record["PRO_UID"], $file); $file = str_replace("{WORKSPACE}", SYS_SYS, $file); - $file = str_replace("{credentials}", json_encode($clientToken), $file); - echo $file; + $file = str_replace("{FILEPOST}", $filename, $file); + $file = str_replace("{PORT}", $_SERVER["SERVER_PORT"] , $file); + $file = str_replace("{credentials}", G::json_encode($clientToken), $file); + $file = str_replace("{FIELDSREQUIRED}", G::json_encode($this->arrayFieldRequired), $file); + echo $file; exit(); } - + private function clientToken() { $client = $this->getClientCredentials(); diff --git a/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js b/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js index ababad45f..0f6af810f 100644 --- a/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js +++ b/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js @@ -49,7 +49,7 @@ $(window).load(function () { submitRest: false }); new PMDynaform.core.Proxy({ - url: "http://" + window.project.keys.server + "/" + window.project.keys.apiName + "/" + window.project.keys.apiVersion + "/" + window.project.keys.workspace + "/cases/" + app_uid + "/variables", + url: "http://" + window.project.keys.server + ":"+port +"/" + window.project.keys.apiName + "/" + window.project.keys.apiVersion + "/" + window.project.keys.workspace + "/cases/" + app_uid + "/variables", method: 'GET', data: {}, keys: window.project.token, diff --git a/workflow/engine/js/cases/core/webentry_pmdynaform.js b/workflow/engine/js/cases/core/webentry_pmdynaform.js index 33843f102..3fb7228f5 100644 --- a/workflow/engine/js/cases/core/webentry_pmdynaform.js +++ b/workflow/engine/js/cases/core/webentry_pmdynaform.js @@ -36,16 +36,7 @@ $(window).load(function () { }, token: credentials, submitRest: false - }); - new PMDynaform.core.Proxy({ - url: "http://" + window.project.keys.server + "/" + window.project.keys.apiName + "/" + window.project.keys.apiVersion + "/" + window.project.keys.workspace + "/cases/" + app_uid + "/variables", - method: 'GET', - data: {}, - keys: window.project.token, - successCallback: function (xhr, response) { - window.project.setData2(response); - } - }); + }); var type = document.createElement("input"); type.type = "hidden"; @@ -66,13 +57,18 @@ $(window).load(function () { var dynaformname = document.createElement("input"); dynaformname.type = "hidden"; dynaformname.name = "__DynaformName__"; - dynaformname.value = __DynaformName__; + //dynaformname.value = __DynaformName__; var appuid = document.createElement("input"); appuid.type = "hidden"; appuid.name = "APP_UID"; - appuid.value = app_uid; + + var arrayRequired = document.createElement("input"); + arrayRequired.type = "hidden"; + arrayRequired.name = "DynaformRequiredFields"; + arrayRequired.value = fieldsRequired; + //appuid.value = app_uid; var form = document.getElementsByTagName("form")[0]; - form.action = "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid; + form.action = filePost; form.method = "post"; form.appendChild(type); form.appendChild(uid); @@ -80,6 +76,7 @@ $(window).load(function () { form.appendChild(action); form.appendChild(dynaformname); form.appendChild(appuid); + form.appendChild(arrayRequired); var dyn_forward = document.getElementById("dyn_forward"); dyn_forward.onclick = function () { diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php index 7a580ca33..52511af14 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php @@ -400,7 +400,7 @@ class WebEntry $fileContent .= "G::LoadClass('pmDynaform');\n"; $fileContent .= "\$a = new pmDynaform('".$arrayWebEntryData["DYN_UID"]."', array());\n"; $fileContent .= "if(\$a->isResponsive()){"; - $fileContent .= "\$a->printWebEntry();"; + $fileContent .= "\$a->printWebEntry('".$fileName."Post.php');"; $fileContent .= "}else {"; $fileContent .= "\$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . "/" . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n"; $fileContent .= "G::RenderPage(\"publish\", \"blank\");"; diff --git a/workflow/engine/templates/cases/WebEntry_Pmdynaform.html b/workflow/engine/templates/cases/WebEntry_Pmdynaform.html index 2d4c02a3a..d55f866f5 100644 --- a/workflow/engine/templates/cases/WebEntry_Pmdynaform.html +++ b/workflow/engine/templates/cases/WebEntry_Pmdynaform.html @@ -28,6 +28,10 @@ //var step_mode = '{STEP_MODE}'; var workspace = '{WORKSPACE}'; var credentials = {credentials}; + var filePost = '{FILEPOST}'; + var port = '{PORT}'; + var fieldsRequired = {FIELDSREQUIRED}; + diff --git a/workflow/engine/templates/cases/cases_Step_Pmdynaform.html b/workflow/engine/templates/cases/cases_Step_Pmdynaform.html index cae588671..8fabe6c67 100644 --- a/workflow/engine/templates/cases/cases_Step_Pmdynaform.html +++ b/workflow/engine/templates/cases/cases_Step_Pmdynaform.html @@ -27,6 +27,7 @@ var prj_uid = '{PRJ_UID}'; var step_mode = '{STEP_MODE}'; var workspace = '{WORKSPACE}'; + var port = '{PORT}'; var credentials = {credentials}; From b412dd61c3e6c15f0ea654fe7900e98133cb4424 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Wed, 18 Feb 2015 15:40:49 -0400 Subject: [PATCH 044/155] OutputDocument --- .../engine/classes/model/OutputDocument.php | 73 +------------------ 1 file changed, 4 insertions(+), 69 deletions(-) diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index f8a78f680..a4c96bce7 100755 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -173,35 +173,7 @@ class OutputDocument extends BaseOutputDocument $iResult = $oOutputDocument->save(); $oConnection->commit(); - //Add Audit Log - $description = "Output Document Name: ".$aData['OUT_DOC_TITLE'].", Output Document Uid: ".$aData['OUT_DOC_UID'].", Filename generated: ".$aData['OUT_DOC_FILENAME']; - if(!empty($aData['OUT_DOC_DESCRIPTION'])){ - $description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION']; - } - $description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'].", Output Document to Generate: ".$aData['OUT_DOC_GENERATE']; - if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){ - $pdfSecurity = 'Disabled'; - }else{ - $pdfSecurity = 'Enabled'; - } - $description .= ", PDF Security: ".$pdfSecurity; - if(!empty($aData['OUT_DOC_VERSIONING'])){ - $description .= ", Enable Versioning: Yes"; - } - if(!empty($aData['OUT_DOC_DESTINATION_PATH'])){ - $description .= ", Destination Path: ".$aData['OUT_DOC_DESTINATION_PATH']; - } - if(!empty($aData['OUT_DOC_TAGS'])){ - $description .= ", Tags: ".$aData['OUT_DOC_TAGS']; - } - if($aData['OUT_DOC_OPEN_TYPE']==0){ - $genLink = 'Open the file'; - }else{ - $genLink = 'Download the file'; - } - $description .= ", By clicking on the generated file link: ".$genLink; - G::auditLog("CreateOuputDocument", $description); - + return $aData['OUT_DOC_UID']; } else { $sMessage = ''; @@ -255,40 +227,8 @@ class OutputDocument extends BaseOutputDocument } $iResult = $oOutputDocument->save(); - $oConnection->commit(); - //Add Audit Log - $description = "Output Document Name: ".$aData['OUT_DOC_TITLE'].", Output Document Uid: ".$aData['OUT_DOC_UID'].", Filename generated: ".$aData['OUT_DOC_FILENAME']; - if(!empty($aData['OUT_DOC_DESCRIPTION'])){ - $description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION']; - } - $description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'].", Output Document to Generate: ".$aData['OUT_DOC_GENERATE']; - if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){ - $pdfSecurity = 'Disabled'; - }else{ - $pdfSecurity = 'Enabled'; - } - $description .= ", PDF Security: ".$pdfSecurity; - if(!empty($aData['OUT_DOC_VERSIONING'])){ - $description .= ", Enable Versioning: Yes"; - } - if(!empty($aData['OUT_DOC_DESTINATION_PATH'])){ - $description .= ", Destination Path: ".$aData['OUT_DOC_DESTINATION_PATH']; - } - if(!empty($aData['OUT_DOC_TAGS'])){ - $description .= ", Tags: ".$aData['OUT_DOC_TAGS']; - } - if($aData['OUT_DOC_OPEN_TYPE']==0){ - $genLink = 'Open the file'; - }else{ - $genLink = 'Download the file'; - } - $description .= ", By clicking on the generated file link: ".$genLink; - if (isset($aData['OUT_DOC_TEMPLATE'])) { - $description .= ", [EDIT TEMPLATE]"; - } - G::auditLog("UpdateOuputDocument", $description); - - + $oConnectOC_UID'].")"); + return $iResult; } else { $sMessage = ''; @@ -323,18 +263,13 @@ class OutputDocument extends BaseOutputDocument $oOutputDocument = OutputDocumentPeer::retrieveByPK($sOutDocUid); if (!is_null($oOutputDocument)) { - $outputName = $this->getOutDocTitle(); - $outputDesc = $this->getOutDocDescription(); - $outputFile = $this->getOutDocFilename(); $oConnection->begin(); Content::removeContent('OUT_DOC_TITLE', '', $oOutputDocument->getOutDocUid()); Content::removeContent('OUT_DOC_DESCRIPTION', '', $oOutputDocument->getOutDocUid()); Content::removeContent('OUT_DOC_FILENAME', '', $oOutputDocument->getOutDocUid()); Content::removeContent('OUT_DOC_TEMPLATE', '', $oOutputDocument->getOutDocUid()); $iResult = $oOutputDocument->delete(); - $oConnection->commit(); - //Add Audit Log - G::auditLog("DeleteOuputDocument", "Output Document Name: ".$outputName.", Output Document Uid: ".$sOutDocUid.", Description: ".$outputDesc.", Filename generated: ".$outputFile); + $oConnectutDocUid.")"); return $iResult; } else { From 905312a046a25d08de660866cd2c4210357988c4 Mon Sep 17 00:00:00 2001 From: dheeyi Date: Wed, 18 Feb 2015 15:46:59 -0400 Subject: [PATCH 045/155] PM-1583 Audit Log para Routing Rules, Start Event, End Event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Causa. Solo se tiene un auditLog para la seccion ADMIN. SolucióSe utiliza el metodo auditLog(), misma que es utilizado en la seccion ADMIN, mas especificamente se crea un auditlog para la seccion "Routing Rules" del Diseñr. --- .../engine/methods/patterns/patterns_Ajax.php | 242 +++++--------- .../methods/processes/processes_Ajax.php | 310 ++++-------------- workflow/engine/methods/tasks/tasks_Ajax.php | 18 +- 3 files changed, 162 insertions(+), 408 deletions(-) diff --git a/workflow/engine/methods/patterns/patterns_Ajax.php b/workflow/engine/methods/patterns/patterns_Ajax.php index dde6e728c..72aa99dcc 100755 --- a/workflow/engine/methods/patterns/patterns_Ajax.php +++ b/workflow/engine/methods/patterns/patterns_Ajax.php @@ -56,29 +56,10 @@ switch ($aData['action']) { break; case 'SELECT': $tasksAffected=''; - $sType = 'SELECT'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $aData['TASK'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleTask = $row['CON_VALUE']; + $oTaskSavePattern = new Task(); + $oTaskSavePattern->load($aData['TASK']); + $titleTask=$oTaskSavePattern->getTasTitle(); foreach ($aData['GRID_SELECT_TYPE'] as $iKey => $aRow) { - $sType = 'SELECT'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $aRow['ROU_NEXT_TASK'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleNextTask = $row['CON_VALUE']; /*if ($aRow['ROU_UID'] != '') { $aFields['ROU_UID'] = $aRow['ROU_UID']; @@ -91,52 +72,35 @@ switch ($aData['action']) { $aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION']; //$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER']; $rou_id = $oRoute->create( $aFields ); - if ($aRow['ROU_NEXT_TASK']=='-1') { - $tasksAffected.='From -> '.$titleTask.' To End Procces Condition -> '.$aFields['ROU_CONDITION'].' ; '; - }else{ - $tasksAffected.='From -> '.$titleTask.' To -> '.$titleNextTask.' Condition -> '.$aFields['ROU_CONDITION'].' ; '; - } + if ($aRow['ROU_NEXT_TASK']=='-1') { + if ($aRow['ROU_CONDITION']=='') { + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To End Procces Condition -> Empty; '; + }else{ + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To End Procces Condition -> '.$aFields['ROU_CONDITION'].' ; '; + } + }else{ + $oTaskSaveNextPattern = new Task(); + $oTaskSaveNextPattern->load($aRow['ROU_NEXT_TASK']); + $titleNextTask=$oTaskSaveNextPattern->getTasTitle(); + if ($aRow['ROU_CONDITION']=='') { + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To -> '.$titleNextTask.' : '.$aRow['ROU_NEXT_TASK'].' Condition -> Empty ; '; + }else{ + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To -> '.$titleNextTask.' : '.$aRow['ROU_NEXT_TASK'].' Condition -> '.$aFields['ROU_CONDITION'].' ; '; + } + } unset( $aFields ); - } - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); - $k->add(ContentPeer::CON_ID, $aData['PROCESS'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleProcess = $row['CON_VALUE']; - G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' ACTION : '.$aData['ROU_TYPE'].' Save Pattern DETAILS: ROU_TYPE_OLD -> '.$aData['ROU_TYPE_OLD']. ' ROU_TYPE_NEW ->'.$aData['ROU_TYPE']. ' '.$tasksAffected); + } + $oProcessNewPattern = new Process(); + $oProcessNewPattern->load($aData['PROCESS']); + $titleProcess=$oProcessNewPattern->getProTitle(); + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$aData['PROCESS'].' ACTION : '.$aData['ROU_TYPE'].' Save Pattern DETAILS: ROU_TYPE_OLD -> '.$aData['ROU_TYPE_OLD']. ' ROU_TYPE ->'.$aData['ROU_TYPE']. ' '.$tasksAffected); break; - case 'EVALUATE': + case 'EVALUATE': $tasksAffected=''; - $sType = 'SELECT'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $aData['TASK'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleTask = $row['CON_VALUE']; - - foreach ($aData['GRID_EVALUATE_TYPE'] as $iKey => $aRow) { - $sType = 'SELECT'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $aRow['ROU_NEXT_TASK'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleNextTask = $row['CON_VALUE']; - + $oTaskSavePattern = new Task(); + $oTaskSavePattern->load($aData['TASK']); + $titleTask=$oTaskSavePattern->getTasTitle(); + foreach ($aData['GRID_EVALUATE_TYPE'] as $iKey => $aRow) { /*if ($aRow['ROU_UID'] != '') { $aFields['ROU_UID'] = $aRow['ROU_UID']; @@ -148,51 +112,36 @@ switch ($aData['action']) { $aFields['ROU_TYPE'] = $aData['ROU_TYPE']; $aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION']; //$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER']; - $rou_id = $oRoute->create( $aFields ); - if ($aRow['ROU_NEXT_TASK']=='-1') { - $tasksAffected.='From -> '.$titleTask.' To End Procces Condition -> '.$aFields['ROU_CONDITION'].' ; '; - }else{ - $tasksAffected.='From -> '.$titleTask.' To -> '.$titleNextTask.' Condition -> '.$aFields['ROU_CONDITION'].' ; '; - } - unset( $aFields ); + $rou_id = $oRoute->create( $aFields ); + if ($aRow['ROU_NEXT_TASK']=='-1') { + if ($aRow['ROU_CONDITION']=='') { + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To End Procces Condition -> Empty; '; + }else{ + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To End Procces Condition -> '.$aFields['ROU_CONDITION'].' ; '; + } + }else{ + $oTaskSaveNextPattern = new Task(); + $oTaskSaveNextPattern->load($aRow['ROU_NEXT_TASK']); + $titleNextTask=$oTaskSaveNextPattern->getTasTitle(); + if ($aRow['ROU_CONDITION']=='') { + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To -> '.$titleNextTask.' : '.$aRow['ROU_NEXT_TASK'].' Condition -> Empty ; '; + }else{ + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To -> '.$titleNextTask.' : '.$aRow['ROU_NEXT_TASK'].' Condition -> '.$aFields['ROU_CONDITION'].' ; '; + } + } + unset( $aFields ); } - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); - $k->add(ContentPeer::CON_ID, $aData['PROCESS'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleProcess = $row['CON_VALUE']; - G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' ACTION : '.$aData['ROU_TYPE'].' Save Pattern DETAILS: ROU_TYPE_OLD -> '.$aData['ROU_TYPE_OLD']. ' ROU_TYPE_NEW ->'.$aData['ROU_TYPE']. ' '.$tasksAffected); + $oProcessNewPattern = new Process(); + $oProcessNewPattern->load($aData['PROCESS']); + $titleProcess=$oProcessNewPattern->getProTitle(); + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$aData['PROCESS'].' ACTION : '.$aData['ROU_TYPE'].' Save Pattern DETAILS: ROU_TYPE_OLD -> '.$aData['ROU_TYPE_OLD']. ' ROU_TYPE ->'.$aData['ROU_TYPE']. ' '.$tasksAffected); break; case 'PARALLEL': $tasksAffected=''; - $sType = 'SELECT'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $aData['TASK'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleTask = $row['CON_VALUE']; + $oTaskSavePattern = new Task(); + $oTaskSavePattern->load($aData['TASK']); + $titleTask=$oTaskSavePattern->getTasTitle(); foreach ($aData['GRID_PARALLEL_TYPE'] as $iKey => $aRow) { - $sType = 'SELECT'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $aRow['ROU_NEXT_TASK'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleNextTask = $row['CON_VALUE']; /*if ($aRow['ROU_UID'] != '') { $aFields['ROU_UID'] = $aRow['ROU_UID']; @@ -202,47 +151,24 @@ switch ($aData['action']) { $aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK']; $aFields['ROU_CASE'] = $iKey; $aFields['ROU_TYPE'] = $aData['ROU_TYPE']; - $rou_id = $oRoute->create( $aFields ); - $tasksAffected.='From -> '.$titleTask.' To -> '.$titleNextTask.' ; '; + $rou_id = $oRoute->create( $aFields ); + $oTaskSaveNextPattern = new Task(); + $oTaskSaveNextPattern->load($aRow['ROU_NEXT_TASK']); + $titleNextTask=$oTaskSaveNextPattern->getTasTitle(); + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To -> '.$titleNextTask.' : '.$aRow['ROU_NEXT_TASK'].' ; '; unset( $aFields ); } - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); - $k->add(ContentPeer::CON_ID, $aData['PROCESS'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleProcess = $row['CON_VALUE']; - G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' ACTION : '.$aData['ROU_TYPE'].' Save Pattern DETAILS: ROU_TYPE_OLD -> '.$aData['ROU_TYPE_OLD']. ' ROU_TYPE_NEW ->'.$aData['ROU_TYPE']. ' '.$tasksAffected); + $oProcessNewPattern = new Process(); + $oProcessNewPattern->load($aData['PROCESS']); + $titleProcess=$oProcessNewPattern->getProTitle(); + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$aData['PROCESS'].' ACTION : '.$aData['ROU_TYPE'].' Save Pattern DETAILS: ROU_TYPE_OLD -> '.$aData['ROU_TYPE_OLD']. ' ROU_TYPE ->'.$aData['ROU_TYPE']. ' '.$tasksAffected); break; case 'PARALLEL-BY-EVALUATION': $tasksAffected=''; - $sType = 'SELECT'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $aData['TASK'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleTask = $row['CON_VALUE']; + $oTaskSavePattern = new Task(); + $oTaskSavePattern->load($aData['TASK']); + $titleTask=$oTaskSavePattern->getTasTitle(); foreach ($aData['GRID_PARALLEL_EVALUATION_TYPE'] as $iKey => $aRow) { - $sType = 'SELECT'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $aRow['ROU_NEXT_TASK'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleNextTask = $row['CON_VALUE']; /*if ($aRow['ROU_UID'] != '') { $aFields['ROU_UID'] = $aRow['ROU_UID']; @@ -257,24 +183,28 @@ switch ($aData['action']) { if (isset( $aRow['ROU_OPTIONAL'] ) && trim( $aRow['ROU_OPTIONAL'] ) != '' && ($aRow['ROU_OPTIONAL'] === 'TRUE' || $aRow['ROU_OPTIONAL'] === 'FALSE')) $aFields['ROU_OPTIONAL'] = $aRow['ROU_OPTIONAL']; $rou_id = $oRoute->create( $aFields ); - if ($aRow['ROU_NEXT_TASK']=='-1') { - $tasksAffected.='From -> '.$titleTask.' To End Procces Condition -> '.$aFields['ROU_CONDITION'].' ; '; - }else{ - $tasksAffected.='From -> '.$titleTask.' To -> '.$titleNextTask.' Condition -> '.$aFields['ROU_CONDITION'].' ; '; - } + if ($aRow['ROU_NEXT_TASK']=='-1') { + if ($aRow['ROU_CONDITION']=='') { + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To End Procces Condition -> Empty; '; + }else{ + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To End Procces Condition -> '.$aFields['ROU_CONDITION'].' ; '; + } + }else{ + $oTaskSaveNextPattern = new Task(); + $oTaskSaveNextPattern->load($aRow['ROU_NEXT_TASK']); + $titleNextTask=$oTaskSaveNextPattern->getTasTitle(); + if ($aRow['ROU_CONDITION']=='') { + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To -> '.$titleNextTask.' : '.$aRow['ROU_NEXT_TASK'].' Condition -> Empty ; '; + }else{ + $tasksAffected.='From -> '.$titleTask.' : '.$aData['TASK'].' To -> '.$titleNextTask.' : '.$aRow['ROU_NEXT_TASK'].' Condition -> '.$aFields['ROU_CONDITION'].' ; '; + } + } unset( $aFields ); } - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); - $k->add(ContentPeer::CON_ID, $aData['PROCESS'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleProcess = $row['CON_VALUE']; - G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' ACTION : '.$aData['ROU_TYPE'].' Save Pattern DETAILS: ROU_TYPE_OLD -> '.$aData['ROU_TYPE_OLD']. ' ROU_TYPE_NEW ->'.$aData['ROU_TYPE']. ' '.$tasksAffected); + $oProcessNewPattern = new Process(); + $oProcessNewPattern->load($aData['PROCESS']); + $titleProcess=$oProcessNewPattern->getProTitle(); + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$aData['PROCESS'].' ACTION : '.$aData['ROU_TYPE'].' Save Pattern DETAILS: ROU_TYPE_OLD -> '.$aData['ROU_TYPE_OLD']. ' ROU_TYPE ->'.$aData['ROU_TYPE']. ' '.$tasksAffected); break; case 'DISCRIMINATOR': //Girish ->Added to save changes, while editing the route foreach ($aData['GRID_DISCRIMINATOR_TYPE'] as $iKey => $aRow) { diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index 6c5a486a1..3ac58f87f 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -262,266 +262,100 @@ try { break; case 'saveNewPattern': switch ($oData->type) { - case 0: - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->pro_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleProcess = $row['CON_VALUE']; - + case 0: $sType = 'SEQUENTIAL'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->tas_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleTask = $row['CON_VALUE']; - - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->next_task ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleNextTask = $row['CON_VALUE']; + $oProcessNewPattern = new Process(); + $oProcessNewPattern->load($oData->pro_uid); + $titleProcess=$oProcessNewPattern->getProTitle(); + $oTaskNewPattern = new Task(); + $oTaskNewPattern->load($oData->tas_uid); + $titleTask=$oTaskNewPattern->getTasTitle(); + $oTaskNextNewPattern = new Task(); + $oTaskNextNewPattern->load($oData->next_task); + $titleNextTask=$oTaskNextNewPattern->getTasTitle(); if ($titleNextTask=='') { - G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' ACTION : END OF PROCESS Task Name -> '.$titleTask); + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$oData->pro_uid.' ACTION : END OF PROCESS Task Name -> '.$titleTask.' : '.$oData->tas_uid); }else{ - G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' ACTION : SEQUENTIAL from -> '.$titleTask. ' To ->'.$titleNextTask); + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$oData->pro_uid.' ACTION : '.$sType.' from -> '.$titleTask.' : '.$oData->tas_uid.' To -> '.$titleNextTask.' : '.$oData->next_task); } break; case 1: - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->pro_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleProcess = $row['CON_VALUE']; - $sType = 'SELECT'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->tas_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleTask = $row['CON_VALUE']; - - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->next_task ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleNextTask = $row['CON_VALUE']; - G::auditLog("DerivationRule","PROCESS NAME : ".$titleProcess." ACTION : SELECT from -> ".$titleTask. " To ->".$titleNextTask); + $oProcessNewPattern = new Process(); + $oProcessNewPattern->load($oData->pro_uid); + $titleProcess=$oProcessNewPattern->getProTitle(); + $oTaskNewPattern = new Task(); + $oTaskNewPattern->load($oData->tas_uid); + $titleTask=$oTaskNewPattern->getTasTitle(); + $oTaskNextNewPattern = new Task(); + $oTaskNextNewPattern->load($oData->next_task); + $titleNextTask=$oTaskNextNewPattern->getTasTitle(); + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$oData->pro_uid.' ACTION : '.$sType.' from -> '.$titleTask.' : '.$oData->tas_uid.' To -> '.$titleNextTask.' : '.$oData->next_task); break; case 2: - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->pro_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleProcess = $row['CON_VALUE']; - $sType = 'EVALUATE'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->tas_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleTask = $row['CON_VALUE']; - - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->next_task ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleNextTask = $row['CON_VALUE']; - - G::auditLog("DerivationRule","PROCESS NAME : ".$titleProcess." ACTION : EVALUATE from -> ".$titleTask. " To ->".$titleNextTask); + $oProcessNewPattern = new Process(); + $oProcessNewPattern->load($oData->pro_uid); + $titleProcess=$oProcessNewPattern->getProTitle(); + $oTaskNewPattern = new Task(); + $oTaskNewPattern->load($oData->tas_uid); + $titleTask=$oTaskNewPattern->getTasTitle(); + $oTaskNextNewPattern = new Task(); + $oTaskNextNewPattern->load($oData->next_task); + $titleNextTask=$oTaskNextNewPattern->getTasTitle(); + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$oData->pro_uid.' ACTION : '.$sType.' from -> '.$titleTask.' : '.$oData->tas_uid.' To -> '.$titleNextTask.' : '.$oData->next_task); break; case 3: - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->pro_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleProcess = $row['CON_VALUE']; - $sType = 'PARALLEL'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->tas_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleTask = $row['CON_VALUE']; - - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->next_task ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleNextTask = $row['CON_VALUE']; - - G::auditLog("DerivationRule","PROCESS NAME : ".$titleProcess." ACTION : PARALLEL from -> ".$titleTask. " To ->".$titleNextTask); + $oProcessNewPattern = new Process(); + $oProcessNewPattern->load($oData->pro_uid); + $titleProcess=$oProcessNewPattern->getProTitle(); + $oTaskNewPattern = new Task(); + $oTaskNewPattern->load($oData->tas_uid); + $titleTask=$oTaskNewPattern->getTasTitle(); + $oTaskNextNewPattern = new Task(); + $oTaskNextNewPattern->load($oData->next_task); + $titleNextTask=$oTaskNextNewPattern->getTasTitle(); + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$oData->pro_uid.' ACTION : '.$sType.' from -> '.$titleTask.' : '.$oData->tas_uid.' To -> '.$titleNextTask.' : '.$oData->next_task); break; case 4: - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->pro_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleProcess = $row['CON_VALUE']; - $sType = 'PARALLEL-BY-EVALUATION'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->tas_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleTask = $row['CON_VALUE']; - - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->next_task ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleNextTask = $row['CON_VALUE']; - - G::auditLog("DerivationRule","PROCESS NAME : ".$titleProcess." ACTION : PARALLEL-BY-EVALUATION from -> ".$titleTask. " To ->".$titleNextTask); + $oProcessNewPattern = new Process(); + $oProcessNewPattern->load($oData->pro_uid); + $titleProcess=$oProcessNewPattern->getProTitle(); + $oTaskNewPattern = new Task(); + $oTaskNewPattern->load($oData->tas_uid); + $titleTask=$oTaskNewPattern->getTasTitle(); + $oTaskNextNewPattern = new Task(); + $oTaskNextNewPattern->load($oData->next_task); + $titleNextTask=$oTaskNextNewPattern->getTasTitle(); + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$oData->pro_uid.' ACTION : '.$sType.' from -> '.$titleTask.' : '.$oData->tas_uid.' To -> '.$titleNextTask.' : '.$oData->next_task); break; case 5: - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->pro_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleProcess = $row['CON_VALUE']; - $sType = 'SEC-JOIN'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->tas_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleTask = $row['CON_VALUE']; - - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->next_task ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleNextTask = $row['CON_VALUE']; - - G::auditLog("DerivationRule","PROCESS NAME : ".$titleProcess." ACTION : SEC-JOIN from -> ".$titleTask. " To ->".$titleNextTask); + $oProcessNewPattern = new Process(); + $oProcessNewPattern->load($oData->pro_uid); + $titleProcess=$oProcessNewPattern->getProTitle(); + $oTaskNewPattern = new Task(); + $oTaskNewPattern->load($oData->tas_uid); + $titleTask=$oTaskNewPattern->getTasTitle(); + $oTaskNextNewPattern = new Task(); + $oTaskNextNewPattern->load($oData->next_task); + $titleNextTask=$oTaskNextNewPattern->getTasTitle(); + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$oData->pro_uid.' ACTION : '.$sType.' from -> '.$titleTask.' : '.$oData->tas_uid.' To -> '.$titleNextTask.' : '.$oData->next_task); break; case 8: - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->pro_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleProcess = $row['CON_VALUE']; - $sType = 'DISCRIMINATOR'; - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->tas_uid ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleTask = $row['CON_VALUE']; - - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $oData->next_task ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleNextTask = $row['CON_VALUE']; - - G::auditLog("DerivationRule","PROCESS NAME : ".$titleProcess." ACTION : DISCRIMINATOR from -> ".$titleTask. " To ->".$titleNextTask); + $oProcessNewPattern = new Process(); + $oProcessNewPattern->load($oData->pro_uid); + $titleProcess=$oProcessNewPattern->getProTitle(); + $oTaskNewPattern = new Task(); + $oTaskNewPattern->load($oData->tas_uid); + $titleTask=$oTaskNewPattern->getTasTitle(); + $oTaskNextNewPattern = new Task(); + $oTaskNextNewPattern->load($oData->next_task); + $titleNextTask=$oTaskNextNewPattern->getTasTitle(); + G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$oData->pro_uid.' ACTION : '.$sType.' from -> '.$titleTask.' : '.$oData->tas_uid.' To -> '.$titleNextTask.' : '.$oData->next_task); break; } if (($oData->type != 0) && ($oData->type != 5) && ($oData->type != 8)) { diff --git a/workflow/engine/methods/tasks/tasks_Ajax.php b/workflow/engine/methods/tasks/tasks_Ajax.php index 14b0ee56c..28f8ef4e6 100755 --- a/workflow/engine/methods/tasks/tasks_Ajax.php +++ b/workflow/engine/methods/tasks/tasks_Ajax.php @@ -34,19 +34,6 @@ try { switch ($sAction) { case "saveTaskData": - $k = new Criteria('william'); - $k->clearSelectColumns(); - $k->addSelectColumn(ContentPeer::CON_VALUE); - $k->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); - $k->add(ContentPeer::CON_ID, $aData['TAS_UID'] ); - $rs = ContentPeer::doSelectRS($k); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $titleTask = $row['CON_VALUE']; - - G::auditLog("DerivationRule","STARTING PROCESS Task Name -> ".$titleTask); - require_once ("classes/model/Task.php"); $response = array (); @@ -128,7 +115,10 @@ try { $aData['TAS_GROUP_VARIABLE'] = ''; break; } - + $oTaskNewPattern = new Task(); + $oTaskNewPattern->load($aData['TAS_UID']); + $titleTask=$oTaskNewPattern->getTasTitle(); + G::auditLog("DerivationRule","ASSIGN STARTING TASK : Task Name -> ".$titleTask.' : '.$aData['TAS_UID']); $result = $oTask->update( $aData ); $response["status"] = "OK"; From 6577f219a06836f6280329c197279bcbb211714e Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Wed, 18 Feb 2015 15:49:39 -0400 Subject: [PATCH 046/155] OutputDocument --- workflow/engine/classes/model/OutputDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index a4c96bce7..c30b455c1 100755 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -227,7 +227,7 @@ class OutputDocument extends BaseOutputDocument } $iResult = $oOutputDocument->save(); - $oConnectOC_UID'].")"); + $oConnection->commit(); return $iResult; } else { From c1e95fe2d3bf81af9ce0f80d185b913a5c5dbca1 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Wed, 18 Feb 2015 15:58:46 -0400 Subject: [PATCH 047/155] I corrected only the Ouputdocument file --- .../engine/classes/model/OutputDocument.php | 63 ++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index c30b455c1..07e2d227f 100755 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -173,6 +173,34 @@ class OutputDocument extends BaseOutputDocument $iResult = $oOutputDocument->save(); $oConnection->commit(); + //Add Audit Log + $description = "Output Document Name: ".$aData['OUT_DOC_TITLE'].", Output Document Uid: ".$aData['OUT_DOC_UID'].", Filename generated: ".$aData['OUT_DOC_FILENAME']; + if(!empty($aData['OUT_DOC_DESCRIPTION'])){ + $description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION']; + } + $description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'].", Output Document to Generate: ".$aData['OUT_DOC_GENERATE']; + if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){ + $pdfSecurity = 'Disabled'; + }else{ + $pdfSecurity = 'Enabled'; + } + $description .= ", PDF Security: ".$pdfSecurity; + if(!empty($aData['OUT_DOC_VERSIONING'])){ + $description .= ", Enable Versioning: Yes"; + } + if(!empty($aData['OUT_DOC_DESTINATION_PATH'])){ + $description .= ", Destination Path: ".$aData['OUT_DOC_DESTINATION_PATH']; + } + if(!empty($aData['OUT_DOC_TAGS'])){ + $description .= ", Tags: ".$aData['OUT_DOC_TAGS']; + } + if($aData['OUT_DOC_OPEN_TYPE']==0){ + $genLink = 'Open the file'; + }else{ + $genLink = 'Download the file'; + } + $description .= ", By clicking on the generated file link: ".$genLink; + G::auditLog("CreateOuputDocument", $description); return $aData['OUT_DOC_UID']; } else { @@ -228,6 +256,37 @@ class OutputDocument extends BaseOutputDocument $iResult = $oOutputDocument->save(); $oConnection->commit(); + //Add Audit Log + $description = "Output Document Name: ".$aData['OUT_DOC_TITLE'].", Output Document Uid: ".$aData['OUT_DOC_UID'].", Filename generated: ".$aData['OUT_DOC_FILENAME']; + if(!empty($aData['OUT_DOC_DESCRIPTION'])){ + $description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION']; + } + $description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'].", Output Document to Generate: ".$aData['OUT_DOC_GENERATE']; + if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){ + $pdfSecurity = 'Disabled'; + }else{ + $pdfSecurity = 'Enabled'; + } + $description .= ", PDF Security: ".$pdfSecurity; + if(!empty($aData['OUT_DOC_VERSIONING'])){ + $description .= ", Enable Versioning: Yes"; + } + if(!empty($aData['OUT_DOC_DESTINATION_PATH'])){ + $description .= ", Destination Path: ".$aData['OUT_DOC_DESTINATION_PATH']; + } + if(!empty($aData['OUT_DOC_TAGS'])){ + $description .= ", Tags: ".$aData['OUT_DOC_TAGS']; + } + if($aData['OUT_DOC_OPEN_TYPE']==0){ + $genLink = 'Open the file'; + }else{ + $genLink = 'Download the file'; + } + $description .= ", By clicking on the generated file link: ".$genLink; + if (isset($aData['OUT_DOC_TEMPLATE'])) { + $description .= ", [EDIT TEMPLATE]"; + } + G::auditLog("UpdateOuputDocument", $description); return $iResult; } else { @@ -269,7 +328,9 @@ class OutputDocument extends BaseOutputDocument Content::removeContent('OUT_DOC_FILENAME', '', $oOutputDocument->getOutDocUid()); Content::removeContent('OUT_DOC_TEMPLATE', '', $oOutputDocument->getOutDocUid()); $iResult = $oOutputDocument->delete(); - $oConnectutDocUid.")"); + $oConnection->commit(); + //Add Audit Log + G::auditLog("DeleteOuputDocument", "Output Document Name: ".$outputName.", Output Document Uid: ".$sOutDocUid.", Description: ".$outputDesc.", Filename generated: ".$outputFile); return $iResult; } else { From 0c525246bf1739ebb13ec08e51a7960016314a25 Mon Sep 17 00:00:00 2001 From: "marcelo.cuiza" Date: Wed, 18 Feb 2015 17:17:28 -0400 Subject: [PATCH 048/155] PM-1585 Audit Log para todas las opciones del menu contextual del PROCESO --- .../engine/methods/events/eventsDelete.php | 12 ++--- workflow/engine/methods/events/eventsSave.php | 6 +-- .../engine/methods/events/triggersSave.php | 12 ++--- .../methods/processes/processes_Ajax.php | 23 +++++--- .../methods/processes/processes_Save.php | 54 ++++++++++++++++++- .../processes_SaveObjectPermission.php | 3 +- 6 files changed, 78 insertions(+), 32 deletions(-) diff --git a/workflow/engine/methods/events/eventsDelete.php b/workflow/engine/methods/events/eventsDelete.php index 33af91bfe..373883cbf 100755 --- a/workflow/engine/methods/events/eventsDelete.php +++ b/workflow/engine/methods/events/eventsDelete.php @@ -28,15 +28,9 @@ if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) { die(); } -$k = new Criteria('workflow'); -$k->clearSelectColumns(); -$k->addSelectColumn(EventPeer::PRO_UID); -$k->add(EventPeer::EVN_UID, $_POST['EVN_UID'] ); -$rs = EventPeer::doSelectRS($k); -$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); -$rs->next(); -$row = $rs->getRow(); -$proUid = $row['PRO_UID']; +$eventInstance = new Event(); +$eventFields = $eventInstance->load($_POST['EVN_UID']); +$proUid = $eventFields['PRO_UID']; $infoProcess = new Process(); $resultProcess = $infoProcess->load($proUid); diff --git a/workflow/engine/methods/events/eventsSave.php b/workflow/engine/methods/events/eventsSave.php index ad8bf2ef5..eff6a99db 100755 --- a/workflow/engine/methods/events/eventsSave.php +++ b/workflow/engine/methods/events/eventsSave.php @@ -59,9 +59,9 @@ if ($_POST['form']['EVN_UID'] == '') { */ $oEvent->update( $_POST['form'] ); } -$infoProcess = new Processes(); -$proFields = $infoProcess->serializeProcess($_POST['form']['PRO_UID']); -$resultProcess = $infoProcess->saveSerializedProcess($proFields); + +$infoProcess = new Process(); +$resultProcess = $infoProcess->load($_POST['form']['PRO_UID']); G::auditLog('Events','Save intermediate message ('.$_POST['form']['EVN_UID'].') in process "'.$resultProcess['PRO_TITLE'].'"'); function replaceQuotes ($aData) diff --git a/workflow/engine/methods/events/triggersSave.php b/workflow/engine/methods/events/triggersSave.php index 7e602d9d1..d16381f75 100755 --- a/workflow/engine/methods/events/triggersSave.php +++ b/workflow/engine/methods/events/triggersSave.php @@ -36,17 +36,11 @@ if ($_POST['form']['TRI_UID'] != '') { $oTrigger->update( $_POST['form'] ); -$k = new Criteria('workflow'); -$k->clearSelectColumns(); -$k->addSelectColumn(TriggersPeer::PRO_UID); -$k->add(TriggersPeer::TRI_UID, $_POST['form']['TRI_UID'] ); -$rs = TriggersPeer::doSelectRS($k); -$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); -$rs->next(); -$row = $rs->getRow(); -$proUid = $row['PRO_UID']; +$triggerFields = $oTrigger->load($_POST['form']['TRI_UID']); +$proUid = $triggerFields['PRO_UID']; $infoProcess = new Process(); $resultProcess = $infoProcess->load($proUid); + G::auditLog('Events','Save event ('.$_POST['form']['TRI_UID'].') in process "'.$resultProcess['PRO_TITLE'].'"'); diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index 88c73acc6..d5b56d99c 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -91,11 +91,13 @@ try { $c = new Criteria('workflow'); $c->clearSelectColumns(); $c->addSelectColumn(ProcessUserPeer::PRO_UID); + $c->addSelectColumn(ProcessUserPeer::USR_UID); $c->add(ProcessUserPeer::PU_UID, $oData->PU_UID); $oDataset = AppDelegationPeer::doSelectRS($c); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $row = $oDataset->getRow(); + $userSupervisor = $row['USR_UID']; G::LoadClass('processes'); $infoProcess = new Processes(); @@ -123,6 +125,7 @@ try { $resultProcess = $infoProcess->updateProcessRow($valuesProcess); $resultProcess = $infoProcess->getProcessRow($proUid); } + //G::LoadClass( 'processMap' ); $oProcessMap = new processMap(new DBConnection()); @@ -192,7 +195,7 @@ try { G::LoadClass('processMap'); $oProcessMap = new ProcessMap(); $oProcessMap->listProcessesUser($oData->PRO_UID); - G::auditLog('AssignRole','Assign new supervisor in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('AssignRole','Assign new supervisor ('.$oData->USR_UID.') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'removeProcessUser': $oProcessMap->removeProcessUser($oData->PU_UID); @@ -203,7 +206,7 @@ try { } } - G::auditLog('RemoveUser','Remove supervisor in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('RemoveUser','Remove supervisor ('.$userSupervisor.') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'supervisorDynaforms': $oProcessMap->supervisorDynaforms($oData->pro_uid); @@ -267,7 +270,9 @@ try { break; case 'addGuide': $sOutput = $oProcessMap->addGuide($oData->uid, $oData->position, $oData->direction); - G::auditLog('Add'.ucwords($oDataAux['direction']).'Line','Add '.$oDataAux['direction'].' line in process "'.$resultProcess['PRO_TITLE'].'"'); + $sOutputAux = G::json_decode($sOutput); + $sOutputAux = (array)$sOutputAux; + G::auditLog('Add'.ucwords($oDataAux['direction']).'Line','Add '.$oDataAux['direction'].' line ('.$sOutputAux['uid'].') in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'saveGuidePosition': $sOutput = $oProcessMap->saveGuidePosition($oData->uid, $oData->position, $oData->direction); @@ -275,7 +280,7 @@ try { break; case 'deleteGuide': $sOutput = $oProcessMap->deleteGuide($oData->uid); - G::auditLog('DeleteLine','Delete line in process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('DeleteLine','Delete line ('.$oData->uid.') in process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'deleteGuides': $sOutput = $oProcessMap->deleteGuides($oData->pro_uid); @@ -283,19 +288,21 @@ try { break; case 'addText': $sOutput = $oProcessMap->addText($oData->uid, $oData->label, $oData->position->x, $oData->position->y); - G::auditLog('AddText','Add new text ('.$oDataAux['label'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); + $sOutputAux = G::json_decode($sOutput); + $sOutputAux = (array)$sOutputAux; + G::auditLog('AddText','Add new text ('.$sOutputAux['uid'].') in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'updateText': $sOutput = $oProcessMap->updateText($oData->uid, $oData->label); - G::auditLog('UpdateText','Edit text ('.$oDataAux['label'].' ) in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('UpdateText','Edit text ('.$oData->uid.' ) in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'saveTextPosition': $sOutput = $oProcessMap->saveTextPosition($oData->uid, $oData->position->x, $oData->position->y); - G::auditLog('SaveTextPosition','Change text position in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('SaveTextPosition','Change text position ('.$oData->uid.' ) in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'deleteText': $sOutput = $oProcessMap->deleteText($oData->uid); - G::auditLog('DeleteText','Delete text in Process "'.$resultProcess['PRO_TITLE'].'"'); + G::auditLog('DeleteText','Delete text ('.$oData->uid.' ) in Process "'.$resultProcess['PRO_TITLE'].'"'); break; case 'dynaforms': $oProcessMap->dynaformsList($oData->pro_uid); diff --git a/workflow/engine/methods/processes/processes_Save.php b/workflow/engine/methods/processes/processes_Save.php index eef57ac1e..6678ce79e 100755 --- a/workflow/engine/methods/processes/processes_Save.php +++ b/workflow/engine/methods/processes/processes_Save.php @@ -30,7 +30,8 @@ //G::LoadThirdParty( 'pear/json', 'class.json' ); $function = isset( $_POST['function'] ) ? $_POST['function'] : ''; - +$infoProcess = new Process(); +$resultProcessOld = $infoProcess->load($_POST['form']['PRO_UID']); switch ($function) { case 'lookForNameProcess': require_once 'classes/model/Content.php'; @@ -92,4 +93,53 @@ switch ($function) { break; } -G::auditLog('EditProcess','Edit Process "'.$_POST['form']['PRO_TITLE'].'"'); \ No newline at end of file +$resultProcessNew = $infoProcess->load($_POST['form']['PRO_UID']); +$oldFields = array_diff_assoc($resultProcessOld,$resultProcessNew); +$newFields = array_diff_assoc($resultProcessNew,$resultProcessOld); + +if(array_key_exists('PRO_TITLE', $newFields)) { + $fields[] = G::LoadTranslation('ID_TITLE'); +} +if(array_key_exists('PRO_DESCRIPTION', $newFields)) { + $fields[] = G::LoadTranslation('ID_DESCRIPTION'); +} +if(array_key_exists('PRO_CALENDAR', $newFields)) { + $fields[] = G::LoadTranslation('ID_CALENDAR'); +} +if(array_key_exists('PRO_CATEGORY', $newFields)) { + $fields[] = "Process Category"; +} +if(array_key_exists('PRO_SUMMARY_DYNAFORM', $newFields)) { + $fields[] = "Dynaform to show a case summary"; +} +if(array_key_exists('PRO_DERIVATION_SCREEN_TPL', $newFields)) { + $fields[] = "Routing Screen Template"; +} +if(array_key_exists('PRO_DEBUG', $newFields)) { + $fields[] = G::LoadTranslation('ID_PRO_DEBUG'); +} +if(array_key_exists('PRO_SHOW_MESSAGE', $newFields)) { + $fields[] = "Hide the case number and the case title in the steps"; +} +if(array_key_exists('PRO_SUBPROCESS', $newFields)) { + $fields[] = "This a sub process"; +} +if(array_key_exists('PRO_TRI_DELETED', $newFields)) { + $fields[] = "Execute a trigger when a case is deleted"; +} +if(array_key_exists('PRO_TRI_CANCELED', $newFields)) { + $fields[] = "Execute a trigger when a case is canceled"; +} +if(array_key_exists('PRO_TRI_PAUSED', $newFields)) { + $fields[] = "Execute a trigger when a case is paused"; +} +if(array_key_exists('PRO_TRI_REASSIGNED', $newFields)) { + $fields[] = "Execute a trigger when a case is reassigned"; G +} +if(array_key_exists('PRO_TRI_UNPAUSED', $newFields)) { + $fields[] = "Execute a trigger when a case is unpaused"; +} +if(array_key_exists('PRO_TYPE_PROCESS', $newFields)) { + $fields[] = "Type of process (only owners can edit private processes)"; +} +G::auditLog('EditProcess','Edit fields ('.implode(', ',$fields).') in process "'.$_POST['form']['PRO_TITLE'].'"'); \ No newline at end of file diff --git a/workflow/engine/methods/processes/processes_SaveObjectPermission.php b/workflow/engine/methods/processes/processes_SaveObjectPermission.php index e606bcfb9..11d6c50d9 100755 --- a/workflow/engine/methods/processes/processes_SaveObjectPermission.php +++ b/workflow/engine/methods/processes/processes_SaveObjectPermission.php @@ -79,4 +79,5 @@ $oProcessMap->getObjectsPermissionsCriteria( $sValue['PRO_UID'] ); $infoProcess = new Processes(); $resultProcess = $infoProcess->getProcessRow($sValue['PRO_UID']); -G::auditLog('ProcessPermissions','Add Permission "'.$sValue['OP_OBJ_TYPE'].'" in Process "'.$resultProcess['PRO_TITLE'].'"'); +$participation = $sValue['OP_PARTICIPATE'] == 1 ? "YES" : "NO"; +G::auditLog('ProcessPermissions','Add Permission (group or user: '.end(explode( '|', $sValue['GROUP_USER'] )).', permission: '.$sValue['OP_ACTION'].', status case: '.$sValue['OP_CASE_STATUS'].', type: '.$sValue['OP_OBJ_TYPE'].', participation required: '.$participation.') in Process "'.$resultProcess['PRO_TITLE'].'"'); From 39fdd11d809d74ef70741c551993970327a52760 Mon Sep 17 00:00:00 2001 From: Richard Yujra Date: Wed, 18 Feb 2015 18:52:43 -0400 Subject: [PATCH 049/155] support for ie8 PMDynaform --- workflow/engine/js/cases/core/cases_Step_Pmdynaform.js | 4 ++-- workflow/engine/templates/cases/cases_Step_Pmdynaform.html | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js b/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js index 0f6af810f..8595a60b6 100644 --- a/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js +++ b/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js @@ -22,10 +22,10 @@ function dynaFormChanged(frm) { return false; } $(window).load(function () { - if ((navigator.userAgent.indexOf("MSIE") !== -1) || (navigator.userAgent.indexOf("Trident") !== -1)) { + /*if ((navigator.userAgent.indexOf("MSIE") !== -1) || (navigator.userAgent.indexOf("Trident") !== -1)) { document.body.innerHTML = "
Responsive Dynaforms are not supported in this browser.
"; return; - } + }*/ if (pm_run_outside_main_app === 'true') { if (parent.showCaseNavigatorPanel) { parent.showCaseNavigatorPanel('DRAFT'); diff --git a/workflow/engine/templates/cases/cases_Step_Pmdynaform.html b/workflow/engine/templates/cases/cases_Step_Pmdynaform.html index 8fabe6c67..fb7c8528c 100644 --- a/workflow/engine/templates/cases/cases_Step_Pmdynaform.html +++ b/workflow/engine/templates/cases/cases_Step_Pmdynaform.html @@ -13,10 +13,15 @@ +
###TEMPLATES### + - + +
diff --git a/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html b/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html index e40bb2118..ce7acbd52 100644 --- a/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html +++ b/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html @@ -13,10 +13,13 @@ + +
###TEMPLATES### + diff --git a/workflow/engine/templates/cases/cases_Step_Pmdynaform_View.html b/workflow/engine/templates/cases/cases_Step_Pmdynaform_View.html index 9be9e56f3..0a5e455b7 100644 --- a/workflow/engine/templates/cases/cases_Step_Pmdynaform_View.html +++ b/workflow/engine/templates/cases/cases_Step_Pmdynaform_View.html @@ -13,10 +13,13 @@ + +
###TEMPLATES### + Cause: En Front-end no se esta validando este campo cuando se ingresa texto con el tag Cause: En Front-end no se esta validando este campo cuando se ingresa texto con el tag \n"; + + $file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/pmdynaform.html'); + $file = str_replace("{javascript}", $javascrip, $file); + + $this->debug(); echo $file; exit(); } @@ -235,34 +222,43 @@ class pmDynaform public function printEdit($pm_run_outside_main_app, $application, $headData, $step_mode = 'EDIT') { ob_clean(); - $this->mergeDynContentAppData($application, $this->items); - - $a = $this->clientToken(); - $clientToken = array( - "accessToken" => $a["access_token"], - "expiresIn" => $a["expires_in"], - "tokenType" => $a["token_type"], - "scope" => $a["scope"], - "refreshToken" => $a["refresh_token"], - "clientId" => $a["client_id"], - "clientSecret" => $a["client_secret"] - ); + $json = G::json_decode($this->record["DYN_CONTENT"]); + $this->jsonr($json); + $javascrip = "" . + "\n" . + "\n" . + "\n" . + "\n" . + " \n" . + " \n" . + " \n" . + "
" . $headData["CASE"] . " #: " . $headData["APP_NUMBER"] . "     " . $headData["TITLE"] . ": " . $headData["APP_TITLE"] . "
\n" . + "
\n" . + "  \n" . + " \n" . + " \n" . + "  \n" . + " \n" . + " Next Step\n" . + " \n" . + "
"; - $file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform.html'); - $file = str_replace("{JSON_DATA}", $this->record["DYN_CONTENT"], $file); - $file = str_replace("{CASE}", $headData["CASE"], $file); - $file = str_replace("{APP_NUMBER}", $headData["APP_NUMBER"], $file); - $file = str_replace("{TITLE}", $headData["TITLE"], $file); - $file = str_replace("{APP_TITLE}", $headData["APP_TITLE"], $file); - $file = str_replace("{PM_RUN_OUTSIDE_MAIN_APP}", $pm_run_outside_main_app, $file); - $file = str_replace("{DYN_UID}", $this->dyn_uid, $file); - $file = str_replace("{DYNAFORMNAME}", $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"], $file); - $file = str_replace("{APP_UID}", $application, $file); - $file = str_replace("{PRJ_UID}", $this->app_data["PROCESS"], $file); - $file = str_replace("{STEP_MODE}", $step_mode, $file); - $file = str_replace("{WORKSPACE}", $this->app_data["SYS_SYS"], $file); - $file = str_replace("{PORT}", $_SERVER["SERVER_PORT"] , $file); - $file = str_replace("{credentials}", G::json_encode($clientToken), $file); + $file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/pmdynaform.html'); + $file = str_replace("{javascript}", $javascrip, $file); + + $this->debug(); echo $file; exit(); } @@ -270,25 +266,51 @@ class pmDynaform public function printWebEntry($filename) { ob_clean(); - $a = $this->clientToken(); - $clientToken = array( - "accessToken" => $a["access_token"], - "expiresIn" => $a["expires_in"], - "tokenType" => $a["token_type"], - "scope" => $a["scope"], - "refreshToken" => $a["refresh_token"], - "clientId" => $a["client_id"], - "clientSecret" => $a["client_secret"] - ); - $file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/WebEntry_Pmdynaform.html'); - $file = str_replace("{JSON_DATA}", $this->record["DYN_CONTENT"], $file); - $file = str_replace("{DYN_UID}", $this->dyn_uid, $file); - $file = str_replace("{PRJ_UID}",$this->record["PRO_UID"], $file); - $file = str_replace("{WORKSPACE}", SYS_SYS, $file); - $file = str_replace("{FILEPOST}", $filename, $file); - $file = str_replace("{PORT}", $_SERVER["SERVER_PORT"] , $file); - $file = str_replace("{credentials}", G::json_encode($clientToken), $file); - $file = str_replace("{FIELDSREQUIRED}", G::json_encode($this->arrayFieldRequired), $file); + $json = G::json_decode($this->record["DYN_CONTENT"]); + $this->jsonr($json); + $javascrip = "" . + "\n" . + "\n" . + "
\n" . + "  \n" . + " \n" . + " Next Step\n" . + " \n" . + "
"; + + $file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/pmdynaform.html'); + $file = str_replace("{javascript}", $javascrip, $file); + + $this->debug(); + echo $file; + exit(); + } + + public function printPmDynaform() + { + $json = G::json_decode($this->record["DYN_CONTENT"]); + $this->jsonr($json); + $javascrip = "" . + ""; + + $file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/pmdynaform.html'); + $file = str_replace("{javascript}", $javascrip, $file); + + $this->debug(); echo $file; exit(); } @@ -360,4 +382,13 @@ class pmDynaform return array('dsn' => $dsn, 'username' => DB_USER, 'password' => DB_PASS); } + private function debug() + { + if ($this->debugMode) { + echo "
";
+            echo G::json_encode($json);
+            echo "
"; + } + } + } diff --git a/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js b/workflow/engine/js/cases/core/pmDynaform.js similarity index 88% rename from workflow/engine/js/cases/core/cases_Step_Pmdynaform.js rename to workflow/engine/js/cases/core/pmDynaform.js index e3c6fefdd..62030d439 100644 --- a/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js +++ b/workflow/engine/js/cases/core/pmDynaform.js @@ -26,14 +26,13 @@ $(window).load(function () { if (parent.showCaseNavigatorPanel) { parent.showCaseNavigatorPanel('DRAFT'); } - if (parent.setCurrent) { parent.setCurrent(dyn_uid); } } - var data = jsondata; - data.items[0].mode = step_mode.toLowerCase(); + if (step_mode) + data.items[0].mode = step_mode.toLowerCase(); window.project = new PMDynaform.core.Project({ data: data, keys: { @@ -69,8 +68,12 @@ $(window).load(function () { appuid.type = "hidden"; appuid.name = "APP_UID"; appuid.value = app_uid; + var arrayRequired = document.createElement("input"); + arrayRequired.type = "hidden"; + arrayRequired.name = "DynaformRequiredFields"; + arrayRequired.value = fieldsRequired; var form = document.getElementsByTagName("form")[0]; - form.action = "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid; + form.action = filePost ? filePost : "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid; form.method = "post"; form.enctype = "multipart/form-data"; form.appendChild(type); @@ -79,7 +82,7 @@ $(window).load(function () { form.appendChild(action); form.appendChild(dynaformname); form.appendChild(appuid); - + form.appendChild(arrayRequired); var dyn_forward = document.getElementById("dyn_forward"); dyn_forward.onclick = function () { form.submit(); diff --git a/workflow/engine/js/cases/core/webentry_pmdynaform.js b/workflow/engine/js/cases/core/webentry_pmdynaform.js deleted file mode 100644 index 65b358f90..000000000 --- a/workflow/engine/js/cases/core/webentry_pmdynaform.js +++ /dev/null @@ -1,86 +0,0 @@ -function dynaFormChanged(frm) { - for (var i1 = 0; i1 <= frm.elements.length - 1; i1++) { - if ((frm.elements[i1].type === "radio" || frm.elements[i1].type === "checkbox") && (frm.elements[i1].checked !== frm.elements[i1].defaultChecked)) { - return true; - } - if ((frm.elements[i1].type === "textarea" || frm.elements[i1].type === "text" || frm.elements[i1].type === "file") && (frm.elements[i1].value !== frm.elements[i1].defaultValue)) { - return true; - } - if (frm.elements[i1].tagName.toLowerCase() === "select") { - var selectDefaultValue = frm.elements[i1].value; - for (var i2 = 0; i2 <= frm.elements[i1].options.length - 1; i2++) { - if (frm.elements[i1].options[i2].defaultSelected) { - selectDefaultValue = frm.elements[i1].options[i2].value; - break; - } - } - if (frm.elements[i1].value !== selectDefaultValue) { - return true; - } - } - } - return false; -} -$(window).load(function () { - /*if ((navigator.userAgent.indexOf("MSIE") !== -1) || (navigator.userAgent.indexOf("Trident") !== -1)) { - document.body.innerHTML = "
Responsive Dynaforms are not supported in this browser.
"; - return; - }*/ - var data = jsondata; - window.project = new PMDynaform.core.Project({ - data: data, - keys: { - server: location.host, - projectId: prj_uid, - workspace: workspace - }, - token: credentials, - submitRest: false - }); - - var type = document.createElement("input"); - type.type = "hidden"; - type.name = "TYPE"; - type.value = "ASSIGN_TASK"; - var uid = document.createElement("input"); - uid.type = "hidden"; - uid.name = "UID"; - uid.value = dyn_uid; - var position = document.createElement("input"); - position.type = "hidden"; - position.name = "POSITION"; - position.value = "10000"; - var action = document.createElement("input"); - action.type = "hidden"; - action.name = "ACTION"; - action.value = "ASSIGN"; - var dynaformname = document.createElement("input"); - dynaformname.type = "hidden"; - dynaformname.name = "__DynaformName__"; - //dynaformname.value = __DynaformName__; - var appuid = document.createElement("input"); - appuid.type = "hidden"; - appuid.name = "APP_UID"; - - var arrayRequired = document.createElement("input"); - arrayRequired.type = "hidden"; - arrayRequired.name = "DynaformRequiredFields"; - arrayRequired.value = fieldsRequired; - //appuid.value = app_uid; - var form = document.getElementsByTagName("form")[0]; - form.action = filePost; - form.method = "post"; - form.appendChild(type); - form.appendChild(uid); - form.appendChild(position); - form.appendChild(action); - form.appendChild(dynaformname); - form.appendChild(appuid); - form.appendChild(arrayRequired); - - var dyn_forward = document.getElementById("dyn_forward"); - dyn_forward.onclick = function () { - form.submit(); - return false; - }; -}); \ No newline at end of file diff --git a/workflow/engine/methods/cases/pmDynaform.php b/workflow/engine/methods/cases/pmDynaform.php new file mode 100644 index 000000000..90a97bf9c --- /dev/null +++ b/workflow/engine/methods/cases/pmDynaform.php @@ -0,0 +1,6 @@ +printPmDynaform(); diff --git a/workflow/engine/templates/cases/WebEntry_Pmdynaform.html b/workflow/engine/templates/cases/WebEntry_Pmdynaform.html deleted file mode 100644 index d55f866f5..000000000 --- a/workflow/engine/templates/cases/WebEntry_Pmdynaform.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - PMDynaform - - - - - - - - - - - - - -
- ###TEMPLATES### - - - - - - - - -
-
-   - - -   - - Next Step - -
- - diff --git a/workflow/engine/templates/cases/cases_Step_Pmdynaform.html b/workflow/engine/templates/cases/cases_Step_Pmdynaform.html deleted file mode 100644 index d0e8be781..000000000 --- a/workflow/engine/templates/cases/cases_Step_Pmdynaform.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - PMDynaform - - - - - - - - - - - - - - - -
- ###TEMPLATES### - - - - - - - - - -
{CASE} #: {APP_NUMBER}     {TITLE}: {APP_TITLE}
-
-   - - -   - - Next Step - -
- - diff --git a/workflow/engine/templates/cases/cases_Step_Pmdynaform_View.html b/workflow/engine/templates/cases/cases_Step_Pmdynaform_View.html deleted file mode 100644 index 3095232ed..000000000 --- a/workflow/engine/templates/cases/cases_Step_Pmdynaform_View.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - PMDynaform - - - - - - - - - - - - - - - -
- ###TEMPLATES### - - - - - diff --git a/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html b/workflow/engine/templates/cases/pmdynaform.html similarity index 85% rename from workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html rename to workflow/engine/templates/cases/pmdynaform.html index ce7acbd52..e3920be59 100644 --- a/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html +++ b/workflow/engine/templates/cases/pmdynaform.html @@ -13,13 +13,13 @@ - - + +
###TEMPLATES### - + {javascript} diff --git a/workflow/engine/templates/processes/wsClient.php b/workflow/engine/templates/processes/wsClient.php index 9247e5131..45b8f5af6 100644 --- a/workflow/engine/templates/processes/wsClient.php +++ b/workflow/engine/templates/processes/wsClient.php @@ -27,7 +27,7 @@ function parseItemArray($array) { * @return array of objects */ function convertFormToWSObjects($form) { - + $aVariables = array(); foreach ( $form as $key => $val ) { if (! is_array($val)) { //Normal Variables $obj = new stdClass(); diff --git a/workflow/engine/test/unit/ws/wsClient.php b/workflow/engine/test/unit/ws/wsClient.php index 9247e5131..45b8f5af6 100755 --- a/workflow/engine/test/unit/ws/wsClient.php +++ b/workflow/engine/test/unit/ws/wsClient.php @@ -27,7 +27,7 @@ function parseItemArray($array) { * @return array of objects */ function convertFormToWSObjects($form) { - + $aVariables = array(); foreach ( $form as $key => $val ) { if (! is_array($val)) { //Normal Variables $obj = new stdClass(); From 23d5a6708a131949351b802062dba624456cf5bf Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Mon, 2 Mar 2015 11:10:40 -0400 Subject: [PATCH 127/155] List issues --- workflow/engine/classes/class.case.php | 1 + workflow/engine/classes/class.configuration.php | 2 +- workflow/engine/classes/class.derivation.php | 1 + workflow/engine/classes/model/AppDelegation.php | 1 + workflow/engine/classes/model/ListInbox.php | 1 - workflow/engine/classes/model/ListParticipatedLast.php | 2 +- workflow/engine/classes/model/map/ListInboxMapBuilder.php | 1 - .../engine/classes/model/map/ListParticipatedLastMapBuilder.php | 1 - workflow/engine/classes/model/om/BaseListInbox.php | 1 + workflow/engine/classes/model/om/BaseListInboxPeer.php | 2 ++ workflow/engine/classes/model/om/BaseListParticipatedLast.php | 1 + .../engine/classes/model/om/BaseListParticipatedLastPeer.php | 1 + workflow/engine/methods/cases/casesListExtJs.php | 1 + workflow/engine/src/ProcessMaker/BusinessModel/Lists.php | 2 +- workflow/engine/templates/cases/casesList.js | 1 - workflow/engine/xmlform/cases/cases_Resume.xml | 1 + workflow/engine/xmlform/cases/cases_Resume_Current_Task.xml | 1 + .../engine/xmlform/cases/cases_Resume_Current_Task_Title.xml | 1 + 18 files changed, 15 insertions(+), 7 deletions(-) diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index 15c88c33a..37c4ad3f1 100755 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -1066,6 +1066,7 @@ class Cases } $inbox = new ListInbox(); $inbox->update($Fields); + /*----------------------------------********---------------------------------*/ //Return diff --git a/workflow/engine/classes/class.configuration.php b/workflow/engine/classes/class.configuration.php index ad15414f6..86c626e4c 100755 --- a/workflow/engine/classes/class.configuration.php +++ b/workflow/engine/classes/class.configuration.php @@ -654,7 +654,7 @@ class Configurations // extends Configuration * @param string $translation Translation * @return array Return the fields and configuration * - */ + */ public function casesListDefaultFieldsAndConfig($action, $translation = 1) { $caseColumns = array(); diff --git a/workflow/engine/classes/class.derivation.php b/workflow/engine/classes/class.derivation.php index df5d8ddd5..d0a9dbf47 100755 --- a/workflow/engine/classes/class.derivation.php +++ b/workflow/engine/classes/class.derivation.php @@ -975,6 +975,7 @@ class Derivation /*----------------------------------********---------------------------------*/ $inbox = new ListInbox(); $inbox->update($aParentCase); + /*----------------------------------********---------------------------------*/ //Update table SUB_APPLICATION $oSubApplication = new SubApplication(); diff --git a/workflow/engine/classes/model/AppDelegation.php b/workflow/engine/classes/model/AppDelegation.php index defb92132..692f3c045 100755 --- a/workflow/engine/classes/model/AppDelegation.php +++ b/workflow/engine/classes/model/AppDelegation.php @@ -159,6 +159,7 @@ class AppDelegation extends BaseAppDelegation $res = $this->toArray(BasePeer::TYPE_FIELDNAME); $inbox->newRow($this->toArray(BasePeer::TYPE_FIELDNAME), $delPreviusUsrUid); } + /*----------------------------------********---------------------------------*/ } catch (PropelException $e) { throw ($e); diff --git a/workflow/engine/classes/model/ListInbox.php b/workflow/engine/classes/model/ListInbox.php index a21eb5363..746960171 100644 --- a/workflow/engine/classes/model/ListInbox.php +++ b/workflow/engine/classes/model/ListInbox.php @@ -2,7 +2,6 @@ require_once 'classes/model/om/BaseListInbox.php'; - /** * Skeleton subclass for representing a row from the 'LIST_INBOX' table. * diff --git a/workflow/engine/classes/model/ListParticipatedLast.php b/workflow/engine/classes/model/ListParticipatedLast.php index dda3ccad1..ba9b74f87 100644 --- a/workflow/engine/classes/model/ListParticipatedLast.php +++ b/workflow/engine/classes/model/ListParticipatedLast.php @@ -13,7 +13,7 @@ require_once 'classes/model/om/BaseListParticipatedLast.php'; * long as it does not already exist in the output directory. * * @package classes.model - */ +*/ class ListParticipatedLast extends BaseListParticipatedLast { /** diff --git a/workflow/engine/classes/model/map/ListInboxMapBuilder.php b/workflow/engine/classes/model/map/ListInboxMapBuilder.php index 058cd03c7..0eeb6be5c 100644 --- a/workflow/engine/classes/model/map/ListInboxMapBuilder.php +++ b/workflow/engine/classes/model/map/ListInboxMapBuilder.php @@ -3,7 +3,6 @@ require_once 'propel/map/MapBuilder.php'; include_once 'creole/CreoleTypes.php'; - /** * This class adds structure of 'LIST_INBOX' table to 'workflow' DatabaseMap object. * diff --git a/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php b/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php index b410439cf..dc3ed4563 100644 --- a/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php +++ b/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php @@ -3,7 +3,6 @@ require_once 'propel/map/MapBuilder.php'; include_once 'creole/CreoleTypes.php'; - /** * This class adds structure of 'LIST_PARTICIPATED_LAST' table to 'workflow' DatabaseMap object. * diff --git a/workflow/engine/classes/model/om/BaseListInbox.php b/workflow/engine/classes/model/om/BaseListInbox.php index 9eadd7cb9..1c2bacdd4 100644 --- a/workflow/engine/classes/model/om/BaseListInbox.php +++ b/workflow/engine/classes/model/om/BaseListInbox.php @@ -9,6 +9,7 @@ include_once 'propel/util/Criteria.php'; include_once 'classes/model/ListInboxPeer.php'; + /** * Base class that represents a row from the 'LIST_INBOX' table. * diff --git a/workflow/engine/classes/model/om/BaseListInboxPeer.php b/workflow/engine/classes/model/om/BaseListInboxPeer.php index 2dd69a3ed..001686512 100644 --- a/workflow/engine/classes/model/om/BaseListInboxPeer.php +++ b/workflow/engine/classes/model/om/BaseListInboxPeer.php @@ -1,10 +1,12 @@ * @copyright Colosa - Bolivia - */ + */ public function getList($listName = 'inbox', $dataList = array(), $total = false) { Validator::isArray($dataList, '$dataList'); diff --git a/workflow/engine/templates/cases/casesList.js b/workflow/engine/templates/cases/casesList.js index 39e5f6ce4..09399b079 100755 --- a/workflow/engine/templates/cases/casesList.js +++ b/workflow/engine/templates/cases/casesList.js @@ -2270,7 +2270,6 @@ var gridForm = new Ext.FormPanel({ if(typeof(comboUser) != 'undefined'){ comboUser.setValue(""); } - comboAllUsers.setValue("CURRENT_USER"); // hidding the buttons for the reassign diff --git a/workflow/engine/xmlform/cases/cases_Resume.xml b/workflow/engine/xmlform/cases/cases_Resume.xml index c45814e82..f87568235 100755 --- a/workflow/engine/xmlform/cases/cases_Resume.xml +++ b/workflow/engine/xmlform/cases/cases_Resume.xml @@ -30,4 +30,5 @@ + diff --git a/workflow/engine/xmlform/cases/cases_Resume_Current_Task.xml b/workflow/engine/xmlform/cases/cases_Resume_Current_Task.xml index 35cf0c356..bf4abcdf3 100644 --- a/workflow/engine/xmlform/cases/cases_Resume_Current_Task.xml +++ b/workflow/engine/xmlform/cases/cases_Resume_Current_Task.xml @@ -18,4 +18,5 @@ + diff --git a/workflow/engine/xmlform/cases/cases_Resume_Current_Task_Title.xml b/workflow/engine/xmlform/cases/cases_Resume_Current_Task_Title.xml index f05b0a29e..d8bcced88 100644 --- a/workflow/engine/xmlform/cases/cases_Resume_Current_Task_Title.xml +++ b/workflow/engine/xmlform/cases/cases_Resume_Current_Task_Title.xml @@ -3,4 +3,5 @@ + From 6ede532d79e0a0b903203196358f8a545609f2ef Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Mon, 2 Mar 2015 11:15:23 -0400 Subject: [PATCH 128/155] List issues --- workflow/engine/classes/class.case.php | 4 ++-- workflow/engine/classes/class.configuration.php | 1 + workflow/engine/classes/class.derivation.php | 5 +++-- workflow/engine/classes/model/AppDelegation.php | 4 ++-- workflow/engine/classes/model/ListInbox.php | 1 + workflow/engine/classes/model/ListParticipatedLast.php | 1 + workflow/engine/classes/model/map/ListInboxMapBuilder.php | 1 + .../classes/model/map/ListParticipatedLastMapBuilder.php | 1 + workflow/engine/classes/model/om/BaseListInbox.php | 3 ++- workflow/engine/classes/model/om/BaseListInboxPeer.php | 3 ++- .../engine/classes/model/om/BaseListParticipatedLast.php | 3 ++- .../engine/classes/model/om/BaseListParticipatedLastPeer.php | 3 ++- workflow/engine/methods/cases/casesListExtJs.php | 2 +- workflow/engine/src/ProcessMaker/BusinessModel/Lists.php | 1 - workflow/engine/templates/cases/casesList.js | 2 +- workflow/engine/xmlform/cases/cases_Resume.xml | 4 ++-- workflow/engine/xmlform/cases/cases_Resume_Current_Task.xml | 4 ++-- .../engine/xmlform/cases/cases_Resume_Current_Task_Title.xml | 4 ++-- 18 files changed, 28 insertions(+), 19 deletions(-) diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index 37c4ad3f1..ba27dce97 100755 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -1060,13 +1060,13 @@ class Cases $appAssignSelfServiceValue->remove($sAppUid); } + /*----------------------------------********---------------------------------*/ if(!isset($Fields['DEL_INDEX'])){ $Fields['DEL_INDEX'] = 1; } $inbox = new ListInbox(); - $inbox->update($Fields); - + $inbox->update($Fields); /*----------------------------------********---------------------------------*/ //Return diff --git a/workflow/engine/classes/class.configuration.php b/workflow/engine/classes/class.configuration.php index 86c626e4c..15aa0cdb9 100755 --- a/workflow/engine/classes/class.configuration.php +++ b/workflow/engine/classes/class.configuration.php @@ -1,5 +1,6 @@ updateCase( $aSA['APP_PARENT'], $aParentCase ); /*----------------------------------********---------------------------------*/ $inbox = new ListInbox(); - $inbox->update($aParentCase); - + $inbox->update($aParentCase); /*----------------------------------********---------------------------------*/ + //Update table SUB_APPLICATION $oSubApplication = new SubApplication(); $oSubApplication->update( array ('APP_UID' => $sApplicationUID,'APP_PARENT' => $aSA['APP_PARENT'],'DEL_INDEX_PARENT' => $aSA['DEL_INDEX_PARENT'],'DEL_THREAD_PARENT' => $aSA['DEL_THREAD_PARENT'],'SA_STATUS' => 'FINISHED','SA_VALUES_IN' => serialize( $aNewFields ),'SA_FINISH_DATE' => date( 'Y-m-d H:i:s' ) ) ); + //Derive the parent case $aDeriveTasks = $this->prepareInformation( array ('USER_UID' => - 1,'APP_UID' => $aSA['APP_PARENT'],'DEL_INDEX' => $aSA['DEL_INDEX_PARENT'] ) ); diff --git a/workflow/engine/classes/model/AppDelegation.php b/workflow/engine/classes/model/AppDelegation.php index 692f3c045..1afeb5557 100755 --- a/workflow/engine/classes/model/AppDelegation.php +++ b/workflow/engine/classes/model/AppDelegation.php @@ -151,6 +151,7 @@ class AppDelegation extends BaseAppDelegation if ($this->validate()) { try { $res = $this->save(); + /*----------------------------------********---------------------------------*/ $task = TaskPeer::retrieveByPK( $this->getTasUid() ); $taskType = $task->getTasType(); @@ -158,8 +159,7 @@ class AppDelegation extends BaseAppDelegation $inbox = new ListInbox(); $res = $this->toArray(BasePeer::TYPE_FIELDNAME); $inbox->newRow($this->toArray(BasePeer::TYPE_FIELDNAME), $delPreviusUsrUid); - } - + } /*----------------------------------********---------------------------------*/ } catch (PropelException $e) { throw ($e); diff --git a/workflow/engine/classes/model/ListInbox.php b/workflow/engine/classes/model/ListInbox.php index 746960171..9d5f3511c 100644 --- a/workflow/engine/classes/model/ListInbox.php +++ b/workflow/engine/classes/model/ListInbox.php @@ -13,6 +13,7 @@ require_once 'classes/model/om/BaseListInbox.php'; * * @package classes.model */ + class ListInbox extends BaseListInbox { /** diff --git a/workflow/engine/classes/model/ListParticipatedLast.php b/workflow/engine/classes/model/ListParticipatedLast.php index ba9b74f87..919068345 100644 --- a/workflow/engine/classes/model/ListParticipatedLast.php +++ b/workflow/engine/classes/model/ListParticipatedLast.php @@ -14,6 +14,7 @@ require_once 'classes/model/om/BaseListParticipatedLast.php'; * * @package classes.model */ + class ListParticipatedLast extends BaseListParticipatedLast { /** diff --git a/workflow/engine/classes/model/map/ListInboxMapBuilder.php b/workflow/engine/classes/model/map/ListInboxMapBuilder.php index 0eeb6be5c..fffac5ac3 100644 --- a/workflow/engine/classes/model/map/ListInboxMapBuilder.php +++ b/workflow/engine/classes/model/map/ListInboxMapBuilder.php @@ -15,6 +15,7 @@ include_once 'creole/CreoleTypes.php'; * * @package workflow.classes.model.map */ + class ListInboxMapBuilder { diff --git a/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php b/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php index dc3ed4563..b8fae755b 100644 --- a/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php +++ b/workflow/engine/classes/model/map/ListParticipatedLastMapBuilder.php @@ -15,6 +15,7 @@ include_once 'creole/CreoleTypes.php'; * * @package workflow.classes.model.map */ + class ListParticipatedLastMapBuilder { diff --git a/workflow/engine/classes/model/om/BaseListInbox.php b/workflow/engine/classes/model/om/BaseListInbox.php index 1c2bacdd4..c045167a3 100644 --- a/workflow/engine/classes/model/om/BaseListInbox.php +++ b/workflow/engine/classes/model/om/BaseListInbox.php @@ -16,7 +16,8 @@ include_once 'classes/model/ListInboxPeer.php'; * * * @package workflow.classes.model.om - */ +*/ + abstract class BaseListInbox extends BaseObject implements Persistent { diff --git a/workflow/engine/classes/model/om/BaseListInboxPeer.php b/workflow/engine/classes/model/om/BaseListInboxPeer.php index 001686512..5f0bae0a8 100644 --- a/workflow/engine/classes/model/om/BaseListInboxPeer.php +++ b/workflow/engine/classes/model/om/BaseListInboxPeer.php @@ -13,7 +13,8 @@ include_once 'classes/model/ListInbox.php'; * * * @package workflow.classes.model.om - */ +*/ + abstract class BaseListInboxPeer { diff --git a/workflow/engine/classes/model/om/BaseListParticipatedLast.php b/workflow/engine/classes/model/om/BaseListParticipatedLast.php index 00199684f..6d41df0a8 100644 --- a/workflow/engine/classes/model/om/BaseListParticipatedLast.php +++ b/workflow/engine/classes/model/om/BaseListParticipatedLast.php @@ -16,7 +16,8 @@ include_once 'classes/model/ListParticipatedLastPeer.php'; * * * @package workflow.classes.model.om - */ +*/ + abstract class BaseListParticipatedLast extends BaseObject implements Persistent { diff --git a/workflow/engine/classes/model/om/BaseListParticipatedLastPeer.php b/workflow/engine/classes/model/om/BaseListParticipatedLastPeer.php index fa8180c69..41e3a4920 100644 --- a/workflow/engine/classes/model/om/BaseListParticipatedLastPeer.php +++ b/workflow/engine/classes/model/om/BaseListParticipatedLastPeer.php @@ -12,7 +12,8 @@ include_once 'classes/model/ListParticipatedLast.php'; * * * @package workflow.classes.model.om - */ +*/ + abstract class BaseListParticipatedLastPeer { diff --git a/workflow/engine/methods/cases/casesListExtJs.php b/workflow/engine/methods/cases/casesListExtJs.php index 1815e7050..d752b1743 100755 --- a/workflow/engine/methods/cases/casesListExtJs.php +++ b/workflow/engine/methods/cases/casesListExtJs.php @@ -3,8 +3,8 @@ unset($_SESSION['APPLICATION']); //get the action from GET or POST, default is todo $action = isset( $_GET['action'] ) ? $_GET['action'] : (isset( $_POST['action'] ) ? $_POST['action'] : 'todo'); -//fix a previous inconsistency +//fix a previous inconsistency $urlProxy = 'proxyCasesList'; if ($action == 'selfservice') { $action = 'unassigned'; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php b/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php index b909cead5..83524f067 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php @@ -1,6 +1,5 @@ + @@ -29,6 +30,5 @@ - - + diff --git a/workflow/engine/xmlform/cases/cases_Resume_Current_Task.xml b/workflow/engine/xmlform/cases/cases_Resume_Current_Task.xml index bf4abcdf3..f251935e7 100644 --- a/workflow/engine/xmlform/cases/cases_Resume_Current_Task.xml +++ b/workflow/engine/xmlform/cases/cases_Resume_Current_Task.xml @@ -1,4 +1,5 @@  + @@ -17,6 +18,5 @@ - - + diff --git a/workflow/engine/xmlform/cases/cases_Resume_Current_Task_Title.xml b/workflow/engine/xmlform/cases/cases_Resume_Current_Task_Title.xml index d8bcced88..778e802cb 100644 --- a/workflow/engine/xmlform/cases/cases_Resume_Current_Task_Title.xml +++ b/workflow/engine/xmlform/cases/cases_Resume_Current_Task_Title.xml @@ -1,7 +1,7 @@  + - - + From bbf49d3835d915f6d9fb8efb68e9b2f2c110739a Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Mon, 2 Mar 2015 12:51:29 -0400 Subject: [PATCH 129/155] PM-1606 --- workflow/engine/classes/class.pmDynaform.php | 13 +++++++------ workflow/engine/methods/cases/cases_Step.php | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 5038af110..61ebf680c 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -224,6 +224,11 @@ class pmDynaform ob_clean(); $json = G::json_decode($this->record["DYN_CONTENT"]); $this->jsonr($json); + $title = "\n" . + " \n" . + " \n" . + " \n" . + "
" . $headData["CASE"] . " #: " . $headData["APP_NUMBER"] . "     " . $headData["TITLE"] . ": " . $headData["APP_TITLE"] . "
\n"; $javascrip = "" . "\n" . "\n" . "\n" . - "\n" . - " \n" . - " \n" . - " \n" . - "
" . $headData["CASE"] . " #: " . $headData["APP_NUMBER"] . "     " . $headData["TITLE"] . ": " . $headData["APP_TITLE"] . "
\n" . - "
\n" . + ($this->app_data["PRO_SHOW_MESSAGE"] === 1 ? '' : $title ) . + "
\n" . "  \n" . " \n" . " \n" . diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php index 88d00fcf4..5daf495cc 100755 --- a/workflow/engine/methods/cases/cases_Step.php +++ b/workflow/engine/methods/cases/cases_Step.php @@ -271,6 +271,7 @@ try { G::LoadClass('pmDynaform'); $a = new pmDynaform($_GET['UID'], $Fields['APP_DATA']); if ($a->isResponsive()) { + $a->app_data["PRO_SHOW_MESSAGE"] = $noShowTitle; $a->printEdit((!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false", $_SESSION['APPLICATION'], $array, $oStep->getStepMode()); } else { $G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', $Fields['APP_DATA'], 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : '')); From dc7b91f1f5db08ca1f4a4348c5ffba39aa5015b4 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Mon, 2 Mar 2015 14:27:34 -0400 Subject: [PATCH 130/155] I corrected some observations --- workflow/engine/classes/model/ListInbox.php | 14 +------------- workflow/engine/config/schema.xml | 2 +- workflow/engine/data/mysql/schema.sql | 2 +- .../src/ProcessMaker/BusinessModel/Lists.php | 10 ---------- workflow/engine/templates/cases/casesList.js | 8 -------- 5 files changed, 3 insertions(+), 33 deletions(-) diff --git a/workflow/engine/classes/model/ListInbox.php b/workflow/engine/classes/model/ListInbox.php index 9d5f3511c..403c9a7f6 100644 --- a/workflow/engine/classes/model/ListInbox.php +++ b/workflow/engine/classes/model/ListInbox.php @@ -80,19 +80,7 @@ class ListInbox extends BaseListInbox // update participated history $listParticipatedHistory = new ListParticipatedHistory(); - $listParticipatedHistory->update($data); - //$listParticipatedLast = new ListParticipatedLast(); - //$listParticipatedLast->update($data); - /*if(isset($data['APP_UID']) && isset($data['DEL_INDEX'])){ - $oRow = ListInboxPeer::retrieveByPK( $data['APP_UID'], $data['DEL_INDEX'] ); - if(is_object($oRow)){ - $newData = $oRow->toArray( BasePeer::TYPE_FIELDNAME ); - - // update participated last - $listParticipatedLast = new ListParticipatedLast(); - $listParticipatedLast->update($newData); - } - }*/ + $listParticipatedHistory->update($data); return $result; } else { $con->rollback(); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 503936358..012edebf3 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -4030,7 +4030,7 @@ - + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 70fa9078c..9066d054f 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2213,7 +2213,7 @@ CREATE TABLE `LIST_INBOX` `DEL_DUE_DATE` DATETIME, `DEL_PRIORITY` VARCHAR(32) default '3' NOT NULL, PRIMARY KEY (`APP_UID`,`DEL_INDEX`), - KEY `indexInboxUser`(`USR_UID`, `DEL_DELEGATE_DATE`) + KEY `indexInboxUser`(`USR_UID`, `DEL_DELEGATE_DATE`) )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Inbox list'; #----------------------------------------------------------------------------- #-- LIST_PARTICIPATED_HISTORY diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php b/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php index 83524f067..0c70c0e1d 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Lists.php @@ -30,19 +30,9 @@ class Lists { $userUid = $dataList["userId"]; $filters["paged"] = isset( $dataList["paged"] ) ? $dataList["paged"] : true; $filters['count'] = isset( $dataList['count'] ) ? $dataList['count'] : true; - $filters["category"] = isset( $dataList["category"] ) ? $dataList["category"] : ""; - if(empty($filters["category"]) && isset($_GET['category'])){ - $filters["category"] = $_GET['category']; - } $filters["process"] = isset( $dataList["process"] ) ? $dataList["process"] : ""; - if(empty($filters["process"]) && isset($_GET['process'])){ - $filters["process"] = $_GET['process']; - } $filters["search"] = isset( $dataList["search"] ) ? $dataList["search"] : ""; - if(empty($filters["search"]) && isset($_GET['search'])){ - $filters["category"] = $_GET['search']; - } $filters["filter"] = isset( $dataList["filter"] ) ? $dataList["filter"] : ""; $filters["dateFrom"] = (!empty( $dataList["dateFrom"] )) ? substr( $dataList["dateFrom"], 0, 10 ) : ""; $filters["dateTo"] = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : ""; diff --git a/workflow/engine/templates/cases/casesList.js b/workflow/engine/templates/cases/casesList.js index 25feb8ee3..59f73908b 100755 --- a/workflow/engine/templates/cases/casesList.js +++ b/workflow/engine/templates/cases/casesList.js @@ -2272,14 +2272,6 @@ var gridForm = new Ext.FormPanel({ } comboAllUsers.setValue("CURRENT_USER"); -// hidding the buttons for the reassign -// if (action=='to_reassign'){ -// btnSelectAll.hide(); -// btnUnSelectAll.hide(); -// btnReassign.hide(); -// } - - function reassign(){ storeReassignCases.removeAll(); var rows = grid.getSelectionModel().getSelections(); From 75944083588bbf45611f4671f68181f29614c604 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Mon, 2 Mar 2015 14:36:42 -0400 Subject: [PATCH 131/155] I correted the search in List Inbox --- .../src/ProcessMaker/Services/Api/Lists.php | 192 +++++++++--------- 1 file changed, 96 insertions(+), 96 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Lists.php b/workflow/engine/src/ProcessMaker/Services/Api/Lists.php index 3e32cb60c..44f42508b 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Lists.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Lists.php @@ -24,8 +24,8 @@ class Lists extends Api * @param string $limit {@from path} * @param string $sort {@from path} * @param string $dir {@from path} - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -45,8 +45,8 @@ class Lists extends Api $limit = 0, $sort = 'APP_UPDATE_DATE', $dir = 'DESC', - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -63,8 +63,8 @@ class Lists extends Api $dataList['sort'] = $sort; $dataList['dir'] = $dir; - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -83,8 +83,8 @@ class Lists extends Api /** * Get count list Inbox * - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -98,8 +98,8 @@ class Lists extends Api * @url GET /total */ public function doGetCountInbox( - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -108,8 +108,8 @@ class Lists extends Api try { $dataList['userId'] = $this->getUserId(); - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -132,8 +132,8 @@ class Lists extends Api * @param string $limit {@from path} * @param string $sort {@from path} * @param string $dir {@from path} - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -153,8 +153,8 @@ class Lists extends Api $limit = 0, $sort = 'APP_UPDATE_DATE', $dir = 'DESC', - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -170,8 +170,8 @@ class Lists extends Api $dataList['sort'] = $sort; $dataList['dir'] = $dir; - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -188,8 +188,8 @@ class Lists extends Api /** * Get count list Participated Last * - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -203,8 +203,8 @@ class Lists extends Api * @url GET /participated-last/total */ public function doGetCountParticipatedLast( - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -213,8 +213,8 @@ class Lists extends Api try { $dataList['userId'] = $this->getUserId(); - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -237,8 +237,8 @@ class Lists extends Api * @param string $limit {@from path} * @param string $sort {@from path} * @param string $dir {@from path} - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -257,8 +257,8 @@ class Lists extends Api $limit = 0, $sort = 'APP_UPDATE_DATE', $dir = 'DESC', - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -274,8 +274,8 @@ class Lists extends Api $dataList['sort'] = $sort; $dataList['dir'] = $dir; - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -292,8 +292,8 @@ class Lists extends Api /** * Get count list Participated History * - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -306,8 +306,8 @@ class Lists extends Api * @url GET /participated-history/total */ public function doGetCountParticipatedHistory( - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -316,8 +316,8 @@ class Lists extends Api try { $dataList['userId'] = $this->getUserId(); - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -343,8 +343,8 @@ class Lists extends Api * @param string $limit {@from path} * @param string $sort {@from path} * @param string $dir {@from path} - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -363,8 +363,8 @@ class Lists extends Api $limit = 0, $sort = 'APP_PAUSED_DATE', $dir = 'DESC', - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -380,8 +380,8 @@ class Lists extends Api $dataList['sort'] = $sort; $dataList['dir'] = $dir; - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -398,8 +398,8 @@ class Lists extends Api /** * Get count list Paused * - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -412,8 +412,8 @@ class Lists extends Api * @url GET /paused/total */ public function doGetCountPaused( - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -422,8 +422,8 @@ class Lists extends Api try { $dataList['userId'] = $this->getUserId(); - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -448,8 +448,8 @@ class Lists extends Api * @param string $limit {@from path} * @param string $sort {@from path} * @param string $dir {@from path} - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -468,8 +468,8 @@ class Lists extends Api $limit = 0, $sort = 'APP_CANCELED_DATE', $dir = 'DESC', - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -485,8 +485,8 @@ class Lists extends Api $dataList['sort'] = $sort; $dataList['dir'] = $dir; - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -503,8 +503,8 @@ class Lists extends Api /** * Get count list Canceled * - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -517,8 +517,8 @@ class Lists extends Api * @url GET /canceled/total */ public function doGetCountCanceled( - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -527,8 +527,8 @@ class Lists extends Api try { $dataList['userId'] = $this->getUserId(); - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -552,8 +552,8 @@ class Lists extends Api * @param string $limit {@from path} * @param string $sort {@from path} * @param string $dir {@from path} - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -572,8 +572,8 @@ class Lists extends Api $limit = 0, $sort = 'APP_UPDATE_DATE', $dir = 'DESC', - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -589,8 +589,8 @@ class Lists extends Api $dataList['sort'] = $sort; $dataList['dir'] = $dir; - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -607,8 +607,8 @@ class Lists extends Api /** * Get count list Participated History * - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -621,8 +621,8 @@ class Lists extends Api * @url GET /completed/total */ public function doGetCountCompleted( - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -631,8 +631,8 @@ class Lists extends Api try { $dataList['userId'] = $this->getUserId(); - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -656,8 +656,8 @@ class Lists extends Api * @param string $limit {@from path} * @param string $sort {@from path} * @param string $dir {@from path} - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -676,8 +676,8 @@ class Lists extends Api $limit = 0, $sort = 'APP_UPDATE_DATE', $dir = 'DESC', - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -693,8 +693,8 @@ class Lists extends Api $dataList['sort'] = $sort; $dataList['dir'] = $dir; - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -711,8 +711,8 @@ class Lists extends Api /** * Get count list Participated History * - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -725,8 +725,8 @@ class Lists extends Api * @url GET /my-inbox/total */ public function doGetCountListMyInbox( - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -735,8 +735,8 @@ class Lists extends Api try { $dataList['userId'] = $this->getUserId(); - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -759,8 +759,8 @@ class Lists extends Api * @param string $limit {@from path} * @param string $sort {@from path} * @param string $dir {@from path} - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -779,8 +779,8 @@ class Lists extends Api $limit = 0, $sort = 'APP_UPDATE_DATE', $dir = 'DESC', - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -797,8 +797,8 @@ class Lists extends Api $dataList['sort'] = $sort; $dataList['dir'] = $dir; - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; @@ -815,8 +815,8 @@ class Lists extends Api /** * Get count list Unassigned * - * @param string $cat_uid {@from path} - * @param string $pro_uid {@from path} + * @param string $category {@from path} + * @param string $process {@from path} * @param string $search {@from path} * @param string $filter {@from path} * @param string $date_from {@from path} @@ -829,8 +829,8 @@ class Lists extends Api * @url GET /unassigned/total */ public function doGetCountUnassigned( - $cat_uid = '', - $pro_uid = '', + $category = '', + $process = '', $search = '', $filter = '', $date_from = '', @@ -839,8 +839,8 @@ class Lists extends Api try { $dataList['userId'] = $this->getUserId(); - $dataList['category'] = $cat_uid; - $dataList['process'] = $pro_uid; + $dataList['category'] = $category; + $dataList['process'] = $process; $dataList['search'] = $search; $dataList['filter'] = $filter; $dataList['dateFrom'] = $date_from; From 5f5695a56d3650691a9a412ca21a779d43c92f0e Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Mon, 2 Mar 2015 16:27:20 -0400 Subject: [PATCH 132/155] PM-243 Change sample Apache VirtualHost definition file for ProcessMaker --- virtualhost.conf.example => pmos.conf.example | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename virtualhost.conf.example => pmos.conf.example (100%) diff --git a/virtualhost.conf.example b/pmos.conf.example similarity index 100% rename from virtualhost.conf.example rename to pmos.conf.example From 21b8072452b45be4f1516696a7f58f572d9bb8dc Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Mon, 2 Mar 2015 17:48:53 -0400 Subject: [PATCH 133/155] PM-1700 "Ocurre un error al importar y actualizar un proceso..." SOLVED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: Ocurre un error al importar y actualizar un proceso de tipo bpmn, despliega un error sin descripció el proceso se convierte en un proceso de tipo classic Cause: Mala definicion de variables para el "Add Audit Log" Solution: Se a suprimido las variables, ahora se utiliza el objeto para el seteo de variables --- workflow/engine/classes/model/OutputDocument.php | 10 ++++++---- workflow/engine/classes/model/Triggers.php | 16 ++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index 7a0e2fd64..9929c2e7c 100755 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -201,7 +201,7 @@ class OutputDocument extends BaseOutputDocument } $description .= ", By clicking on the generated file link: ".$genLink; G::auditLog("CreateOutputDocument", $description); - + return $aData['OUT_DOC_UID']; } else { $sMessage = ''; @@ -329,9 +329,11 @@ class OutputDocument extends BaseOutputDocument Content::removeContent('OUT_DOC_TEMPLATE', '', $oOutputDocument->getOutDocUid()); $iResult = $oOutputDocument->delete(); $oConnection->commit(); - //Add Audit Log - G::auditLog("DeleteOutputDocument", "Output Document Name: ".$outputName.", Output Document Uid: ".$sOutDocUid.", Description: ".$outputDesc.", Filename generated: ".$outputFile); + //Add Audit Log + G::auditLog("DeleteOutputDocument", "Output Document Name: " . $oOutputDocument->getOutDocTitle() . ", Output Document Uid: " . $sOutDocUid . ", Description: " . $oOutputDocument->getOutDocDescription() . ", Filename generated: " . $oOutputDocument->getOutDocFilename()); + + //Return return $iResult; } else { throw (new Exception('This row doesn\'t exist!')); @@ -845,7 +847,7 @@ class OutputDocument extends BaseOutputDocument $sContent = str_ireplace("", "", $sContent); $sContent = str_replace($nrthtml, $nrt, $sContent); - + $sContent = str_replace("margin-left", "text-indent", $sContent); // define Save file diff --git a/workflow/engine/classes/model/Triggers.php b/workflow/engine/classes/model/Triggers.php index 13321d6d0..0f381703c 100755 --- a/workflow/engine/classes/model/Triggers.php +++ b/workflow/engine/classes/model/Triggers.php @@ -189,7 +189,7 @@ class Triggers extends BaseTriggers $description .= ", Description: ".$aData['TRI_DESCRIPTION']; } G::auditLog("CreateTrigger", $description); - + return $result; } else { $con->rollback(); @@ -240,18 +240,14 @@ class Triggers extends BaseTriggers $con->begin(); $oTri = TriggersPeer::retrieveByPK( $TriUid ); if (!is_null($oTri)) { - $triggerName = $this->getTriTitle(); - $triggerDesc = $this->getTriDescription(); - Content::removeContent( 'TRI_TITLE', '', $this->getTriUid()); - Content::removeContent( 'TRI_DESCRIPTION', '', $this->getTriUid()); + Content::removeContent("TRI_TITLE", "", $TriUid); + Content::removeContent("TRI_DESCRIPTION", "", $TriUid); + $result = $oTri->delete(); $con->commit(); + //Add Audit Log - $description = "Trigger Name: ".$triggerName.", Trigger Uid: ".$TriUid; - if (isset ( $triggerDesc )) { - $description .= ", Description: ".$triggerDesc; - } - G::auditLog("DeleteTrigger", $description); + G::auditLog("DeleteTrigger", "Trigger Name: " . $oTri->getTriTitle() . ", Trigger Uid: " . $TriUid . ", Description: " . $oTri->getTriDescription()); } return $result; } catch (Exception $e) { From 39fc054b02329901ac0be972f1c074638d048535 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Mon, 2 Mar 2015 18:19:55 -0400 Subject: [PATCH 134/155] PM-1571 --- workflow/engine/classes/class.pmDynaform.php | 10 +++---- workflow/engine/js/cases/core/pmDynaform.js | 29 ++++++-------------- workflow/engine/templates/cases/open.js | 2 +- 3 files changed, 14 insertions(+), 27 deletions(-) diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 61ebf680c..9f6cf0dc3 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -101,7 +101,7 @@ class pmDynaform ); } //query & options - if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggets")) { + if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggest")) { if (!isset($json->dbConnection)) $json->dbConnection = "none"; if (!isset($json->sql)) @@ -135,14 +135,14 @@ class pmDynaform //data if ($column->type === "text" || $column->type === "textarea" || $column->type === "dropdown") { array_push($cells, array( - "value" => $row[$column->name], - "label" => $row[$column->name . "_label"] + "value" => isset($row[$column->name]) ? $row[$column->name] : "", + "label" => isset($row[$column->name . "_label"]) ? $row[$column->name . "_label"] : "" )); } if ($column->type === "suggest") { array_push($cells, array( - "value" => $row[$column->name . "_label"], - "label" => $row[$column->name] + "value" => isset($row[$column->name . "_label"]) ? $row[$column->name . "_label"] : "", + "label" => isset($row[$column->name]) ? $row[$column->name] : "" )); } } diff --git a/workflow/engine/js/cases/core/pmDynaform.js b/workflow/engine/js/cases/core/pmDynaform.js index 62030d439..befaa4abd 100644 --- a/workflow/engine/js/cases/core/pmDynaform.js +++ b/workflow/engine/js/cases/core/pmDynaform.js @@ -1,25 +1,11 @@ +function ajax_post(action, form, method, callback, asynchronous) { + document.getElementById("dyn_forward").onclick(); + window.onload = function () { + method(); + }; +} function dynaFormChanged(frm) { - for (var i1 = 0; i1 <= frm.elements.length - 1; i1++) { - if ((frm.elements[i1].type === "radio" || frm.elements[i1].type === "checkbox") && (frm.elements[i1].checked !== frm.elements[i1].defaultChecked)) { - return true; - } - if ((frm.elements[i1].type === "textarea" || frm.elements[i1].type === "text" || frm.elements[i1].type === "file") && (frm.elements[i1].value !== frm.elements[i1].defaultValue)) { - return true; - } - if (frm.elements[i1].tagName.toLowerCase() === "select") { - var selectDefaultValue = frm.elements[i1].value; - for (var i2 = 0; i2 <= frm.elements[i1].options.length - 1; i2++) { - if (frm.elements[i1].options[i2].defaultSelected) { - selectDefaultValue = frm.elements[i1].options[i2].value; - break; - } - } - if (frm.elements[i1].value !== selectDefaultValue) { - return true; - } - } - } - return false; + return true; } $(window).load(function () { if (pm_run_outside_main_app === 'true') { @@ -28,6 +14,7 @@ $(window).load(function () { } if (parent.setCurrent) { parent.setCurrent(dyn_uid); + } } var data = jsondata; diff --git a/workflow/engine/templates/cases/open.js b/workflow/engine/templates/cases/open.js index 8e640d494..bcd38d4f4 100755 --- a/workflow/engine/templates/cases/open.js +++ b/workflow/engine/templates/cases/open.js @@ -249,7 +249,7 @@ Ext.onReady(function(){ if (iframeDynaForm.getElementsByTagName("form")) { dynaformChange = iframeDynaForm.getElementsByTagName("form").item(0); - if (typeof(window.frames["openCaseFrame"].dynaFormChanged) == "function") { + if (typeof(window.frames["openCaseFrame"].dynaFormChanged) == "function" && dynaformChange) { swDynaformChange = (window.frames["openCaseFrame"].dynaFormChanged(dynaformChange))? 1 : 0; } } From 7f5f7baad7324ec1764ddd60da84077929f8a256 Mon Sep 17 00:00:00 2001 From: Luis Fernando Saisa Lopez Date: Tue, 3 Mar 2015 10:23:54 -0400 Subject: [PATCH 135/155] PM-000 "Email Server cambiar estructura de campos" SOLVED > Solution: Se cambia el esquema de los campos MESS_FROM_MAIL y MESS_FROM_NAME que permita introducir valores nulos. --- workflow/engine/classes/model/map/EmailServerMapBuilder.php | 4 ++-- workflow/engine/config/schema.xml | 6 +++--- workflow/engine/data/mysql/schema.sql | 5 ++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/workflow/engine/classes/model/map/EmailServerMapBuilder.php b/workflow/engine/classes/model/map/EmailServerMapBuilder.php index ba474c9dd..d3ceb8f91 100644 --- a/workflow/engine/classes/model/map/EmailServerMapBuilder.php +++ b/workflow/engine/classes/model/map/EmailServerMapBuilder.php @@ -79,9 +79,9 @@ class EmailServerMapBuilder $tMap->addColumn('MESS_PASSWORD', 'MessPassword', 'string', CreoleTypes::VARCHAR, true, 256); - $tMap->addColumn('MESS_FROM_MAIL', 'MessFromMail', 'string', CreoleTypes::VARCHAR, true, 256); + $tMap->addColumn('MESS_FROM_MAIL', 'MessFromMail', 'string', CreoleTypes::VARCHAR, false, 256); - $tMap->addColumn('MESS_FROM_NAME', 'MessFromName', 'string', CreoleTypes::VARCHAR, true, 256); + $tMap->addColumn('MESS_FROM_NAME', 'MessFromName', 'string', CreoleTypes::VARCHAR, false, 256); $tMap->addColumn('SMTPSECURE', 'Smtpsecure', 'string', CreoleTypes::VARCHAR, true, 3); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 012edebf3..a72dcc672 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -4030,7 +4030,7 @@ -
+ @@ -4336,8 +4336,8 @@ - - + + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 9066d054f..79c15e9d7 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2483,7 +2483,6 @@ CREATE TABLE `MESSAGE_TYPE_VARIABLE` DROP TABLE IF EXISTS `EMAIL_SERVER`; - CREATE TABLE `EMAIL_SERVER` ( `MESS_UID` VARCHAR(32) default '' NOT NULL, @@ -2493,8 +2492,8 @@ CREATE TABLE `EMAIL_SERVER` `MESS_RAUTH` INTEGER default 0 NOT NULL, `MESS_ACCOUNT` VARCHAR(256) default '' NOT NULL, `MESS_PASSWORD` VARCHAR(256) default '' NOT NULL, - `MESS_FROM_MAIL` VARCHAR(256) default '' NOT NULL, - `MESS_FROM_NAME` VARCHAR(256) default '' NOT NULL, + `MESS_FROM_MAIL` VARCHAR(256) default '', + `MESS_FROM_NAME` VARCHAR(256) default '', `SMTPSECURE` VARCHAR(3) default 'No' NOT NULL, `MESS_TRY_SEND_INMEDIATLY` INTEGER default 0 NOT NULL, `MAIL_TO` VARCHAR(256) default '' NOT NULL, From d3b90c125ab60baff1dfbd0c8c4fa4967231f696 Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Tue, 3 Mar 2015 10:48:34 -0400 Subject: [PATCH 136/155] Fix bugs in database upgrade (found in enterprise trial server) --- workflow/engine/bin/tasks/cliWorkspaces.php | 4 ++-- .../engine/src/ProcessMaker/BusinessModel/EmailServer.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index ca1dff7f6..517f8f68f 100755 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -338,8 +338,8 @@ function database_upgrade($command, $args) { $arrayData["MESS_RAUTH"] = (int)($emailConfiguration["MESS_RAUTH"]); $arrayData["MESS_ACCOUNT"] = $emailConfiguration["MESS_ACCOUNT"]; $arrayData["MESS_PASSWORD"] = $emailConfiguration["MESS_PASSWORD"]; - $arrayData["MESS_FROM_MAIL"] = $emailConfiguration["MESS_FROM_MAIL"]; - $arrayData["MESS_FROM_NAME"] = $emailConfiguration["MESS_FROM_NAME"]; + $arrayData["MESS_FROM_MAIL"] = isset($emailConfiguration["MESS_FROM_MAIL"]) ? $emailConfiguration["MESS_FROM_MAIL"] : ""; + $arrayData["MESS_FROM_NAME"] = isset($emailConfiguration["MESS_FROM_NAME"]) ? $emailConfiguration["MESS_FROM_NAME"] : ""; $arrayData["SMTPSECURE"] = $emailConfiguration["SMTPSecure"]; $arrayData["MESS_TRY_SEND_INMEDIATLY"] = (int)($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"]); $arrayData["MAIL_TO"] = $emailConfiguration["MAIL_TO"]; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php index 516c166e8..7d806c1c3 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php @@ -13,7 +13,7 @@ class EmailServer "MESS_PASSWORD" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerPassword"), "MESS_FROM_MAIL" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerFromMail"), "MESS_FROM_NAME" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerFromName"), - "SMTPSECURE" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array("No", "tls", "ssl"), "fieldNameAux" => "emailServerSecureConnection"), + "SMTPSECURE" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array("No", "tls", "ssl", "none"), "fieldNameAux" => "emailServerSecureConnection"), "MESS_TRY_SEND_INMEDIATLY" => array("type" => "int", "required" => false, "empty" => false, "defaultValues" => array(0, 1), "fieldNameAux" => "emailServerSendTestMail"), "MAIL_TO" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerMailTo"), "MESS_DEFAULT" => array("type" => "int", "required" => false, "empty" => false, "defaultValues" => array(0, 1), "fieldNameAux" => "emailServerDefault") From 77fd5e7f839db59224afc154ee18d640fb641edf Mon Sep 17 00:00:00 2001 From: Ronald Quenta Date: Tue, 3 Mar 2015 10:50:51 -0400 Subject: [PATCH 137/155] add endpoints for get information in status paused and participated --- .../src/ProcessMaker/BusinessModel/Light.php | 74 +++++++++++++++++++ .../src/ProcessMaker/Services/Api/Light.php | 18 +++++ 2 files changed, 92 insertions(+) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php index 2d423184f..3c0ba80dd 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php @@ -592,4 +592,78 @@ class Light return $response; } + + /** + * Get information for status paused and participated or other status + * + * @param $userUid + * @param $type + * @param $app_uid + * @throws \Exception + */ + public function getInformation($userUid, $type, $app_uid) + { + switch ($type) { + case 'paused': + case 'participated': + $oCase = new \Cases(); + $iDelIndex = $oCase->getCurrentDelegationCase( $app_uid ); + $aFields = $oCase->loadCase( $app_uid, $iDelIndex ); + $this->getInfoResume($userUid, $aFields, $type); + break; + } + } + + /** + * view in html response for status + * + * @param $userUid + * @param $Fields + * @param $type + * @throws \Exception + */ + public function getInfoResume($userUid, $Fields, $type) + { + //print_r($Fields);die; + /* Includes */ + G::LoadClass( 'case' ); + /* Prepare page before to show */ + //$oCase = new \Cases(); + +// $participated = $oCase->userParticipatedInCase( $Fields['APP_UID'], $userUid ); +// if ($RBAC->userCanAccess( 'PM_ALLCASES' ) < 0 && $participated == 0) { +// /*if (strtoupper($Fields['APP_STATUS']) != 'COMPLETED') { +// $oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'SHOW_MESSAGE'); +// }*/ +// $aMessage['MESSAGE'] = G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' ); +// $G_PUBLISH = new Publisher(); +// $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); +// G::RenderPage( 'publishBlank', 'blank' ); +// die(); +// } + + $objProc = new \Process(); + $aProc = $objProc->load( $Fields['PRO_UID'] ); + $Fields['PRO_TITLE'] = $aProc['PRO_TITLE']; + + $objTask = new \Task(); + + if (isset($_SESSION['ACTION']) && ($_SESSION['ACTION'] == 'jump')) { + $task = explode('-', $Fields['TAS_UID']); + $Fields['TAS_TITLE'] = ''; + for( $i = 0; $i < sizeof($task)-1; $i ++ ) { + $aTask = $objTask->load( $task[$i] ); + $Fields['TAS_TITLE'][] = $aTask['TAS_TITLE']; + } + $Fields['TAS_TITLE'] = implode(" - ", array_values($Fields['TAS_TITLE'])); + } else { + $aTask = $objTask->load( $Fields['TAS_UID'] ); + $Fields['TAS_TITLE'] = $aTask['TAS_TITLE']; + } + + require_once(PATH_GULLIVER .'../thirdparty/smarty/libs/Smarty.class.php'); + $G_PUBLISH = new \Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Resume.xml', '', $Fields, '' ); + $G_PUBLISH->RenderContent(); + } } diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Light.php b/workflow/engine/src/ProcessMaker/Services/Api/Light.php index bac12171a..1148d746e 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Light.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Light.php @@ -713,4 +713,22 @@ class Light extends Api } return $files; } + + /** + * @url GET /:type/case/:app_uid + * + * @param $access + * @param $refresh + * @return mixed + */ + public function getInformation($type, $app_uid) + { + try { + $userUid = $this->getUserId(); + $oMobile = new \ProcessMaker\BusinessModel\Light(); + $oMobile->getInformation($userUid, $type, $app_uid); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } } From 95740b0b15dedaf1c24231991fac61f6df67418b Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Tue, 3 Mar 2015 14:05:39 -0400 Subject: [PATCH 138/155] PM-1703 La funcionalidad "Type Process" en procesos no funciona SOLVED --- workflow/engine/methods/processes/processesList.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow/engine/methods/processes/processesList.php b/workflow/engine/methods/processes/processesList.php index f677292ed..354209ce9 100755 --- a/workflow/engine/methods/processes/processesList.php +++ b/workflow/engine/methods/processes/processesList.php @@ -40,16 +40,16 @@ $memcacheUsed = 'not used'; $totalCount = 0; if (isset( $_POST['category'] ) && $_POST['category'] !== '') { if (isset( $_POST['processName'] )) - $proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'], $_POST['processName']); + $proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'], $_POST['processName'], true, false, $_SESSION["USER_LOGGED"]); else - $proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category']); + $proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'], null, true, false, $_SESSION["USER_LOGGED"]); } else { if (isset( $_POST['processName'] )) { $memkey = 'processList-' . $start . '-' . $limit . '-' . $_POST['processName']; $memcacheUsed = 'yes'; $proData = $memcache->get( $memkey ); if ($proData === false) { - $proData = $oProcess->getAllProcesses( $start, $limit, null, $_POST['processName']); + $proData = $oProcess->getAllProcesses( $start, $limit, null, $_POST['processName'], true, false, $_SESSION["USER_LOGGED"]); $memcache->set( $memkey, $proData, PMmemcached::ONE_HOUR ); $totalCount = count($proData); $proData = array_splice($proData, $start, $limit); From b7d37ca3fb343cda2eb8f8bd2c186ac8bb0dda3d Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 3 Mar 2015 15:17:43 -0400 Subject: [PATCH 139/155] PM-1521 --- Rakefile | 3 +- workflow/engine/classes/class.pmDynaform.php | 38 +++++++++++--------- workflow/engine/js/cases/core/pmDynaform.js | 3 ++ workflow/engine/methods/cases/cases_Step.php | 1 + 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/Rakefile b/Rakefile index 8c314a6fc..e66aa1033 100644 --- a/Rakefile +++ b/Rakefile @@ -230,7 +230,8 @@ def buildMafe(homeDir, targetDir, mode) "#{homeDir}/build/js/designer.js" => "#{mafeDir}/designer.min.js", "#{homeDir}/build/js/mafe.js" => "#{mafeDir}/mafe.min.js", "#{homeDir}/build/css/mafe.css" => "#{mafeDir}/mafe.min.css", - "#{homeDir}/img/*.*" => "#{imgTargetDir}" + "#{homeDir}/img/*.*" => "#{imgTargetDir}", + "#{targetDir}/../lib-dev/pmUI/images/*.*" => "#{imgTargetDir}" }) puts "\nCopying lib files into: #{jsTargetDir}".bold diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 9f6cf0dc3..a6e6806be 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -87,21 +87,8 @@ class pmDynaform $json->$key = $this->app_data[$triggerValue]; } } - //data - if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown")) { - $json->data = array( - "value" => isset($this->data[$json->name]) ? $this->data[$json->name] : "", - "label" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "" - ); - } - if ($key === "type" && ($value === "suggets")) { - $json->data = array( - "value" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "", - "label" => isset($this->data[$json->name]) ? $this->data[$json->name] : "" - ); - } //query & options - if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggest")) { + if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggest" || $value === "checkbox" || $value === "radio")) { if (!isset($json->dbConnection)) $json->dbConnection = "none"; if (!isset($json->sql)) @@ -120,9 +107,24 @@ class pmDynaform ); array_push($json->options, $option); } - $json->data = isset($json->options[0]) ? $json->options[0] : $json->data; + if (isset($json->options[0])) { + $json->data = $json->options[0]; + } } } + //data + if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "checkbox" || $value === "radio")) { + $json->data = array( + "value" => isset($this->data[$json->name]) ? $this->data[$json->name] : "", + "label" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "" + ); + } + if ($key === "type" && ($value === "suggest")) { + $json->data = array( + "value" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "", + "label" => isset($this->data[$json->name]) ? $this->data[$json->name] : "" + ); + } //grid if ($key === "type" && ($value === "grid")) { if (isset($this->data[$json->name])) { @@ -191,6 +193,7 @@ class pmDynaform "var credentials = " . G::json_encode($clientToken) . ";\n" . "var filePost = null;\n" . "var fieldsRequired = null;\n" . + "var triggerDebug = null;\n" . "$(window).load(function () {\n" . " var data = jsondata;\n" . " data.items[0].mode = 'view';\n" . @@ -221,6 +224,7 @@ class pmDynaform public function printEdit($pm_run_outside_main_app, $application, $headData, $step_mode = 'EDIT') { + error_log(print_r($this->app_data, true)); ob_clean(); $json = G::json_decode($this->record["DYN_CONTENT"]); $this->jsonr($json); @@ -242,6 +246,7 @@ class pmDynaform "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var filePost = null;\n" . "var fieldsRequired = null;\n" . + "var triggerDebug = " . ($this->app_data["TRIGGER_DEBUG"] === 1 ? "true" : "false") . ";\n" . "\n" . "\n" . "\n" . @@ -282,6 +287,7 @@ class pmDynaform "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var filePost = '" . $filename . "';\n" . "var fieldsRequired = " . G::json_encode($this->arrayFieldRequired) . ";\n" . + "var triggerDebug = null;\n" . "\n" . "\n" . "
\n" . @@ -387,7 +393,7 @@ class pmDynaform { if ($this->debugMode) { echo "
";
-            echo G::json_encode($json);
+            echo G::json_encode(array($this->app_data, $this->data));
             echo "
"; } } diff --git a/workflow/engine/js/cases/core/pmDynaform.js b/workflow/engine/js/cases/core/pmDynaform.js index befaa4abd..bc6ddf189 100644 --- a/workflow/engine/js/cases/core/pmDynaform.js +++ b/workflow/engine/js/cases/core/pmDynaform.js @@ -75,4 +75,7 @@ $(window).load(function () { form.submit(); return false; }; + if (triggerDebug === true) { + showdebug(); + } }); \ No newline at end of file diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php index 5daf495cc..6ee2a1c8d 100755 --- a/workflow/engine/methods/cases/cases_Step.php +++ b/workflow/engine/methods/cases/cases_Step.php @@ -272,6 +272,7 @@ try { $a = new pmDynaform($_GET['UID'], $Fields['APP_DATA']); if ($a->isResponsive()) { $a->app_data["PRO_SHOW_MESSAGE"] = $noShowTitle; + $a->app_data["TRIGGER_DEBUG"] = $_SESSION['TRIGGER_DEBUG']['ISSET']; $a->printEdit((!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false", $_SESSION['APPLICATION'], $array, $oStep->getStepMode()); } else { $G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', $Fields['APP_DATA'], 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : '')); From 752e65a57f95cf1c1b46b752de2accd7f6777be3 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Tue, 3 Mar 2015 16:32:11 -0400 Subject: [PATCH 140/155] PM-1691 "0016872: Event execution times are not being..." SOLVED Issue: 0016872: Event execution times are not being generated correctly Cause: Se esta mandando un numero real (ej 955.33) a la funcion "strtotime" Solution: Se esta redondeando el numero con la funcion "round", para que de esa manera se mande un numero entero a la funcion "strtotime" Explanation: - En nuestro "Calendario" se tiene definido por default que son 8 horas de trabajo por dia (8 horas/dia) - En el proceso adjunto en el bug, se tiene definido lo siguiente: > ... > The time starts with task: Task2 > Estimated Task duration: 8 hours (esto se transforma a: 0.33333333333333 (8/24), segun la wiki) > Execution time: 0 days After interval ends > ... Estos valores mas el resto de campos son almacenados en la tabla "EVENT" - Ahora como ejemplo tenemos el siguiente caso: en fecha y hora "2015-03-03 13:49:52" se inicia un caso con el Task1 y es derivado al Task2, entonces se crea un registro en la tabla "APP_EVENT". El campo que es objeto de estudio es "APP_EVENT.APP_EVN_ACTION_DATE", el cual tiene un valor de "2015-03-03 16:29:52" - Entonces el analisis es el siguiente: 0.33333333333333 dias * 8 horas/dia = 2.6666666666666 horas Lo que quiere decir que el cron.php ejecutara/iniciara/revisara el caso el "2015-03-03 13:49:52" + "2.6666666666666 horas" osea el "2015-03-03 16:29:52" --- workflow/engine/classes/class.calendar.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/engine/classes/class.calendar.php b/workflow/engine/classes/class.calendar.php index 07939d4bd..e6e28c5b9 100755 --- a/workflow/engine/classes/class.calendar.php +++ b/workflow/engine/classes/class.calendar.php @@ -414,7 +414,7 @@ class calendar extends CalendarDefinition $hoursDuration -= (float)($secondRes/3600); //$dataLog[] = (float)($secondRes/3600); } else { - $newDate = date('Y-m-d H:i:s', strtotime('+' . (((float)$hoursDuration)*3600) . ' seconds', strtotime($newDate))); + $newDate = date("Y-m-d H:i:s", strtotime("+" . round(((float)($hoursDuration)) * 3600) . " seconds", strtotime($newDate))); //$dataLog[] = (float)($hoursDuration); $hoursDuration = 0; } @@ -797,4 +797,4 @@ class calendar extends CalendarDefinition } } -?> \ No newline at end of file +?> From 0340a295418cee66b160f537bb1e15ac08dfb4f6 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 4 Mar 2015 11:15:56 -0400 Subject: [PATCH 141/155] fix in oauth in distinct workspace --- framework/src/Maveriks/WebApplication.php | 4 +++- workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 42fc81e1c..58f0aef75 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -297,7 +297,9 @@ class WebApplication $port = empty($port) ? '' : ";port=$port"; Services\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port); if (DB_NAME != DB_RBAC_NAME) { //it's PM < 3 - Services\OAuth2\Server::setDatabaseSourceRBAC(DB_RBAC_USER, DB_RBAC_PASS, DB_ADAPTER.":host=".DB_RBAC_HOST.";dbname=".DB_RBAC_NAME.$port); + list($host, $port) = strpos(DB_RBAC_HOST, ':') !== false ? explode(':', DB_RBAC_HOST) : array(DB_RBAC_HOST, ''); + $port = empty($port) ? '' : ";port=$port"; + Services\OAuth2\Server::setDatabaseSourceRBAC(DB_RBAC_USER, DB_RBAC_PASS, DB_ADAPTER.":host=$host;dbname=".DB_RBAC_NAME.$port); } // Setting default OAuth Client id, for local PM Web Designer diff --git a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php index fde833117..6ff57df53 100644 --- a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php +++ b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php @@ -49,7 +49,7 @@ class Server implements iAuthenticate $cnn = array('dsn' => self::$dsn, 'username' => self::$dbUser, 'password' => self::$dbPassword); if (self::$isRBAC) { - $config = array('user_table' => 'USERS'); + $config = array(); $cnnrbac = array('dsn' => self::$dsnRBAC, 'username' => self::$dbUserRBAC, 'password' => self::$dbPasswordRBAC); $this->storage = new PmPdo($cnn, $config, $cnnrbac); } else { From 7a0ace2bdaa56c176c60c4683b96fc26e646994b Mon Sep 17 00:00:00 2001 From: Richard Yujra Date: Wed, 4 Mar 2015 12:28:49 -0400 Subject: [PATCH 142/155] config pmdynaform.html to support new datetime and ie8 --- workflow/engine/templates/cases/pmdynaform.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/workflow/engine/templates/cases/pmdynaform.html b/workflow/engine/templates/cases/pmdynaform.html index e3920be59..b93895beb 100644 --- a/workflow/engine/templates/cases/pmdynaform.html +++ b/workflow/engine/templates/cases/pmdynaform.html @@ -7,9 +7,11 @@ + + @@ -19,6 +21,7 @@
###TEMPLATES### + {javascript} From abcb772202e75bdff473b39fde0677f63b37f026 Mon Sep 17 00:00:00 2001 From: Ronald Quenta Date: Wed, 4 Mar 2015 14:32:11 -0400 Subject: [PATCH 143/155] Fix in list start case --- workflow/engine/src/ProcessMaker/BusinessModel/Light.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php index 3c0ba80dd..c55094132 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php @@ -55,6 +55,7 @@ class Light $task->setFormatFieldNameInUppercase(false); $task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid")); + $response = array(); foreach ($processList as $key => $processInfo) { $tempTreeChildren = array (); foreach ($processList[$key] as $keyChild => $processInfoChild) { @@ -78,7 +79,7 @@ class Light $tempTreeChildren[] = $tempTreeChild; } } - $response = $tempTreeChildren; + $response = array_merge($response, $tempTreeChildren); } } catch (\Exception $e) { throw $e; From 8a0b87a267afb9f4560d3abb7eb1582b8bd501ca Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Wed, 4 Mar 2015 15:51:33 -0400 Subject: [PATCH 144/155] IMPROVEMENT --- Rakefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index e66aa1033..8c314a6fc 100644 --- a/Rakefile +++ b/Rakefile @@ -230,8 +230,7 @@ def buildMafe(homeDir, targetDir, mode) "#{homeDir}/build/js/designer.js" => "#{mafeDir}/designer.min.js", "#{homeDir}/build/js/mafe.js" => "#{mafeDir}/mafe.min.js", "#{homeDir}/build/css/mafe.css" => "#{mafeDir}/mafe.min.css", - "#{homeDir}/img/*.*" => "#{imgTargetDir}", - "#{targetDir}/../lib-dev/pmUI/images/*.*" => "#{imgTargetDir}" + "#{homeDir}/img/*.*" => "#{imgTargetDir}" }) puts "\nCopying lib files into: #{jsTargetDir}".bold From c11b14fee967b7ccd9f892be2e23a5377ac490a3 Mon Sep 17 00:00:00 2001 From: "marcelo.cuiza" Date: Wed, 4 Mar 2015 16:11:01 -0400 Subject: [PATCH 145/155] PM-1650 Nuevo directorio para filtrar xss --- ...166bfe16a0cc6bd18d813b83121ef2eaf16545,1.ser | Bin 0 -> 25532 bytes ...03c8ec0e84e7feb92afd4c0f1735841b5fdacf,1.ser | Bin 0 -> 516 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 gulliver/thirdparty/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer/CSS/4.6.0,24166bfe16a0cc6bd18d813b83121ef2eaf16545,1.ser create mode 100644 gulliver/thirdparty/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer/URI/4.6.0,8d03c8ec0e84e7feb92afd4c0f1735841b5fdacf,1.ser diff --git a/gulliver/thirdparty/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer/CSS/4.6.0,24166bfe16a0cc6bd18d813b83121ef2eaf16545,1.ser b/gulliver/thirdparty/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer/CSS/4.6.0,24166bfe16a0cc6bd18d813b83121ef2eaf16545,1.ser new file mode 100644 index 0000000000000000000000000000000000000000..fe7977acbaf2b8d6484375b1d243fcfc794e314a GIT binary patch literal 25532 zcmeG_Wpm?7w)<0F&Bs@jsyLaMWPCqaWXqN%S&}JVZiyv}S@PCaJ!WQRX5Pol%*@Qp zd|KdS?wy&<+TJ94YrkaLtycF@_u+H;4A(z<+J7{XrVO9Owqfh>>$oTqx?%fvY6t$K z{^S1J6ZrEetwR0LYf1mS{|H8)7IfOa5j=WL?mw+Z^-f`!UZy9qYn%R~*SP*;82#Mj zgEWm{cC^Urv=;_(D*Gv+t3fQMLENqeFKN1g-amWtlJ`kJ^V-q9v;LzTR@7dHznPvO zcsih6-AEt3X7^74T$n1hO{@OhgWvGos_v(Hj0T)R$3_3qCQDM=s8G-OYwt+_Y>HY9CkseCw$g_2Uyb{974cjom|}Sp^x1god7pmsA@WRC}06Ov|uTKH-Yz1-~zVN!gVytJAV~B zoMvunhd>1l_X4s>Y~Msw(H=a!?8#+EHMiv=`=SfHr@Fcf-0}W6PRGV?G8~XP9al%} z2Eg2Lb;QKsF`$u!cIo~(H~?q3fed`={`TW@gi=V4fDStaeM3bZ2nB)L2a0P)SuLN=?qB=>=c+d_mtz~$tNX;hGlYF_+Cro# zCa|UMi7JPnu%UgtceDeB>e@+*b|+zgls!;@?~!!7%>!M>)@tNJ_=nI9l%2Nc0c;#_ zxf>hT*a`Q?@1C{%PP3DmLR*qm?HI&aN3uw`MwuM96kBhqrmJ>K=15EJ_29FD0+jDK z@Z?&(ManAb&cg6!H&R)zN6T(#$!HyB6Jmjb9jjehB8%>}wu-+-Hd z;TXzsf(%S}4VdzCufb5hdD^c5ZcRsYn<)YIP2DU z+)ekmo9$WG(>rUr-tmrWD$_kh*AhWbf()=3`8|-HbUTX$X1U$K11w=sKdw36dz{xX zpjC*q^QPf-K+iy_o$IV-f4vvUP%!)8P(X;hOf!K2fFm&Ag&Z87p4ZalJ-(g5=xeuM z8q0oSfUSsczzHzq#C&3 z8$E_dhHZIHl-zX3;`J*1TIqa`qYPlIBC8I#`7&QSIg-xNVEh4m0VwkZRIwiF_iMY? z{twuy4wA+It$oZ0w3FHygjnl!SM9q-NDN2l2PfBW-ajUvfr@ftd*w8hRm%fq=NPEH zFT3b$tVE3icW2`x$BkV!F6#$iVZmA6*tlbwrmqapU^@!sJ8QV{O#(b1!Cc)pk*AI8 zpTo(%l&>(&u$@;E-h{Bpqt{qKQowEW6L~e!&)c${9=Jl`y;fIl?Ui#lw3hda_p zBZS*2AdI9y%&QGIz4ANQdT94LECvvOn0VdSO?jWN&}~2Vw&MVz{liSVlRi0~u(?0PM3Zwvq(>8RuWIT$wwirps8S%=FW3RpmR z&j+R+3SdZix{eD!6sUk6u7%VwMEWZk`n7CoIr8&X)f40cssre6;%ptdzTs)BgLXP3 za>rbM&Q6btAzuP1T(8h&Ub*&%Jruy67ikX#s%!pvB!~{-pY_S#G5-V=-qj(QD?Uj=S%q|z zqsaApH4FgLZpQP085|+W?*Qhww;6mFYzzpX05p<%jX+LRU>4V!RV#U2Ic_phk&<6evFkyZ0L?nP zE|diTv(&%Ahi~^${2$(`muYg3kCg(@qTyT84TkjCyY@5Q1%m~B*R_59#L}D8^!rP@ zfLOy}R90s(+?RB{jdKUC<{eKpyaW+dpZu zjPH*?cVh6BQHsv6?m~xPG9MOgdFxA+eM5&`o|&Aba0%*o@rAp;ib-V%KGfw0Y_D#$0YMmPN$45Ku|oq3dtu_8i1c@35!eLC z8-G(26>=7U?Lnd)1Uz08O1-UTq`m|5GJnFmD9i8wET%T^4`B`5qB{_A4l~K$jWY$V z{iXwLicq}pEE|e>H`6K~4r4sNtEh44z1JH0z}JD|_6qsKdq;|0$Ni`02PGc>D7ESV z7cEh_mm^)SJqO11LK%We%t%m;rmZeh7qhvW%MC!Sb>Pg9J==wZ{6n29@4`Z(;Icf` zEOqmOktZjR00eCR;u+|eub;f1tf-LZY+CllaXmi>qc};kyeO-!EX$CoCTp@T8?q@| zvMq09M|Nen_$mi-C`WQECvqxhaxNEgDOd7VkrhQz6;06xtgc>TA+nmq{UjIrCO%tTA`I%rEPUtS9Dd^bX_-e zQwN1b-{_9+>TugY58zryq@#P1sh;V%Ug)J>>03iK6hk#MLpKb=G%Uk5Hil!khG#&L zBO^2-BQ_EvH8LYN3ZpbCV{6K$VyY%orZElEG%eFMH>P8{rf2$QV1{O7#%5xsW@hGQ zVU}iPZY|kTEY;F1-7+lGvMk%$SdQgdp5)l zDA8ovmTlV`+p%4!J>=Vg9omr{+vvV}X6JTcmv&`uH}Xc=s2gpgZ;Xw(u{QQ*vvD@= z#@qOtU=wblO}t4q=_cFcn_^RLs?FAs9mP={&CwmhF&)dXosHu-uH!kr6F8w0IkA&C zsgpUmQ#hqlIa^nD6<2jNS9cB9bS>9*H?HHluIKu0;D&DG#%|)KZsz80;g)XYZavvk zJk`@Y-7`GXvpn0|c#h|Kp67dTGuVr~*h{?B%e>qxywa<@tuOnEulky=`-X4&mT&tT z-|=1F^L z$D7!R-Pnu$IEceIisLwm(>ROsxQNTRinocJD2bYAiJlmVnOKRPY!WAN6EE?TAPJKw ziIXHrlPt-TA}Nz9*`{);q-v_AdTOL_Un8~CP3oj>>ZN`fq+uGRahjxQnx%PKq-9#A z+f2@sOwF`R&y38>tjx|fnUlGhm-$(cg;|uvS(2q$mgQNIm06W-b2(RXHP>=IH*zz# zay#GTPVVMj?&m=s=20H!NuK6ep65kg=2gBe|#?mgQGOQlpxt<+1SG)t?r%T4K&Zt0bN8I)lem2sJrX_=LIS(Ig2 zmD@_LluE6%O0SH{tgOneHkDJkl~?&yP=!@g#Z^+JRaWIyQI%CyZ3h@mkkoKQk0;EO z<@lK(O7q2XwZ0k*2G{@}5Cd{R4Tgi!fF6tolL0fB4%h)V;0LpTFc1gQU_Mw3mV?z` zJ-EUK7>3~(fsq)64Y3hMV`FTBG1wGiF%ILg875#NCSh}Ifi1BWw#KgT0gmA~PT(X? z;X{0c)A$&l;0!*+S)9Xpe1;3Sh)eh!U*Jo8g|G1|VnAR7P7nl1P{fcJ5i~I-CImxF z36|gpo|q8=ArcZXClYqDSM=WW6jgJV}3jv z3uAFCjpyUVcsX8;*W;_nV1iBX2{9oj)MPjrP3XyZGMO-w>4cqd6MizA2orH4P3Duu zWI0()){`q{z+eo{5Ddvs%#ax|G&5!<48u$rmf;wlnK1$*G7>Xq7R-`aF>B^(I+$Wp zd`e8oDK#BVM^kz_o=&FBbUJ0H+?1crrovR5O4IptF0x3|!P#6icFcu~PBTNNW-~?Wn34$OBk}ww*!ctfXYvD>9h?t0rgh+~%I21=B zEsn*B$cR&s6*-X?XQCjAq9o46g}4+~;#$0t1`;OW5+RWiB@LyKL`!37A~DibVkJ)E zrI{p1q9jRkX(278m9&#Fxa9TvE&7aC$$u0TiY$+_orL>$c7t7^xwOlW+R)ZC`!dJwK zTv4mxYP6zP(I5NqpZLk2`sttf z*`NFQU--pe`sH8w)nEJd-}uen`t9HO-QWBDKlsBx`r|+O(?9$3zxd0)`s=^>+rRt! zfB46L`saW7*MIx>|M<`U`tSew-~U4@@9lgU`x{m0a#^k67e`Cm+1oa)Gw8wKznRq9 zmO*pt5{t;1hUZG))&)h7DO_iuL5)tUt$uk9(Q8!50@Y)L=XL7|w9f0+Q`BF#E}-?K zZe2p_Y2A7Tt&6$^RVwWMWz$3jN1ip!V_iVl|G2;-hED4khS=GwtW9Kyz3?^?6k=(- zZZ*=h`&fPD;)O?0lgSN$TBitX5)^A`PN4;L zcRWw(2Q}&Jim==xi>D79FD?(M2`_i*w>$g{EaO@M~dYg2oLx+T6m5Z z?>r2o9mYI>(}H7ecLy-ng<^Y0$>iQwSk>+~NRYmUrMbWcU5O4CwPmOW27==OR9pbg z1@&W)kMg9cw0F1<@1RWsEU(F}*{>SIP_5jDvsUwJ&;JBHacESb?HSNdIUuA?rYGk|_;>)<=+J zP_G01Mq>3EpOK0JuQvsxP@Wx9LYtcxP*?o9qTn5azpkxVzjfVRYc=ns*SVSy)k8?d zYD;C^s@EUmjxlz^&QNq5Yvih!pt)iz&Vup0t4uToQwo}*pUQ(GGxQP=HGHw6XBF52$QRc(#Df@AS7lX zn{r}SJO5zhdS|rrAeJ~Cp*+Qh`FWO6J+G4c$QxP5j4Yyy6GCEw$1a*S3aRa z#S<7y6` literal 0 HcmV?d00001 From 578d58a89fca01033503d10cbf9e1b7f2f2f1dd5 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Wed, 4 Mar 2015 16:51:41 -0400 Subject: [PATCH 146/155] PM-1723 "Designer: Se pierde las configuraciones de un..." SOLVED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: Designer: Se pierde las configuraciones de un subproceso al importar el proceso Cause: Al momento de importar no se esta registrando de manera correcta los registros en la tabla "SUB_PROCESS" Solution: Se esta validando que los registros en la tabla "SUB_PROCESS" sean unicos al momento de la importacion Explanation: - Al momento de la importacion de un projecto, si un Activity de tipo sub-process tiene definido sus properties, esta configuracion se registra en la tabla correspondiente, no importando si previamente ya fue importado el projecto que es el sub-process. - La importacion del projecto-principal y el projecto-sub-proceso es independiente, este criterio ya se lo tiene en produccion desde hace varias veriones atras. - Un ejemplo practico seria el siguiente caso: Un administrador exporta el projecto-principal y el projecto-sub-proceso, y dadas las circunstancias el projecto-sub-proceso se pierde, dañetc. Entonces el administrador por lo menos lograra importar en su workspace el projecto-principal (pues la importacion no valida que primero deba importar el projecto-sub-proceso) --- workflow/engine/classes/class.processes.php | 17 ++++++++++++++--- .../src/ProcessMaker/Project/Workflow.php | 7 +++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/workflow/engine/classes/class.processes.php b/workflow/engine/classes/class.processes.php index 513b78ba1..6725e8f66 100755 --- a/workflow/engine/classes/class.processes.php +++ b/workflow/engine/classes/class.processes.php @@ -1516,9 +1516,20 @@ class Processes { foreach ($SubProcess as $key => $row) { $oSubProcess = new SubProcess(); - if ($oSubProcess->subProcessExists( $row['SP_UID'] )) { - $oSubProcess->remove( $row['SP_UID'] ); - } + + //if ($oSubProcess->subProcessExists( $row['SP_UID'] )) { + // $oSubProcess->remove( $row['SP_UID'] ); + //} + + //Delete + $criteria = new Criteria("workflow"); + + $criteria->add(SubProcessPeer::PRO_PARENT, $row["PRO_PARENT"], Criteria::EQUAL); + $criteria->add(SubProcessPeer::TAS_PARENT, $row["TAS_PARENT"], Criteria::EQUAL); + + $result = SubProcessPeer::doDelete($criteria); + + //Create $res = $oSubProcess->create( $row ); } return; diff --git a/workflow/engine/src/ProcessMaker/Project/Workflow.php b/workflow/engine/src/ProcessMaker/Project/Workflow.php index 688023b9d..c46911cfc 100755 --- a/workflow/engine/src/ProcessMaker/Project/Workflow.php +++ b/workflow/engine/src/ProcessMaker/Project/Workflow.php @@ -764,6 +764,13 @@ class Workflow extends Handler $oCriteria->add(\CaseTrackerObjectPeer::PRO_UID, $sProcessUID); \ProcessUserPeer::doDelete($oCriteria); + //Delete SubProcess + $criteria = new \Criteria("workflow"); + + $criteria->add(\SubProcessPeer::PRO_PARENT, $sProcessUID, \Criteria::EQUAL); + + $result = \SubProcessPeer::doDelete($criteria); + //Delete WebEntries $webEntry = new \ProcessMaker\BusinessModel\WebEntry(); From 681dfff07d55d9f319fc35f2f642236e555f3780 Mon Sep 17 00:00:00 2001 From: jonathan Date: Wed, 4 Mar 2015 17:25:52 -0400 Subject: [PATCH 147/155] fix 1423 view proces map legends in internet explorer --- workflow/engine/templates/cases/open.js | 39 ++++++++++++++++--------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/workflow/engine/templates/cases/open.js b/workflow/engine/templates/cases/open.js index bcd38d4f4..32dbe0da1 100755 --- a/workflow/engine/templates/cases/open.js +++ b/workflow/engine/templates/cases/open.js @@ -30,7 +30,14 @@ function formatAMPM(date, initVal) { minutes = minutes < 10 ? '0'+minutes : minutes; var strTime = hours + ':' + minutes + ' ' + ampm; return strTime; -} +}; + +function isBrowserIE(){ + if(navigator.appName.indexOf("Internet Explorer")!=-1){ //yeah, he's using IE + return true; + } + return false; +}; Ext.onReady(function(){ openToRevisePanel = function() { @@ -1531,20 +1538,24 @@ Ext.onReady(function(){ TabPanel.setActiveTab(tabId); } else { - TabPanel.add({ - id: tabId, - title: menuSelectedTitle[name], - frameConfig: {name: name + 'Frame', id: name + 'Frame'}, - defaultSrc: uri, - loadMask: {msg: _('ID_LOADING_GRID') + '...'}, - autoWidth: true, - closable: true, - autoScroll: true, - bodyStyle: {height: (PMExt.getBrowser().screen.height - 60) + 'px', overflow: 'auto'} - }).show(); + if(!isBrowserIE()){ + TabPanel.add({ + id: tabId, + title: menuSelectedTitle[name], + frameConfig: {name: name + 'Frame', id: name + 'Frame'}, + defaultSrc: uri, + loadMask: {msg: _('ID_LOADING_GRID') + '...'}, + autoWidth: true, + closable: true, + autoScroll: true, + bodyStyle: {height: (PMExt.getBrowser().screen.height - 60) + 'px', overflow: 'auto'} + }).show(); - TabPanel.doLayout(); - } + TabPanel.doLayout(); + }else{ + var windContainer = window.open(uri,"winContainer"); + } + } } }, failure: function ( result, request) { From 90425e7a6efb4bf49e3f6731ad3a25d903de6aa9 Mon Sep 17 00:00:00 2001 From: jonathan Date: Thu, 5 Mar 2015 10:51:54 -0400 Subject: [PATCH 148/155] update function for recognize ie11 --- workflow/engine/templates/cases/open.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/workflow/engine/templates/cases/open.js b/workflow/engine/templates/cases/open.js index 32dbe0da1..ea9cc3336 100755 --- a/workflow/engine/templates/cases/open.js +++ b/workflow/engine/templates/cases/open.js @@ -33,10 +33,11 @@ function formatAMPM(date, initVal) { }; function isBrowserIE(){ - if(navigator.appName.indexOf("Internet Explorer")!=-1){ //yeah, he's using IE - return true; - } - return false; + if ( (navigator.userAgent.indexOf("MSIE")!=-1) || (navigator.userAgent.indexOf("Trident")!=-1) ){ + return true; + } else { + return false; + } }; Ext.onReady(function(){ From cb2e834dc17ddb49f7daf80959294f20d0b39022 Mon Sep 17 00:00:00 2001 From: dheeyi Date: Thu, 5 Mar 2015 12:20:19 -0400 Subject: [PATCH 149/155] =?UTF-8?q?PM-1485=200016744:=20In=20the=20BPMN=20?= =?UTF-8?q?Designer,=20can=20not=20connect=20to=20Oracle=20(and=20probably?= =?UTF-8?q?=20MS=20SQL)=20databases=20because=20no=20"Encode"=20options.?= =?UTF-8?q?=20Causa:=20Solo=20exisitia=20en=20el=20dise=C3=B1r=20anterior.?= =?UTF-8?q?=20Solicion:=20Se=20agrego=20esa=20funcionalidad=20al=20nuevo?= =?UTF-8?q?=20dise=C3=B1r.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- workflow/engine/classes/class.net.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/workflow/engine/classes/class.net.php b/workflow/engine/classes/class.net.php index 10dd46d50..78e3e2e0a 100755 --- a/workflow/engine/classes/class.net.php +++ b/workflow/engine/classes/class.net.php @@ -213,7 +213,15 @@ class NET } $stat = new Stat(); - $flagTns = (isset($arrayServerData["connectionType"]) && $arrayServerData["connectionType"] == "TNS")? 1 : 0; + if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) { + if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") { + $flagTns=1; + }else{ + $flagTns=0; + } + }else{ + $flagTns=0; + } if (isset($this->db_user) && (isset($this->db_passwd) || $this->db_passwd == "") && (isset($this->db_sourcename) || $flagTns == 1)) { switch ($pDbDriver) { @@ -323,7 +331,15 @@ class NET set_time_limit( 0 ); $stat = new Stat(); - $flagTns = (isset($arrayServerData["connectionType"]) && $arrayServerData["connectionType"] == "TNS")? 1 : 0; + if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) { + if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") { + $flagTns=1; + }else{ + $flagTns=0; + } + }else{ + $flagTns=0; + } if (isset($this->db_user) && (isset($this->db_passwd) || $this->db_passwd == "") && (isset($this->db_sourcename) || $flagTns == 1)) { switch ($pDbDriver) { From 8fe15e8ea5364c4d0abda2bd9d1430e05d117eb5 Mon Sep 17 00:00:00 2001 From: dheeyi Date: Thu, 5 Mar 2015 13:16:20 -0400 Subject: [PATCH 150/155] PM-878: Change description of the "processmaker change-password-hash-method" command in the help --- workflow/engine/bin/tasks/cliAddons.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/bin/tasks/cliAddons.php b/workflow/engine/bin/tasks/cliAddons.php index 27af448db..1fdffd8cf 100644 --- a/workflow/engine/bin/tasks/cliAddons.php +++ b/workflow/engine/bin/tasks/cliAddons.php @@ -21,7 +21,7 @@ EOT /*----------------------------------********---------------------------------*/ CLI::taskName('change-password-hash-method'); CLI::taskDescription(<< Date: Thu, 5 Mar 2015 13:38:57 -0400 Subject: [PATCH 151/155] PM-1127 Change following text in the Trigger Wizard. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Causa: Textos definidos previamentes. SolucióEdicion de nuevos textos. --- workflow/engine/classes/class.pmFunctions.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index f69f43390..78dd3f11f 100755 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -885,7 +885,7 @@ function PMFSendMessage( if ($result->status_code == 0) { return 1; } else { - error_log($result->message); + error_log($result->message); return 0; } } @@ -1402,8 +1402,8 @@ function WSUnpauseCase ($caseUid, $delIndex, $userUid) * * Add a case note. * - * @name WSAddCaseNote - * @label WS Add case note + * @name WSAddACaseNote + * @label WS Add a case note * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#WSAddCaseNote.28.29 * * @param string(32) | $caseUid | ID of the case | The unique ID of the case. @@ -1539,8 +1539,8 @@ function PMFUserList () //its test was successfull * * Add an Input Document. * - * @name PMFAddInputDocument - * @label PMF Add a input document + * @name PMFAddAnInputDocument + * @label PMF Add an input document * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFAddInputDocument.28.29 * * @param string(32) | $inputDocumentUid | ID of the input document | The unique ID of the input document. @@ -2773,8 +2773,8 @@ function PMFUnpauseCase ($caseUid, $delIndex, $userUid) * * Add case note. * - * @name PMFAddCaseNote - * @label PMF Add case note + * @name PMFAddACaseNote + * @label PMF Add a case note * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFAddCaseNote.28.29 * * @param string(32) | $caseUid | ID of the case | The unique ID of the case. From a441d6ff0c93deb500d5fb18a15fba8233c4ba93 Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Thu, 5 Mar 2015 13:44:46 -0400 Subject: [PATCH 152/155] =?UTF-8?q?PM-1774=20No=20esta=20grabando=20el=20d?= =?UTF-8?q?ise=C3=B1o=20de=20un=20parallel=20join=20en=20el=20dise=C3=B1ad?= =?UTF-8?q?or=20SOLVED?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- workflow/engine/methods/processes/processes_Ajax.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index bb3b3555a..01fe49f6e 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -462,6 +462,7 @@ try { break; case 5: $sType = 'SEC-JOIN'; + $oProcessNewPattern = new Process(); $taskProcess=$oProcessNewPattern->load($oData->pro_uid); $titleProcess=$taskProcess['PRO_TITLE']; $oTaskNewPattern = new Task(); @@ -478,6 +479,7 @@ try { break; case 8: $sType = 'DISCRIMINATOR'; + $oProcessNewPattern = new Process(); $taskProcess=$oProcessNewPattern->load($oData->pro_uid); $titleProcess=$taskProcess['PRO_TITLE']; $oTaskNewPattern = new Task(); From 09ec9b175d905de80b764b6feced263c30034e28 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Thu, 5 Mar 2015 13:47:34 -0400 Subject: [PATCH 153/155] PM-1700 "Ocurre un error al importar y actualizar un proceso..." SOLVED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: Ocurre un error al importar y actualizar un proceso de tipo bpmn, despliega un error sin descripció el proceso se convierte en un proceso de tipo classic Cause: Mala definicion de variables para el "Add Audit Log" Solution: Se a suprimido las variables, ahora se utiliza el objeto para el seteo de variables --- workflow/engine/classes/class.processes.php | 28 +++++++----- .../src/ProcessMaker/Importer/Importer.php | 44 +++++++++++++------ 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/workflow/engine/classes/class.processes.php b/workflow/engine/classes/class.processes.php index 6725e8f66..3f0d72746 100755 --- a/workflow/engine/classes/class.processes.php +++ b/workflow/engine/classes/class.processes.php @@ -2290,14 +2290,16 @@ class Processes try { $map = array(); - foreach ($data->messageType as $key => $value) { - $record = $value; + if (isset($data->messageType)) { + foreach ($data->messageType as $key => $value) { + $record = $value; - if (isset($record["MSGT_UID"])) { - $newUid = $this->getUnusedMessageTypeUid(); + if (isset($record["MSGT_UID"])) { + $newUid = $this->getUnusedMessageTypeUid(); - $map[$record["MSGT_UID"]] = $newUid; - $data->messageType[$key]["MSGT_UID"] = $newUid; + $map[$record["MSGT_UID"]] = $newUid; + $data->messageType[$key]["MSGT_UID"] = $newUid; + } } } @@ -2344,14 +2346,16 @@ class Processes try { $map = array(); - foreach ($data->messageTypeVariable as $key => $value) { - $record = $value; + if (isset($data->messageTypeVariable)) { + foreach ($data->messageTypeVariable as $key => $value) { + $record = $value; - if (isset($record["MSGTV_UID"])) { - $newUid = $this->getUnusedMessageTypeVariableUid(); + if (isset($record["MSGTV_UID"])) { + $newUid = $this->getUnusedMessageTypeVariableUid(); - $map[$record["MSGTV_UID"]] = $newUid; - $data->messageTypeVariable[$key]["MSGTV_UID"] = $newUid; + $map[$record["MSGTV_UID"]] = $newUid; + $data->messageTypeVariable[$key]["MSGTV_UID"] = $newUid; + } } } diff --git a/workflow/engine/src/ProcessMaker/Importer/Importer.php b/workflow/engine/src/ProcessMaker/Importer/Importer.php index 1aef380dc..a240f90cd 100755 --- a/workflow/engine/src/ProcessMaker/Importer/Importer.php +++ b/workflow/engine/src/ProcessMaker/Importer/Importer.php @@ -73,8 +73,7 @@ abstract class Importer { $this->prepare(); - $name = $this->importData["tables"]["bpmn"]["project"][0]["prj_name"]; - + //Verify data switch ($option) { case self::IMPORT_OPTION_CREATE_NEW: if ($this->targetExists()) { @@ -94,23 +93,12 @@ abstract class Importer self::IMPORT_STAT_TARGET_ALREADY_EXISTS ); } - $generateUid = false; break; case self::IMPORT_OPTION_OVERWRITE: - $this->removeProject(); - // this option shouldn't generate new uid for all objects - $generateUid = false; break; case self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW: - $this->disableProject(); - // this option should generate new uid for all objects - $generateUid = true; - $name = "New - " . $name . " - " . date("M d, H:i"); break; case self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW: - // this option should generate new uid for all objects - $generateUid = true; - $name = \G::LoadTranslation("ID_COPY_OF") . " - " . $name . " - " . date("M d, H:i"); break; } @@ -149,6 +137,36 @@ abstract class Importer break; } + //Import + $name = $this->importData["tables"]["bpmn"]["project"][0]["prj_name"]; + + switch ($option) { + case self::IMPORT_OPTION_CREATE_NEW: + //Shouldn't generate new UID for all objects + $generateUid = false; + break; + case self::IMPORT_OPTION_OVERWRITE: + //Shouldn't generate new UID for all objects + $this->removeProject(); + + $generateUid = false; + break; + case self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW: + //Should generate new UID for all objects + $this->disableProject(); + + $name = "New - " . $name . " - " . date("M d, H:i"); + + $generateUid = true; + break; + case self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW: + //Should generate new UID for all objects + $name = \G::LoadTranslation("ID_COPY_OF") . " - " . $name . " - " . date("M d, H:i"); + + $generateUid = true; + break; + } + $this->importData["tables"]["bpmn"]["project"][0]["prj_name"] = $name; $this->importData["tables"]["bpmn"]["diagram"][0]["dia_name"] = $name; $this->importData["tables"]["bpmn"]["process"][0]["pro_name"] = $name; From 25ce1e558d35b684ff51329ee2c46bb86f14dcb9 Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Thu, 5 Mar 2015 16:00:40 -0400 Subject: [PATCH 154/155] Deleting unnecesary files in thirdparty --- ...166bfe16a0cc6bd18d813b83121ef2eaf16545,1.ser | Bin 25532 -> 0 bytes ...03c8ec0e84e7feb92afd4c0f1735841b5fdacf,1.ser | Bin 516 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 gulliver/thirdparty/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer/CSS/4.6.0,24166bfe16a0cc6bd18d813b83121ef2eaf16545,1.ser delete mode 100644 gulliver/thirdparty/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer/URI/4.6.0,8d03c8ec0e84e7feb92afd4c0f1735841b5fdacf,1.ser diff --git a/gulliver/thirdparty/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer/CSS/4.6.0,24166bfe16a0cc6bd18d813b83121ef2eaf16545,1.ser b/gulliver/thirdparty/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer/CSS/4.6.0,24166bfe16a0cc6bd18d813b83121ef2eaf16545,1.ser deleted file mode 100644 index fe7977acbaf2b8d6484375b1d243fcfc794e314a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25532 zcmeG_Wpm?7w)<0F&Bs@jsyLaMWPCqaWXqN%S&}JVZiyv}S@PCaJ!WQRX5Pol%*@Qp zd|KdS?wy&<+TJ94YrkaLtycF@_u+H;4A(z<+J7{XrVO9Owqfh>>$oTqx?%fvY6t$K z{^S1J6ZrEetwR0LYf1mS{|H8)7IfOa5j=WL?mw+Z^-f`!UZy9qYn%R~*SP*;82#Mj zgEWm{cC^Urv=;_(D*Gv+t3fQMLENqeFKN1g-amWtlJ`kJ^V-q9v;LzTR@7dHznPvO zcsih6-AEt3X7^74T$n1hO{@OhgWvGos_v(Hj0T)R$3_3qCQDM=s8G-OYwt+_Y>HY9CkseCw$g_2Uyb{974cjom|}Sp^x1god7pmsA@WRC}06Ov|uTKH-Yz1-~zVN!gVytJAV~B zoMvunhd>1l_X4s>Y~Msw(H=a!?8#+EHMiv=`=SfHr@Fcf-0}W6PRGV?G8~XP9al%} z2Eg2Lb;QKsF`$u!cIo~(H~?q3fed`={`TW@gi=V4fDStaeM3bZ2nB)L2a0P)SuLN=?qB=>=c+d_mtz~$tNX;hGlYF_+Cro# zCa|UMi7JPnu%UgtceDeB>e@+*b|+zgls!;@?~!!7%>!M>)@tNJ_=nI9l%2Nc0c;#_ zxf>hT*a`Q?@1C{%PP3DmLR*qm?HI&aN3uw`MwuM96kBhqrmJ>K=15EJ_29FD0+jDK z@Z?&(ManAb&cg6!H&R)zN6T(#$!HyB6Jmjb9jjehB8%>}wu-+-Hd z;TXzsf(%S}4VdzCufb5hdD^c5ZcRsYn<)YIP2DU z+)ekmo9$WG(>rUr-tmrWD$_kh*AhWbf()=3`8|-HbUTX$X1U$K11w=sKdw36dz{xX zpjC*q^QPf-K+iy_o$IV-f4vvUP%!)8P(X;hOf!K2fFm&Ag&Z87p4ZalJ-(g5=xeuM z8q0oSfUSsczzHzq#C&3 z8$E_dhHZIHl-zX3;`J*1TIqa`qYPlIBC8I#`7&QSIg-xNVEh4m0VwkZRIwiF_iMY? z{twuy4wA+It$oZ0w3FHygjnl!SM9q-NDN2l2PfBW-ajUvfr@ftd*w8hRm%fq=NPEH zFT3b$tVE3icW2`x$BkV!F6#$iVZmA6*tlbwrmqapU^@!sJ8QV{O#(b1!Cc)pk*AI8 zpTo(%l&>(&u$@;E-h{Bpqt{qKQowEW6L~e!&)c${9=Jl`y;fIl?Ui#lw3hda_p zBZS*2AdI9y%&QGIz4ANQdT94LECvvOn0VdSO?jWN&}~2Vw&MVz{liSVlRi0~u(?0PM3Zwvq(>8RuWIT$wwirps8S%=FW3RpmR z&j+R+3SdZix{eD!6sUk6u7%VwMEWZk`n7CoIr8&X)f40cssre6;%ptdzTs)BgLXP3 za>rbM&Q6btAzuP1T(8h&Ub*&%Jruy67ikX#s%!pvB!~{-pY_S#G5-V=-qj(QD?Uj=S%q|z zqsaApH4FgLZpQP085|+W?*Qhww;6mFYzzpX05p<%jX+LRU>4V!RV#U2Ic_phk&<6evFkyZ0L?nP zE|diTv(&%Ahi~^${2$(`muYg3kCg(@qTyT84TkjCyY@5Q1%m~B*R_59#L}D8^!rP@ zfLOy}R90s(+?RB{jdKUC<{eKpyaW+dpZu zjPH*?cVh6BQHsv6?m~xPG9MOgdFxA+eM5&`o|&Aba0%*o@rAp;ib-V%KGfw0Y_D#$0YMmPN$45Ku|oq3dtu_8i1c@35!eLC z8-G(26>=7U?Lnd)1Uz08O1-UTq`m|5GJnFmD9i8wET%T^4`B`5qB{_A4l~K$jWY$V z{iXwLicq}pEE|e>H`6K~4r4sNtEh44z1JH0z}JD|_6qsKdq;|0$Ni`02PGc>D7ESV z7cEh_mm^)SJqO11LK%We%t%m;rmZeh7qhvW%MC!Sb>Pg9J==wZ{6n29@4`Z(;Icf` zEOqmOktZjR00eCR;u+|eub;f1tf-LZY+CllaXmi>qc};kyeO-!EX$CoCTp@T8?q@| zvMq09M|Nen_$mi-C`WQECvqxhaxNEgDOd7VkrhQz6;06xtgc>TA+nmq{UjIrCO%tTA`I%rEPUtS9Dd^bX_-e zQwN1b-{_9+>TugY58zryq@#P1sh;V%Ug)J>>03iK6hk#MLpKb=G%Uk5Hil!khG#&L zBO^2-BQ_EvH8LYN3ZpbCV{6K$VyY%orZElEG%eFMH>P8{rf2$QV1{O7#%5xsW@hGQ zVU}iPZY|kTEY;F1-7+lGvMk%$SdQgdp5)l zDA8ovmTlV`+p%4!J>=Vg9omr{+vvV}X6JTcmv&`uH}Xc=s2gpgZ;Xw(u{QQ*vvD@= z#@qOtU=wblO}t4q=_cFcn_^RLs?FAs9mP={&CwmhF&)dXosHu-uH!kr6F8w0IkA&C zsgpUmQ#hqlIa^nD6<2jNS9cB9bS>9*H?HHluIKu0;D&DG#%|)KZsz80;g)XYZavvk zJk`@Y-7`GXvpn0|c#h|Kp67dTGuVr~*h{?B%e>qxywa<@tuOnEulky=`-X4&mT&tT z-|=1F^L z$D7!R-Pnu$IEceIisLwm(>ROsxQNTRinocJD2bYAiJlmVnOKRPY!WAN6EE?TAPJKw ziIXHrlPt-TA}Nz9*`{);q-v_AdTOL_Un8~CP3oj>>ZN`fq+uGRahjxQnx%PKq-9#A z+f2@sOwF`R&y38>tjx|fnUlGhm-$(cg;|uvS(2q$mgQNIm06W-b2(RXHP>=IH*zz# zay#GTPVVMj?&m=s=20H!NuK6ep65kg=2gBe|#?mgQGOQlpxt<+1SG)t?r%T4K&Zt0bN8I)lem2sJrX_=LIS(Ig2 zmD@_LluE6%O0SH{tgOneHkDJkl~?&yP=!@g#Z^+JRaWIyQI%CyZ3h@mkkoKQk0;EO z<@lK(O7q2XwZ0k*2G{@}5Cd{R4Tgi!fF6tolL0fB4%h)V;0LpTFc1gQU_Mw3mV?z` zJ-EUK7>3~(fsq)64Y3hMV`FTBG1wGiF%ILg875#NCSh}Ifi1BWw#KgT0gmA~PT(X? z;X{0c)A$&l;0!*+S)9Xpe1;3Sh)eh!U*Jo8g|G1|VnAR7P7nl1P{fcJ5i~I-CImxF z36|gpo|q8=ArcZXClYqDSM=WW6jgJV}3jv z3uAFCjpyUVcsX8;*W;_nV1iBX2{9oj)MPjrP3XyZGMO-w>4cqd6MizA2orH4P3Duu zWI0()){`q{z+eo{5Ddvs%#ax|G&5!<48u$rmf;wlnK1$*G7>Xq7R-`aF>B^(I+$Wp zd`e8oDK#BVM^kz_o=&FBbUJ0H+?1crrovR5O4IptF0x3|!P#6icFcu~PBTNNW-~?Wn34$OBk}ww*!ctfXYvD>9h?t0rgh+~%I21=B zEsn*B$cR&s6*-X?XQCjAq9o46g}4+~;#$0t1`;OW5+RWiB@LyKL`!37A~DibVkJ)E zrI{p1q9jRkX(278m9&#Fxa9TvE&7aC$$u0TiY$+_orL>$c7t7^xwOlW+R)ZC`!dJwK zTv4mxYP6zP(I5NqpZLk2`sttf z*`NFQU--pe`sH8w)nEJd-}uen`t9HO-QWBDKlsBx`r|+O(?9$3zxd0)`s=^>+rRt! zfB46L`saW7*MIx>|M<`U`tSew-~U4@@9lgU`x{m0a#^k67e`Cm+1oa)Gw8wKznRq9 zmO*pt5{t;1hUZG))&)h7DO_iuL5)tUt$uk9(Q8!50@Y)L=XL7|w9f0+Q`BF#E}-?K zZe2p_Y2A7Tt&6$^RVwWMWz$3jN1ip!V_iVl|G2;-hED4khS=GwtW9Kyz3?^?6k=(- zZZ*=h`&fPD;)O?0lgSN$TBitX5)^A`PN4;L zcRWw(2Q}&Jim==xi>D79FD?(M2`_i*w>$g{EaO@M~dYg2oLx+T6m5Z z?>r2o9mYI>(}H7ecLy-ng<^Y0$>iQwSk>+~NRYmUrMbWcU5O4CwPmOW27==OR9pbg z1@&W)kMg9cw0F1<@1RWsEU(F}*{>SIP_5jDvsUwJ&;JBHacESb?HSNdIUuA?rYGk|_;>)<=+J zP_G01Mq>3EpOK0JuQvsxP@Wx9LYtcxP*?o9qTn5azpkxVzjfVRYc=ns*SVSy)k8?d zYD;C^s@EUmjxlz^&QNq5Yvih!pt)iz&Vup0t4uToQwo}*pUQ(GGxQP=HGHw6XBF52$QRc(#Df@AS7lX zn{r}SJO5zhdS|rrAeJ~Cp*+Qh`FWO6J+G4c$QxP5j4Yyy6GCEw$1a*S3aRa z#S<7y6` From 3839f82f35212d12ac8f89e68ccf89d4c487321f Mon Sep 17 00:00:00 2001 From: dheeyi Date: Thu, 5 Mar 2015 16:11:57 -0400 Subject: [PATCH 155/155] PM-1704 Configuracion de Proceso como privado o publico no disponible. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Causa: Solo en el diseñr antiguo. Solucióadicion de la configuracion. --- workflow/engine/xmlform/processes/processes_Edit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/xmlform/processes/processes_Edit.xml b/workflow/engine/xmlform/processes/processes_Edit.xml index 8025323fb..925143f5d 100755 --- a/workflow/engine/xmlform/processes/processes_Edit.xml +++ b/workflow/engine/xmlform/processes/processes_Edit.xml @@ -57,7 +57,7 @@ WHERE - Type of process (only owners can edit private processes) + Process Design Access: Public / Private (Owner)