solve conflicts

This commit is contained in:
Rodrigo Quelca
2019-05-17 11:16:18 -04:00
218 changed files with 11380 additions and 9660 deletions

View File

@@ -48,6 +48,17 @@ class AbeConfiguration extends BaseAbeConfiguration
}
}
/**
* Create or update.
*
* @param array $data
* @throws Exception
*
* @see Processes->createActionsByEmail()
* @see ProcessMaker\BusinessModel\ActionsByEmail->saveConfiguration()
* @see ProcessMaker\BusinessModel\ActionsByEmail->saveConfiguration2()
* @link https://wiki.processmaker.com/3.3/Actions_by_Email#Configuration
*/
public function createOrUpdate($data)
{
foreach ($data as $field => $value) {
@@ -70,6 +81,11 @@ class AbeConfiguration extends BaseAbeConfiguration
} else {
$abeConfigurationInstance = AbeConfigurationPeer::retrieveByPK($data['ABE_UID']);
}
//Only the 'FIELD' and 'LINK' types have a DYN_UID,
//the DYN_UID field is empty when the type is 'CUSTOM'.
if ($data['ABE_TYPE'] === 'CUSTOM') {
$data['DYN_UID'] = '';
}
if (isset($data['ABE_CUSTOM_GRID'])) {
$data['ABE_CUSTOM_GRID'] = serialize($data['ABE_CUSTOM_GRID']);

View File

@@ -64,6 +64,12 @@ class AppAssignSelfServiceValue extends BaseAppAssignSelfServiceValue
*
* @return void
* @throws Exception
*
* @see \Cases->removeCase()
* @see \Cases->setCatchUser()
* @see \Cases->updateCase()
*
* @link https://wiki.processmaker.com/3.2/Tasks#Self_Service_Value_Based_Assignment
*/
public function remove($applicationUid, $delIndex = 0)
{
@@ -76,18 +82,7 @@ class AppAssignSelfServiceValue extends BaseAppAssignSelfServiceValue
$criteria->add(AppAssignSelfServiceValuePeer::DEL_INDEX, $delIndex, Criteria::EQUAL);
}
$result = AppAssignSelfServiceValuePeer::doDelete($criteria);
// Delete related rows and missing relations, criteria don't execute delete with joins
$cnn = Propel::getConnection(AppAssignSelfServiceValueGroupPeer::DATABASE_NAME);
$cnn->begin();
$stmt = $cnn->createStatement();
$rs = $stmt->executeQuery("DELETE " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . "
FROM " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . "
LEFT JOIN " . AppAssignSelfServiceValuePeer::TABLE_NAME . "
ON (" . AppAssignSelfServiceValueGroupPeer::ID . " = " . AppAssignSelfServiceValuePeer::ID . ")
WHERE " . AppAssignSelfServiceValuePeer::ID . " IS NULL");
$cnn->commit();
AppAssignSelfServiceValuePeer::doDelete($criteria);
} catch (Exception $e) {
throw $e;
}

View File

@@ -223,7 +223,6 @@ class AppDelegation extends BaseAppDelegation
try {
$res = $this->save();
} catch (PropelException $e) {
error_log($e->getMessage());
return;
}
} else {
@@ -1046,4 +1045,45 @@ class AppDelegation extends BaseAppDelegation
return $delIndex;
}
/**
* Update the priority in AppDelegation table, using the defined variable in task
*
* @param integer $delIndex
* @param string $tasUid
* @param string $appUid
* @param array $fieldAppData
*
* @return void
*
* @see Cases->update()
*
*/
public function updatePriority($delIndex, $tasUid, $appUid, $fieldAppData)
{
if (!empty($delIndex) && !empty($tasUid)) {
//Optimized code to avoid load task content row.
$criteria = new Criteria();
$criteria->clearSelectColumns();
$criteria->addSelectColumn(TaskPeer::TAS_PRIORITY_VARIABLE);
$criteria->add(TaskPeer::TAS_UID, $tasUid);
$rs = TaskPeer::doSelectRS($criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
$tasPriority = substr($row['TAS_PRIORITY_VARIABLE'], 2);
//End optimized code.
$x = $fieldAppData;
if (!empty($x[$tasPriority])) {
$array = [];
$array['APP_UID'] = $appUid;
$array['DEL_INDEX'] = $delIndex;
$array['TAS_UID'] = $tasUid;
$array['DEL_PRIORITY'] = (isset($x[$tasPriority]) ?
($x[$tasPriority] >= 1 && $x[$tasPriority] <= 5 ? $x[$tasPriority] : '3') : '3');
$this->update($array);
}
}
}
}

View File

@@ -160,7 +160,7 @@ class AppMessage extends BaseAppMessage
* @param string $appMsgTemplate,
* @param string $appMsgAttach,
* @param string $appMsgStatus,
* @param string $appMsgShowMsg,
* @param integer $appMsgShowMsg,
* @param string $appMsgError,
* @param boolean $contentTypeIsHtml
* @param integer $appNumber,
@@ -183,7 +183,7 @@ class AppMessage extends BaseAppMessage
$appMsgTemplate = '',
$appMsgAttach = '',
$appMsgStatus = 'pending',
$appMsgShowMsg = '',
$appMsgShowMsg = 1,
$appMsgError = '',
$contentTypeIsHtml = true,
$appNumber = 0,

View File

@@ -1,7 +1,7 @@
<?php
//require_once 'classes/model/om/BaseAppNotes.php';
use ProcessMaker\Core\System;
use ProcessMaker\Util\DateTime;
/**
* Skeleton subclass for representing a row from the 'APP_NOTES' table.
@@ -14,9 +14,34 @@ use ProcessMaker\Core\System;
*
* @package classes.model
*/
class AppNotes extends BaseAppNotes
{
public function getNotesList (
/**
* Get the existing case notes information from a case
*
* @param string $appUid
* @param string $usrUid
* @param string $start
* @param int $limit
* @param string $sort
* @param string $dir
* @param string $dateFrom
* @param string $dateTo
* @param string $search
*
* @return array
*
* @see \Cases->getCaseNotes()
* @see \AppProxy->getNotesList()
* @see \Home->getAppsData()
* @see workflow/engine/methods/cases/caseNotesAjax.php->getNotesList()
* @see \ProcessMaker\BusinessModel\Cases->getCaseNotes()
* @see \ProcessMaker\Services\Api\Light->doGetCaseNotes()
*
* @link https://wiki.processmaker.com/3.2/Case_Notes#Viewing_Existing_Case_Notes
*/
public function getNotesList(
$appUid,
$usrUid = '',
$start = '',
@@ -25,70 +50,71 @@ class AppNotes extends BaseAppNotes
$dir = 'DESC',
$dateFrom = '',
$dateTo = '',
$search = '')
{
$Criteria = new Criteria( 'workflow' );
$Criteria->clearSelectColumns();
$search = ''
) {
$criteria = new Criteria('workflow');
$criteria->clearSelectColumns();
$Criteria->addSelectColumn( AppNotesPeer::APP_UID );
$Criteria->addSelectColumn( AppNotesPeer::USR_UID );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_DATE );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_CONTENT );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_TYPE );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_AVAILABILITY );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_ORIGIN_OBJ );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_AFFECTED_OBJ1 );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_AFFECTED_OBJ2 );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_RECIPIENTS );
$Criteria->addSelectColumn( UsersPeer::USR_USERNAME );
$Criteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$Criteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$Criteria->addSelectColumn( UsersPeer::USR_EMAIL );
$criteria->addSelectColumn(AppNotesPeer::APP_UID);
$criteria->addSelectColumn(AppNotesPeer::USR_UID);
$criteria->addSelectColumn(AppNotesPeer::NOTE_DATE);
$criteria->addSelectColumn(AppNotesPeer::NOTE_CONTENT);
$criteria->addSelectColumn(AppNotesPeer::NOTE_TYPE);
$criteria->addSelectColumn(AppNotesPeer::NOTE_AVAILABILITY);
$criteria->addSelectColumn(AppNotesPeer::NOTE_ORIGIN_OBJ);
$criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ1);
$criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ2);
$criteria->addSelectColumn(AppNotesPeer::NOTE_RECIPIENTS);
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$criteria->addSelectColumn(UsersPeer::USR_EMAIL);
$Criteria->addJoin( AppNotesPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN );
$criteria->addJoin(AppNotesPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
$Criteria->add( AppNotesPeer::APP_UID, $appUid, Criteria::EQUAL );
$criteria->add(AppNotesPeer::APP_UID, $appUid, Criteria::EQUAL);
if ($usrUid != '') {
$Criteria->add( AppNotesPeer::USR_UID, $usrUid, Criteria::EQUAL );
$criteria->add(AppNotesPeer::USR_UID, $usrUid, Criteria::EQUAL);
}
if ($dateFrom != '') {
$Criteria->add( AppNotesPeer::NOTE_DATE, $dateFrom, Criteria::GREATER_EQUAL );
$criteria->add(AppNotesPeer::NOTE_DATE, $dateFrom, Criteria::GREATER_EQUAL);
}
if ($dateTo != '') {
$Criteria->add( AppNotesPeer::NOTE_DATE, $dateTo, Criteria::LESS_EQUAL );
$criteria->add(AppNotesPeer::NOTE_DATE, $dateTo, Criteria::LESS_EQUAL);
}
if ($search != '') {
$Criteria->add( AppNotesPeer::NOTE_CONTENT, '%'.$search.'%', Criteria::LIKE );
$criteria->add(AppNotesPeer::NOTE_CONTENT, '%' . $search . '%', Criteria::LIKE);
}
if ($dir == 'DESC') {
$Criteria->addDescendingOrderByColumn($sort);
$criteria->addDescendingOrderByColumn($sort);
} else {
$Criteria->addAscendingOrderByColumn($sort);
$criteria->addAscendingOrderByColumn($sort);
}
$response = array ();
$totalCount = AppNotesPeer::doCount( $Criteria );
$response = [];
$totalCount = AppNotesPeer::doCount($criteria);
$response['totalCount'] = $totalCount;
$response['notes'] = array ();
$response['notes'] = [];
if ($start != '') {
$Criteria->setLimit( $limit );
$Criteria->setOffset( $start );
$criteria->setLimit($limit);
$criteria->setOffset($start);
}
$oDataset = appNotesPeer::doSelectRS( $Criteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$dataset = AppNotesPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
while ($aRow = $oDataset->getRow()) {
$aRow['NOTE_CONTENT'] = stripslashes($aRow['NOTE_CONTENT']);
$response['notes'][] = $aRow;
$oDataset->next();
while ($row = $dataset->getRow()) {
$row['NOTE_CONTENT'] = stripslashes($row['NOTE_CONTENT']);
$response['notes'][] = $row;
$dataset->next();
}
$result['criteria'] = $Criteria;
$result = [];
$result['criteria'] = $criteria;
$result['array'] = $response;
return $result;
@@ -154,8 +180,12 @@ class AppNotes extends BaseAppNotes
* @param string $noteRecipients
* @param string $from
* @param integer $delIndex
*
* @return void
* @throws Exception
*
* @see AppNotes->addCaseNote()
* @see AppNotes->postNewNote()
* @see workflow/engine/src/ProcessMaker/Util/helpers.php::postNote()
*/
public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecipients, $from = '', $delIndex = 0)
{
@@ -169,9 +199,14 @@ class AppNotes extends BaseAppNotes
$configuration['MESS_ENGINE'] = '';
}
$users = new Users();
$userInfo = $users->load($usrUid);
$authorName = ((($userInfo['USR_FIRSTNAME'] != '') || ($userInfo['USR_LASTNAME'] != '')) ? $userInfo['USR_FIRSTNAME'] . ' ' . $userInfo['USR_LASTNAME'] . ' ' : '') . '<' . $userInfo['USR_EMAIL'] . '>';
//This value can be empty when the previous task is: 'Script Task', 'Timer Event' or other without user.
if (!empty($usrUid)) {
$users = new Users();
$userInfo = $users->load($usrUid);
$authorName = ((($userInfo['USR_FIRSTNAME'] != '') || ($userInfo['USR_LASTNAME'] != '')) ? $userInfo['USR_FIRSTNAME'] . ' ' . $userInfo['USR_LASTNAME'] . ' ' : '') . '<' . $userInfo['USR_EMAIL'] . '>';
} else {
$authorName = G::LoadTranslation('UID_UNDEFINED_USER');
}
$cases = new Cases();
$fieldCase = $cases->loadCase($appUid, $delIndex);
@@ -193,7 +228,7 @@ class AppNotes extends BaseAppNotes
'',
$appUid,
$delIndex,
'DERIVATION',
WsBase::MESSAGE_TYPE_CASE_NOTE,
G::replaceDataField($configNoteNotification['subject'], $fieldCase),
G::buildFrom($configuration, $from),
$to,
@@ -203,7 +238,7 @@ class AppNotes extends BaseAppNotes
'',
'',
'pending',
'',
1,
$msgError,
true,
(isset($fieldCase['APP_NUMBER'])) ? $fieldCase['APP_NUMBER'] : 0,

View File

@@ -223,14 +223,8 @@ class Dynaform extends BaseDynaform
$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 = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$sXml .= '<dynaForm type="' . $this->getDynType() . '" name="' . $this->getProUid() . '/' . $this->getDynUid() . '" width="500" enabletemplate="0" mode="" nextstepsave="prompt">' . "\n";
$sXml .= '</dynaForm>';
G::verifyPath(PATH_DYNAFORM . $this->getProUid(), true);
$oFile = fopen(PATH_DYNAFORM . $this->getProUid() . '/' . $this->getDynUid() . '.xml', 'w');
fwrite($oFile, $sXml);
fclose($oFile);
Form::createXMLFile($this->getProUid(), $this->getDynUid(), $this->getDynType(), PATH_DYNAFORM);
return $this->getDynUid();
} else {
$msg = '';

View File

@@ -98,13 +98,13 @@ class Groupwf extends BaseGroupwf
$this->setGrpTitle('Default Group Title');
}
if (!empty($aData['GRP_STATUS'])) {
if (!empty($data['GRP_STATUS'])) {
$this->setGrpStatus($data['GRP_STATUS']);
} else {
$this->setGrpStatus('ACTIVE');
}
if (!empty($aData['GRP_LDAP_DN'])) {
if (!empty($data['GRP_LDAP_DN'])) {
$this->setGrpLdapDn($data['GRP_LDAP_DN']);
} else {
$this->setGrpLdapDn('');

View File

@@ -13,8 +13,8 @@ require_once 'classes/model/om/BaseListCompleted.php';
* long as it does not already exist in the output directory.
*
* @package classes.model
* @deprecated Method deprecated in Release 3.3.9
*/
// @codingStandardsIgnoreStart
class ListCompleted extends BaseListCompleted implements ListInterface
{
use ListBaseTrait;

View File

@@ -1,6 +1,7 @@
<?php
require_once 'classes/model/om/BaseListParticipatedLast.php';
use ProcessMaker\BusinessModel\Cases as BmCases;
/**
@@ -536,4 +537,25 @@ class ListParticipatedLast extends BaseListParticipatedLast implements ListInter
}
BasePeer::doUpdate($criteriaWhere, $criteriaSet, $con);
}
/**
* Update the column APP_STATUS
*
* @param string $appUid
* @param string $status, can be [TO_DO, COMPLETED, etc]
*
* @return void
*
* @see Cases::updateCase()
*/
public function refreshStatus($appUid, $status = 'TO_DO')
{
//Update - WHERE
$criteriaWhere = new Criteria("workflow");
$criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $appUid, Criteria::EQUAL);
//Update - SET
$criteriaSet = new Criteria("workflow");
$criteriaSet->add(ListParticipatedLastPeer::APP_STATUS, $status);
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
}
}

View File

@@ -333,18 +333,16 @@ class ListUnassigned extends BaseListUnassigned implements ListInterface
{
try {
$arrayAppAssignSelfServiceValueData = [];
$criteria = new Criteria("workflow");
$group = new Groups();
//Get the GRP_ID related to the $userUid
$arrayId = $group->getActiveGroupsForAnUserById($userUid);
$sql = "("
. AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID . " IN ("
. " SELECT " . GroupUserPeer::GRP_ID . " "
. " FROM " . GroupUserPeer::TABLE_NAME . " "
. " LEFT JOIN " . GroupwfPeer::TABLE_NAME . " ON (" . GroupUserPeer::GRP_ID . "=" . GroupwfPeer::GRP_ID . ") "
. " WHERE " . GroupUserPeer::USR_UID . "='" . $userUid . "' AND " . GroupwfPeer::GRP_STATUS . "='ACTIVE'"
. " ) AND "
. " " . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE . "=2 "
. ")";
. AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID . " IN (" . implode(",", $arrayId) . ") AND "
. " " . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE . " = 2 "
. ")";
$criteria->setDistinct();
$criteria->addSelectColumn(AppAssignSelfServiceValuePeer::APP_UID);

View File

@@ -130,5 +130,43 @@ class LoginLog extends BaseLoginLog
}
return $aRows;
}
/**
* Returns the last session id of a user
* @param string $userUid User uid
* @return array All session id of php
* @throws PropelException
* @throws SQLException
*/
public function getSessionsIdByUser($userUid)
{
$criteria = new Criteria();
$criteria->addSelectColumn('LOG_SID');
$criteria->add(LoginLogPeer::USR_UID, $userUid);
$criteria->add(LoginLogPeer::LOG_STATUS, 'ACTIVE');
$criteria->setDistinct();
$criteria->addDescendingOrderByColumn(LoginLogPeer::LOG_INIT_DATE);
$resultSet = LoginLogPeer::doSelectRS($criteria);
$resultSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$row = [];
while($resultSet->next()) {
$row[] = $resultSet->getRow();
}
return $row;
}
/**
* Delete all records related to a user uid
* @param string $userUid User uid
* @return int
* @throws PropelException
*/
public function removeByUser($userUid)
{
$criteria = new Criteria();
$criteria->add(LoginLogPeer::USR_UID, $userUid);
$resultSet = LoginLogPeer::doDelete($criteria);
return $resultSet;
}
}

View File

@@ -173,6 +173,20 @@ class OauthAccessTokens extends BaseOauthAccessTokens
return array("numRecTotal" => $numRecTotal, "data" => $arrayData);
}
/**
* Delete all records related to a user uid
* @param string $userUid User uid
* @return int
* @throws PropelException
*/
public function removeByUser($userUid)
{
$criteria = new Criteria();
$criteria->add(OauthAccessTokensPeer::USER_ID, $userUid);
$resultSet = OauthAccessTokensPeer::doDelete($criteria);
return $resultSet;
}
}
// OauthAccessTokens

