Merge branch 'master' of bitbucket.org:colosa/processmaker into CONSOLIDATED

This commit is contained in:
Brayan Pereyra
2015-03-23 14:45:52 -04:00
543 changed files with 41770 additions and 1325 deletions

View File

@@ -33,6 +33,8 @@ class Upgrade
public function install()
{
G::LoadSystem('inputfilter');
$filter = new InputFilter();
//echo "Starting core installation...\n";
$start = microtime(1);
$filename = $this->addon->getDownloadFilename();
@@ -42,7 +44,9 @@ class Upgrade
//printf("Time to open archive: %f\n", microtime(1) - $time);
$time = microtime(1);
$extractDir = dirname($this->addon->getDownloadFilename()) . "/extract";
$extractDir = $filter->xssFilterHard($extractDir);
$backupDir = dirname($this->addon->getDownloadFilename()) . "/backup";
$backupDir = $filter->xssFilterHard($backupDir);
if (file_exists($extractDir)) {
G::rm_dir($extractDir);
}
@@ -85,6 +89,7 @@ class Upgrade
$checksumTime = 0;
foreach ($checksums as $filename => $checksum) {
if (is_dir("$extractDir/$filename")) {
$filename = $filter->xssFilterHard($filename);
print $filename;
continue;
}

View File

@@ -0,0 +1,238 @@
<?php
class actionsByEmailClass extends PMPlugin
{
public function __construct()
{
}
public function setup()
{
}
public function getFieldsForPageSetup()
{
return array();
}
public function updateFieldsForPageSetup()
{
}
public function sendActionsByEmail($data)
{
try {
// Validations
if (!is_object($data)) {
throw new Exception('The parameter $data is null.');
}
if (!isset($data->TAS_UID)) {
throw new Exception('The parameter $data->TAS_UID is null.');
}
if (!isset($data->APP_UID)) {
throw new Exception('The parameter $data->APP_UID is null.');
}
if (!isset($data->DEL_INDEX)) {
throw new Exception('The parameter $data->DEL_INDEX is null.');
}
if ($data->TAS_UID == '') {
throw new Exception('The parameter $data->TAS_UID is empty.');
}
if ($data->APP_UID == '') {
throw new Exception('The parameter $data->APP_UID is empty.');
}
if ($data->DEL_INDEX == '') {
throw new Exception('The parameter $data->DEL_INDEX is empty.');
}
G::LoadClass('pmFunctions');
$emailSetup = getEmailConfiguration();
if (!empty($emailSetup)) {
require_once 'classes/model/AbeConfiguration.php';
G::LoadClass('case');
$cases = new Cases();
$caseFields = $cases->loadCase($data->APP_UID);
$criteria = new Criteria();
$criteria->add(AbeConfigurationPeer::PRO_UID, $caseFields['PRO_UID']);
$criteria->add(AbeConfigurationPeer::TAS_UID, $data->TAS_UID);
$result = AbeConfigurationPeer::doSelectRS($criteria);
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$result->next();
if ($configuration = $result->getRow()) {
$configuration['ABE_EMAIL_FIELD'] = str_replace('@@', '', $configuration['ABE_EMAIL_FIELD']);
if ($configuration['ABE_EMAIL_FIELD'] != '' && isset($caseFields['APP_DATA'][$configuration['ABE_EMAIL_FIELD']])) {
$email = trim($caseFields['APP_DATA'][$configuration['ABE_EMAIL_FIELD']]);
} else {
require_once 'classes/model/Users.php';
$userInstance = new Users();
$userInfo = $userInstance->getAllInformation($data->USR_UID);
$email = $userInfo['mail'];
}
if ($email != '') {
$subject = $caseFields['APP_TITLE'];
// Create
require_once 'classes/model/AbeRequests.php';
$abeRequest = array();
$abeRequest['ABE_REQ_UID'] = '';
$abeRequest['ABE_UID'] = $configuration['ABE_UID'];
$abeRequest['APP_UID'] = $data->APP_UID;
$abeRequest['DEL_INDEX'] = $data->DEL_INDEX;
$abeRequest['ABE_REQ_SENT_TO'] = $email;
$abeRequest['ABE_REQ_SUBJECT'] = $subject;
$abeRequest['ABE_REQ_BODY'] = '';
$abeRequest['ABE_REQ_ANSWERED'] = 0;
$abeRequest['ABE_REQ_STATUS'] = 'PENDING';
try {
$abeRequestsInstance = new AbeRequests();
$abeRequest['ABE_REQ_UID'] = $abeRequestsInstance->createOrUpdate($abeRequest);
} catch (Exception $error) {
throw $error;
}
if ($configuration['ABE_TYPE'] != '') {
// Email
$_SESSION['CURRENT_DYN_UID'] = $configuration['DYN_UID'];
$scriptCode = '';
// foreach ($dynaform->fields as $fieldName => $field) {
// if ($field->type == 'submit') {
// unset($dynaform->fields[$fieldName]);
// }
// }
$__ABE__ = '';
$link = (G::is_https() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/ActionsByEmail';
switch ($configuration['ABE_TYPE']) {
case 'LINK':
// $__ABE__ .= $dynaform->render(PATH_FEATURES . 'actionsByEmail/xmlform.html', $scriptCode) . '<br />';
$__ABE__ .= '<a href="' . $link . 'dataForm?APP_UID=' . G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY) . '&DYN_UID=' . G::encrypt($configuration['DYN_UID'], URL_KEY) . '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank">Please complete this form</a>';
break;
// coment
case 'FIELD':
$variableService = new \ProcessMaker\Services\Api\Project\Variable();
$variables = $variableService->doGetVariables($caseFields['PRO_UID']);
$field = new stdClass();
$field->label = 'Test';
$field->type = 'dropdown';
$field->options = array();
$actionField = str_replace('@@', '', $configuration['ABE_ACTION_FIELD']);
foreach ($variables as $variable) {
if ($variable['var_name'] == $actionField) {
$field->label = $variable['var_name'];
$field->type = 'dropdown';
$values = json_decode($variable['var_accepted_values']);
foreach ($values as $value) {
$field->options[$value->keyValue] = $value->value;
}
}
}
$__ABE__ .= '<strong>' . $field->label . '</strong><br /><table align="left" border="0"><tr>';
switch ($field->type) {
case 'dropdown':
case 'radiogroup':
$index = 1;
$__ABE__.='<br /><td><table align="left" cellpadding="2"><tr>';
foreach ($field->options as $optValue => $optName) {
$__ABE__ .= '<td align="center"><a style="text-decoration: none; color: #000; background-color: #E5E5E5; ';
$__ABE__ .= 'filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFEFEF, endColorstr=#BCBCBC); ';
$__ABE__ .= 'background-image: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), #BCBCBC); ';
$__ABE__ .= 'background-image: -webkit-linear-gradient(top, #EFEFEF, #BCBCBC); ';
$__ABE__ .= 'background-image: -moz-linear-gradient(top, #EFEFEF, #BCBCBC); background-image: -ms-linear-gradient(top, #EFEFEF, #BCBCBC); ';
$__ABE__ .= 'background-image: -o-linear-gradient(top, #EFEFEF, #BCBCBC); border: 1px solid #AAAAAA; ';
$__ABE__ .= 'border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); ';
$__ABE__ .= 'font-family: Arial,serif; font-size: 9pt; font-weight: 400; line-height: 14px; margin: 2px 0; padding: 2px 7px; ';
$__ABE__ .= 'text-decoration: none; text-transform: capitalize;" href="' .urldecode(urlencode($link)). '?ACTION='.G::encrypt('processABE', URL_KEY).'&APP_UID=';
$__ABE__ .= G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY);
$__ABE__ .= '&FIELD=' . G::encrypt($actionField, URL_KEY) . '&VALUE=' . G::encrypt($optValue, URL_KEY);
$__ABE__ .= '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank" >' . $optName;
$__ABE__ .= '</a></td>' . (($index % 5 == 0) ? '</tr><tr>' : ' ');
$index++;
}
$__ABE__.='</tr></table></td>';
break;
case 'yesno':
$__ABE__ .= '<td align="center"><a href="' . $link . 'dataField?APP_UID=' . urlencode(G::encrypt($data->APP_UID, URL_KEY)) . '&DEL_INDEX=' . urlencode(G::encrypt($data->DEL_INDEX, URL_KEY)). '&FIELD=' . urlencode(G::encrypt($actionField, URL_KEY)) . '&VALUE=' . urlencode(G::encrypt(1, URL_KEY)) . '&ABER=' . urlencode(G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY)) . '" target="_blank">' . G::LoadTranslation('ID_YES_VALUE') . '</a></td>';
$__ABE__ .= '<td align="center"><a href="' . $link . 'dataField?APP_UID=' . urlencode(G::encrypt($data->APP_UID, URL_KEY)) . '&DEL_INDEX=' . urlencode(G::encrypt($data->DEL_INDEX, URL_KEY)) . '&FIELD=' . urlencode(G::encrypt($actionField, URL_KEY)) . '&VALUE=' . urlencode(G::encrypt(0, URL_KEY)) . '&ABER=' . urlencode(G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY)) . '" target="_blank">' . G::LoadTranslation('ID_NO_VALUE') . '</a></td>';
break;
case 'checkbox':
$__ABE__ .= '<td align="center"><a href="' . $link . 'dataField?APP_UID=' . G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY) . '&FIELD=' . G::encrypt($actionField, URL_KEY) . '&VALUE=' . G::encrypt($field->value, URL_KEY) . '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank">Check</a></td>';
$__ABE__ .= '<td align="center"><a href="' . $link . 'dataField?APP_UID=' . G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY) . '&FIELD=' . G::encrypt($actionField, URL_KEY) . '&VALUE=' . G::encrypt($field->value, URL_KEY) . '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank">Uncheck</a></td>';
break;
}
$__ABE__ .= '</tr></table>';
break;
}
$__ABE__ = preg_replace('/\<img src=\"\/js\/maborak\/core\/images\/(.+?)\>/', '' , $__ABE__);
$__ABE__ = preg_replace('/\<input\b[^>]*\/>/', '' , $__ABE__);
$__ABE__ = preg_replace('/<select\b[^>]*>(.*?)<\/select>/is', "", $__ABE__);
$__ABE__ = preg_replace('/align=\"center\"/', '' , $__ABE__);
$__ABE__ = preg_replace('/class="tableGrid_view" /', 'class="tableGrid_view" width="100%" ', $__ABE__);
$caseFields['APP_DATA']['__ABE__'] = $__ABE__;
G::LoadClass("Users");
$user = new Users();
$userDetails = $user->loadDetails($data->USR_UID);
$emailFrom = $userDetails["USR_EMAIL"];
G::LoadClass('wsBase');
$wsBaseInstance = new wsBase();
$result = $wsBaseInstance->sendMessage($data->APP_UID,
$emailFrom,
$email,
'',
'',
$subject,
$configuration['ABE_TEMPLATE'],
$caseFields['APP_DATA'],
'');
$abeRequest['ABE_REQ_STATUS'] = ($result->status_code == 0 ? 'SENT' : 'ERROR');
$body = '';
$messageSent = executeQuery('SELECT `APP_MSG_BODY` FROM `APP_MESSAGE` ORDER BY `APP_MSG_SEND_DATE` DESC LIMIT 1');
if (!empty($messageSent) && is_array($messageSent)) {
$body = $messageSent[1]['APP_MSG_BODY'];
}
$abeRequest['ABE_REQ_BODY'] = $body;
// Update
try {
$abeRequestsInstance = new AbeRequests();
$abeRequestsInstance->createOrUpdate($abeRequest);
} catch (Exception $error) {
throw $error;
}
}
}
}
}
} catch (Exception $error) {
throw $error;
}
}
}