View File

@@ -14,6 +14,19 @@ require_once 'classes/model/om/BaseOauthAuthorizationCodes.php';
*
* @package classes.model
*/
class OauthAuthorizationCodes extends BaseOauthAuthorizationCodes {
class OauthAuthorizationCodes extends BaseOauthAuthorizationCodes
{
/**
* Delete all records related to a user uid
* @param string $userUid User uid
* @return int
* @throws PropelException
*/
public function removeByUser($userUid)
{
$criteria = new Criteria();
$criteria->add(OauthAuthorizationCodesPeer::USER_ID, $userUid);
$resultSet = OauthAuthorizationCodesPeer::doDelete($criteria);
return $resultSet;
}
} // OauthAuthorizationCodes

View File

@@ -209,6 +209,19 @@ class OauthClients extends BaseOauthClients
return array("numRecTotal" => $numRecTotal, "data" => $arrayData);
}
/**
* Delete all records related to a user uid
* @param string $userUid User uid
* @return int
* @throws PropelException
*/
public function removeByUser($userUid)
{
$criteria = new Criteria();
$criteria->add(OauthClientsPeer::USR_UID, $userUid);
$resultSet = OauthClientsPeer::doDelete($criteria);
return $resultSet;
}
}
// OauthClients

View File

@@ -14,6 +14,19 @@ require_once 'classes/model/om/BaseOauthRefreshTokens.php';
*
* @package classes.model
*/
class OauthRefreshTokens extends BaseOauthRefreshTokens {
class OauthRefreshTokens extends BaseOauthRefreshTokens
{
/**
* Delete all records related to a user uid
* @param string $userUid User uid
* @return int
* @throws PropelException
*/
public function removeByUser($userUid)
{
$criteria = new Criteria();
$criteria->add(OauthRefreshTokensPeer::USER_ID, $userUid);
$resultSet = OauthRefreshTokensPeer::doDelete($criteria);
return $resultSet;
}
} // OauthRefreshTokens

View File

@@ -508,20 +508,29 @@ class OutputDocument extends BaseOutputDocument
}
}
/*
/**
* Generate the output document
* @param string $sUID
* @param array $aFields
* @param string $sPath
* @return variant
*
* @param string $outDocUid
* @param array $caseFields
* @param string $path
* @param string $filename
* @param string $content
* @param bool $landscape
* @param string $typeDocsToGen
* @param array $properties
*
* @return mixed
*
* @see workflow/engine/methods/cases/cases_Step.php
* @see workflow/engine/classes/class.pmFunctions.php:PMFGenerateOutputDocument()
*/
public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array())
public function generate($outDocUid, $caseFields, $path, $filename, $content, $landscape = false, $typeDocsToGen = 'BOTH', $properties = [])
{
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
$sContent = G::replaceDataGridField($sContent, $aFields);
if (($outDocUid != '') && is_array($caseFields) && ($path != '')) {
$content = G::replaceDataGridField($content, $caseFields, true, true);
if (strpos($sContent, '<!---{') !== false) {
if (strpos($content, '<!---{') !== false) {
$template = new Smarty();
$template->compile_dir = PATH_SMARTY_C;
$template->cache_dir = PATH_SMARTY_CACHE;
@@ -529,20 +538,20 @@ class OutputDocument extends BaseOutputDocument
$template->caching = false;
$template->left_delimiter = '<!---{';
$template->right_delimiter = '}--->';
$oFile = fopen($sPath . $sFilename . '_smarty.html', 'wb');
fwrite($oFile, $sContent);
fclose($oFile);
$template->templateFile = $sPath . $sFilename . '_smarty.html';
$fp = fopen($path . $filename . '_smarty.html', 'wb');
fwrite($fp, $content);
fclose($fp);
$template->templateFile = $path . $filename . '_smarty.html';
//assign the variables and use the template $template
$template->assign($aFields);
$sContent = $template->fetch($template->templateFile);
$template->assign($caseFields);
$content = $template->fetch($template->templateFile);
unlink($template->templateFile);
}
G::verifyPath($sPath, true);
G::verifyPath($path, true);
//Start - Create .doc
$oFile = fopen($sPath . $sFilename . '.doc', 'wb');
$fp = fopen($path . $filename . '.doc', 'wb');
$size = [];
$size["Letter"] = "216mm 279mm";
@@ -566,6 +575,7 @@ class OutputDocument extends BaseOutputDocument
$size["Screenshot800"] = "800mm 600mm";
$size["Screenshot1024"] = "1024mm 768mm";
$sizeLandscape = [];
$sizeLandscape["Letter"] = "279mm 216mm";
$sizeLandscape["Legal"] = "357mm 216mm";
$sizeLandscape["Executive"] = "267mm 184mm";
@@ -587,41 +597,41 @@ class OutputDocument extends BaseOutputDocument
$sizeLandscape["Screenshot800"] = "600mm 800mm";
$sizeLandscape["Screenshot1024"] = "768mm 1024mm";
if (!isset($aProperties['media'])) {
$aProperties['media'] = 'Letter';
if (!isset($properties['media'])) {
$properties['media'] = 'Letter';
}
if ($sLandscape) {
$media = $sizeLandscape[$aProperties['media']];
if ($landscape) {
$media = $sizeLandscape[$properties['media']];
} else {
$media = $size[$aProperties['media']];
$media = $size[$properties['media']];
}
$marginLeft = '15';
if (isset($aProperties['margins']['left'])) {
$marginLeft = $aProperties['margins']['left'];
if (isset($properties['margins']['left'])) {
$marginLeft = $properties['margins']['left'];
}
$marginRight = '15';
if (isset($aProperties['margins']['right'])) {
$marginRight = $aProperties['margins']['right'];
if (isset($properties['margins']['right'])) {
$marginRight = $properties['margins']['right'];
}
$marginTop = '15';
if (isset($aProperties['margins']['top'])) {
$marginTop = $aProperties['margins']['top'];
if (isset($properties['margins']['top'])) {
$marginTop = $properties['margins']['top'];
}
$marginBottom = '15';
if (isset($aProperties['margins']['bottom'])) {
$marginBottom = $aProperties['margins']['bottom'];
if (isset($properties['margins']['bottom'])) {
$marginBottom = $properties['margins']['bottom'];
}
fwrite($oFile, '<html xmlns:v="urn:schemas-microsoft-com:vml"
fwrite($fp, '<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
@@ -667,31 +677,31 @@ class OutputDocument extends BaseOutputDocument
<body>
<div class=WordSection1>');
fwrite($oFile, $sContent);
fwrite($oFile, "\n</div></body></html>\n\n");
fclose($oFile);
fwrite($fp, $content);
fwrite($fp, "\n</div></body></html>\n\n");
fclose($fp);
/* End - Create .doc */
if ($sTypeDocToGener == 'BOTH' || $sTypeDocToGener == 'PDF') {
$oFile = fopen($sPath . $sFilename . '.html', 'wb');
fwrite($oFile, $sContent);
fclose($oFile);
if ($typeDocsToGen == 'BOTH' || $typeDocsToGen == 'PDF') {
$fp = fopen($path . $filename . '.html', 'wb');
fwrite($fp, $content);
fclose($fp);
/* Start - Create .pdf */
if (isset($aProperties['report_generator'])) {
switch ($aProperties['report_generator']) {
if (isset($properties['report_generator'])) {
switch ($properties['report_generator']) {
case 'TCPDF':
$this->generateTcpdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
$this->generateTcpdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
break;
case 'HTML2PDF':
default:
$this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
$this->generateHtml2ps_pdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
break;
}
} else {
$this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
$this->generateHtml2ps_pdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
}
}
//end if $sTypeDocToGener
//end if $typeDocsToGen
/* End - Create .pdf */
} else {
return PEAR::raiseError(

View File

@@ -29,4 +29,20 @@ class PmoauthUserAccessTokens extends BasePmoauthUserAccessTokens
return (is_array($result) && empty($result)) ? false : $result[0];
}
/**
* Delete all records related to a user uid
*
* @param string $userUid User uid
*
* @return int
*/
public function removeByUser($userUid)
{
$criteria = new Criteria();
$criteria->add(PmoauthUserAccessTokensPeer::USER_ID, $userUid);
$resultSet = PmoauthUserAccessTokensPeer::doDelete($criteria);
return $resultSet;
}
} // PmoauthUserAccessTokens

View File

@@ -775,11 +775,22 @@ class Process extends BaseProcess
return $aProc;
}
/**
* Get the trigger configured in committing an action in cases
*
* @param string $proUid
* @param string $action
*
* @return mixed
*
* @see Cases::getExecuteTriggerProcess()
* @link https://wiki.processmaker.com/3.2/Triggers#When_action_cases
*/
public function getTriggerWebBotProcess($proUid, $action)
{
require_once("classes/model/Triggers.php");
if ((! isset($proUid) && $proUid == '') || (! isset($action) && $action == '')) {
if (empty($proUid) || empty($action)){
return false;
}
@@ -788,40 +799,41 @@ class Process extends BaseProcess
switch ($action) {
case 'CREATE':
$var = ProcessPeer::PRO_TRI_CREATE;
$columnName = ProcessPeer::PRO_TRI_CREATE;
break;
case 'OPEN':
$var = ProcessPeer::PRO_TRI_OPEN;
$columnName = ProcessPeer::PRO_TRI_OPEN;
break;
case 'DELETED':
$var = ProcessPeer::PRO_TRI_DELETED;
$columnName = ProcessPeer::PRO_TRI_DELETED;
break;
case 'CANCELED':
$var = ProcessPeer::PRO_TRI_CANCELED;
$columnName = ProcessPeer::PRO_TRI_CANCELED;
break;
case 'PAUSED':
$var = ProcessPeer::PRO_TRI_PAUSED;
$columnName = ProcessPeer::PRO_TRI_PAUSED;
break;
case 'REASSIGNED':
$var = ProcessPeer::PRO_TRI_REASSIGNED;
$columnName = ProcessPeer::PRO_TRI_REASSIGNED;
break;
case "UNPAUSE":
$var = ProcessPeer::PRO_TRI_UNPAUSED;
$columnName = ProcessPeer::PRO_TRI_UNPAUSED;
break;
}
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn($var);
$oCriteria->addSelectColumn(TriggersPeer::TRI_UID);
$oCriteria->addSelectColumn(TriggersPeer::TRI_WEBBOT);
$oCriteria->addJoin($var, TriggersPeer::TRI_UID, Criteria::LEFT_JOIN);
$oCriteria->add(ProcessPeer::PRO_UID, $proUid);
$oDataSet = ProcessPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro'));
$criteria = new Criteria('workflow');
$criteria->addSelectColumn($columnName);
$criteria->addSelectColumn(TriggersPeer::TRI_UID);
$criteria->addSelectColumn(TriggersPeer::TRI_WEBBOT);
$criteria->addSelectColumn(TriggersPeer::TRI_TITLE);
$criteria->addJoin($columnName, TriggersPeer::TRI_UID, Criteria::LEFT_JOIN);
$criteria->add(ProcessPeer::PRO_UID, $proUid);
$criteria->add($columnName, '', Criteria::NOT_EQUAL);
$dataSet = ProcessPeer::doSelectRS($criteria, Propel::getDbConnection('workflow_ro'));
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($oDataSet->next()) {
$row = $oDataSet->getRow();
$arrayWebBotTrigger = ['TRI_UID' => $row['TRI_UID'], 'TRI_WEBBOT' => $row['TRI_WEBBOT']];
if ($dataSet->next()) {
$arrayWebBotTrigger[] = $dataSet->getRow();
}
//Return

View File

@@ -20,5 +20,18 @@ require_once 'classes/model/om/BaseSession.php';
*/
class Session extends BaseSession
{
/**
* Delete all records related to a user uid
* @param string $userUid User uid
* @return int
* @throws PropelException
*/
public function removeByUser($userUid)
{
$criteria = new Criteria();
$criteria->add(SessionPeer::USR_UID, $userUid);
$resultSet = SessionPeer::doDelete($criteria);
return $resultSet;
}
}

View File

@@ -152,5 +152,29 @@ class SubApplication extends BaseSubApplication
return $result;
}
/**
* Load all cases with the same parent case
*
* @param $appUid
*
* @return array
*/
public function loadByAppUidParent($appUid)
{
$criteria = new Criteria('workflow');
$criteria->add(SubApplicationPeer::APP_PARENT, $appUid);
$dataSet = SubApplicationPeer::doSelectRS($criteria);
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$result = [];
while ($dataSet->next()) {
$result[] = $dataSet->getRow();
}
return $result;
}
}