View File

@@ -0,0 +1,84 @@
<?php
function postNote($httpData)
{
//extract(getExtJSParams());
$appUid = (isset($httpData->appUid))? $httpData->appUid : '';
$usrUid = (isset($httpData->usrUid))? $httpData->usrUid : '' ;
require_once ( "classes/model/AppNotes.php" );
$appNotes = new AppNotes();
$noteContent = addslashes($httpData->noteText);
$result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false);
//return true;
//die();
//send the response to client
@ini_set('implicit_flush', 1);
ob_start();
//echo G::json_encode($result);
@ob_flush();
@flush();
@ob_end_flush();
ob_implicit_flush(1);
//return true;
//send notification in background
$noteRecipientsList = array();
G::LoadClass('case');
$oCase = new Cases();
$p = $oCase->getUsersParticipatedInCase($appUid);
foreach ($p['array'] as $key => $userParticipated) {
$noteRecipientsList[] = $key;
}
$noteRecipients = implode(",", $noteRecipientsList);
$appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
}
function loadAbeRequest($AbeRequestsUid)
{
require_once 'classes/model/AbeRequests.php';
$criteria = new Criteria();
$criteria->add(AbeRequestsPeer::ABE_REQ_UID, $AbeRequestsUid);
$resultRequests = AbeRequestsPeer::doSelectRS($criteria);
$resultRequests->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$resultRequests->next();
$abeRequests = $resultRequests->getRow();
return $abeRequests;
}
function loadAbeConfiguration($AbeConfigurationUid)
{
require_once 'classes/model/AbeConfiguration.php';
$criteria = new Criteria();
$criteria->add(AbeConfigurationPeer::ABE_UID, $AbeConfigurationUid);
$result = AbeConfigurationPeer::doSelectRS($criteria);
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$result->next();
$abeConfiguration = $result->getRow();
return $abeConfiguration;
}
function uploadAbeRequest($data)
{
require_once 'classes/model/AbeRequests.php';
try {
$abeRequestsInstance = new AbeRequests();
$abeRequestsInstance->createOrUpdate($data);
} catch (Exception $error) {
throw $error;
}
}

View File

@@ -1065,7 +1065,7 @@ class Cases
$Fields['DEL_INDEX'] = 1;
}
$inbox = new ListInbox();
$inbox->update($Fields);
$inbox->update($Fields);
/*----------------------------------********---------------------------------*/
//Return
@@ -1175,7 +1175,26 @@ class Cases
if ($this->appSolr != null) {
$this->appSolr->deleteApplicationSearchIndex($sAppUid);
}
/*----------------------------------********---------------------------------*/
$criteria = new Criteria();
$criteria->addSelectColumn( ListInboxPeer::USR_UID );
$criteria->add( ListInboxPeer::APP_UID, $sAppUid, Criteria::EQUAL );
$dataset = ApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while($dataset->next()) {
$aRow = $dataset->getRow();
$users = new Users();
$users->refreshTotal($aRow['USR_UID'], 'remove', 'draft');
$users->refreshTotal($aRow['USR_UID'], 'remove', 'participated');
}
$oCriteria = new Criteria('workflow');
$oCriteria->add(ListInboxPeer::APP_UID, $sAppUid);
ListInboxPeer::doDelete($oCriteria);
$oCriteria = new Criteria('workflow');
$oCriteria->add(ListParticipatedLastPeer::APP_UID, $sAppUid);
ListParticipatedLastPeer::doDelete($oCriteria);
/*----------------------------------********---------------------------------*/
return $result;
} catch (exception $e) {
throw ($e);
@@ -1237,6 +1256,12 @@ class Cases
$appAssignSelfServiceValue = new AppAssignSelfServiceValue();
$appAssignSelfServiceValue->remove($sAppUid, $iDelIndex);
/*----------------------------------********---------------------------------*/
$aFields = $oAppDel->toArray(BasePeer::TYPE_FIELDNAME);
$aFields['APP_STATUS'] = 'TO_DO';
$inbox = new ListInbox();
$inbox->update($aFields, true);
/*----------------------------------********---------------------------------*/
} catch (exception $e) {
throw ($e);
}
@@ -1905,11 +1930,11 @@ class Cases
$c->add(AppDelegationPeer::APP_UID, $sAppUid);
$c->add(AppDelegationPeer::DEL_INDEX, $iDelIndex);
$rowObj = AppDelegationPeer::doSelect($c);
G::LoadClass('dates');
$oDates = new dates();
$user = '';
foreach ($rowObj as $appDel) {
$appDel->setDelThreadStatus('CLOSED');
$appDel->setDelFinishDate('now');
$user = $appDel->getUsrUid();
if ($appDel->Validate()) {
$appDel->Save();
} else {
@@ -1926,7 +1951,7 @@ class Cases
$data['DEL_THREAD_STATUS'] = 'CLOSED';
$data['APP_UID'] = $sAppUid;
$data['DEL_INDEX'] = $iDelIndex;
$data['USR_UID'] = $appDel->getUsrUid();
$data['USR_UID'] = $user;
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->refresh($data);
/*----------------------------------********---------------------------------*/
@@ -1981,7 +2006,7 @@ class Cases
* @return Fields
*/
public function startCase($sTasUid, $sUsrUid, $isSubprocess = false)
public function startCase($sTasUid, $sUsrUid, $isSubprocess = false, $dataPreviusApplication = array())
{
if ($sTasUid != '') {
try {
@@ -2045,11 +2070,12 @@ class Cases
$Fields['USR_UID'] = $sUsrUid;
$Fields['DEL_INDEX'] = $iDelIndex;
$Fields['APP_STATUS'] = 'TO_DO';
$Fields['DEL_DELEGATE_DATE'] = $Fields['APP_INIT_DATE'];
if(!$isSubprocess){
$Fields['APP_STATUS'] = 'DRAFT';
}
$inbox = new ListInbox();
$inbox->newRow($Fields, $sUsrUid);
$inbox->newRow($Fields, $sUsrUid, $isSubprocess, $dataPreviusApplication);
/*----------------------------------********---------------------------------*/
} catch (exception $e) {
throw ($e);
@@ -4041,8 +4067,9 @@ class Cases
$this->getExecuteTriggerProcess($sApplicationUID, "UNPAUSE");
/*----------------------------------********---------------------------------*/
$aData = array_merge($aFieldsDel, $aData);
$oListPaused = new ListPaused();
$oListPaused->remove($sApplicationUID, $iDelegation, true);
$oListPaused->remove($sApplicationUID, $iDelegation, $aData);
/*----------------------------------********---------------------------------*/
}
@@ -4254,6 +4281,38 @@ class Cases
$this->appSolr->updateApplicationSearchIndex($sApplicationUID);
}
/*----------------------------------********---------------------------------*/
$oCriteria = new Criteria('workflow');
$oCriteria->add(ListParticipatedLastPeer::APP_UID, $aData['APP_UID']);
$oCriteria->add(ListParticipatedLastPeer::USR_UID, $sUserUID);
$oCriteria->add(ListParticipatedLastPeer::DEL_INDEX, $iDelegation);
ListParticipatedLastPeer::doDelete($oCriteria);
$users = new Users();
$users->refreshTotal($sUserUID, 'remove', 'participated');
$aFieldsDel = array_merge($aData, $aFieldsDel);
$aFieldsDel['USR_UID'] = $newUserUID;
$inbox = new ListInbox();
$inbox->newRow($aFieldsDel, $sUserUID);
//Update - WHERE
$criteriaWhere = new Criteria("workflow");
$criteriaWhere->add(ListInboxPeer::APP_UID, $aFieldsDel["APP_UID"], Criteria::EQUAL);
$criteriaWhere->add(ListInboxPeer::USR_UID, $aFieldsDel['USR_UID'], Criteria::EQUAL);
$criteriaWhere->add(ListInboxPeer::DEL_INDEX, $aFieldsDel['DEL_INDEX'], Criteria::EQUAL);
//Update - SET
$criteriaSet = new Criteria("workflow");
$criteriaSet->add(ListInboxPeer::DEL_INDEX, $aData['DEL_INDEX']);
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
$users = new Users();
if ($aFields['APP_STATUS'] == 'DRAFT') {
$users->refreshTotal($sUserUID, 'remove', 'draft');
} else if ($iDelegation == 2) {
$users->refreshTotal($sUserUID, 'add', 'draft');
$users->refreshTotal($sUserUID, 'remove', 'inbox');
}
/*----------------------------------********---------------------------------*/
$this->getExecuteTriggerProcess($sApplicationUID, 'REASSIGNED');
return true;
}
@@ -6646,7 +6705,6 @@ class Cases
}
}
require_once 'classes/model/Users.php';
$c = new Criteria('workflow');
$c->addSelectColumn(UsersPeer::USR_UID);
$c->addSelectColumn(UsersPeer::USR_USERNAME);

View File

@@ -748,14 +748,13 @@ class Derivation
//SETS THE APP_PROC_CODE
//if (isset($nextDel['TAS_DEF_PROC_CODE']))
//$appFields['APP_PROC_CODE'] = $nextDel['TAS_DEF_PROC_CODE'];
/*----------------------------------********---------------------------------*/
if (!empty($iNewDelIndex) && empty($aSP)) {
$oAppDel = AppDelegationPeer::retrieveByPK( $appFields['APP_UID'], $iNewDelIndex );
$aFields = $oAppDel->toArray( BasePeer::TYPE_FIELDNAME );
$aFields['APP_STATUS'] = $currentDelegation['APP_STATUS'];
$inbox = new ListInbox();
$inbox->newRow($aFields, $nextDel['USR_UID']);
$inbox->newRow($aFields, $appFields['CURRENT_USER_UID'], false, array(), ($nextDel['TAS_ASSIGN_TYPE'] == 'SELF_SERVICE' ? true : false));
}
/*----------------------------------********---------------------------------*/
unset( $aSP );
@@ -863,7 +862,7 @@ class Derivation
if (isset( $aSP )) {
//Create the new case in the sub-process
// set the initial date to null the time its created
$aNewCase = $this->case->startCase( $aSP['TAS_UID'], $aSP['USR_UID'], true );
$aNewCase = $this->case->startCase( $aSP['TAS_UID'], $aSP['USR_UID'], true, $appFields);
//Copy case variables to sub-process case
$aFields = unserialize( $aSP['SP_VARIABLES_OUT'] );
$aNewFields = array ();

View File

@@ -489,8 +489,11 @@ class PMPluginRegistry
if (! file_exists( PATH_PLUGINS . $pluginFile )) {
throw (new Exception( "File \"$pluginFile\" doesn't exist" ));
}
require_once (PATH_PLUGINS . $pluginFile);
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$path = PATH_PLUGINS . $pluginFile;
//$path = $filter->validateInput($path, 'path');
require_once ($path);
$details = $this->getPluginDetails( $pluginFile );
$this->installPlugin( $details->sNamespace );
@@ -509,7 +512,11 @@ class PMPluginRegistry
}
///////
require_once (PATH_PLUGINS . $pluginFile);
$path = PATH_PLUGINS . $pluginFile;
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$path = $filter->validateInput($path, 'path');
require_once ($path);
foreach ($this->_aPluginDetails as $namespace => $detail) {
if ($namespace == $sNamespace) {

View File

@@ -11,24 +11,27 @@ class pmDynaform
{
public static $instance = null;
public $dyn_uid = null;
public $fields = null;
public $record = null;
public $app_data = null;
public $credentials = null;
public $items = array();
public $data = array();
public $variables = array();
public $arrayFieldRequired = array();
public function __construct($dyn_uid, $app_data = array())
public function __construct($fields)
{
$this->dyn_uid = $dyn_uid;
$this->app_data = $app_data;
$this->fields = $fields;
$this->getDynaform();
$this->getCredentials();
if (isset($app_data["APPLICATION"])) {
if (isset($this->fields["APP_UID"])) {
//current
$cases = new \ProcessMaker\BusinessModel\Cases();
$this->data = $cases->getCaseVariables($app_data["APPLICATION"]);
$this->data = $cases->getCaseVariables($this->fields["APP_UID"]);
} else {
//history
$this->fields["APP_UID"] = null;
if (isset($this->fields["APP_DATA"]))
$this->data = $this->fields["APP_DATA"];
if (isset($this->data["DYN_CONTENT_HISTORY"]))
$this->record["DYN_CONTENT"] = $this->data["DYN_CONTENT_HISTORY"];
}
}
@@ -42,7 +45,7 @@ class pmDynaform
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
$a->addSelectColumn(DynaformPeer::PRO_UID);
$a->addSelectColumn(DynaformPeer::DYN_UID);
$a->add(DynaformPeer::DYN_UID, $this->dyn_uid, Criteria::EQUAL);
$a->add(DynaformPeer::DYN_UID, $this->fields["CURRENT_DYNAFORM"], Criteria::EQUAL);
$ds = ProcessPeer::doSelectRS($a);
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$ds->next();
@@ -197,40 +200,28 @@ class pmDynaform
return $this->record != null && $this->record["DYN_VERSION"] == 2 ? true : false;
}
public function printView($pm_run_outside_main_app, $application)
public function printView()
{
ob_clean();
$json = G::json_decode($this->record["DYN_CONTENT"]);
$this->jsonr($json);
$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"]
);
$javascrip = "" .
"<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\n" .
"var pm_run_outside_main_app = '" . $pm_run_outside_main_app . "';\n" .
"var dyn_uid = '" . $this->dyn_uid . "';\n" .
"var pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = '" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "';\n" .
"var app_uid = '" . $application . "';\n" .
"var prj_uid = '" . $this->app_data["PROCESS"] . "';\n" .
"var app_uid = '" . $this->fields["APP_UID"] . "';\n" .
"var prj_uid = '" . $this->fields["PRO_UID"] . "';\n" .
"var step_mode = null;\n" .
"var workspace = '" . $this->app_data["SYS_SYS"] . "';\n" .
"var credentials = " . G::json_encode($clientToken) . ";\n" .
"var workspace = '" . SYS_SYS . "';\n" .
"var credentials = " . G::json_encode($this->credentials) . ";\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" .
" data.items[0].mode = 'disabled';\n" .
" window.project = new PMDynaform.core.Project({\n" .
" data: data,\n" .
" keys: {\n" .
@@ -250,49 +241,55 @@ class pmDynaform
$file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/pmdynaform.html');
$file = str_replace("{javascript}", $javascrip, $file);
echo $file;
echo "<pre>";
//echo print_r($this->fields, true);
// echo print_r($this->data, true);
echo "</pre>";
exit();
}
public function printEdit($pm_run_outside_main_app, $application, $headData, $step_mode = 'EDIT')
public function printEdit()
{
ob_clean();
$json = G::json_decode($this->record["DYN_CONTENT"]);
$this->jsonr($json);
if (!isset($this->fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["PREVIOUS_STEP"])) {
$this->fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["PREVIOUS_STEP"] = "";
}
$title = "<table width='100%' align='center'>\n" .
" <tr class='userGroupTitle'>\n" .
" <td width='100%' align='center'>" . $headData["CASE"] . " #: " . $headData["APP_NUMBER"] . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $headData["TITLE"] . ": " . $headData["APP_TITLE"] . "</td>\n" .
" <td width='100%' align='center'>" . G::LoadTranslation('ID_CASE') . " #: " . $this->fields["APP_NUMBER"] . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . G::LoadTranslation('ID_TITLE') . ": " . $this->fields["APP_TITLE"] . "</td>\n" .
" </tr>\n" .
"</table>\n";
$javascrip = "" .
"<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\n" .
"var pm_run_outside_main_app = '" . $pm_run_outside_main_app . "';\n" .
"var dyn_uid = '" . $this->dyn_uid . "';\n" .
"var pm_run_outside_main_app = '" . $this->fields["PM_RUN_OUTSIDE_MAIN_APP"] . "';\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = '" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "';\n" .
"var app_uid = '" . $application . "';\n" .
"var prj_uid = '" . $this->app_data["PROCESS"] . "';\n" .
"var step_mode = '" . $step_mode . "';\n" .
"var workspace = '" . $this->app_data["SYS_SYS"] . "';\n" .
"var app_uid = '" . $this->fields["APP_UID"] . "';\n" .
"var prj_uid = '" . $this->fields["PRO_UID"] . "';\n" .
"var step_mode = '" . $this->fields["STEP_MODE"] . "';\n" .
"var workspace = '" . SYS_SYS . "';\n" .
"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" .
"var triggerDebug = " . ($this->fields["TRIGGER_DEBUG"] === 1 ? "true" : "false") . ";\n" .
"</script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/cases_Step.js'></script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" .
($this->app_data["PRO_SHOW_MESSAGE"] === 1 ? '' : $title ) .
($this->fields["PRO_SHOW_MESSAGE"] === 1 ? '' : $title ) .
"<div style='width:100%;padding:0px 10px 0px 10px;margin:15px 0px 0px 0px;'>\n" .
" <img src='/images/bulletButtonLeft.gif' style='float:left;'>&nbsp;\n" .
" <a id='dyn_backward' href='' style='float:left;'>\n" .
" <a id='dyn_backward' href='" . $this->fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["PREVIOUS_STEP"] . "' style='float:left;font-size:12px;line-height:1;margin:0px 0px 1px 5px;'>\n" .
" " . $this->fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["PREVIOUS_STEP_LABEL"] . "" .
" </a>\n" .
" <img src='/images/bulletButton.gif' style='float:right;'>&nbsp;\n" .
" <a id='dyn_forward' href='' style='float:right;font-size:12px;line-height:1;margin:0px 5px 1px 0px;'>\n" .
" Next Step\n" .
" <a id='dyn_forward' href='" . $this->fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["NEXT_STEP"] . "' style='float:right;font-size:12px;line-height:1;margin:0px 5px 1px 0px;'>\n" .
" " . $this->fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["NEXT_STEP_LABEL"] . "" .
" </a>\n" .
"</div>";
$file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/pmdynaform.html');
$file = str_replace("{javascript}", $javascrip, $file);
echo $file;
@@ -308,7 +305,7 @@ class pmDynaform
"<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\n" .
"var pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $this->dyn_uid . "';\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = null;\n" .
"var app_uid = null;\n" .
"var prj_uid = '" . $this->record["PRO_UID"] . "';\n" .
@@ -316,7 +313,7 @@ class pmDynaform
"var workspace = '" . SYS_SYS . "';\n" .
"var credentials = " . G::json_encode($this->credentials) . ";\n" .
"var filePost = '" . $filename . "';\n" .
"var fieldsRequired = " . G::json_encode($this->arrayFieldRequired) . ";\n" .
"var fieldsRequired = " . G::json_encode(array()) . ";\n" .
"var triggerDebug = null;\n" .
"</script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" .
@@ -329,7 +326,6 @@ class pmDynaform
$file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/pmdynaform.html');
$file = str_replace("{javascript}", $javascrip, $file);
echo $file;
exit();
}

View File

@@ -135,7 +135,7 @@ class PmTable
* @param string $dbsUid corresponding to DBS_UID key
* @return string contains resolved DBS_UID
*/
public function resolveDbSource ($dbsUid)
public static function resolveDbSource($dbsUid)
{
switch ($dbsUid) {
case 'workflow':

View File

@@ -2356,7 +2356,11 @@ class processMap
$G_PUBLISH->AddContent('propeltable', 'paged-table', '/cases/cases_Scheduler_List', $oCriteria, array('CONFIRM' => G::LoadTranslation('ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER')));
G::RenderPage('publish');
//return true; */
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$schedulerPath = SYS_URI . "cases/cases_Scheduler_List";
$schedulerPath = $filter->xssFilterHard($schedulerPath);
$sProcessUID = $filter->xssFilterHard($sProcessUID);
$html = "<iframe WIDTH=820 HEIGHT=530 FRAMEBORDER=0 src='" . $schedulerPath . '?PRO_UID=' . $sProcessUID . "'></iframe>";
echo $html;
} catch (Exception $oError) {

View File

@@ -338,18 +338,18 @@ class propelTable
if (($this->style[$r]['showInTable'] != '0') && (! (in_array( $this->fields[$r]['Name'], $this->masterdetail )))) {
//if (($this->style[$r]['showInTable'] != '0' ))
$this->tpl->newBlock( "headers" );
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'ASC')) ? 'DESC' : 'ASC');
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? '' : $sortOrder);
$sortDir = "ASC";
if (isset($this->aOrder[$this->fields[$r]["Name"]])) {
$sortDir = ($this->aOrder[$this->fields[$r]["Name"]] == "ASC")? "DESC" : "ASC";
}
if ($this->style[$r]['titleVisibility'] != '0') {
$this->style[$r]['href'] = $this->ownerPage . '?order=' . ($sortOrder !== '' ? (G::createUID( '', $this->fields[$r]['Name'] ) . '=' . $sortOrder) : '') . '&page=' . $this->currentPage;
if ($this->sortable == '0') {
$this->style[$r]['onsort'] = $this->id . '.doSort("' . G::createUID( '', $this->fields[$r]['Name'] ) . '" , ""); return false;';;
} else {
$this->style[$r]['onsort'] = $this->id . '.doSort("' . G::createUID( '', $this->fields[$r]['Name'] ) . '" , "' . $sortOrder . '"); return false;';
}
$this->style[$r]["href"] = "javascript:;";
$this->style[$r]["onsort"] = $this->id . ".doSort(\"" . G::createUID("", $this->fields[$r]["Name"]) . "\", \"" . (($this->sortable == "0")? "" : $sortDir) . "\"); return false;";
} else {
$this->style[$r]['href'] = '#';
$this->style[$r]["href"] = "javascript:;";
$this->style[$r]['onsort'] = 'return false;';
}
if (isset( $this->style[$r]['href'] )) {
@@ -378,10 +378,14 @@ class propelTable
$this->tpl->assign( "align", 'text-align:' . $this->style[$r]['titleAlign'] . ';' );
}
if ($this->style[$r]['titleVisibility'] != '0') {
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'ASC')) ? '<img src="/images/arrow-up.gif">' : '');
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? '<img src="/images/arrow-down.gif">' : $sortOrder);
$this->tpl->assign( "header", $this->fields[$r]['Label'] . $sortOrder );
$this->tpl->assign( 'displaySeparator', (($this->colCount == 0) || (! isset( $this->fields[$r]['Label'] )) || ($this->fields[$r]['Label'] === '')) ? 'display:none;' : '' );
$sortDirImg = "";
if (isset($this->aOrder[$this->fields[$r]["Name"]])) {
$sortDirImg = ($this->aOrder[$this->fields[$r]["Name"]] == "ASC")? "<img src=\"/images/arrow-up.gif\" />" : "<img src=\"/images/arrow-down.gif\" />";
}
$this->tpl->assign("header", $this->fields[$r]["Label"] . $sortDirImg);
$this->tpl->assign("displaySeparator", ($this->colCount == 0 || !isset($this->fields[$r]["Label"]) || $this->fields[$r]["Label"] == "")? "display: none;" : "");
} else {
$this->tpl->assign( 'displaySeparator', 'display:none;' );
}
@@ -555,7 +559,13 @@ class propelTable
* @return string
*/
public function renderTable ($block = '', $fields = '')
{
{
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$fields = $filter->xssFilterHard($fields);
$this->orderBy = $filter->xssFilterHard($this->orderBy);
$this->currentPage = $filter->xssFilterHard($this->currentPage);
//Render Title
$thereisnotitle = true;
foreach ($this->fields as $r => $rval) {
@@ -599,6 +609,11 @@ class propelTable
$this->tpl->assign( 'pagedTable_Name', $this->name );
$this->tpl->assign( 'pagedTable_Height', $this->xmlForm->height );
$this->tpl->assign( "title", $this->title );
$this->xmlForm->home = $filter->xssFilterHard($this->xmlForm->home);
$this->filterForm = $filter->xssFilterHard($this->filterForm);
$this->menu = $filter->xssFilterHard($this->menu);
if (file_exists( $this->xmlForm->home . $this->filterForm . '.xml' )) {
$filterForm = new filterForm( $this->filterForm, $this->xmlForm->home );
if ($this->menu === '') {
@@ -753,29 +768,30 @@ class propelTable
}
}
}
$strjsCurrentOrder = $this->id . ".currentOrder = '" . addslashes($this->orderBy) . "';";
$this->tpl->assign( '_ROOT.gridRows', '=' . $gridRows ); //number of rows in the current page
$this->tpl->newBlock( 'rowTag' );
$this->tpl->assign( 'rowId', 'insertAtLast' );
if ($this->currentPage > 1) {
$firstUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=1';
$firstAjax = $this->id . ".doGoToPage(1);return false;";
$prevpage = $this->currentPage - 1;
$prevUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $prevpage;
$prevAjax = $this->id . ".doGoToPage(" . $prevpage . ");return false;";
$first = "<a href=\"" . htmlentities( $firstUrl, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $firstAjax . "\" class='firstPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
$prev = "<a href=\"" . htmlentities( $prevUrl, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $prevAjax . "\" class='previousPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
$firstAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(1); return false;";
$prevAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(" . $prevpage . "); return false;";
$first = "<a href=\"javascript:;\" onclick=\"" . $firstAjax . "\" class=\"firstPage\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
$prev = "<a href=\"javascript:;\" onclick=\"" . $prevAjax . "\" class=\"previousPage\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
} else {
$first = "<a class='noFirstPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
$prev = "<a class='noPreviousPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
}
if ($this->currentPage < $this->totPages) {
$lastUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $this->totPages;
$lastAjax = $this->id . ".doGoToPage(" . $this->totPages . ");return false;";
$nextpage = $this->currentPage + 1;
$nextUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $nextpage;
$nextAjax = $this->id . ".doGoToPage(" . $nextpage . ");return false;";
$next = "<a href=\"" . htmlentities( $nextUrl, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $nextAjax . "\" class='nextPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
$last = "<a href=\"" . htmlentities( $lastUrl, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $lastAjax . "\" class='lastPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
$nextAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(" . $nextpage . "); return false;";
$lastAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(" . $this->totPages . "); return false;";
$next = "<a href=\"javascript:;\" onclick=\"" . $nextAjax . "\" class=\"nextPage\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
$last = "<a href=\"javascript:;\" onclick=\"" . $lastAjax . "\" class=\"lastPage\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
} else {
$next = "<a class='noNextPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
$last = "<a class='noLastPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
@@ -783,9 +799,10 @@ class propelTable
$pagesEnum = '';
for ($r = 1; $r <= $this->totPages; $r ++) {
if (($r >= ($this->currentPage - 5)) && ($r <= ($this->currentPage + 5))) {
$pageAjax = $this->id . ".doGoToPage(" . $r . ");return false;";
$pageAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(" . $r . "); return false;";
if ($r != $this->currentPage) {
$pagesEnum .= "&nbsp;<a href=\"" . htmlentities( $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $r, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $pageAjax . "\">" . $r . "</a>";
$pagesEnum .= "&nbsp;<a href=\"javascript:;\" onclick=\"" . $pageAjax . "\">" . $r . "</a>";
} else {
$pagesEnum .= "&nbsp;<a>" . $r . "</a>";
}
@@ -833,6 +850,12 @@ class propelTable
}
$this->tpl->assign( "pagesEnum", $pagesEnum );
}
$this->name = $filter->xssFilterHard($this->name);
$this->orderBy = $filter->xssFilterHard($this->orderBy);
$this->currentPage = $filter->xssFilterHard($this->currentPage);
$this->id = $filter->xssFilterHard($this->id);
?>
<script language='JavaScript'>

View File

@@ -183,7 +183,10 @@ class System
/* For distros with the lsb_release, this returns a one-line description of
* the distro name, such as "CentOS release 5.3 (Final)" or "Ubuntu 10.10"
*/
$distro = exec( "lsb_release -d -s 2> /dev/null" );
$distro = '';
if (file_exists("/dev/")){ //Windows does not have this folder
$distro = exec( "lsb_release -d -s 2> /dev/null" );
}
/* For distros without lsb_release, we look for *release (such as
* redhat-release, gentoo-release, SuSE-release, etc) or *version (such as

View File

@@ -398,13 +398,18 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
*/
public function GET(&$options)
{
$paths = $this->paths;
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$options = $filter->xssFilterHard($options);
$paths = $filter->xssFilterHard($this->paths);
$pathClasses = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
if (count($paths) > 0 && $paths[0] == 'classes' && is_dir($pathClasses)) {
$fsFile = $pathClasses . $paths[1];
$fsFile = $filter->xssFilterHard($fsFile);
if (count($paths) == 2 && file_exists($fsFile)) {
$content = file_get_contents($fsFile);
$content = $filter->xssFilterHard($content);
print $content;
header("Content-Type: " . mime_content_type($fsFile));
header("Last-Modified: " . date("D, j M Y H:m:s ", file_mtime($fsFile)) . "GMT");
@@ -418,8 +423,10 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
if (count($paths) == 4 && $paths[2] == 'xmlforms') {
$pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP . $paths[1] . PATH_SEP;
$fsFile = $pathXmlform . $paths[3];
$fsFile = $filter->xssFilterHard($fsFile);
if (count($paths) == 4 && file_exists($fsFile)) {
$content = file_get_contents($fsFile);
$content = $filter->xssFilterHard($content);
print $content;
header("Content-Type: " . mime_content_type($fsFile));
header("Last-Modified: " . date("D, j M Y H:m:s ", file_mtime($fsFile)) . "GMT");
@@ -431,8 +438,10 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
if (count($paths) == 4 && $paths[2] == 'mailTemplates') {
$pathTemplates = $pathProcesses . 'mailTemplates' . PATH_SEP . $paths[1] . PATH_SEP;
$fsFile = $pathTemplates . $paths[3];
$fsFile = $filter->xssFilterHard($fsFile);
if (count($paths) == 4 && file_exists($fsFile)) {
$content = file_get_contents($fsFile);
$content = $filter->xssFilterHard($content);
print $content;
header("Content-Type: " . mime_content_type($fsFile));
header("Last-Modified: " . date("D, j M Y H:m:s ", file_mtime($fsFile)) . "GMT");
@@ -444,8 +453,10 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
if (count($paths) == 4 && $paths[2] == 'public_html') {
$pathPublic = $pathProcesses . 'public' . PATH_SEP . $paths[1] . PATH_SEP;
$fsFile = $pathPublic . $paths[3];
$fsFile = $filter->xssFilterHard($fsFile);
if (count($paths) == 4 && file_exists($fsFile)) {
$content = file_get_contents($fsFile);
$content = $filter->xssFilterHard($content);
print $content;
header("Content-Type: " . mime_content_type($fsFile));
header("Last-Modified: " . date("D, j M Y H:m:s ", file_mtime($fsFile)) . "GMT");
@@ -967,11 +978,15 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
*/
public function checkLock($path)
{
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$path = $filter->validateInput($path, 'nosql');
$result = false;
$query = "SELECT owner, token, expires, exclusivelock
FROM locks
WHERE path = '$path' ";
WHERE path = '%s' ";
$query = $filter->preventSqlInjection($query, array($path));
$res = mysql_query($query);
if ($res) {

View File

@@ -1842,12 +1842,14 @@ class workspaceTools
throw $e;
}
}
/**
* Migrate all cases to New list
*
* return all LIST TABLES with data
*/
public function migrateList ($workSpace){
public function migrateList ($workSpace)
{
$this->initPropel(true);
$appCache = new AppCacheView();
G::LoadClass("case");
@@ -1877,7 +1879,7 @@ class workspaceTools
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
//Insert new data LIST_COMPLETED
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$row = $rsCriteria->getRow();
$listCompleted = new ListCompleted();
$listCompleted->remove($row["APP_UID"]);
$listCompleted->setDeleted(false);
@@ -1887,32 +1889,39 @@ class workspaceTools
//Select data TO_DO OR DRAFT
$inbCriteria = $appCache->getSelAllColumns();
$inbCriteria->add(AppCacheViewPeer::APP_STATUS, "CANCELLED", CRITERIA::NOT_EQUAL);
$rsCriteria = AppCacheViewPeer::doSelectRS($inbCriteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
//Insert new data LIST_INBOX
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
if($row["DEL_THREAD_STATUS"] == 'OPEN'){
$listInbox = new ListInbox();
$listInbox->remove($row["APP_UID"],$row["DEL_INDEX"]);
$listInbox->setDeleted(false);
$listInbox->create($row);
} else {
// create participated List when the thread is CLOSED
$listParticipatedHistory = new ListParticipatedHistory();
$listParticipatedHistory->remove($row['APP_UID'],$row['DEL_INDEX']);
$listParticipatedHistory = new ListParticipatedHistory();
$listParticipatedHistory->create($row);
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->remove($row['APP_UID'], $row['USR_UID']);
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->create($row);
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->refresh($row);
}
$row = $rsCriteria->getRow();
$isSelfService = ($row['USR_UID'] == '') ? true : false;
if($row["DEL_THREAD_STATUS"] == 'OPEN'){
$row["DEL_PREVIOUS_USR_UID"] = $row["PREVIOUS_USR_UID"];
$listInbox = new ListInbox();
$listInbox->remove($row["APP_UID"],$row["DEL_INDEX"]);
$listInbox->setDeleted(false);
$listInbox->create($row, $isSelfService);
} else {
// create participated List when the thread is CLOSED
$listParticipatedHistory = new ListParticipatedHistory();
$listParticipatedHistory->remove($row['APP_UID'], $row['DEL_INDEX']);
$listParticipatedHistory = new ListParticipatedHistory();
$listParticipatedHistory->create($row);
$oCriteria = new Criteria('workflow');
$oCriteria->add(ListParticipatedLastPeer::APP_UID, $row['APP_UID']);
$oCriteria->add(ListParticipatedLastPeer::USR_UID, $row['USR_UID']);
ListParticipatedLastPeer::doDelete($oCriteria);
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->create($row);
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->refresh($row);
}
}
CLI::logging("> Completed table LIST_INBOX\n");
//With this List is populated the LIST_PARTICIPATED_HISTORY and LIST_PARTICIPATED_LAST
CLI::logging("> Completed table LIST_PARTICIPATED_HISTORY\n");
@@ -1922,7 +1931,7 @@ class workspaceTools
$myiCriteria = $appCache->getSelAllColumns();
$myiCriteria->add(AppCacheViewPeer::DEL_INDEX, "1", CRITERIA::EQUAL);
$rsCriteria = AppCacheViewPeer::doSelectRS($myiCriteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
//Insert new data LIST_MY_INBOX
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
@@ -1939,7 +1948,13 @@ class workspaceTools
$delaycriteria->addSelectColumn(AppDelayPeer::PRO_UID);
$delaycriteria->addSelectColumn(AppDelayPeer::APP_DEL_INDEX);
$delaycriteria->addSelectColumn(AppCacheViewPeer::APP_NUMBER);
$delaycriteria->addJoin( AppCacheViewPeer::APP_UID, AppDelayPeer::APP_UID, Criteria::INNER_JOIN );
$delaycriteria->addSelectColumn(AppCacheViewPeer::USR_UID);
$delaycriteria->addSelectColumn(AppCacheViewPeer::APP_STATUS);
$delaycriteria->addSelectColumn(AppCacheViewPeer::TAS_UID);
$delaycriteria->addJoin( AppCacheViewPeer::APP_UID, AppDelayPeer::APP_UID . ' AND ' . AppCacheViewPeer::DEL_INDEX . ' = ' . AppDelayPeer::APP_DEL_INDEX, Criteria::INNER_JOIN );
$delaycriteria->add(AppDelayPeer::APP_DISABLE_ACTION_USER, "0", CRITERIA::EQUAL);
$delaycriteria->add(AppDelayPeer::APP_TYPE, "PAUSE", CRITERIA::EQUAL);
$rsCriteria = AppDelayPeer::doSelectRS($delaycriteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
//Insert new data LIST_PAUSED
@@ -1948,7 +1963,6 @@ class workspaceTools
$data = $row;
$data["DEL_INDEX"] = $row["APP_DEL_INDEX"];
$listPaused = new ListPaused();
$listPaused->remove($data["APP_UID"],$data["DEL_INDEX"]);
$listPaused->setDeleted(false);
$listPaused->create($data);
}
@@ -1965,14 +1979,48 @@ class workspaceTools
$del->doDeleteAll();
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$listUnassigned = new ListUnassigned();
$listUnassigned = new ListUnassigned();
$unaUid = $listUnassigned->generateData($row["APP_UID"],$row["PREVIOUS_USR_UID"]);
}
CLI::logging("> Completed table LIST_UNASSIGNED\n");
CLI::logging("> Completed table LIST_UNASSIGNED_GROUP\n");
// ADD LISTS COUNTS
$aTypes = array(
'to_do',
'draft',
'cancelled',
'sent',
'paused',
'completed',
'selfservice'
);
$users = new Users();
$criteria = new Criteria();
$criteria->addSelectColumn(UsersPeer::USR_UID);
$dataset = UsersPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while($dataset->next()) {
$aRow = $dataset->getRow();
$oAppCache = new AppCacheView();
$aCount = $oAppCache->getAllCounters( $aTypes, $aRow['USR_UID'] );
$newData = array(
'USR_UID' => $aRow['USR_UID'],
'USR_TOTAL_INBOX' => $aCount['to_do'],
'USR_TOTAL_DRAFT' => $aCount['draft'],
'USR_TOTAL_CANCELLED' => $aCount['cancelled'],
'USR_TOTAL_PARTICIPATED' => $aCount['sent'],
'USR_TOTAL_PAUSED' => $aCount['paused'],
'USR_TOTAL_COMPLETED' => $aCount['completed'],
'USR_TOTAL_UNASSIGNED' => $aCount['selfservice']
);
$users->update($newData);
}
$this->listFirstExecution('insert');
return true;
}
}
/**
* This function checks if List tables are going to migrated
*

View File

@@ -0,0 +1,97 @@
<?php
require_once 'classes/model/om/BaseAbeConfiguration.php';
/**
* Skeleton subclass for representing a row from the 'ABE_CONFIGURATION' 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 classes.model
*/
class AbeConfiguration extends BaseAbeConfiguration
{
private $filterThisFields = array('ABE_UID', 'PRO_UID', 'TAS_UID', 'ABE_TYPE',
'ABE_TEMPLATE', 'ABE_DYN_TYPE', 'DYN_UID','ABE_EMAIL_FIELD',
'ABE_ACTION_FIELD', 'ABE_CASE_NOTE_IN_RESPONSE', 'ABE_CREATE_DATE','ABE_UPDATE_DATE');
public function load($abeUid)
{
try {
$abeConfigurationInstance = AbeConfigurationPeer::retrieveByPK($abeUid);
$fields = $abeConfigurationInstance->toArray(BasePeer::TYPE_FIELDNAME);
return $fields;
} catch (Exception $error) {
throw $error;
}
}
public function createOrUpdate($data)
{
foreach ($data as $field => $value) {
if (!in_array($field, $this->filterThisFields)) {
unset($data[$field]);
}
}
$connection = Propel::getConnection(AbeConfigurationPeer::DATABASE_NAME);
try {
if (!isset($data['ABE_UID'])) {
$data['ABE_UID'] = '';
}
if ($data['ABE_UID'] == '') {
$data['ABE_UID'] = G::generateUniqueID();
$data['ABE_CREATE_DATE'] = date('Y-m-d H:i:s');
$abeConfigurationInstance = new AbeConfiguration();
} else {
$abeConfigurationInstance = AbeConfigurationPeer::retrieveByPK($data['ABE_UID']);
}
$data['ABE_UPDATE_DATE'] = date('Y-m-d H:i:s');
$abeConfigurationInstance->fromArray($data, BasePeer::TYPE_FIELDNAME);
if ($abeConfigurationInstance->validate()) {
$connection->begin();
$result = $abeConfigurationInstance->save();
$connection->commit();
return $data['ABE_UID'];
} else {
$message = '';
$validationFailures = $abeConfigurationInstance->getValidationFailures();
foreach ($validationFailures as $validationFailure) {
$message .= $validationFailure->getMessage() . '. ';
}
throw (new Exception('Error trying to update: ' . $message));
}
} catch (Exception $error) {
$connection->rollback();
throw $error;
}
}
public function deleteByTasUid($tasUid)
{
try {
$criteria = new Criteria('workflow');
$criteria->add(AbeConfigurationPeer::TAS_UID, $tasUid);
AbeConfigurationPeer::doDelete($criteria);
} catch (Exception $error) {
throw $error;
}
}
}
// AbeConfiguration

View File

@@ -0,0 +1,25 @@
<?php
// include base peer class
require_once 'classes/model/om/BaseAbeConfigurationPeer.php';
// include object class
include_once 'classes/model/AbeConfiguration.php';
/**
* Skeleton subclass for performing query and update operations on the 'ABE_CONFIGURATION' 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 classes.model
*/
class AbeConfigurationPeer extends BaseAbeConfigurationPeer
{
}
// AbeConfigurationPeer

View File

@@ -0,0 +1,87 @@
<?php
require_once 'classes/model/om/BaseAbeRequests.php';
/**
* Skeleton subclass for representing a row from the 'ABE_REQUESTS' 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 classes.model
*/
class AbeRequests extends BaseAbeRequests
{
private $filterThisFields = array('ABE_REQ_UID', 'ABE_UID', 'APP_UID', 'DEL_INDEX',
'ABE_REQ_SENT_TO', 'ABE_REQ_SUBJECT', 'ABE_REQ_BODY',
'ABE_REQ_DATE', 'ABE_REQ_STATUS', 'ABE_REQ_ANSWERED');
public function load($abeRequestUid)
{
try {
$abeRequestInstance = AbeRequestsPeer::retrieveByPK($abeRequestUid);
$fields = $abeRequestInstance->toArray(BasePeer::TYPE_FIELDNAME);
return $fields;
} catch (Exception $error) {
throw $error;
}
}
public function createOrUpdate($data)
{
$additionalFields = array();
foreach ($data as $field => $value) {
if (!in_array($field, $this->filterThisFields)) {
$additionalFields[$field] = $value;
unset($data[$field]);
}
}
$connection = Propel::getConnection(AbeRequestsPeer::DATABASE_NAME);
try {
if (!isset($data['ABE_REQ_UID'])) {
$data['ABE_REQ_UID'] = '';
}
if ($data['ABE_REQ_UID'] == '') {
$data['ABE_REQ_UID'] = G::generateUniqueID();
$data['ABE_REQ_DATE'] = date('Y-m-d H:i:s');
$AbeRequestsInstance = new AbeRequests();
} else {
$AbeRequestsInstance = AbeRequestsPeer::retrieveByPK($data['ABE_REQ_UID']);
}
$AbeRequestsInstance->fromArray($data, BasePeer::TYPE_FIELDNAME);
if ($AbeRequestsInstance->validate()) {
$connection->begin();
$result = $AbeRequestsInstance->save();
$connection->commit();
return $data['ABE_REQ_UID'];
} else {
$message = '';
$validationFailures = $AbeRequestsInstance->getValidationFailures();
foreach ($validationFailures as $validationFailure) {
$message .= $validationFailure->getMessage() . '. ';
}
throw(new Exception('Error trying to update: ' . $message));
}
} catch (Exception $error) {
$connection->rollback();
throw $error;
}
}
}
// AbeRequests

View File

@@ -0,0 +1,24 @@
<?php
// include base peer class
require_once 'classes/model/om/BaseAbeRequestsPeer.php';
// include object class
include_once 'classes/model/AbeRequests.php';
/**
* Skeleton subclass for performing query and update operations on the 'ABE_REQUESTS' 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 classes.model
*/
class AbeRequestsPeer extends BaseAbeRequestsPeer
{
}
// AbeRequestsPeer

View File

@@ -0,0 +1,88 @@
<?php
require_once 'classes/model/om/BaseAbeResponses.php';
/**
* Skeleton subclass for representing a row from the 'ABE_RESPONSES' 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 classes.model
*/
class AbeResponses extends BaseAbeResponses
{
private $filterThisFields = array('ABE_RES_UID', 'ABE_REQ_UID', 'ABE_RES_CLIENT_IP', 'ABE_RES_DATA',
'ABE_RES_DATE', 'ABE_RES_STATUS', 'ABE_RES_MESSAGE');
public function load($abeResponsesUid)
{
try {
$abeResponsesInstance = AbeResponsesPeer::retrieveByPK($abeResponsesUid);
$fields = $abeResponsesInstance->toArray(BasePeer::TYPE_FIELDNAME);
return $fields;
} catch (Exception $error) {
throw $error;
}
}
public function createOrUpdate($data)
{
$additionalFields = array();
foreach ($data as $field => $value) {
if (!in_array($field, $this->filterThisFields)) {
$additionalFields[$field] = $value;
unset($data[$field]);
}
}
$connection = Propel::getConnection(AbeResponsesPeer::DATABASE_NAME);
try {
if (!isset($data['ABE_RES_UID'])) {
$data['ABE_RES_UID'] = '';
}
if ($data['ABE_RES_UID'] == '') {
$data['ABE_RES_UID'] = G::generateUniqueID();
$data['ABE_RES_DATE'] = date('Y-m-d H:i:s');
$AbeResponsesInstance = new AbeResponses();
} else {
$AbeResponsesInstance = AbeResponsesPeer::retrieveByPK($data['ABE_RES_UID']);
}
//$data['ABE_RES_UPDATE'] = date('Y-m-d H:i:s');
$AbeResponsesInstance->fromArray($data, BasePeer::TYPE_FIELDNAME);
if ($AbeResponsesInstance->validate()) {
$connection->begin();
$result = $AbeResponsesInstance->save();
$connection->commit();
return $data['ABE_RES_UID'];
} else {
$message = '';
$validationFailures = $AbeResponsesInstance->getValidationFailures();
foreach ($validationFailures as $validationFailure) {
$message .= $validationFailure->getMessage() . '. ';
}
throw(new Exception('Error trying to update: ' . $message));
}
} catch (Exception $error) {
$connection->rollback();
throw $error;
}
}
}
// AbeResponses

View File

@@ -0,0 +1,25 @@
<?php
// include base peer class
require_once 'classes/model/om/BaseAbeResponsesPeer.php';
// include object class
include_once 'classes/model/AbeResponses.php';
/**
* Skeleton subclass for performing query and update operations on the 'ABE_RESPONSES' 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 classes.model
*/
class AbeResponsesPeer extends BaseAbeResponsesPeer
{
}
// AbeResponsesPeer

View File

@@ -1,4 +1,4 @@
<?php
<?php
/**
* AdditionalTables.php
@@ -445,19 +445,23 @@ class AdditionalTables extends BaseAdditionalTables
$oCriteriaCount = clone $oCriteria;
eval('$count = ' . $sClassPeerName . '::doCount($oCriteria);');
}
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$sClassPeerName = $filter->validateInput($sClassPeerName);
if (isset($_POST['sort'])) {
$_POST['sort'] = $filter->validateInput($_POST['sort']);
if ($_POST['dir'] == 'ASC') {
if ($keyOrderUppercase) {
eval('$oCriteria->addAscendingOrderByColumn("' . $_POST['sort'] . '");');
eval('$oCriteria->addAscendingOrderByColumn("' . $sort . '");');
} else {
eval('$oCriteria->addAscendingOrderByColumn(' . $sClassPeerName . '::' . $_POST['sort'] . ');');
eval('$oCriteria->addAscendingOrderByColumn(' . $sClassPeerName . '::' . $sort . ');');
}
} else {
if ($keyOrderUppercase) {
eval('$oCriteria->addDescendingOrderByColumn("' . $_POST['sort'] . '");');
eval('$oCriteria->addDescendingOrderByColumn("' . $sort . '");');
} else {
eval('$oCriteria->addDescendingOrderByColumn(' . $sClassPeerName . '::' . $_POST['sort'] . ');');
eval('$oCriteria->addDescendingOrderByColumn(' . $sClassPeerName . '::' . $sort . ');');
}
}
}

View File

@@ -132,7 +132,11 @@ class AddonsManager extends BaseAddonsManager
$oPluginRegistry = &PMPluginRegistry::getSingleton();
require_once (PATH_PLUGINS . $this->getAddonName() . ".php");
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$requiredPath = PATH_PLUGINS . $this->getAddonName() . ".php";
$requiredPath = $filter->validateInput($requiredPath, 'path');
require_once ($requiredPath);
if ($enable) {
//$oDetails = $oPluginRegistry->getPluginDetails($this->getAddonName());

View File

@@ -174,7 +174,20 @@ class AppDelegation extends BaseAppDelegation
$data->DEL_INDEX = $delIndex;
$data->USR_UID = $sUsrUid;
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$oPluginRegistry->executeTriggers( PM_CREATE_NEW_DELEGATION, $data );
$oPluginRegistry->executeTriggers(PM_CREATE_NEW_DELEGATION, $data);
/*----------------------------------********---------------------------------*/
// this section evaluates the actions by email trigger execution please
// modify this section carefully, the if evaluation checks if the license has been
// activated in order to send the mail according to the configuration table
if (PMLicensedFeatures
::getSingleton()
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
G::LoadClass('actionsByEmail');
$actionsByEmail = new actionsByEmailClass();
$actionsByEmail->sendActionsByEmail($data);
}
/*----------------------------------********---------------------------------*/
}
return $delIndex;

View File

@@ -460,6 +460,10 @@ class Department extends BaseDepartment
$node['DEP_MANAGER_LASTNAME'] = '';
}
$criteria = new \Criteria();
$criteria->add(UsersPeer::DEP_UID, $node['DEP_UID'], \Criteria::EQUAL );
$node['DEP_MEMBERS'] = UsersPeer::doCount($criteria);
$criteriaCount = new Criteria( 'workflow' );
$criteriaCount->clearSelectColumns();
$criteriaCount->addSelectColumn( 'COUNT(*)' );

View File

@@ -0,0 +1,5 @@
<?php
class ElementTaskRelation extends BaseElementTaskRelation
{
}

View File

@@ -0,0 +1,5 @@
<?php
class ElementTaskRelationPeer extends BaseElementTaskRelationPeer
{
}

View File

@@ -103,6 +103,10 @@ class ListCanceled extends BaseListCanceled {
$oListInbox = new ListInbox();
$oListInbox->removeAll($data['APP_UID']);
$users = new Users();
$users->refreshTotal($data['USR_UID'], 'removed', 'inbox');
$users->refreshTotal($data['USR_UID'], 'add', 'canceled');
$con = Propel::getConnection( ListCanceledPeer::DATABASE_NAME );
try {
$this->fromArray( $data, BasePeer::TYPE_FIELDNAME );

View File

@@ -94,6 +94,14 @@ class ListCompleted extends BaseListCompleted
$criteriaSet->add(ListParticipatedLastPeer::APP_STATUS, 'COMPLETED');
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
$users = new Users();
$users->refreshTotal($data['USR_UID'], 'add', 'completed');
if ($data['DEL_PREVIOUS'] != 0) {
$users->refreshTotal($data['USR_UID'], 'remove', 'inbox');
} else {
$users->refreshTotal($data['USR_UID'], 'remove', 'draft');
}
$con = Propel::getConnection( ListCompletedPeer::DATABASE_NAME );
try {
$this->fromArray( $data, BasePeer::TYPE_FIELDNAME );

View File

@@ -23,7 +23,7 @@ class ListInbox extends BaseListInbox
* @return type
*
*/
public function create($data)
public function create($data, $isSelfService = false)
{
$con = Propel::getConnection( ListInboxPeer::DATABASE_NAME );
try {
@@ -48,12 +48,38 @@ class ListInbox extends BaseListInbox
$listMyInbox->refresh($data);
// remove and create participated last
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->remove($data['APP_UID'], $data['USR_UID']);
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->create($data);
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->refresh($data);
if (!$isSelfService) {
$oCriteria = new Criteria('workflow');
$oCriteria->add(ListParticipatedLastPeer::APP_UID, $data['APP_UID']);
$oCriteria->add(ListParticipatedLastPeer::USR_UID, $data['USR_UID']);
$exit = ListParticipatedLastPeer::doCount($oCriteria);
if ($exit) {
$oCriteria = new Criteria('workflow');
$oCriteria->add(ListParticipatedLastPeer::APP_UID, $data['APP_UID']);
$oCriteria->add(ListParticipatedLastPeer::USR_UID, $data['USR_UID']);
ListParticipatedLastPeer::doDelete($oCriteria);
$users = new Users();
$users->refreshTotal($data['USR_UID'], 'removed', 'participated');
}
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->create($data);
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->refresh($data);
} else {
$data['USR_UID'] = $data['DEL_PREVIOUS_USR_UID'];
$data['DEL_CURRENT_USR_LASTNAME'] = '';
$data['DEL_CURRENT_USR_USERNAME'] = '';
$data['DEL_CURRENT_USR_FIRSTNAME'] = '';
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->refresh($data, $isSelfService);
$data['USR_UID'] = 'SELF_SERVICES';
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->create($data);
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->refresh($data, $isSelfService);
}
return $result;
} catch(Exception $e) {
@@ -69,8 +95,31 @@ class ListInbox extends BaseListInbox
* @return type
* @throws type
*/
public function update($data)
public function update($data, $isSelfService = false)
{
if ($isSelfService) {
$users = new Users();
$users->refreshTotal($data['USR_UID'], 'add', 'inbox');
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->remove($data['APP_UID'], $data['USR_UID']);
//Update - WHERE
$criteriaWhere = new Criteria("workflow");
$criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $data["APP_UID"], Criteria::EQUAL);
$criteriaWhere->add(ListParticipatedLastPeer::USR_UID, 'SELF_SERVICES', Criteria::EQUAL);
$criteriaWhere->add(ListParticipatedLastPeer::DEL_INDEX, $data["DEL_INDEX"], Criteria::EQUAL);
//Update - SET
$criteriaSet = new Criteria("workflow");
$criteriaSet->add(ListParticipatedLastPeer::USR_UID, $data['USR_UID']);
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->refresh($data);
$users = new Users();
$users->refreshTotal($data['USR_UID'], 'add', 'participated');
}
$con = Propel::getConnection( ListInboxPeer::DATABASE_NAME );
try {
$con->begin();
@@ -141,7 +190,7 @@ class ListInbox extends BaseListInbox
}
}
public function newRow ($data, $delPreviusUsrUid)
public function newRow ($data, $delPreviusUsrUid, $isInitSubprocess = false, $dataPreviusApplication = array(), $isSelfService = false)
{
$data['DEL_PREVIOUS_USR_UID'] = $delPreviusUsrUid;
if (isset($data['DEL_TASK_DUE_DATE'])) {
@@ -211,7 +260,53 @@ class ListInbox extends BaseListInbox
$data['DEL_PREVIOUS_USR_LASTNAME'] = $aRow['USR_LASTNAME'];
}
self::create($data);
$users = new Users();
$criteria = new Criteria();
$criteria->addSelectColumn(SubApplicationPeer::DEL_INDEX_PARENT);
$criteria->add( SubApplicationPeer::APP_PARENT, $data['APP_UID'], Criteria::EQUAL );
$dataset = SubApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($dataset->next()) {
$aSub = $dataset->getRow();
if ($aSub['DEL_INDEX_PARENT'] == $data['DEL_PREVIOUS'] && !$isSelfService) {
$users->refreshTotal($data['USR_UID'], 'add', 'inbox');
self::create($data, $isSelfService);
return 1;
}
}
if (!$isInitSubprocess) {
if ($data['APP_STATUS'] == 'DRAFT') {
$users->refreshTotal($data['USR_UID'], 'add', 'draft');
} else {
$oRow = ApplicationPeer::retrieveByPK($data['APP_UID']);
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
if ($data['DEL_INDEX'] == 2 || $aFields['APP_STATUS'] == 'DRAFT') {
$criteria = new Criteria();
$criteria->addSelectColumn(SubApplicationPeer::APP_UID);
$criteria->add( SubApplicationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL );
$dataset = SubApplicationPeer::doSelectRS($criteria);
if ($dataset->next()) {
$users->refreshTotal($delPreviusUsrUid, 'remove', 'inbox');
} else {
$users->refreshTotal($delPreviusUsrUid, 'remove', 'draft');
}
} else {
$users->refreshTotal($delPreviusUsrUid, 'remove', 'inbox');
}
if (!$isSelfService) {
$users->refreshTotal($data['USR_UID'], 'add', 'inbox');
}
}
} else {
$users->refreshTotal($data['USR_UID'], 'add', 'inbox');
if ($dataPreviusApplication['APP_STATUS'] == 'DRAFT') {
$users->refreshTotal($dataPreviusApplication['CURRENT_USER_UID'], 'remove', 'draft');
} else {
$users->refreshTotal($dataPreviusApplication['CURRENT_USER_UID'], 'remove', 'inbox');
}
}
self::create($data, $isSelfService);
}
public function loadFilters (&$criteria, $filters)
@@ -283,6 +378,11 @@ class ListInbox extends BaseListInbox
{
$criteria = new Criteria();
$criteria->add( ListInboxPeer::USR_UID, $usr_uid, Criteria::EQUAL );
if ($filters['action'] == 'draft') {
$criteria->add( ListInboxPeer::APP_STATUS, 'DRAFT', Criteria::EQUAL );
} else {
$criteria->add( ListInboxPeer::APP_STATUS, 'TO_DO', Criteria::EQUAL );
}
self::loadFilters($criteria, $filters);
$total = ListInboxPeer::doCount( $criteria );
return (int)$total;

View File

@@ -123,6 +123,7 @@ class ListMyInbox extends BaseListMyInbox
if ($data['DEL_INDEX'] == 1 && $data['APP_STATUS'] == 'TO_DO') {
$data['APP_CREATE_DATE'] = $data['APP_UPDATE_DATE'];
$this->remove($data['APP_UID'], $data['USR_UID']);
$this->create($data);
} else {
unset($data['USR_UID']);

View File

@@ -26,19 +26,6 @@ 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 );
@@ -48,6 +35,24 @@ class ListParticipatedLast extends BaseListParticipatedLast
$aRow = $dataset->getRow();
$data['APP_STATUS'] = $aRow['APP_STATUS'];
if ($data['USR_UID'] != 'SELF_SERVICES') {
$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'];
$users = new Users();
$users->refreshTotal($data['USR_UID'], 'add', 'participated');
}
$con = Propel::getConnection( ListParticipatedLastPeer::DATABASE_NAME );
try {
$this->fromArray( $data, BasePeer::TYPE_FIELDNAME );
@@ -102,24 +107,32 @@ class ListParticipatedLast extends BaseListParticipatedLast
* @throws type
*
*/
public function refresh ($data)
public function refresh ($data, $isSelfService = false)
{
$data['APP_STATUS'] = (empty($data['APP_STATUS'])) ? 'TO_DO' : $data['APP_STATUS'];
$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_UID'] = $data['USR_UID'];
$data['DEL_CURRENT_USR_USERNAME'] = $aRow['USR_USERNAME'];
$data['DEL_CURRENT_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME'];
$data['DEL_CURRENT_USR_LASTNAME'] = $aRow['USR_LASTNAME'];
$this->update($data);
if (!$isSelfService) {
$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();
//Update - WHERE
$criteriaWhere = new Criteria("workflow");
$criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $data["APP_UID"], Criteria::EQUAL);
//Update - SET
$criteriaSet = new Criteria("workflow");
$criteriaSet->add(ListParticipatedLastPeer::DEL_CURRENT_USR_USERNAME, $aRow['USR_USERNAME']);
$criteriaSet->add(ListParticipatedLastPeer::DEL_CURRENT_USR_FIRSTNAME, $aRow['USR_FIRSTNAME']);
$criteriaSet->add(ListParticipatedLastPeer::DEL_CURRENT_USR_LASTNAME, $aRow['USR_LASTNAME']);
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
}
$this->update($data);
}
/**
@@ -130,8 +143,13 @@ class ListParticipatedLast extends BaseListParticipatedLast
* @throws type
*
*/
public function remove ($app_uid, $usr_uid)
public function remove ($app_uid, $usr_uid, $del_index)
{
$existField = ListParticipatedLastPeer::retrieveByPK($app_uid, $usr_uid, $del_index);
if (! is_null( $existField )) {
$users = new Users();
$users->refreshTotal($usr_uid, 'removed', 'participated');
}
$con = Propel::getConnection( ListParticipatedLastPeer::DATABASE_NAME );
try {
$this->setAppUid($app_uid);

Some files were not shown because too many files have changed in this diff Show More