Fix conflicts with develop branch

This commit is contained in:
Julio Cesar Laura Avendaño
2020-01-17 11:27:11 -04:00
400 changed files with 7056 additions and 86309 deletions

View File

@@ -24,12 +24,11 @@ use ProcessMaker\Core\JobsManager;
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
$fn = '
register_shutdown_function(function () {
if (class_exists("Propel")) {
Propel::close();
}
';
register_shutdown_function(create_function('', $fn));
});
ini_set('memory_limit', '512M');

View File

@@ -797,7 +797,7 @@ class Cases
public function array_key_intersect(&$a, &$b)
{
$array = array();
while (list($key, $value) = each($a)) {
foreach ($a as $key => $value) {
if (isset($b[$key])) {
if (is_object($b[$key]) && is_object($value)) {
if (serialize($b[$key]) === serialize($value)) {
@@ -1034,6 +1034,7 @@ class Cases
public function removeCase($sAppUid, $deleteDelegation = true)
{
try {
$appUidCopy = $sAppUid;
$this->getExecuteTriggerProcess($sAppUid, 'DELETED');
$oAppDocument = new AppDocument();
@@ -1152,7 +1153,7 @@ class Cases
/** ProcessMaker log*/
$context = Bootstrap::getDefaultContextLog();
$context['appUid'] = $sAppUid;
$context['appUid'] = $appUidCopy;
$context['request'] = $nameFiles;
Bootstrap::registerMonolog('DeleteCases', 200, 'Delete Case', $context);

View File

@@ -357,6 +357,7 @@ class PmDynaform
$option->value = isset($row[0]) ? $row[0] : "";
$option->label = isset($row[1]) ? $row[1] : "";
$json->optionsSql[] = $option;
$json->queryOutputData[] = $option;
}
}
if ($value === "suggest" && isset($json->queryField) && $json->queryField == true) {
@@ -1022,8 +1023,17 @@ class PmDynaform
. " JOIN "
. $dt[$key]["table"]
. ($dt[$key]["table"] == $dt[$key]["alias"] ? "" : " " . $dt[$key]["alias"]) . " "
. $dt[$key]["ref_type"] . " "
. rtrim($dt[$key]["ref_clause"], " INNER");
. $dt[$key]["ref_type"] . " ";
// Get the last 6 chars of the string
$tempString = mb_substr($dt[$key]["ref_clause"], -6);
// If the last section is a "INNER" statement we need to remove it
if (strcasecmp($tempString, " INNER") === 0) {
$from .= mb_substr($dt[$key]["ref_clause"], 0, mb_strlen($dt[$key]["ref_clause"]) - 6);
} else {
$from .= $dt[$key]["ref_clause"];
}
}
}
}

View File

@@ -166,8 +166,14 @@ class PmLicenseManager
}
}
if (file_exists(PATH_DATA_SITE . "ee")) {
$aPlugins = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee')));
$eeData = Cache::get(config('system.workspace') . 'enterprise.ee', function () {
if (file_exists(PATH_DATA_SITE . 'ee')) {
return trim(file_get_contents(PATH_DATA_SITE . 'ee'));
}
return null;
});
if ($eeData) {
$aPlugins = unserialize($eeData);
$aDenied = [];
foreach ($aPlugins as $aPlugin) {
$sClassName = substr($aPlugin ['sFilename'], 0, strpos($aPlugin ['sFilename'], '-'));
@@ -210,8 +216,14 @@ class PmLicenseManager
$oPluginRegistry->savePlugin($oDetails->getNamespace());
}
if (file_exists(PATH_DATA_SITE . 'ee')) {
$aPlugins = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee')));
$eeData = Cache::get(config('system.workspace') . 'enterprise.ee', function () {
if (file_exists(PATH_DATA_SITE . 'ee')) {
return trim(file_get_contents(PATH_DATA_SITE . 'ee'));
}
return null;
});
if ($eeData) {
$aPlugins = unserialize($eeData);
foreach ($aPlugins as $aPlugin) {
$sClassName = substr($aPlugin ['sFilename'], 0, strpos($aPlugin ['sFilename'], '-'));

View File

@@ -466,7 +466,7 @@ class PmTable
}
if (empty($line)) {
continue;
break;
}
if (strpos($line, "#") === 0) {
@@ -474,7 +474,7 @@ class PmTable
}
if (empty($line)) {
continue;
break;
}
// Concatenate the previous line, if any, with the current
@@ -487,7 +487,7 @@ class PmTable
// with the next one, thus supporting multi-line statements.
if (strrpos($line, ";") != strlen($line) - 1) {
$previous = $line;
continue;
break;
}
$line = substr($line, 0, strrpos($line, ";"));
@@ -513,7 +513,7 @@ class PmTable
}
if (empty($line)) {
continue;
break;
}
if (strpos($line, "#") === 0) {
@@ -521,7 +521,7 @@ class PmTable
}
if (empty($line)) {
continue;
break;
}
// Concatenate the previous line, if any, with the current
@@ -534,13 +534,13 @@ class PmTable
// with the next one, thus supporting multi-line statements.
if (strrpos($line, ";") != strlen($line) - 1) {
$previous = $line;
continue;
break;
}
$line = substr($line, 0, strrpos($line, ";"));
if (strpos($line, $this->tableName) == false) {
continue;
break;
}
$auxCreate = explode('CREATE', $line);
@@ -553,7 +553,7 @@ class PmTable
case 'oracle':
$line = trim($line); // Remove comments from the script
if (empty($line)) {
continue;
break;
}
switch (true) {
case preg_match("/^CREATE TABLE\s/i", $line):

View File

@@ -729,6 +729,7 @@ class ProcessMap
$urlEdit = '';
$linkEditValue = '';
$shouldItContinue = false;
switch ($aRow['STEP_TYPE_OBJ']) {
case 'DYNAFORM':
$oDynaform = new Dynaform();
@@ -748,7 +749,8 @@ class ProcessMap
$oInputDocument = new InputDocument();
$aFields = $oInputDocument->getByUid($aRow['STEP_UID_OBJ']);
if ($aFields === false) {
continue;
$shouldItContinue = true;
break;
}
$sTitle = $aFields['INP_DOC_TITLE'];
break;
@@ -757,7 +759,8 @@ class ProcessMap
$aFields = $oOutputDocument->getByUid($aRow['STEP_UID_OBJ']);
if ($aFields === false) {
continue;
$shouldItContinue = true;
break;
}
$sTitle = $aFields['OUT_DOC_TITLE'];
break;
@@ -777,6 +780,9 @@ class ProcessMap
}
break;
}
if ($shouldItContinue === true) {
continue;
}
$aSteps[] = array('STEP_TITLE' => $sTitle, 'STEP_UID' => $aRow['STEP_UID'], 'STEP_TYPE_OBJ' => $aRow['STEP_TYPE_OBJ'], 'STEP_MODE' => $aRow['STEP_MODE'], 'STEP_CONDITION' => $aRow['STEP_CONDITION'], 'STEP_POSITION' => $aRow['STEP_POSITION'], 'urlEdit' => $urlEdit, 'linkEditValue' => $linkEditValue, 'PRO_UID' => $aRow['PRO_UID']
);

View File

@@ -1017,6 +1017,9 @@ class Processes
$map[$val['DYN_UID']] = $newGuid;
$oData->dynaforms[$key]['DYN_UID'] = $newGuid;
unset($oData->dynaforms[$key]['DYN_ID']);
//this is important when UID's is updated
$oData->dynaforms[$key]['DYN_FILENAME'] = $oData->dynaforms[$key]['PRO_UID'] . "/" . $oData->dynaforms[$key]['DYN_UID'];
}
$oData->uid["DYNAFORM"] = $map;

View File

@@ -2,15 +2,15 @@
use ProcessMaker\Plugins\PluginRegistry;
function __autoload($sClassName)
{
spl_autoload_register(function($sClassName) {
if (!empty(config("system.workspace"))) {
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
if (file_exists($sPath . $sClassName . '.php')) {
require_once $sPath . $sClassName . '.php';
}
}
}
});
if (!empty(config("system.workspace")) && (!defined('PATH_DATA_SITE') || !defined('PATH_WORKSPACE'))) {
Bootstrap::setConstantsRelatedWs(config("system.workspace"));
}

View File

@@ -1086,6 +1086,7 @@ class AdditionalTables extends BaseAdditionalTables
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE);
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG);
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_OFFLINE);
$criteria->addSelectColumn(AdditionalTablesPeer::PRO_UID);
$criteria->addSelectColumn(AdditionalTablesPeer::DBS_UID);

View File

@@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Cache;
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
@@ -354,8 +355,14 @@ class AddonsStore extends BaseAddonsStore
$oPluginRegistry = PluginRegistry::loadSingleton();
$aPluginsPP = array();
if (file_exists(PATH_DATA_SITE . 'ee')) {
$aPluginsPP = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee')));
$eeData = Cache::get(config('system.workspace') . 'enterprise.ee', function () {
if (file_exists(PATH_DATA_SITE . 'ee')) {
return trim(file_get_contents(PATH_DATA_SITE . 'ee'));
}
return null;
});
if ($eeData) {
$aPluginsPP = unserialize($eeData);
}
$pmLicenseManagerO = PmLicenseManager::getSingleton();

View File

@@ -103,7 +103,7 @@ class Configuration extends BaseConfiguration
public function exists($CfgUid, $ObjUid = "", $ProUid = "", $UsrUid = "", $AppUid = "")
{
$oRow = ConfigurationPeer::retrieveByPK( $CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid );
return (( get_class ($oRow) == 'Configuration' )&&(!is_null($oRow)));
return (!is_null($oRow) && get_class($oRow) === 'Configuration');
}
public function getAll ()

View File

@@ -778,17 +778,38 @@ class OutputDocument extends BaseOutputDocument
unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
}
public function generateTcpdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array())
/**
* Generate a PDF file using the TCPDF library
*
* @param string $outDocUid
* @param array $fields
* @param string $path
* @param string $filename
* @param string $content
* @param bool $landscape
* @param array $properties
*
* @see generate()
* @see \ProcessMaker\BusinessModel\Cases\OutputDocument::generate()
*
* @link https://wiki.processmaker.com/3.3/Output_Documents#Creating_Output_Documents_Usign_TCPDF_Generator
*/
public function generateTcpdf($outDocUid, $fields, $path, $filename, $content, $landscape = false, $properties = [])
{
require_once(PATH_THIRDPARTY . "tcpdf" . PATH_SEP . "config" . PATH_SEP . "lang" . PATH_SEP . "eng.php");
require_once(PATH_THIRDPARTY . "tcpdf" . PATH_SEP . "tcpdf.php");
// Including the basic configuration for the TCPDF library
require_once PATH_TRUNK . "vendor" . PATH_SEP . "tecnickcom" . PATH_SEP . "tcpdf" . PATH_SEP . "config" . PATH_SEP . "tcpdf_config.php";
$nrt = array("\n", "\r", "\t");
$nrthtml = array("(n /)", "(r /)", "(t /)");
$strContentAux = str_replace($nrt, $nrthtml, $sContent);
$sContent = null;
// Initialize variables
$nrt = ["\n", "\r", "\t"];
$nrtHtml = ["(n /)", "(r /)", "(t /)"];
$outputType = 2;
$orientation = ($landscape == false) ? PDF_PAGE_ORIENTATION : 'L';
$media = (isset($properties['media'])) ? $properties['media'] : PDF_PAGE_FORMAT;
$lang = (defined('SYS_LANG')) ? SYS_LANG : 'en';
$strContentAux = str_replace($nrt, $nrtHtml, $content);
$content = null;
// Convert the deprecated "font" tags into "style" tags
while (preg_match("/^(.*)<font([^>]*)>(.*)$/i", $strContentAux, $arrayMatch)) {
$str = trim($arrayMatch[2]);
$strAttribute = null;
@@ -804,7 +825,7 @@ class OutputDocument extends BaseOutputDocument
$str = $strAux . $str;
//Get attributes
// Get attributes
$strStyle = null;
$array = explode(" ", $str);
@@ -813,7 +834,7 @@ class OutputDocument extends BaseOutputDocument
if (isset($arrayAux[1])) {
$a = trim($arrayAux[0]);
$v = trim(str_replace(array("__SPACE__", "\"", "'"), array(" ", null, null), $arrayAux[1]));
$v = trim(str_replace(["__SPACE__", "\"", "'"], [" ", null, null], $arrayAux[1]));
switch (strtolower($a)) {
case "color":
@@ -823,7 +844,7 @@ class OutputDocument extends BaseOutputDocument
$strStyle = $strStyle . "font-family: $v;";
break;
case "size":
$arrayPt = array(0, 8, 10, 12, 14, 18, 24, 36);
$arrayPt = [0, 8, 10, 12, 14, 18, 24, 36];
$strStyle = $strStyle . "font-size: " . $arrayPt[intval($v)] . "pt;";
break;
case "style":
@@ -842,39 +863,35 @@ class OutputDocument extends BaseOutputDocument
}
$strContentAux = $arrayMatch[1];
$sContent = "<span" . $strAttribute . ">" . $arrayMatch[3] . $sContent;
$content = "<span" . $strAttribute . ">" . $arrayMatch[3] . $content;
}
$sContent = $strContentAux . $sContent;
// Replenish the content
$content = $strContentAux . $content;
$sContent = str_ireplace("</font>", "</span>", $sContent);
// Replace some remaining incorrect/deprecated HTML tags/properties
$content = str_ireplace("</font>", "</span>", $content);
$content = str_replace($nrtHtml, $nrt, $content);
$content = str_replace("margin-left", "text-indent", $content);
$sContent = str_replace($nrthtml, $nrt, $sContent);
// Instance the TCPDF library
$pdf = new TCPDF($orientation, PDF_UNIT, $media, true, 'UTF-8', false);
$sContent = str_replace("margin-left", "text-indent", $sContent);
// define Save file
$sOutput = 2;
$sOrientation = ($sLandscape == false) ? PDF_PAGE_ORIENTATION : 'L';
$sMedia = (isset($aProperties['media'])) ? $aProperties['media'] : PDF_PAGE_FORMAT;
$sLang = (defined('SYS_LANG')) ? SYS_LANG : 'en';
// create new PDF document
$pdf = new TCPDF($sOrientation, PDF_UNIT, $sMedia, true, 'UTF-8', false);
// set document information
// Set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor($aFields['USR_USERNAME']);
$pdf->SetTitle('Processmaker');
$pdf->SetSubject($sFilename);
$pdf->SetAuthor($fields['USR_USERNAME']);
$pdf->SetTitle('ProcessMaker');
$pdf->SetSubject($filename);
$pdf->SetCompression(true);
$margins = $aProperties['margins'];
// Define margins
$margins = $properties['margins'];
$margins["left"] = ($margins["left"] >= 0) ? $margins["left"] : PDF_MARGIN_LEFT;
$margins["top"] = ($margins["top"] >= 0) ? $margins["top"] : PDF_MARGIN_TOP;
$margins["right"] = ($margins["right"] >= 0) ? $margins["right"] : PDF_MARGIN_RIGHT;
$margins["bottom"] = ($margins["bottom"] >= 0) ? $margins["bottom"] : PDF_MARGIN_BOTTOM;
// Set margins configuration
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetLeftMargin($margins['left']);
@@ -882,76 +899,67 @@ class OutputDocument extends BaseOutputDocument
$pdf->SetRightMargin($margins['right']);
$pdf->SetAutoPageBreak(true, $margins['bottom']);
$oServerConf = ServerConf::getSingleton();
// Get ServerConf singleton
$serverConf = ServerConf::getSingleton();
// set some language dependent data:
// Set language configuration
$lg = [];
$lg['a_meta_charset'] = 'UTF-8';
$lg['a_meta_dir'] = ($oServerConf->isRtl($sLang)) ? 'rtl' : 'ltr';
$lg['a_meta_language'] = $sLang;
$lg['a_meta_dir'] = ($serverConf->isRtl($lang)) ? 'rtl' : 'ltr';
$lg['a_meta_language'] = $lang;
$lg['w_page'] = 'page';
//set some language-dependent strings
$pdf->setLanguageArray($lg);
if (isset($aProperties['pdfSecurity'])) {
$tcpdfPermissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high');
$pdfSecurity = $aProperties['pdfSecurity'];
$userPass = G::decrypt($pdfSecurity['openPassword'], $sUID);
$ownerPass = ($pdfSecurity['ownerPassword'] != '') ? G::decrypt($pdfSecurity['ownerPassword'], $sUID) : null;
// Set security configuration
if (isset($properties['pdfSecurity'])) {
$tcPdfPermissions = ['print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'];
$pdfSecurity = $properties['pdfSecurity'];
$userPass = G::decrypt($pdfSecurity['openPassword'], $outDocUid);
$ownerPass = ($pdfSecurity['ownerPassword'] != '') ? G::decrypt($pdfSecurity['ownerPassword'], $outDocUid) : null;
$permissions = explode("|", $pdfSecurity['permissions']);
$permissions = array_diff($tcpdfPermissions, $permissions);
$permissions = array_diff($tcPdfPermissions, $permissions);
$pdf->SetProtection($permissions, $userPass, $ownerPass);
}
// ---------------------------------------------------------
// set default font subsetting mode
// Enable the font sub-setting option
$pdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
//$pdf->SetFont('dejavusans', '', 14, '', true);
// Detect chinese, japanese, thai
if (preg_match('/[\x{30FF}\x{3040}-\x{309F}\x{4E00}-\x{9FFF}\x{0E00}-\x{0E7F}]/u', $sContent, $matches)) {
$fileArialunittf = PATH_THIRDPARTY . "tcpdf" . PATH_SEP . "fonts" . PATH_SEP . "arialuni.ttf";
$pdf->SetFont((!file_exists($fileArialunittf)) ? "kozminproregular" : $pdf->addTTFfont($fileArialunittf, "TrueTypeUnicode", "", 32));
// Set unicode font if is required, we need to detect if is chinese, japanese, thai, etc.
if (preg_match('/[\x{30FF}\x{3040}-\x{309F}\x{4E00}-\x{9FFF}\x{0E00}-\x{0E7F}]/u', $content, $matches)) {
// The additional fonts should be in "shared/fonts" folder
$fileArialUniTTF = PATH_DATA . "fonts" . PATH_SEP . "arialuni.ttf";
$pdf->SetFont((!file_exists($fileArialUniTTF)) ? "kozminproregular" :
$pdf->addTTFfont($fileArialUniTTF, "TrueTypeUnicode", "", 32));
}
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
// set text shadow effect
//$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
// Print text using writeHTMLCell()
// $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
if (mb_detect_encoding($sContent) == 'UTF-8') {
$sContent = mb_convert_encoding($sContent, 'HTML-ENTITIES', 'UTF-8');
// Convert the encoding of the content if is UTF-8
if (mb_detect_encoding($content) == 'UTF-8') {
$content = mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8');
}
// Fix the HTML using DOMDocument class
$doc = new DOMDocument('1.0', 'UTF-8');
if ($sContent != '') {
$doc->loadHtml($sContent);
if ($content != '') {
$doc->loadHtml($content);
}
// Add a page and put the HTML fixed
$pdf->AddPage();
$pdf->writeHTML($doc->saveXML(), false, false, false, false, '');
// ---------------------------------------------------------
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
//$pdf->Output('example_00.pdf', 'I');
//$pdf->Output('/home/hector/processmaker/example_00.pdf', 'D');
switch ($sOutput) {
// Generate the PDF file
switch ($outputType) {
case 0:
// Vrew browser
$pdf->Output($sPath . $sFilename . '.pdf', 'I');
// Browser
$pdf->Output($path . $filename . '.pdf', 'I');
break;
case 1:
// Donwnload
$pdf->Output($sPath . $sFilename . '.pdf', 'D');
// Download
$pdf->Output($path . $filename . '.pdf', 'D');
break;
case 2:
// Save file
$pdf->Output($sPath . $sFilename . '.pdf', 'F');
// Save to file
$pdf->Output($path . $filename . '.pdf', 'F');
break;
}
}

View File

@@ -237,7 +237,7 @@ class Translation extends BaseTranslation
}
$res['cacheFileMafe'] = $cacheFileMafe;
$res['languague'] = count($cacheFileMafe);
$res['languague'] = (is_array($cacheFileMafe) || $cacheFileMafe instanceof Countable) ? count($cacheFileMafe) : 0;
$res['rowsMafeJS'] = count( $translation );
return $res;
} catch (Exception $e) {

View File

@@ -97,6 +97,10 @@ class AdditionalTablesMapBuilder
$tMap->addColumn('ADD_TAB_TAG', 'AddTabTag', 'string', CreoleTypes::VARCHAR, false, 256);
$tMap->addColumn('ADD_TAB_OFFLINE', 'AddTabOffline', 'int', CreoleTypes::TINYINT, true, null);
$tMap->addColumn('ADD_TAB_UPDATE_DATE', 'AddTabUpdateDate', 'int', CreoleTypes::TIMESTAMP, true, null);
} // doBuild()
} // AdditionalTablesMapBuilder

View File

@@ -73,11 +73,11 @@ class JobsPendingMapBuilder
$tMap->addColumn('ATTEMPTS', 'Attempts', 'int', CreoleTypes::TINYINT, true, 3);
$tMap->addColumn('RESERVED_AT', 'ReservedAt', 'int', CreoleTypes::TINYINT, false, 10);
$tMap->addColumn('RESERVED_AT', 'ReservedAt', 'string', CreoleTypes::BIGINT, false, 10);
$tMap->addColumn('AVAILABLE_AT', 'AvailableAt', 'int', CreoleTypes::TINYINT, true, 10);
$tMap->addColumn('AVAILABLE_AT', 'AvailableAt', 'string', CreoleTypes::BIGINT, true, 10);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TINYINT, true, 10);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'string', CreoleTypes::BIGINT, true, 10);
} // doBuild()

View File

@@ -123,6 +123,18 @@ abstract class BaseAdditionalTables extends BaseObject implements Persistent
*/
protected $add_tab_tag = '';
/**
* The value for the add_tab_offline field.
* @var int
*/
protected $add_tab_offline = 0;
/**
* The value for the add_tab_update_date field.
* @var int
*/
protected $add_tab_update_date;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -313,6 +325,49 @@ abstract class BaseAdditionalTables extends BaseObject implements Persistent
return $this->add_tab_tag;
}
/**
* Get the [add_tab_offline] column value.
*
* @return int
*/
public function getAddTabOffline()
{
return $this->add_tab_offline;
}
/**
* Get the [optionally formatted] [add_tab_update_date] column value.
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the integer unix timestamp will be returned.
* @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
* @throws PropelException - if unable to convert the date/time to timestamp.
*/
public function getAddTabUpdateDate($format = 'Y-m-d H:i:s')
{
if ($this->add_tab_update_date === null || $this->add_tab_update_date === '') {
return null;
} elseif (!is_int($this->add_tab_update_date)) {
// a non-timestamp value was set externally, so we convert it
$ts = strtotime($this->add_tab_update_date);
if ($ts === -1 || $ts === false) {
throw new PropelException("Unable to parse value of [add_tab_update_date] as date/time value: " .
var_export($this->add_tab_update_date, true));
}
} else {
$ts = $this->add_tab_update_date;
}
if ($format === null) {
return $ts;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $ts);
} else {
return date($format, $ts);
}
}
/**
* Set the value of [add_tab_uid] column.
*
@@ -665,6 +720,57 @@ abstract class BaseAdditionalTables extends BaseObject implements Persistent
} // setAddTabTag()
/**
* Set the value of [add_tab_offline] column.
*
* @param int $v new value
* @return void
*/
public function setAddTabOffline($v)
{
// Since the native PHP type for this column is integer,
// we will cast the input value to an int (if it is not).
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->add_tab_offline !== $v || $v === 0) {
$this->add_tab_offline = $v;
$this->modifiedColumns[] = AdditionalTablesPeer::ADD_TAB_OFFLINE;
}
} // setAddTabOffline()
/**
* Set the value of [add_tab_update_date] column.
*
* @param int $v new value
* @return void
*/
public function setAddTabUpdateDate($v)
{
if ($v !== null && !is_int($v)) {
$ts = strtotime($v);
//Date/time accepts null values
if ($v == '') {
$ts = null;
}
if ($ts === -1 || $ts === false) {
throw new PropelException("Unable to parse date/time value for [add_tab_update_date] from input: " .
var_export($v, true));
}
} else {
$ts = $v;
}
if ($this->add_tab_update_date !== $ts) {
$this->add_tab_update_date = $ts;
$this->modifiedColumns[] = AdditionalTablesPeer::ADD_TAB_UPDATE_DATE;
}
} // setAddTabUpdateDate()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
@@ -714,12 +820,16 @@ abstract class BaseAdditionalTables extends BaseObject implements Persistent
$this->add_tab_tag = $rs->getString($startcol + 15);
$this->add_tab_offline = $rs->getInt($startcol + 16);
$this->add_tab_update_date = $rs->getTimestamp($startcol + 17, null);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 16; // 16 = AdditionalTablesPeer::NUM_COLUMNS - AdditionalTablesPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 18; // 18 = AdditionalTablesPeer::NUM_COLUMNS - AdditionalTablesPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating AdditionalTables object", $e);
@@ -971,6 +1081,12 @@ abstract class BaseAdditionalTables extends BaseObject implements Persistent
case 15:
return $this->getAddTabTag();
break;
case 16:
return $this->getAddTabOffline();
break;
case 17:
return $this->getAddTabUpdateDate();
break;
default:
return null;
break;
@@ -1007,6 +1123,8 @@ abstract class BaseAdditionalTables extends BaseObject implements Persistent
$keys[13] => $this->getAddTabType(),
$keys[14] => $this->getAddTabGrid(),
$keys[15] => $this->getAddTabTag(),
$keys[16] => $this->getAddTabOffline(),
$keys[17] => $this->getAddTabUpdateDate(),
);
return $result;
}
@@ -1086,6 +1204,12 @@ abstract class BaseAdditionalTables extends BaseObject implements Persistent
case 15:
$this->setAddTabTag($value);
break;
case 16:
$this->setAddTabOffline($value);
break;
case 17:
$this->setAddTabUpdateDate($value);
break;
} // switch()
}
@@ -1173,6 +1297,14 @@ abstract class BaseAdditionalTables extends BaseObject implements Persistent
$this->setAddTabTag($arr[$keys[15]]);
}
if (array_key_exists($keys[16], $arr)) {
$this->setAddTabOffline($arr[$keys[16]]);
}
if (array_key_exists($keys[17], $arr)) {
$this->setAddTabUpdateDate($arr[$keys[17]]);
}
}
/**
@@ -1248,6 +1380,14 @@ abstract class BaseAdditionalTables extends BaseObject implements Persistent
$criteria->add(AdditionalTablesPeer::ADD_TAB_TAG, $this->add_tab_tag);
}
if ($this->isColumnModified(AdditionalTablesPeer::ADD_TAB_OFFLINE)) {
$criteria->add(AdditionalTablesPeer::ADD_TAB_OFFLINE, $this->add_tab_offline);
}
if ($this->isColumnModified(AdditionalTablesPeer::ADD_TAB_UPDATE_DATE)) {
$criteria->add(AdditionalTablesPeer::ADD_TAB_UPDATE_DATE, $this->add_tab_update_date);
}
return $criteria;
}
@@ -1332,6 +1472,10 @@ abstract class BaseAdditionalTables extends BaseObject implements Persistent
$copyObj->setAddTabTag($this->add_tab_tag);
$copyObj->setAddTabOffline($this->add_tab_offline);
$copyObj->setAddTabUpdateDate($this->add_tab_update_date);
$copyObj->setNew(true);

View File

@@ -25,7 +25,7 @@ abstract class BaseAdditionalTablesPeer
const CLASS_DEFAULT = 'classes.model.AdditionalTables';
/** The total number of columns. */
const NUM_COLUMNS = 16;
const NUM_COLUMNS = 18;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -79,6 +79,12 @@ abstract class BaseAdditionalTablesPeer
/** the column name for the ADD_TAB_TAG field */
const ADD_TAB_TAG = 'ADDITIONAL_TABLES.ADD_TAB_TAG';
/** the column name for the ADD_TAB_OFFLINE field */
const ADD_TAB_OFFLINE = 'ADDITIONAL_TABLES.ADD_TAB_OFFLINE';
/** the column name for the ADD_TAB_UPDATE_DATE field */
const ADD_TAB_UPDATE_DATE = 'ADDITIONAL_TABLES.ADD_TAB_UPDATE_DATE';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
@@ -90,10 +96,10 @@ abstract class BaseAdditionalTablesPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('AddTabUid', 'AddTabName', 'AddTabClassName', 'AddTabDescription', 'AddTabSdwLogInsert', 'AddTabSdwLogUpdate', 'AddTabSdwLogDelete', 'AddTabSdwLogSelect', 'AddTabSdwMaxLength', 'AddTabSdwAutoDelete', 'AddTabPlgUid', 'DbsUid', 'ProUid', 'AddTabType', 'AddTabGrid', 'AddTabTag', ),
BasePeer::TYPE_COLNAME => array (AdditionalTablesPeer::ADD_TAB_UID, AdditionalTablesPeer::ADD_TAB_NAME, AdditionalTablesPeer::ADD_TAB_CLASS_NAME, AdditionalTablesPeer::ADD_TAB_DESCRIPTION, AdditionalTablesPeer::ADD_TAB_SDW_LOG_INSERT, AdditionalTablesPeer::ADD_TAB_SDW_LOG_UPDATE, AdditionalTablesPeer::ADD_TAB_SDW_LOG_DELETE, AdditionalTablesPeer::ADD_TAB_SDW_LOG_SELECT, AdditionalTablesPeer::ADD_TAB_SDW_MAX_LENGTH, AdditionalTablesPeer::ADD_TAB_SDW_AUTO_DELETE, AdditionalTablesPeer::ADD_TAB_PLG_UID, AdditionalTablesPeer::DBS_UID, AdditionalTablesPeer::PRO_UID, AdditionalTablesPeer::ADD_TAB_TYPE, AdditionalTablesPeer::ADD_TAB_GRID, AdditionalTablesPeer::ADD_TAB_TAG, ),
BasePeer::TYPE_FIELDNAME => array ('ADD_TAB_UID', 'ADD_TAB_NAME', 'ADD_TAB_CLASS_NAME', 'ADD_TAB_DESCRIPTION', 'ADD_TAB_SDW_LOG_INSERT', 'ADD_TAB_SDW_LOG_UPDATE', 'ADD_TAB_SDW_LOG_DELETE', 'ADD_TAB_SDW_LOG_SELECT', 'ADD_TAB_SDW_MAX_LENGTH', 'ADD_TAB_SDW_AUTO_DELETE', 'ADD_TAB_PLG_UID', 'DBS_UID', 'PRO_UID', 'ADD_TAB_TYPE', 'ADD_TAB_GRID', 'ADD_TAB_TAG', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
BasePeer::TYPE_PHPNAME => array ('AddTabUid', 'AddTabName', 'AddTabClassName', 'AddTabDescription', 'AddTabSdwLogInsert', 'AddTabSdwLogUpdate', 'AddTabSdwLogDelete', 'AddTabSdwLogSelect', 'AddTabSdwMaxLength', 'AddTabSdwAutoDelete', 'AddTabPlgUid', 'DbsUid', 'ProUid', 'AddTabType', 'AddTabGrid', 'AddTabTag', 'AddTabOffline', 'AddTabUpdateDate', ),
BasePeer::TYPE_COLNAME => array (AdditionalTablesPeer::ADD_TAB_UID, AdditionalTablesPeer::ADD_TAB_NAME, AdditionalTablesPeer::ADD_TAB_CLASS_NAME, AdditionalTablesPeer::ADD_TAB_DESCRIPTION, AdditionalTablesPeer::ADD_TAB_SDW_LOG_INSERT, AdditionalTablesPeer::ADD_TAB_SDW_LOG_UPDATE, AdditionalTablesPeer::ADD_TAB_SDW_LOG_DELETE, AdditionalTablesPeer::ADD_TAB_SDW_LOG_SELECT, AdditionalTablesPeer::ADD_TAB_SDW_MAX_LENGTH, AdditionalTablesPeer::ADD_TAB_SDW_AUTO_DELETE, AdditionalTablesPeer::ADD_TAB_PLG_UID, AdditionalTablesPeer::DBS_UID, AdditionalTablesPeer::PRO_UID, AdditionalTablesPeer::ADD_TAB_TYPE, AdditionalTablesPeer::ADD_TAB_GRID, AdditionalTablesPeer::ADD_TAB_TAG, AdditionalTablesPeer::ADD_TAB_OFFLINE, AdditionalTablesPeer::ADD_TAB_UPDATE_DATE, ),
BasePeer::TYPE_FIELDNAME => array ('ADD_TAB_UID', 'ADD_TAB_NAME', 'ADD_TAB_CLASS_NAME', 'ADD_TAB_DESCRIPTION', 'ADD_TAB_SDW_LOG_INSERT', 'ADD_TAB_SDW_LOG_UPDATE', 'ADD_TAB_SDW_LOG_DELETE', 'ADD_TAB_SDW_LOG_SELECT', 'ADD_TAB_SDW_MAX_LENGTH', 'ADD_TAB_SDW_AUTO_DELETE', 'ADD_TAB_PLG_UID', 'DBS_UID', 'PRO_UID', 'ADD_TAB_TYPE', 'ADD_TAB_GRID', 'ADD_TAB_TAG', 'ADD_TAB_OFFLINE', 'ADD_TAB_UPDATE_DATE', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
@@ -103,10 +109,10 @@ abstract class BaseAdditionalTablesPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('AddTabUid' => 0, 'AddTabName' => 1, 'AddTabClassName' => 2, 'AddTabDescription' => 3, 'AddTabSdwLogInsert' => 4, 'AddTabSdwLogUpdate' => 5, 'AddTabSdwLogDelete' => 6, 'AddTabSdwLogSelect' => 7, 'AddTabSdwMaxLength' => 8, 'AddTabSdwAutoDelete' => 9, 'AddTabPlgUid' => 10, 'DbsUid' => 11, 'ProUid' => 12, 'AddTabType' => 13, 'AddTabGrid' => 14, 'AddTabTag' => 15, ),
BasePeer::TYPE_COLNAME => array (AdditionalTablesPeer::ADD_TAB_UID => 0, AdditionalTablesPeer::ADD_TAB_NAME => 1, AdditionalTablesPeer::ADD_TAB_CLASS_NAME => 2, AdditionalTablesPeer::ADD_TAB_DESCRIPTION => 3, AdditionalTablesPeer::ADD_TAB_SDW_LOG_INSERT => 4, AdditionalTablesPeer::ADD_TAB_SDW_LOG_UPDATE => 5, AdditionalTablesPeer::ADD_TAB_SDW_LOG_DELETE => 6, AdditionalTablesPeer::ADD_TAB_SDW_LOG_SELECT => 7, AdditionalTablesPeer::ADD_TAB_SDW_MAX_LENGTH => 8, AdditionalTablesPeer::ADD_TAB_SDW_AUTO_DELETE => 9, AdditionalTablesPeer::ADD_TAB_PLG_UID => 10, AdditionalTablesPeer::DBS_UID => 11, AdditionalTablesPeer::PRO_UID => 12, AdditionalTablesPeer::ADD_TAB_TYPE => 13, AdditionalTablesPeer::ADD_TAB_GRID => 14, AdditionalTablesPeer::ADD_TAB_TAG => 15, ),
BasePeer::TYPE_FIELDNAME => array ('ADD_TAB_UID' => 0, 'ADD_TAB_NAME' => 1, 'ADD_TAB_CLASS_NAME' => 2, 'ADD_TAB_DESCRIPTION' => 3, 'ADD_TAB_SDW_LOG_INSERT' => 4, 'ADD_TAB_SDW_LOG_UPDATE' => 5, 'ADD_TAB_SDW_LOG_DELETE' => 6, 'ADD_TAB_SDW_LOG_SELECT' => 7, 'ADD_TAB_SDW_MAX_LENGTH' => 8, 'ADD_TAB_SDW_AUTO_DELETE' => 9, 'ADD_TAB_PLG_UID' => 10, 'DBS_UID' => 11, 'PRO_UID' => 12, 'ADD_TAB_TYPE' => 13, 'ADD_TAB_GRID' => 14, 'ADD_TAB_TAG' => 15, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
BasePeer::TYPE_PHPNAME => array ('AddTabUid' => 0, 'AddTabName' => 1, 'AddTabClassName' => 2, 'AddTabDescription' => 3, 'AddTabSdwLogInsert' => 4, 'AddTabSdwLogUpdate' => 5, 'AddTabSdwLogDelete' => 6, 'AddTabSdwLogSelect' => 7, 'AddTabSdwMaxLength' => 8, 'AddTabSdwAutoDelete' => 9, 'AddTabPlgUid' => 10, 'DbsUid' => 11, 'ProUid' => 12, 'AddTabType' => 13, 'AddTabGrid' => 14, 'AddTabTag' => 15, 'AddTabOffline' => 16, 'AddTabUpdateDate' => 17, ),
BasePeer::TYPE_COLNAME => array (AdditionalTablesPeer::ADD_TAB_UID => 0, AdditionalTablesPeer::ADD_TAB_NAME => 1, AdditionalTablesPeer::ADD_TAB_CLASS_NAME => 2, AdditionalTablesPeer::ADD_TAB_DESCRIPTION => 3, AdditionalTablesPeer::ADD_TAB_SDW_LOG_INSERT => 4, AdditionalTablesPeer::ADD_TAB_SDW_LOG_UPDATE => 5, AdditionalTablesPeer::ADD_TAB_SDW_LOG_DELETE => 6, AdditionalTablesPeer::ADD_TAB_SDW_LOG_SELECT => 7, AdditionalTablesPeer::ADD_TAB_SDW_MAX_LENGTH => 8, AdditionalTablesPeer::ADD_TAB_SDW_AUTO_DELETE => 9, AdditionalTablesPeer::ADD_TAB_PLG_UID => 10, AdditionalTablesPeer::DBS_UID => 11, AdditionalTablesPeer::PRO_UID => 12, AdditionalTablesPeer::ADD_TAB_TYPE => 13, AdditionalTablesPeer::ADD_TAB_GRID => 14, AdditionalTablesPeer::ADD_TAB_TAG => 15, AdditionalTablesPeer::ADD_TAB_OFFLINE => 16, AdditionalTablesPeer::ADD_TAB_UPDATE_DATE => 17, ),
BasePeer::TYPE_FIELDNAME => array ('ADD_TAB_UID' => 0, 'ADD_TAB_NAME' => 1, 'ADD_TAB_CLASS_NAME' => 2, 'ADD_TAB_DESCRIPTION' => 3, 'ADD_TAB_SDW_LOG_INSERT' => 4, 'ADD_TAB_SDW_LOG_UPDATE' => 5, 'ADD_TAB_SDW_LOG_DELETE' => 6, 'ADD_TAB_SDW_LOG_SELECT' => 7, 'ADD_TAB_SDW_MAX_LENGTH' => 8, 'ADD_TAB_SDW_AUTO_DELETE' => 9, 'ADD_TAB_PLG_UID' => 10, 'DBS_UID' => 11, 'PRO_UID' => 12, 'ADD_TAB_TYPE' => 13, 'ADD_TAB_GRID' => 14, 'ADD_TAB_TAG' => 15, 'ADD_TAB_OFFLINE' => 16, 'ADD_TAB_UPDATE_DATE' => 17, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
@@ -239,6 +245,10 @@ abstract class BaseAdditionalTablesPeer
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG);
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_OFFLINE);
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UPDATE_DATE);
}
const COUNT = 'COUNT(ADDITIONAL_TABLES.ADD_TAB_UID)';

View File

@@ -163,19 +163,19 @@ abstract class BaseAppCacheView extends BaseObject implements Persistent
* The value for the del_duration field.
* @var double
*/
protected $del_duration = 0;
protected $del_duration = 0.0;
/**
* The value for the del_queue_duration field.
* @var double
*/
protected $del_queue_duration = 0;
protected $del_queue_duration = 0.0;
/**
* The value for the del_delay_duration field.
* @var double
*/
protected $del_delay_duration = 0;
protected $del_delay_duration = 0.0;
/**
* The value for the del_started field.
@@ -1281,7 +1281,7 @@ abstract class BaseAppCacheView extends BaseObject implements Persistent
public function setDelDuration($v)
{
if ($this->del_duration !== $v || $v === 0) {
if ($this->del_duration !== $v || $v === 0.0) {
$this->del_duration = $v;
$this->modifiedColumns[] = AppCacheViewPeer::DEL_DURATION;
}
@@ -1297,7 +1297,7 @@ abstract class BaseAppCacheView extends BaseObject implements Persistent
public function setDelQueueDuration($v)
{
if ($this->del_queue_duration !== $v || $v === 0) {
if ($this->del_queue_duration !== $v || $v === 0.0) {
$this->del_queue_duration = $v;
$this->modifiedColumns[] = AppCacheViewPeer::DEL_QUEUE_DURATION;
}
@@ -1313,7 +1313,7 @@ abstract class BaseAppCacheView extends BaseObject implements Persistent
public function setDelDelayDuration($v)
{
if ($this->del_delay_duration !== $v || $v === 0) {
if ($this->del_delay_duration !== $v || $v === 0.0) {
$this->del_delay_duration = $v;
$this->modifiedColumns[] = AppCacheViewPeer::DEL_DELAY_DURATION;
}

View File

@@ -139,19 +139,19 @@ abstract class BaseAppDelegation extends BaseObject implements Persistent
* The value for the del_duration field.
* @var double
*/
protected $del_duration = 0;
protected $del_duration = 0.0;
/**
* The value for the del_queue_duration field.
* @var double
*/
protected $del_queue_duration = 0;
protected $del_queue_duration = 0.0;
/**
* The value for the del_delay_duration field.
* @var double
*/
protected $del_delay_duration = 0;
protected $del_delay_duration = 0.0;
/**
* The value for the del_started field.
@@ -181,7 +181,7 @@ abstract class BaseAppDelegation extends BaseObject implements Persistent
* The value for the app_overdue_percentage field.
* @var double
*/
protected $app_overdue_percentage = 0;
protected $app_overdue_percentage = 0.0;
/**
* The value for the usr_id field.
@@ -1079,7 +1079,7 @@ abstract class BaseAppDelegation extends BaseObject implements Persistent
public function setDelDuration($v)
{
if ($this->del_duration !== $v || $v === 0) {
if ($this->del_duration !== $v || $v === 0.0) {
$this->del_duration = $v;
$this->modifiedColumns[] = AppDelegationPeer::DEL_DURATION;
}
@@ -1095,7 +1095,7 @@ abstract class BaseAppDelegation extends BaseObject implements Persistent
public function setDelQueueDuration($v)
{
if ($this->del_queue_duration !== $v || $v === 0) {
if ($this->del_queue_duration !== $v || $v === 0.0) {
$this->del_queue_duration = $v;
$this->modifiedColumns[] = AppDelegationPeer::DEL_QUEUE_DURATION;
}
@@ -1111,7 +1111,7 @@ abstract class BaseAppDelegation extends BaseObject implements Persistent
public function setDelDelayDuration($v)
{
if ($this->del_delay_duration !== $v || $v === 0) {
if ($this->del_delay_duration !== $v || $v === 0.0) {
$this->del_delay_duration = $v;
$this->modifiedColumns[] = AppDelegationPeer::DEL_DELAY_DURATION;
}
@@ -1215,7 +1215,7 @@ abstract class BaseAppDelegation extends BaseObject implements Persistent
public function setAppOverduePercentage($v)
{
if ($this->app_overdue_percentage !== $v || $v === 0) {
if ($this->app_overdue_percentage !== $v || $v === 0.0) {
$this->app_overdue_percentage = $v;
$this->modifiedColumns[] = AppDelegationPeer::APP_OVERDUE_PERCENTAGE;
}

View File

@@ -145,13 +145,13 @@ abstract class BaseApplication extends BaseObject implements Persistent
* The value for the app_duration field.
* @var double
*/
protected $app_duration = 0;
protected $app_duration = 0.0;
/**
* The value for the app_delay_duration field.
* @var double
*/
protected $app_delay_duration = 0;
protected $app_delay_duration = 0.0;
/**
* The value for the app_drive_folder_uid field.
@@ -971,7 +971,7 @@ abstract class BaseApplication extends BaseObject implements Persistent
public function setAppDuration($v)
{
if ($this->app_duration !== $v || $v === 0) {
if ($this->app_duration !== $v || $v === 0.0) {
$this->app_duration = $v;
$this->modifiedColumns[] = ApplicationPeer::APP_DURATION;
}
@@ -987,7 +987,7 @@ abstract class BaseApplication extends BaseObject implements Persistent
public function setAppDelayDuration($v)
{
if ($this->app_delay_duration !== $v || $v === 0) {
if ($this->app_delay_duration !== $v || $v === 0.0) {
$this->app_delay_duration = $v;
$this->modifiedColumns[] = ApplicationPeer::APP_DELAY_DURATION;
}

View File

@@ -55,7 +55,7 @@ abstract class BaseDashboardIndicator extends BaseObject implements Persistent
* The value for the das_ind_goal field.
* @var double
*/
protected $das_ind_goal = 0;
protected $das_ind_goal = 0.0;
/**
* The value for the das_ind_direction field.
@@ -427,7 +427,7 @@ abstract class BaseDashboardIndicator extends BaseObject implements Persistent
public function setDasIndGoal($v)
{
if ($this->das_ind_goal !== $v || $v === 0) {
if ($this->das_ind_goal !== $v || $v === 0.0) {
$this->das_ind_goal = $v;
$this->modifiedColumns[] = DashboardIndicatorPeer::DAS_IND_GOAL;
}

View File

@@ -79,7 +79,7 @@ abstract class BaseEvent extends BaseObject implements Persistent
* The value for the evn_tas_estimated_duration field.
* @var double
*/
protected $evn_tas_estimated_duration = 0;
protected $evn_tas_estimated_duration = 0.0;
/**
* The value for the evn_time_unit field.
@@ -91,7 +91,7 @@ abstract class BaseEvent extends BaseObject implements Persistent
* The value for the evn_when field.
* @var double
*/
protected $evn_when = 0;
protected $evn_when = 0.0;
/**
* The value for the evn_max_attempts field.
@@ -566,7 +566,7 @@ abstract class BaseEvent extends BaseObject implements Persistent
public function setEvnTasEstimatedDuration($v)
{
if ($this->evn_tas_estimated_duration !== $v || $v === 0) {
if ($this->evn_tas_estimated_duration !== $v || $v === 0.0) {
$this->evn_tas_estimated_duration = $v;
$this->modifiedColumns[] = EventPeer::EVN_TAS_ESTIMATED_DURATION;
}
@@ -604,7 +604,7 @@ abstract class BaseEvent extends BaseObject implements Persistent
public function setEvnWhen($v)
{
if ($this->evn_when !== $v || $v === 0) {
if ($this->evn_when !== $v || $v === 0.0) {
$this->evn_when = $v;
$this->modifiedColumns[] = EventPeer::EVN_WHEN;
}

View File

@@ -53,19 +53,19 @@ abstract class BaseJobsPending extends BaseObject implements Persistent
/**
* The value for the reserved_at field.
* @var int
* @var string
*/
protected $reserved_at;
/**
* The value for the available_at field.
* @var int
* @var string
*/
protected $available_at;
/**
* The value for the created_at field.
* @var int
* @var string
*/
protected $created_at;
@@ -130,7 +130,7 @@ abstract class BaseJobsPending extends BaseObject implements Persistent
/**
* Get the [reserved_at] column value.
*
* @return int
* @return string
*/
public function getReservedAt()
{
@@ -141,7 +141,7 @@ abstract class BaseJobsPending extends BaseObject implements Persistent
/**
* Get the [available_at] column value.
*
* @return int
* @return string
*/
public function getAvailableAt()
{
@@ -152,7 +152,7 @@ abstract class BaseJobsPending extends BaseObject implements Persistent
/**
* Get the [created_at] column value.
*
* @return int
* @return string
*/
public function getCreatedAt()
{
@@ -251,16 +251,16 @@ abstract class BaseJobsPending extends BaseObject implements Persistent
/**
* Set the value of [reserved_at] column.
*
* @param int $v new value
* @param string $v new value
* @return void
*/
public function setReservedAt($v)
{
// Since the native PHP type for this column is integer,
// we will cast the input value to an int (if it is not).
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->reserved_at !== $v) {
@@ -273,16 +273,16 @@ abstract class BaseJobsPending extends BaseObject implements Persistent
/**
* Set the value of [available_at] column.
*
* @param int $v new value
* @param string $v new value
* @return void
*/
public function setAvailableAt($v)
{
// Since the native PHP type for this column is integer,
// we will cast the input value to an int (if it is not).
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->available_at !== $v) {
@@ -295,16 +295,16 @@ abstract class BaseJobsPending extends BaseObject implements Persistent
/**
* Set the value of [created_at] column.
*
* @param int $v new value
* @param string $v new value
* @return void
*/
public function setCreatedAt($v)
{
// Since the native PHP type for this column is integer,
// we will cast the input value to an int (if it is not).
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->created_at !== $v) {
@@ -339,11 +339,11 @@ abstract class BaseJobsPending extends BaseObject implements Persistent
$this->attempts = $rs->getInt($startcol + 3);
$this->reserved_at = $rs->getInt($startcol + 4);
$this->reserved_at = $rs->getString($startcol + 4);
$this->available_at = $rs->getInt($startcol + 5);
$this->available_at = $rs->getString($startcol + 5);
$this->created_at = $rs->getInt($startcol + 6);
$this->created_at = $rs->getString($startcol + 6);
$this->resetModified();

View File

@@ -49,61 +49,61 @@ abstract class BaseProReporting extends BaseObject implements Persistent
* The value for the avg_time field.
* @var double
*/
protected $avg_time = 0;
protected $avg_time = 0.0;
/**
* The value for the sdv_time field.
* @var double
*/
protected $sdv_time = 0;
protected $sdv_time = 0.0;
/**
* The value for the total_cases_in field.
* @var double
*/
protected $total_cases_in = 0;
protected $total_cases_in = 0.0;
/**
* The value for the total_cases_out field.
* @var double
*/
protected $total_cases_out = 0;
protected $total_cases_out = 0.0;
/**
* The value for the configured_process_time field.
* @var double
*/
protected $configured_process_time = 0;
protected $configured_process_time = 0.0;
/**
* The value for the configured_process_cost field.
* @var double
*/
protected $configured_process_cost = 0;
protected $configured_process_cost = 0.0;
/**
* The value for the total_cases_open field.
* @var double
*/
protected $total_cases_open = 0;
protected $total_cases_open = 0.0;
/**
* The value for the total_cases_overdue field.
* @var double
*/
protected $total_cases_overdue = 0;
protected $total_cases_overdue = 0.0;
/**
* The value for the total_cases_on_time field.
* @var double
*/
protected $total_cases_on_time = 0;
protected $total_cases_on_time = 0.0;
/**
* The value for the pro_cost field.
* @var double
*/
protected $pro_cost = 0;
protected $pro_cost = 0.0;
/**
* The value for the pro_unit_cost field.
@@ -354,7 +354,7 @@ abstract class BaseProReporting extends BaseObject implements Persistent
public function setAvgTime($v)
{
if ($this->avg_time !== $v || $v === 0) {
if ($this->avg_time !== $v || $v === 0.0) {
$this->avg_time = $v;
$this->modifiedColumns[] = ProReportingPeer::AVG_TIME;
}
@@ -370,7 +370,7 @@ abstract class BaseProReporting extends BaseObject implements Persistent
public function setSdvTime($v)
{
if ($this->sdv_time !== $v || $v === 0) {
if ($this->sdv_time !== $v || $v === 0.0) {
$this->sdv_time = $v;
$this->modifiedColumns[] = ProReportingPeer::SDV_TIME;
}
@@ -386,7 +386,7 @@ abstract class BaseProReporting extends BaseObject implements Persistent
public function setTotalCasesIn($v)
{
if ($this->total_cases_in !== $v || $v === 0) {
if ($this->total_cases_in !== $v || $v === 0.0) {
$this->total_cases_in = $v;
$this->modifiedColumns[] = ProReportingPeer::TOTAL_CASES_IN;
}
@@ -402,7 +402,7 @@ abstract class BaseProReporting extends BaseObject implements Persistent
public function setTotalCasesOut($v)
{
if ($this->total_cases_out !== $v || $v === 0) {
if ($this->total_cases_out !== $v || $v === 0.0) {
$this->total_cases_out = $v;
$this->modifiedColumns[] = ProReportingPeer::TOTAL_CASES_OUT;
}
@@ -418,7 +418,7 @@ abstract class BaseProReporting extends BaseObject implements Persistent
public function setConfiguredProcessTime($v)
{
if ($this->configured_process_time !== $v || $v === 0) {
if ($this->configured_process_time !== $v || $v === 0.0) {
$this->configured_process_time = $v;
$this->modifiedColumns[] = ProReportingPeer::CONFIGURED_PROCESS_TIME;
}
@@ -434,7 +434,7 @@ abstract class BaseProReporting extends BaseObject implements Persistent
public function setConfiguredProcessCost($v)
{
if ($this->configured_process_cost !== $v || $v === 0) {
if ($this->configured_process_cost !== $v || $v === 0.0) {
$this->configured_process_cost = $v;
$this->modifiedColumns[] = ProReportingPeer::CONFIGURED_PROCESS_COST;
}
@@ -450,7 +450,7 @@ abstract class BaseProReporting extends BaseObject implements Persistent
public function setTotalCasesOpen($v)
{
if ($this->total_cases_open !== $v || $v === 0) {
if ($this->total_cases_open !== $v || $v === 0.0) {
$this->total_cases_open = $v;
$this->modifiedColumns[] = ProReportingPeer::TOTAL_CASES_OPEN;
}
@@ -466,7 +466,7 @@ abstract class BaseProReporting extends BaseObject implements Persistent
public function setTotalCasesOverdue($v)
{
if ($this->total_cases_overdue !== $v || $v === 0) {
if ($this->total_cases_overdue !== $v || $v === 0.0) {
$this->total_cases_overdue = $v;
$this->modifiedColumns[] = ProReportingPeer::TOTAL_CASES_OVERDUE;
}
@@ -482,7 +482,7 @@ abstract class BaseProReporting extends BaseObject implements Persistent
public function setTotalCasesOnTime($v)
{
if ($this->total_cases_on_time !== $v || $v === 0) {
if ($this->total_cases_on_time !== $v || $v === 0.0) {
$this->total_cases_on_time = $v;
$this->modifiedColumns[] = ProReportingPeer::TOTAL_CASES_ON_TIME;
}
@@ -498,7 +498,7 @@ abstract class BaseProReporting extends BaseObject implements Persistent
public function setProCost($v)
{
if ($this->pro_cost !== $v || $v === 0) {
if ($this->pro_cost !== $v || $v === 0.0) {
$this->pro_cost = $v;
$this->modifiedColumns[] = ProReportingPeer::PRO_COST;
}

View File

@@ -199,7 +199,7 @@ abstract class BaseUsers extends BaseObject implements Persistent
* The value for the usr_cost_by_hour field.
* @var double
*/
protected $usr_cost_by_hour = 0;
protected $usr_cost_by_hour = 0.0;
/**
* The value for the usr_unit_cost field.
@@ -1394,7 +1394,7 @@ abstract class BaseUsers extends BaseObject implements Persistent
public function setUsrCostByHour($v)
{
if ($this->usr_cost_by_hour !== $v || $v === 0) {
if ($this->usr_cost_by_hour !== $v || $v === 0.0) {
$this->usr_cost_by_hour = $v;
$this->modifiedColumns[] = UsersPeer::USR_COST_BY_HOUR;
}

View File

@@ -61,67 +61,67 @@ abstract class BaseUsrReporting extends BaseObject implements Persistent
* The value for the total_queue_time_by_task field.
* @var double
*/
protected $total_queue_time_by_task = 0;
protected $total_queue_time_by_task = 0.0;
/**
* The value for the total_time_by_task field.
* @var double
*/
protected $total_time_by_task = 0;
protected $total_time_by_task = 0.0;
/**
* The value for the total_cases_in field.
* @var double
*/
protected $total_cases_in = 0;
protected $total_cases_in = 0.0;
/**
* The value for the total_cases_out field.
* @var double
*/
protected $total_cases_out = 0;
protected $total_cases_out = 0.0;
/**
* The value for the user_hour_cost field.
* @var double
*/
protected $user_hour_cost = 0;
protected $user_hour_cost = 0.0;
/**
* The value for the avg_time field.
* @var double
*/
protected $avg_time = 0;
protected $avg_time = 0.0;
/**
* The value for the sdv_time field.
* @var double
*/
protected $sdv_time = 0;
protected $sdv_time = 0.0;
/**
* The value for the configured_task_time field.
* @var double
*/
protected $configured_task_time = 0;
protected $configured_task_time = 0.0;
/**
* The value for the total_cases_overdue field.
* @var double
*/
protected $total_cases_overdue = 0;
protected $total_cases_overdue = 0.0;
/**
* The value for the total_cases_on_time field.
* @var double
*/
protected $total_cases_on_time = 0;
protected $total_cases_on_time = 0.0;
/**
* The value for the pro_cost field.
* @var double
*/
protected $pro_cost = 0;
protected $pro_cost = 0.0;
/**
* The value for the pro_unit_cost field.
@@ -449,7 +449,7 @@ abstract class BaseUsrReporting extends BaseObject implements Persistent
public function setTotalQueueTimeByTask($v)
{
if ($this->total_queue_time_by_task !== $v || $v === 0) {
if ($this->total_queue_time_by_task !== $v || $v === 0.0) {
$this->total_queue_time_by_task = $v;
$this->modifiedColumns[] = UsrReportingPeer::TOTAL_QUEUE_TIME_BY_TASK;
}
@@ -465,7 +465,7 @@ abstract class BaseUsrReporting extends BaseObject implements Persistent
public function setTotalTimeByTask($v)
{
if ($this->total_time_by_task !== $v || $v === 0) {
if ($this->total_time_by_task !== $v || $v === 0.0) {
$this->total_time_by_task = $v;
$this->modifiedColumns[] = UsrReportingPeer::TOTAL_TIME_BY_TASK;
}
@@ -481,7 +481,7 @@ abstract class BaseUsrReporting extends BaseObject implements Persistent
public function setTotalCasesIn($v)
{
if ($this->total_cases_in !== $v || $v === 0) {
if ($this->total_cases_in !== $v || $v === 0.0) {
$this->total_cases_in = $v;
$this->modifiedColumns[] = UsrReportingPeer::TOTAL_CASES_IN;
}
@@ -497,7 +497,7 @@ abstract class BaseUsrReporting extends BaseObject implements Persistent
public function setTotalCasesOut($v)
{
if ($this->total_cases_out !== $v || $v === 0) {
if ($this->total_cases_out !== $v || $v === 0.0) {
$this->total_cases_out = $v;
$this->modifiedColumns[] = UsrReportingPeer::TOTAL_CASES_OUT;
}
@@ -513,7 +513,7 @@ abstract class BaseUsrReporting extends BaseObject implements Persistent
public function setUserHourCost($v)
{
if ($this->user_hour_cost !== $v || $v === 0) {
if ($this->user_hour_cost !== $v || $v === 0.0) {
$this->user_hour_cost = $v;
$this->modifiedColumns[] = UsrReportingPeer::USER_HOUR_COST;
}
@@ -529,7 +529,7 @@ abstract class BaseUsrReporting extends BaseObject implements Persistent
public function setAvgTime($v)
{
if ($this->avg_time !== $v || $v === 0) {
if ($this->avg_time !== $v || $v === 0.0) {
$this->avg_time = $v;
$this->modifiedColumns[] = UsrReportingPeer::AVG_TIME;
}
@@ -545,7 +545,7 @@ abstract class BaseUsrReporting extends BaseObject implements Persistent
public function setSdvTime($v)
{
if ($this->sdv_time !== $v || $v === 0) {
if ($this->sdv_time !== $v || $v === 0.0) {
$this->sdv_time = $v;
$this->modifiedColumns[] = UsrReportingPeer::SDV_TIME;
}
@@ -561,7 +561,7 @@ abstract class BaseUsrReporting extends BaseObject implements Persistent
public function setConfiguredTaskTime($v)
{
if ($this->configured_task_time !== $v || $v === 0) {
if ($this->configured_task_time !== $v || $v === 0.0) {
$this->configured_task_time = $v;
$this->modifiedColumns[] = UsrReportingPeer::CONFIGURED_TASK_TIME;
}
@@ -577,7 +577,7 @@ abstract class BaseUsrReporting extends BaseObject implements Persistent
public function setTotalCasesOverdue($v)
{
if ($this->total_cases_overdue !== $v || $v === 0) {
if ($this->total_cases_overdue !== $v || $v === 0.0) {
$this->total_cases_overdue = $v;
$this->modifiedColumns[] = UsrReportingPeer::TOTAL_CASES_OVERDUE;
}
@@ -593,7 +593,7 @@ abstract class BaseUsrReporting extends BaseObject implements Persistent
public function setTotalCasesOnTime($v)
{
if ($this->total_cases_on_time !== $v || $v === 0) {
if ($this->total_cases_on_time !== $v || $v === 0.0) {
$this->total_cases_on_time = $v;
$this->modifiedColumns[] = UsrReportingPeer::TOTAL_CASES_ON_TIME;
}
@@ -609,7 +609,7 @@ abstract class BaseUsrReporting extends BaseObject implements Persistent
public function setProCost($v)
{
if ($this->pro_cost !== $v || $v === 0) {
if ($this->pro_cost !== $v || $v === 0.0) {
$this->pro_cost = $v;
$this->modifiedColumns[] = UsrReportingPeer::PRO_COST;
}

View File

@@ -2522,6 +2522,8 @@
<column name="ADD_TAB_TYPE" type="VARCHAR" size="32" required="false" default=""/>
<column name="ADD_TAB_GRID" type="VARCHAR" size="256" required="false" default=""/>
<column name="ADD_TAB_TAG" type="VARCHAR" size="256" required="false" default=""/>
<column name="ADD_TAB_OFFLINE" type="TINYINT" required="true" default="0"/>
<column name="ADD_TAB_UPDATE_DATE" type="TIMESTAMP" required="true"/>
<index name="indexAdditionalProcess">
<index-column name="PRO_UID"/>
</index>

File diff suppressed because one or more lines are too long

View File

@@ -2755,6 +2755,18 @@ msgstr "AVAILABLE GROUPS"
msgid "AVAILABLE MEMBERS"
msgstr "AVAILABLE MEMBERS"
# TRANSLATION
# LABEL/ID_AVAILABLE_OFFLINE
#: LABEL/ID_AVAILABLE_OFFLINE
msgid "Available offline"
msgstr "Available offline"
# TRANSLATION
# LABEL/ID_AVAILABLE_OFFLINE_THE_MOBILE_APPLICATIONS
#: LABEL/ID_AVAILABLE_OFFLINE_THE_MOBILE_APPLICATIONS
msgid "Available offline, the mobile applications will download this table for offline use"
msgstr "Available offline, the mobile applications will download this table for offline use"
# TRANSLATION
# LABEL/ID_AVAILABLE_PERMISSIONS
#: LABEL/ID_AVAILABLE_PERMISSIONS
@@ -3329,6 +3341,12 @@ msgstr "No actions available for this case."
msgid "Case Demo"
msgstr "Case Demo"
# TRANSLATION
# LABEL/ID_CASE_DELETE_SUCCESFULLY
#: LABEL/ID_CASE_DELETE_SUCCESFULLY
msgid "The Case was deleted successfully."
msgstr "The Case was deleted successfully."
# TRANSLATION
# LABEL/ID_CASES
#: LABEL/ID_CASES
@@ -3341,6 +3359,12 @@ msgstr "HOME"
msgid "[LABEL/ID_CASES1] Cases"
msgstr "Cases"
# TRANSLATION
# LABEL/ID_CASES_DELETE_SUCCESFULLY
#: LABEL/ID_CASES_DELETE_SUCCESFULLY
msgid "All Cases were deleted successfully."
msgstr "All Cases were deleted successfully."
# TRANSLATION
# LABEL/ID_CASESLIST_APP_CURRENT_USER
#: LABEL/ID_CASESLIST_APP_CURRENT_USER
@@ -5741,6 +5765,12 @@ msgstr "Deleted"
msgid "Deleted Successfully"
msgstr "Deleted Successfully"
# TRANSLATION
# LABEL/ID_DELETE_ACTION
#: LABEL/ID_DELETE_ACTION
msgid "Delete case"
msgstr "Delete case"
# TRANSLATION
# LABEL/ID_DELETE_ALL_FIELDS
#: LABEL/ID_DELETE_ALL_FIELDS
@@ -19703,6 +19733,12 @@ msgstr "After routing notify the next assigned user(s)"
msgid "Notify users of case"
msgstr "Notify users of case"
# TRANSLATION
# LABEL/ID_NOT_ABLE_DELETE_CASES
#: LABEL/ID_NOT_ABLE_DELETE_CASES
msgid "You are not allowed to delete cases, please contact your System Administrator."
msgstr "You are not allowed to delete cases, please contact your System Administrator."
# TRANSLATION
# LABEL/ID_NOT_ABLE_REASSIGN
#: LABEL/ID_NOT_ABLE_REASSIGN
@@ -20093,6 +20129,24 @@ msgstr "User has been updated successfully"
msgid "Off"
msgstr "Off"
# TRANSLATION
# LABEL/ID_OFFLINE_TABLES
#: LABEL/ID_OFFLINE_TABLES
msgid "Offline Tables"
msgstr "Offline Tables"
# TRANSLATION
# LABEL/ID_OFFLINE_TABLES_ENABLE
#: LABEL/ID_OFFLINE_TABLES_ENABLE
msgid "Set Offline"
msgstr "Set Offline"
# TRANSLATION
# LABEL/ID_OFFLINE_TABLES_DISABLE
#: LABEL/ID_OFFLINE_TABLES_DISABLE
msgid "Set Online"
msgstr "Set Online"
# TRANSLATION
# LABEL/ID_OF_THE_MONTH
#: LABEL/ID_OF_THE_MONTH
@@ -21680,8 +21734,8 @@ msgstr "Open SSL is optional"
# TRANSLATION
# LABEL/ID_PROCESSMAKER_REQUIREMENTS_PHP
#: LABEL/ID_PROCESSMAKER_REQUIREMENTS_PHP
msgid "PHP recommended version 7.1 or higher, PHP 7.2 is not yet supported"
msgstr "PHP recommended version 7.1 or higher, PHP 7.2 is not yet supported"
msgid "PHP recommended version 7.3, we maintain compatibility starting with PHP 7.1"
msgstr "PHP recommended version 7.3, we maintain compatibility starting with PHP 7.1"
# TRANSLATION
# LABEL/ID_PROCESSMAKER_REQUIREMENTS_SOAP

View File

@@ -12,8 +12,8 @@ include PATH_LANGUAGECONT . "translation." . SYS_LANG;
class InstallerModule extends Controller
{
const PHP_VERSION_MINIMUM_SUPPORTED = '7.1';
const PHP_VERSION_NOT_SUPPORTED = '7.2';
const PHP_VERSION_MINIMUM_SUPPORTED = "7.1";
const PHP_VERSION_NOT_SUPPORTED = "7.4";
public $path_config;
public $path_languages;
public $path_plugins;

View File

@@ -1,5 +1,7 @@
<?php
use \ProcessMaker\BusinessModel\Cases;
class adhocUserProxy extends HttpProxyController
{
//list of users into adhoc option
@@ -46,21 +48,27 @@ class adhocUserProxy extends HttpProxyController
$cases->reassignCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], $_POST['USR_UID'], $_POST['THETYPE'] );
$this->success = true;
}
//delete case adhoc
function deleteCase ($params)
/**
* Delete case from the actions menu
*
* @link https://wiki.processmaker.com/3.3/Cases/Actions#Delete
*/
function deleteCase($params)
{
$ainfoCase = array ();
try {
$applicationUID = (isset( $_POST['APP_UID'] )) ? $_POST['APP_UID'] : $_SESSION['APPLICATION'];
$appUid = (isset($_POST['APP_UID'])) ? $_POST['APP_UID'] : $_SESSION['APPLICATION'];
// Load case information for get appNumber
$data = [];
$app = new Application();
$caseData = $app->load( $applicationUID );
$caseData = $app->load($appUid);
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];
$oCase = new Cases();
$oCase->removeCase( $applicationUID );
$case = new Cases();
$case->deleteCase($appUid, $_SESSION['USER_LOGGED']);
// Result successfully
$this->success = true;
$this->msg = G::LoadTranslation( 'ID_CASE_DELETED_SUCCESSFULLY', SYS_LANG, $data );
$this->msg = G::LoadTranslation('ID_CASE_DELETED_SUCCESSFULLY', SYS_LANG, $data);
} catch (Exception $e) {
$this->success = false;
$this->msg = $e->getMessage();

View File

@@ -69,7 +69,7 @@ class Admin extends Controller
$this->setJSVar( 'CONFIG', $Config );
$this->setJSVar( 'FORMATS', $c->getFormats() );
$this->setJSVar( 'uxTypes', AdminProxy::getUxTypesList( 'list' ) );
$this->setJSVar( 'uxTypes', adminProxy::getUxTypesList( 'list' ) );
G::RenderPage( 'publish', 'extJs' );
}

View File

@@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Cache;
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Validation\ValidationUploadedFiles;
@@ -232,7 +233,7 @@ class adminProxy extends HttpProxyController
return array('success' => $success, 'users' => $usersAdmin);
}
public function getUxTypesList($type = 'assoc')
public static function getUxTypesList($type = 'assoc')
{
$list = array();
@@ -1500,8 +1501,14 @@ class adminProxy extends HttpProxyController
//Installed Plugins (license info?)
$arrayAddon = array();
if (file_exists(PATH_DATA_SITE . "ee")) {
$arrayAddon = unserialize(trim(file_get_contents(PATH_DATA_SITE . "ee")));
$eeData = Cache::get(config('system.workspace') . 'enterprise.ee', function () {
if (file_exists(PATH_DATA_SITE . 'ee')) {
return trim(file_get_contents(PATH_DATA_SITE . 'ee'));
}
return null;
});
if ($eeData) {
$arrayAddon = unserialize($eeData);
}
$plugins = array();

View File

@@ -1,6 +1,7 @@
<?php
use ProcessMaker\Core\System;
use ProcessMaker\Model\AdditionalTables as AdditionalTablesModel;
use ProcessMaker\Validation\ExceptionRestApi;
use ProcessMaker\Validation\ValidationUploadedFiles;
@@ -218,6 +219,34 @@ class pmTablesProxy extends HttpProxyController
}
}
/**
* Update the offline property.
* @param stdClass $httpData
* @return stdClass
*/
public function updateOffline(stdClass $httpData): stdClass
{
$result = new stdClass();
try {
$array = G::json_decode(stripslashes($httpData->rows));
$data = [];
$enable = false;
foreach ($array as $value) {
if ($value->type !== "NORMAL") {
$data[] = $value->id;
$enable = $value->offline ? 1 : 0;
}
}
AdditionalTablesModel::updatePropertyOffline($data, $enable);
$result->success = true;
$result->message = $enable ? G::LoadTranslation("ID_ENABLE") : G::LoadTranslation("ID_DISABLE");
} catch (Exception $e) {
$result->success = false;
$result->message = $e->getMessage();
}
return $result;
}
/**
* delete pm table
*

View File

@@ -1,5 +1,5 @@
INSERT INTO USERS (USR_UID,USR_USERNAME,USR_PASSWORD,USR_FIRSTNAME,USR_LASTNAME,USR_EMAIL,USR_DUE_DATE,USR_CREATE_DATE,USR_UPDATE_DATE,USR_STATUS,USR_COUNTRY,USR_CITY,USR_LOCATION,USR_ADDRESS,USR_PHONE,USR_FAX,USR_CELLULAR,USR_ZIP_CODE,DEP_UID,USR_POSITION,USR_RESUME,USR_BIRTHDAY,USR_ROLE,USR_REPORTS_TO,USR_REPLACED_BY ) VALUES
('00000000000000000000000000000001','admin','21232f297a57a5a743894a0e4a801fc3','Administrator',' ', 'admin@processmaker.com','2020-01-01','1999-11-30 00:00:00','2008-05-23 18:36:19','ACTIVE', 'US','FL','MMK','','', '1-305-402-0282','1-305-675-1400','','','Administrator', '','1999-02-25','PROCESSMAKER_ADMIN','',''),
('00000000000000000000000000000001','admin','21232f297a57a5a743894a0e4a801fc3','Administrator',' ','admin@processmaker.com',DATE_ADD(curdate(), INTERVAL 1 YEAR),'1999-11-30 00:00:00','2008-05-23 18:36:19','ACTIVE', 'US','FL','MMK','','', '1-305-402-0282','1-305-675-1400','','','Administrator', '','1999-02-25','PROCESSMAKER_ADMIN','',''),
('00000000000000000000000000000002','guest','674ba9750749d735ec9787d606170d78','Guest',' ', 'guest@processmaker.com','2030-01-01','2009-02-01 12:24:36','2009-02-01 12:24:36','INACTIVE', 'US','FL','MMK','','', '1-305-402-0282','1-305-675-1400','','','Guest', '','2009-02-01','PROCESSMAKER_GUEST','','');
INSERT INTO CONTENT (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG,CON_VALUE) VALUES
@@ -57261,6 +57261,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_AVAILABLE_FIELDS','en','Available Fields','2014-01-15') ,
( 'LABEL','ID_AVAILABLE_GROUPS','en','AVAILABLE GROUPS','2014-01-15') ,
( 'LABEL','ID_AVAILABLE_MEMBERS','en','AVAILABLE MEMBERS','2014-01-15') ,
( 'LABEL','ID_AVAILABLE_OFFLINE','en','Available offline','2019-10-15') ,
( 'LABEL','ID_AVAILABLE_OFFLINE_THE_MOBILE_APPLICATIONS','en','Available offline, the mobile applications will download this table for offline use','2019-10-15') ,
( 'LABEL','ID_AVAILABLE_PERMISSIONS','en','AVAILABLE PERMISSIONS','2014-01-15') ,
( 'LABEL','ID_AVAILABLE_TRIGGERS','en','Available Triggers','2014-01-15') ,
( 'LABEL','ID_AVAILABLE_USERS','en','AVAILABLE USERS','2014-01-15') ,
@@ -57358,8 +57360,10 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_CASE','en','Case','2014-01-15') ,
( 'LABEL','ID_CASECANCEL','en','No actions available for this case.','2014-01-15') ,
( 'LABEL','ID_CASEDEMO','en','Case Demo','2014-01-15') ,
( 'LABEL','ID_CASE_DELETE_SUCCESFULLY','en','The Case was deleted successfully.','2020-01-08') ,
( 'LABEL','ID_CASES','en','HOME','2014-01-15') ,
( 'LABEL','ID_CASES1','en','Cases','2015-12-15') ,
( 'LABEL','ID_CASES_DELETE_SUCCESFULLY','en','All Cases were deleted successfully.','2020-01-08') ,
( 'LABEL','ID_CASESLIST_APP_CURRENT_USER','en','Current User','2014-01-15') ,
( 'LABEL','ID_CASESLIST_APP_DEL_INDEX','en','Del Index','2014-01-15') ,
( 'LABEL','ID_CASESLIST_APP_DEL_PREVIOUS_USER','en','Sent by','2014-01-15') ,
@@ -57770,6 +57774,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_DELETE','en','Delete','2014-01-15') ,
( 'LABEL','ID_DELETED','en','Deleted','2014-01-15') ,
( 'LABEL','ID_DELETED_SUCCESSFULLY','en','Deleted Successfully','2014-01-15') ,
( 'LABEL','ID_DELETE_ACTION','en','Delete case','2020-01-15') ,
( 'LABEL','ID_DELETE_ALL_FIELDS','en','Do you want to delete all fields?','2014-01-15') ,
( 'LABEL','ID_DELETE_ALL_REPORT_TABLE','en','Do you want to delete all report tables?','2014-01-15') ,
( 'LABEL','ID_DELETE_AUTH_SOURCE','en','Delete Authentication Source','2014-10-13') ,
@@ -60150,6 +60155,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_NOTIFY','en','Notify','2016-10-20') ,
( 'LABEL','ID_NOTIFY_USERS_AFTER_ASSIGN','en','After routing notify the next assigned user(s)','2014-01-15') ,
( 'LABEL','ID_NOTIFY_USERS_CASE','en','Notify users of case','2014-01-15') ,
( 'LABEL','ID_NOT_ABLE_DELETE_CASES','en','You are not allowed to delete cases, please contact your System Administrator.','2020-01-08') ,
( 'LABEL','ID_NOT_ABLE_REASSIGN','en','You are not able to reassign cases of this process.','2018-05-15') ,
( 'LABEL','ID_NOT_AVAILABLE_DATABASE','en','Not available.','2015-04-21') ,
( 'LABEL','ID_NOT_CREATE_TABLE','en','Could not create the table with the name','2014-01-15') ,
@@ -60217,6 +60223,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_OBJECT_REMOVE','en','Object has been removed successfully','2014-01-15') ,
( 'LABEL','ID_OBJECT_UPDATE','en','User has been updated successfully','2014-01-15') ,
( 'LABEL','ID_OFF','en','Off','2014-01-15') ,
( 'LABEL','ID_OFFLINE_TABLES','en','Offline Tables','2019-12-19') ,
( 'LABEL','ID_OFFLINE_TABLES_ENABLE','en','Set Offline Tables','2019-12-19') ,
( 'LABEL','ID_OFFLINE_TABLES_DISABLE','en','Set Online Tables','2019-12-19') ,
( 'LABEL','ID_OF_THE_MONTH','en','of the month(s)','2014-01-15') ,
( 'LABEL','ID_OK','en','Ok','2015-09-17') ,
( 'LABEL','ID_OLD_VERSION','en','old version','2014-01-15') ,
@@ -60489,7 +60498,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_OPENSSL_OPTIONAL','en','Open SSL is optional','2014-01-15') ,
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_PHP','en','PHP recommended version 7.1 or higher, PHP 7.2 is not yet supported','2018-06-13') ,
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_PHP','en','PHP recommended version 7.3, we maintain compatibility starting with PHP 7.1','2019-12-02') ,
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_SOAP','en','Soap Support','2014-01-15') ,
( 'LABEL','ID_PROCESSMAKER_SLOGAN1','en','This Business Process is Powered By ProcessMaker','2014-01-15') ,
( 'LABEL','ID_PROCESSMAKER_SUCCESS_INSTALLED','en','ProcessMaker was successfully installed<br/>Workspace <b>" {0} " </b> was installed correctly.','2014-01-15') ,

View File

@@ -1162,6 +1162,8 @@ CREATE TABLE `ADDITIONAL_TABLES`
`ADD_TAB_TYPE` VARCHAR(32) default '',
`ADD_TAB_GRID` VARCHAR(256) default '',
`ADD_TAB_TAG` VARCHAR(256) default '',
`ADD_TAB_OFFLINE` TINYINT default 0 NOT NULL,
`ADD_TAB_UPDATE_DATE` DATETIME NOT NULL,
PRIMARY KEY (`ADD_TAB_UID`),
KEY `indexAdditionalProcess`(`PRO_UID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';

View File

@@ -737,10 +737,12 @@ function sortContent()
function openPMFolder()
{
$oPMFolder = new AppFolder();
$rootFolder = "/";
$WIDTH_PANEL = 350;
$folderContent = $oPMFolder->getFolderList($_POST ['folderID'] != '0' ?
$_POST ['folderID'] == 'NA' ? "" : $_POST ['folderID'] : $rootFolder);
//krumo($folderContent);
if (! is_array($folderContent)) {
echo $folderContent;
exit();
@@ -750,51 +752,49 @@ function openPMFolder()
$tree->name = 'DMS';
$tree->nodeType = "blank";
//$tree->width="350px";
$tree->value = '';
$tree->showSign = false;
$i = 0;
foreach ($folderContent as $key => $obj) {
foreach ($folderContent['folders'] as $key => $obj) {
$i ++;
//if ($obj->item_type=="F") {
$RowClass = ($i % 2 == 0) ? 'Row1' : 'Row2';
$id_delete = G::LoadTranslation('ID_DELETE');
$id_edit = G::LoadTranslation('ID_EDIT');
$htmlGroup = <<<GHTML
<table cellspacing='0' cellpadding='0' border='1' style='border:0px;' width="100%" class="pagedTable">
<tr id="{$i}" onmouseout="setRowClass(this, '{$RowClass}')" onmouseover="setRowClass(this, 'RowPointer')"
class="{$RowClass}" style="cursor:hand">
<td width='' class='treeNode' style='border:0px;background-color:transparent;'><a href="#"
onclick="focusRow(this, 'Selected');openPMFolder('{$obj['FOLDER_UID']}','{$_POST['rootfolder']}');">
<img src="/images/folderV2.gif" border = "0" valign="middle" />&nbsp;{$obj['FOLDER_NAME']}</a>
<a href="#" onclick="deletePMFolder('{$obj['FOLDER_UID']}','{$_POST['rootfolder']}');">&nbsp; {$id_delete}</a>
$htmlGroup = "
<table cellspacing='0' cellpadding='0' border='1' style='border:0px;' width=\"100%\" class=\"pagedTable\">
<tr id=\"{$i}\" onmouseout=\"setRowClass(this, '{$RowClass}')\" onmouseover=\"setRowClass(this, 'RowPointer')\"
class=\"{$RowClass}\" style=\"cursor:hand\">
<td width='' class='treeNode' style='border:0px;background-color:transparent;'><a href=\"#\"
onclick=\"focusRow(this, 'Selected');openPMFolder('{$obj['FOLDER_UID']}','{$_POST['rootfolder']}');\">
<img src=\"/images/folderV2.gif\" border = \"0\" valign=\"middle\" />&nbsp;{$obj['FOLDER_NAME']}</a>
<a href=\"#\" onclick=\"deletePMFolder('{$obj['FOLDER_UID']}','{$_POST['rootfolder']}');\">&nbsp; {$id_delete}</a>
</td>
</tr>
</table>
<div id="child_{$obj['FOLDER_UID']}"></div>
GHTML;
<div id=\"child_{$obj['FOLDER_UID']}\"></div>
";
$ch = $tree->addChild ($key, $htmlGroup, array ('nodeType' => 'child'));
$ch->point = ' ';
}
$RowClass = ($i % 2 == 0) ? 'Row1' : 'Row2';
$key = 0;
if ($_POST ['folderID'] == '0') {
$notInFolderLabel = G::LoadTranslation ('ID_NOT_IN_FOLDER');
$htmlGroup = <<<GHTML
<table cellspacing='0' cellpadding='0' border='1' style='border:0px;' width="100%" class="pagedTable">
<tr id="{$i}" onclick="focusRow(this, 'Selected');openPMFolder('NA');"
onmouseout="setRowClass(this, '{$RowClass}')" onmouseover="setRowClass(this, 'RowPointer')" class="{$RowClass}">
<td width='' class='treeNode' style='border:0px;background-color:transparent;'><a href="#" onclick="">
<img src="/images/folderV2.gif" border = "0" valign="middle" />&nbsp;- {$notInFolderLabel} -</a>&nbsp;</td>
}
$RowClass = ($i % 2 == 0) ? 'Row1' : 'Row2';
$key = 0;
if ($_POST ['folderID'] == '0') {
$notInFolderLabel = G::LoadTranslation ('ID_NOT_IN_FOLDER');
$htmlGroup = "
<table cellspacing='0' cellpadding='0' border='1' style='border:0px;' width=\"100%\" class=\"pagedTable\">
<tr id=\"{$i}\" onclick=\"focusRow(this, 'Selected');openPMFolder('NA');\"
onmouseout=\"setRowClass(this, '{$RowClass}')\" onmouseover=\"setRowClass(this, 'RowPointer')\" class=\"{$RowClass}\">
<td width='' class='treeNode' style='border:0px;background-color:transparent;'><a href=\"#\" onclick=\"\">
<img src=\"/images/folderV2.gif\" border = \"0\" valign=\"middle\" />&nbsp;- {$notInFolderLabel} -</a>&nbsp;</td>
</tr>
</table>
<div id="child_NA"></div>
GHTML;
<div id=\"child_NA\"></div>
";
$ch = $tree->addChild($key, $htmlGroup, array('nodeType' => 'child'));
$ch->point = ' ';

View File

@@ -200,9 +200,11 @@ class Ajax
} else {
$options[] = ['text' => G::LoadTranslation('ID_UNPAUSE'), 'fn' => 'unpauseCase'];
}
$options[] = ['text' => G::LoadTranslation('ID_DELETE'), 'fn' => 'deleteCase'];
// Check if the user has the permission for the action Delete Case
if ($RBAC->userCanAccess('PM_DELETECASE') == 1) {
$options[] = ['text' => G::LoadTranslation('ID_DELETE'), 'fn' => 'deleteCase'];
}
// Check if the user has the permission for the action Reassign Case
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1 || $RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) {
if (!AppDelay::isPaused($appUid, $index)) {
$options[] = ['text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign'];

View File

@@ -188,6 +188,9 @@ $reassignCaseSup = ($RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) ? '
$headPublisher->assign('varReassignCase', $reassignCase);
$headPublisher->assign('varReassignCaseSupervisor', $reassignCaseSup);
$deleteCase = ($RBAC->userCanAccess('PM_DELETECASE') == 1) ? 'true' : 'false';
$headPublisher->assign('varDeleteCase', $deleteCase);
$c = new Configurations();
$headPublisher->addExtJsScript('app/main', true);
$headPublisher->addExtJsScript('cases/casesList', false); //adding a javascript file .js

View File

@@ -2,26 +2,13 @@
/**
* cases_Delete.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
* Delete case from the cases List option
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
* @link https://wiki.processmaker.com/3.3/Roles#PM_DELETECASE
*/
/* Permissions */
use ProcessMaker\BusinessModel\Cases;
switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
@@ -35,23 +22,23 @@ switch ($RBAC->userCanAccess( 'PM_CASES' )) {
break;
}
/* Process the info */
try {
$oCase = new Cases();
if (isset( $_POST['APP_UIDS'] )) {
$ids = explode( ',', $_POST['APP_UIDS'] );
foreach ($ids as $id) {
$oCase->removeCase( $id );
if (isset($_POST['APP_UIDS'])) {
$cases = explode(',', $_POST['APP_UIDS']);
foreach ($cases as $appUid) {
$case = new Cases();
$case->deleteCase($appUid, $_SESSION['USER_LOGGED']);
}
if (count( $_POST['APP_UIDS'] ) > 1) {
echo 'The Case was deleted successfully';
// Prepare the response successfully
if (count($cases) == 1) {
G::outRes(G::outRes(G::LoadTranslation('ID_CASE_DELETE_SUCCESFULLY')));
} else {
echo 'All Cases were deleted successfully';
G::outRes(G::outRes(G::LoadTranslation('ID_CASES_DELETE_SUCCESFULLY')));
}
}
} catch (Exception $e) {
$token = strtotime("now");
PMException::registerErrorLog($e, $token);
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
G::outRes($e->getMessage());
}

View File

@@ -191,6 +191,7 @@ try {
$response['filters'] = $filters;
$response['totalCount'] = $list->getCountList($userUid, $filters);
$response['data'] = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($result);
!empty($response['filters']['search']) ? $response['filters']['search'] = '' : '';
echo G::json_encode($response);
} catch (Exception $e) {
$msg = array("error" => $e->getMessage());

View File

@@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Cache;
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
@@ -207,15 +208,47 @@ class enterprisePlugin extends PMPlugin
}
}
/**
* Registeres the plugin in the enterprise data
* Note, this utilizes caching to reduce the burden of the file I/O on the ee file. However, this does
* require caching to be enabled.
*/
public function registerEE($pluginFile, $pluginVersion)
{
if (file_exists(PATH_DATA_SITE . "ee")) {
$this->systemAvailable = unserialize(trim(file_get_contents(PATH_DATA_SITE . "ee")));
$cacheKey = config('system.workspace') . 'enterprise.ee';
// Fetch the value from cache. If not present, fetch from the filesystem.
$value = Cache::get($cacheKey, function () use($cacheKey) {
if (file_exists(PATH_DATA_SITE . "ee")) {
$contents = trim(file_get_contents(PATH_DATA_SITE . "ee"));
// Store it in cache so it can be used in the future
Cache::forever($cacheKey, $contents);
return $contents;
} else {
return null;
}
});
if ($value) {
$this->systemAvailable = unserialize($value);
} else {
// Handle potential no value
$this->systemAvailable = [];
}
$this->systemAvailable[$pluginFile]["sFilename"] = $pluginFile . "-" . $pluginVersion . ".tar";
file_put_contents(PATH_DATA_SITE . "ee", serialize($this->systemAvailable));
$filename = $pluginFile . '-' . $pluginVersion . '.tar';
// Check to see if update is required
if (
!isset($this->systemAvailable[$pluginFile]) ||
!isset($this->systemAvailable[$pluginFile]['sFilename']) ||
$this->systemAvailable[$pluginFile]['sFilename'] != $filename
) {
// Update required
$this->systemAvailable[$pluginFile]["sFilename"] = $filename;
file_put_contents(PATH_DATA_SITE . "ee", serialize($this->systemAvailable));
// Put in cache as well
Cache::forever($cacheKey, serialize($this->systemAvailable));
}
return true;
}

View File

@@ -59,9 +59,7 @@ switch ($_POST['action']) {
$sortDir = isset($_REQUEST["dir"]) ? $_REQUEST["dir"] : "";
global $RBAC;
if ($limit == $start) {
$limit = $limit + $limit;
}
$tasks = new TaskUser();
$aTask = $tasks->getCountAllTaksByGroups();

View File

@@ -37,7 +37,7 @@ try {
if (\BpmnProject::exists($_GET["pro_uid"]) && isset($_GET['objects'])) {
/*----------------------------------********---------------------------------*/
$_GET["objects"] = \G::json_decode($_GET['objects']);
if (sizeof($_GET['objects']) == 0) {
if (empty($_GET['objects'])) {
/*----------------------------------********---------------------------------*/
$exporter = new ProcessMaker\Exporter\XmlExporter($_GET["pro_uid"]);
$projectName = $exporter->getProjectName();

View File

@@ -144,7 +144,7 @@ if (isset($_FILES["PROCESS_FILENAME"]) && (pathinfo($_FILES["PROCESS_FILENAME"][
}
}
if (isset($_POST['objectsToImport']) && sizeof(G::json_decode($_POST['objectsToImport']))){
if (isset($_POST['objectsToImport']) && !empty(G::json_decode($_POST['objectsToImport']))) {
$objectsToImport = G::json_decode($_POST['objectsToImport']);
}
/*----------------------------------********---------------------------------*/
@@ -268,41 +268,44 @@ if (isset($_POST["PRO_FILENAME"]) &&
try {
/*----------------------------------********---------------------------------*/
$objectsToImport = '';
// only uploadFileNewProcessExist
if (version_compare($data['version'], '3.0', '>') && isset($_POST['objectsToImport']) && $_POST['objectsToImport'] === '' && $_POST['IMPORT_OPTION']==="1") {
$objectImport = (isset($data['objects'])) ? explode('|', $data['objects']) : "";
$ids = new \ProcessMaker\BusinessModel\Migrator\ExportObjects();
$objectImport = $ids->getIdObjectList($objectImport);
$granularImport = true;
$result = array(
"success" => true,
"catchMessage" => '',
"ExistProcessInDatabase" => 0,
"ExistGroupsInDatabase" => 0,
"notExistProcessInDatabase" => 0,
"affectedGroups" => '',
"sNewProUid" => '',
"project_type" => 'bpmn',
"isGranularImport" => $granularImport,
"objectGranularImport" => $objectImport,
"project_type_aux" => ''
);
echo G::json_encode($result);
exit(0);
}
if (version_compare($data['version'], '3.0', '>')) {
$dataObject = (isset($data['objects'])) ? explode('|', $data['objects']) : "";
$exportObjects = new \ProcessMaker\BusinessModel\Migrator\ExportObjects();
$idObjectList = $exportObjects->getIdObjectList($dataObject);
if (version_compare($data['version'], '3.0', '>') && $_POST['IMPORT_OPTION']==="3") {
$objectsToImport = [];
$objects = (isset($data['objects'])) ? explode('|', $data['objects']) : "";
$ids = new \ProcessMaker\BusinessModel\Migrator\ExportObjects();
$objects = $ids->getIdObjectList($objects);
foreach ($objects as $object) {
$objectsToImport[] = (object)array('id' => $object, 'action' => 'replace');
// only uploadFileNewProcessExist
if (isset($_POST['objectsToImport']) && $_POST['objectsToImport'] === '' && $_POST['IMPORT_OPTION'] === "1") {
$granularImport = true;
$result = [
"success" => true,
"catchMessage" => '',
"ExistProcessInDatabase" => 0,
"ExistGroupsInDatabase" => 0,
"notExistProcessInDatabase" => 0,
"affectedGroups" => '',
"sNewProUid" => '',
"project_type" => 'bpmn',
"isGranularImport" => $granularImport,
"objectGranularImport" => $idObjectList,
"project_type_aux" => ''
];
echo G::json_encode($result);
exit(0);
}
}
if (isset($_POST['objectsToImport']) && sizeof(G::json_decode($_POST['objectsToImport']))){
$objectsToImport = G::json_decode($_POST['objectsToImport']);
$actionImport = "merge";
if ($_POST['IMPORT_OPTION'] === "3") {
$actionImport = "replace";
}
$objectsToImport = [];
foreach ($idObjectList as $object) {
$objectsToImport[] = (object) ['id' => $object, 'action' => $actionImport];
}
if (isset($_POST['objectsToImport']) && !empty(G::json_decode($_POST['objectsToImport']))) {
$objectsToImport = G::json_decode($_POST['objectsToImport']);
}
}
/*----------------------------------********---------------------------------*/
$prjUid = $importer->import($option, $optionGroup, false, $objectsToImport);

View File

@@ -200,91 +200,83 @@ function newSkin ($baseSkin = 'classic')
function importSkin ()
{
try {
ValidationUploadedFiles::getValidationUploadedFiles()->dispatch(function($validator) {
ValidationUploadedFiles::getValidationUploadedFiles()->dispatch(function ($validator) {
throw new Exception($validator->getMessage());
});
if (! isset( $_FILES['uploadedFile'] )) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FILE_REQUIRED' ) ));
if (!isset($_FILES['uploadedFile'])) {
throw (new Exception(G::LoadTranslation('ID_SKIN_FILE_REQUIRED')));
}
$uploadedInstances = count( $_FILES['uploadedFile']['name'] );
$sw_error = false;
$sw_error_exists = isset( $_FILES['uploadedFile']['error'] );
$emptyInstances = 0;
$quequeUpload = array ();
// upload files & check for errors
$sw_error_exists = isset($_FILES['uploadedFile']['error']);
// Upload files & check for errors
$tmp = $_FILES['uploadedFile']['tmp_name'];
$items = stripslashes( $_FILES['uploadedFile']['name'] );
$items = stripslashes($_FILES['uploadedFile']['name']);
if ($sw_error_exists) {
$up_err = $_FILES['uploadedFile']['error'];
} else {
$up_err = (file_exists( $tmp ) ? 0 : 4);
$up_err = (file_exists($tmp) ? 0 : 4);
}
if ($items == "" || $up_err == 4) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FILE_REQUIRED' ) ));
throw (new Exception(G::LoadTranslation('ID_SKIN_FILE_REQUIRED')));
}
if ($up_err == 1 || $up_err == 2) {
throw (new Exception( G::LoadTranslation( 'ID_FILE_TOO_BIG' ) ));
//$errors[$i]='miscfilesize';
throw (new Exception(G::LoadTranslation('ID_FILE_TOO_BIG')));
}
if ($up_err == 3) {
throw (new Exception( G::LoadTranslation( 'ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR' ) ));
//$errors[$i]='miscfilepart';
throw (new Exception(G::LoadTranslation('ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR')));
}
if (! @is_uploaded_file( $tmp )) {
throw (new Exception( G::LoadTranslation( 'ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR' ) ));
//$errors[$i]='uploadfile';
if (!@is_uploaded_file($tmp)) {
throw (new Exception(G::LoadTranslation('ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR')));
}
$fileInfo = pathinfo( $items );
$validType = array ('tar','gz'
);
$fileInfo = pathinfo($items);
$validType = ['tar', 'gz'];
if (! in_array( $fileInfo['extension'], $validType )) {
throw (new Exception( G::LoadTranslation( 'ID_FILE_UPLOAD_INCORRECT_EXTENSION' ) ));
//$errors[$i]='wrongtype';
if (!in_array($fileInfo['extension'], $validType)) {
throw (new Exception(G::LoadTranslation('ID_FILE_UPLOAD_INCORRECT_EXTENSION')));
}
$filename = $items;
$tempPath = PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP;
G::verifyPath( $tempPath, true );
G::verifyPath($tempPath, true);
$tempName = $tmp;
G::uploadFile( $tempName, $tempPath, $filename );
G::uploadFile($tempName, $tempPath, $filename);
$tar = new Archive_Tar( $tempPath . $filename );
$tar = new Archive_Tar($tempPath . $filename);
$aFiles = $tar->listContent();
$swConfigFile = false;
foreach ($aFiles as $key => $val) {
if (basename( $val['filename'] ) == 'config.xml') {
$skinName = dirname( $val['filename'] );
$skinArray = explode( "/", $skinName );
if (count( $skinArray ) == 1) {
if (basename($val['filename']) == 'config.xml') {
$skinName = dirname($val['filename']);
$skinArray = explode("/", $skinName);
if (count($skinArray) == 1) {
$swConfigFile = true;
}
}
}
if (! $swConfigFile) {
@unlink( PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename );
throw (new Exception( G::LoadTranslation( 'ID_SKIN_CONFIGURATION_MISSING' ) ));
if (!$swConfigFile) {
@unlink(PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename);
throw (new Exception(G::LoadTranslation('ID_SKIN_CONFIGURATION_MISSING')));
}
if (is_dir( PATH_CUSTOM_SKINS . $skinName )) {
if ((isset( $_REQUEST['overwrite_files'] )) && ($_REQUEST['overwrite_files'] == 'on')) {
G::rm_dir( PATH_CUSTOM_SKINS . $skinName, false );
if (is_dir(PATH_CUSTOM_SKINS . $skinName)) {
if ((isset($_REQUEST['overwrite_files'])) && ($_REQUEST['overwrite_files'] == 'on')) {
G::rm_dir(PATH_CUSTOM_SKINS . $skinName, false);
} else {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_ALREADY_EXISTS' ) ));
throw (new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS')));
}
}
$res = $tar->extract( PATH_CUSTOM_SKINS );
if (! $res) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_ERROR_EXTRACTING' ) ));
$res = $tar->extract(PATH_CUSTOM_SKINS);
if (!$res) {
throw (new Exception(G::LoadTranslation('ID_SKIN_ERROR_EXTRACTING')));
}
$configFileOriginal = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml';
$configFileFinal = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml';
$xmlConfiguration = file_get_contents( $configFileOriginal );
$xmlConfiguration = file_get_contents($configFileOriginal);
$workspace = ($_REQUEST['workspace'] == 'global') ? '' : config("system.workspace");
@@ -292,27 +284,27 @@ function importSkin ()
$skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"];
if (isset($skinInformationArray["workspace"]["__VALUE__"])) {
$workspace = ($workspace != "" && !empty($skinInformationArray["workspace"]["__VALUE__"]))? $skinInformationArray["workspace"]["__VALUE__"] . "|" . $workspace : $workspace;
$workspace = ($workspace != "" && !empty($skinInformationArray["workspace"]["__VALUE__"])) ? $skinInformationArray["workspace"]["__VALUE__"] . "|" . $workspace : $workspace;
$xmlConfiguration = preg_replace("/(<workspace>)(.*)(<\/workspace>)/i", "<workspace>" . $workspace . "</workspace><!-- $2 -->", $xmlConfiguration);
} else {
$xmlConfiguration = preg_replace("/(<name>)(.*)(<\/name>)/i", "<name>" . $skinName . "</name><!-- $2 -->\n<workspace>" . $workspace . "</workspace>", $xmlConfiguration);
}
file_put_contents( $configFileFinal, $xmlConfiguration );
file_put_contents($configFileFinal, $xmlConfiguration);
//Delete Temporal
@unlink( PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename );
// Delete Temporal
@unlink(PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename);
$response['success'] = true;
$response['message'] = G::LoadTranslation( 'ID_SKIN_SUCCESSFUL_IMPORTED' );
G::auditLog("ImportSkin", "Skin Name: ".$skinName);
G::outRes( G::json_encode( $response ) );
$response['message'] = G::LoadTranslation('ID_SKIN_SUCCESSFUL_IMPORTED');
G::auditLog("ImportSkin", "Skin Name: " . $skinName);
G::outRes(G::json_encode($response));
} catch (Exception $e) {
$response['success'] = false;
$response['message'] = $e->getMessage();
$response['error'] = $e->getMessage();
G::outRes( G::json_encode( $response ) );
G::outRes(G::json_encode($response));
}
}

View File

@@ -1,5 +1,8 @@
<?php
use ProcessMaker\BusinessModel\User as BmUser;
// Sanitizing the values sent in the global variables
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
if (isset($_SESSION['USER_LOGGED'])) {
@@ -9,456 +12,482 @@ if (isset($_SESSION['USR_USERNAME'])) {
$_SESSION['USR_USERNAME'] = $filter->xssFilterHard($_SESSION['USR_USERNAME']);
}
global $RBAC;
// Initializing variables
$action = !empty($_POST['action']) ? $_POST['action'] : '';
$result = new StdClass();
switch ($_POST['action']) {
case 'countryList':
require_once("classes/model/IsoCountry.php");
$c = new Criteria();
$c->add(IsoCountryPeer::IC_UID, null, Criteria::ISNOTNULL);
$c->addAscendingOrderByColumn(IsoCountryPeer::IC_NAME);
// Try to execute the requested action
try {
// Checking access permissions for the current action
global $RBAC;
$RBAC->allows(basename(__FILE__), $action);
$countries = IsoCountryPeer::doSelect($c);
foreach ($countries as $rowid => $row) {
$oData[] = array('IC_UID' => $row->getICUid(), 'IC_NAME' => $row->getICName());
}
print(G::json_encode($oData));
break;
case 'stateList':
require_once("classes/model/IsoSubdivision.php");
$c = new Criteria();
$country = $_POST['IC_UID'];
$c->add(IsoSubdivisionPeer::IC_UID, $country, Criteria::EQUAL);
$c->addAscendingOrderByColumn(IsoSubdivisionPeer::IS_NAME);
$locations = IsoSubdivisionPeer::doSelect($c);
// Executing the action
switch ($action) {
case 'countryList':
$c = new Criteria();
$c->add(IsoCountryPeer::IC_UID, null, Criteria::ISNOTNULL);
$c->addAscendingOrderByColumn(IsoCountryPeer::IC_NAME);
$countries = IsoCountryPeer::doSelect($c);
$oData = array();
foreach ($locations as $rowid => $row) {
if (($row->getISUid() != '') && ($row->getISName() != '')) {
$oData[] = array('IS_UID' => $row->getISUid(), 'IS_NAME' => $row->getISName());
$data = [];
foreach ($countries as $row) {
$data[] = ['IC_UID' => $row->getICUid(), 'IC_NAME' => $row->getICName()];
}
}
print(G::json_encode($oData));
break;
case 'locationList':
require_once("classes/model/IsoLocation.php");
$c = new Criteria();
$country = $_POST['IC_UID'];
$state = $_POST['IS_UID'];
$c->add(IsoLocationPeer::IC_UID, $country, Criteria::EQUAL);
$c->add(IsoLocationPeer::IS_UID, $state, Criteria::EQUAL);
$c->addAscendingOrderByColumn(IsoLocationPeer::IL_NAME);
$locations = IsoLocationPeer::doSelect($c);
print(G::json_encode($data));
break;
case 'stateList':
$c = new Criteria();
$country = $_POST['IC_UID'];
$c->add(IsoSubdivisionPeer::IC_UID, $country, Criteria::EQUAL);
$c->addAscendingOrderByColumn(IsoSubdivisionPeer::IS_NAME);
$locations = IsoSubdivisionPeer::doSelect($c);
$oData = array();
foreach ($locations as $rowid => $row) {
if (($row->getILUid() != '') && ($row->getILName() != '')) {
$oData[] = array('IL_UID' => $row->getILUid(), 'IL_NAME' => $row->getILName());
}
}
print(G::json_encode($oData));
break;
case 'usersList':
$filter = (isset($_POST['filter']))? $_POST['filter'] : '';
$arrayUser = [];
$user = new \ProcessMaker\BusinessModel\User();
$conf = new Configurations();
$arrayConfFormat = $conf->getFormats();
$arrayCondition = [[UsersPeer::USR_STATUS, ['ACTIVE', 'VACATION'], Criteria::IN]];
if (isset($_POST['USR_UID'])) {
$arrayCondition[] = [UsersPeer::USR_UID, $_POST['USR_UID'], Criteria::NOT_EQUAL];
}
$result = $user->getUsers(['condition' => $arrayCondition, 'filter' => $filter], null, null, null, 25);
foreach ($result['data'] as $record) {
$arrayUser[] = [
'USR_UID' => $record['USR_UID'],
'USER_FULLNAME' => G::getFormatUserList($arrayConfFormat['format'], $record)
];
}
echo G::json_encode($arrayUser);
break;
case 'availableCalendars':
$calendar = new Calendar();
$calendarObj = $calendar->getCalendarList(true, true);
$oData[] = array('CALENDAR_UID' => '', 'CALENDAR_NAME' => '- ' . G::LoadTranslation('ID_NONE') . ' -');
foreach ($calendarObj['array'] as $rowid => $row) {
if ($rowid > 0) {
$oData[] = array('CALENDAR_UID' => $row['CALENDAR_UID'], 'CALENDAR_NAME' => $row['CALENDAR_NAME']);
}
}
print(G::json_encode($oData));
break;
case 'rolesList':
require_once PATH_RBAC . "model/Roles.php";
$roles = new Roles();
$rolesData = $roles->getAllRoles();
foreach ($rolesData as $rowid => $row) {
$oData[] = array('ROL_UID' => $row['ROL_CODE'], 'ROL_CODE' => $row['ROL_NAME']);
}
print(G::json_encode($oData));
break;
case 'getUserLogedRole':
require_once 'classes/model/Users.php';
$oUser = new Users();
$aUserLog = $oUser->loadDetailed($_SESSION['USER_LOGGED']);
print(G::json_encode(array(
'USR_UID' => $aUserLog['USR_UID'],
'USR_USERNAME' => $aUserLog['USR_USERNAME'],
'USR_ROLE' => $aUserLog['USR_ROLE']
)));
break;
case 'languagesList':
$Translations = new Translation();
$langs = $Translations->getTranslationEnvironments();
$oData[] = array('LAN_ID' => '', 'LAN_NAME' => '- ' . G::LoadTranslation('ID_NONE') . ' -');
foreach ($langs as $lang) {
$oData[] = array('LAN_ID' => $lang['LOCALE'],'LAN_NAME' => $lang['LANGUAGE']
);
}
print(G::json_encode($oData));
break;
case 'saveUser':
case 'savePersonalInfo':
try {
verifyCsrfToken($_POST);
$user = new \ProcessMaker\BusinessModel\User();
$form = $_POST;
$permissionsToSaveData = $user->getPermissionsForEdit();
$form = $user->checkPermissionForEdit($_SESSION['USER_LOGGED'], $permissionsToSaveData, $form);
switch ($_POST['action']) {
case 'saveUser':
if (!$user->checkPermission($_SESSION['USER_LOGGED'], 'PM_USERS')) {
throw new Exception(G::LoadTranslation('ID_USER_NOT_HAVE_PERMISSION', [$_SESSION['USER_LOGGED']]));
}
break;
case 'savePersonalInfo':
if (!$user->checkPermission($_SESSION['USER_LOGGED'], 'PM_USERS') &&
!$user->checkPermission($_SESSION['USER_LOGGED'], 'PM_EDITPERSONALINFO')
) {
throw new Exception(G::LoadTranslation('ID_USER_NOT_HAVE_PERMISSION', [$_SESSION['USER_LOGGED']]));
}
break;
default:
throw new Exception(G::LoadTranslation('ID_INVALID_DATA'));
break;
}
if (array_key_exists('USR_LOGGED_NEXT_TIME', $form)) {
$form['USR_LOGGED_NEXT_TIME'] = ($form['USR_LOGGED_NEXT_TIME']) ? 1 : 0;
}
$userUid = '';
$auditLogType = '';
if ($form['USR_UID'] == '') {
$arrayUserData = $user->create($form);
$userUid = $arrayUserData['USR_UID'];
$auditLogType = 'INS';
} else {
if (array_key_exists('USR_NEW_PASS', $form) && $form['USR_NEW_PASS'] == '') {
unset($form['USR_NEW_PASS']);
}
$result = $user->update($form['USR_UID'], $form, $_SESSION['USER_LOGGED']);
$userUid = $form['USR_UID'];
$arrayUserData = $user->getUserRecordByPk($userUid, [], false);
$auditLogType = 'UPD';
}
$user->auditLog($auditLogType, array_merge(['USR_UID' => $userUid, 'USR_USERNAME' => $arrayUserData['USR_USERNAME']], $form));
/* Saving preferences */
$def_lang = isset($form['PREF_DEFAULT_LANG']) ? $form['PREF_DEFAULT_LANG'] : '';
$def_menu = isset($form['PREF_DEFAULT_MENUSELECTED']) ? $form['PREF_DEFAULT_MENUSELECTED'] : '';
$def_cases_menu = isset($form['PREF_DEFAULT_CASES_MENUSELECTED']) ? $form['PREF_DEFAULT_CASES_MENUSELECTED'] : '';
$oConf = new Configurations();
$aConf = array('DEFAULT_LANG' => $def_lang, 'DEFAULT_MENU' => $def_menu, 'DEFAULT_CASES_MENU' => $def_cases_menu);
$oConf->aConfig = $aConf;
$oConf->saveConfig('USER_PREFERENCES', '', '', $userUid);
if ($user->checkPermission($userUid, 'PM_EDIT_USER_PROFILE_PHOTO')) {
try {
$user->uploadImage($userUid);
} catch (Exception $e) {
$result = new stdClass();
$result->success = false;
$result->fileError = true;
echo G::json_encode($result);
exit(0);
$data = [];
foreach ($locations as $row) {
if (($row->getISUid() != '') && ($row->getISName() != '')) {
$data[] = ['IS_UID' => $row->getISUid(), 'IS_NAME' => $row->getISName()];
}
}
print(G::json_encode($data));
break;
case 'locationList':
$c = new Criteria();
$country = $_POST['IC_UID'];
$state = $_POST['IS_UID'];
$c->add(IsoLocationPeer::IC_UID, $country, Criteria::EQUAL);
$c->add(IsoLocationPeer::IS_UID, $state, Criteria::EQUAL);
$c->addAscendingOrderByColumn(IsoLocationPeer::IL_NAME);
$locations = IsoLocationPeer::doSelect($c);
if ($_SESSION['USER_LOGGED'] == $form['USR_UID']) {
/* UPDATING SESSION VARIABLES */
$aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']);
$_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
$data = [];
foreach ($locations as $row) {
if (($row->getILUid() != '') && ($row->getILName() != '')) {
$data[] = ['IL_UID' => $row->getILUid(), 'IL_NAME' => $row->getILName()];
}
}
print(G::json_encode($data));
break;
case 'usersList':
$filter = (isset($_POST['filter'])) ? $_POST['filter'] : '';
$arrayUser = [];
$user = new BmUser();
$conf = new Configurations();
$arrayConfFormat = $conf->getFormats();
$arrayCondition = [[UsersPeer::USR_STATUS, ['ACTIVE', 'VACATION'], Criteria::IN]];
if (isset($_POST['USR_UID'])) {
$arrayCondition[] = [UsersPeer::USR_UID, $_POST['USR_UID'], Criteria::NOT_EQUAL];
}
$result = new stdClass();
$result->success = true;
print(G::json_encode($result));
} catch (Exception $e) {
$result = new stdClass();
$result->success = false;
$result->error = $e->getMessage();
print(G::json_encode($result));
}
break;
case 'userData':
require_once 'classes/model/Users.php';
$_SESSION['CURRENT_USER'] = $_POST['USR_UID'];
$oUser = new Users();
$aFields = $oUser->loadDetailed($_POST['USR_UID']);
$results = $user->getUsers(['condition' => $arrayCondition, 'filter' => $filter], null, null, null, 25);
//Load Calendar options and falue for this user
$calendar = new Calendar();
$calendarInfo = $calendar->getCalendarFor($_POST['USR_UID'], $_POST['USR_UID'], $_POST['USR_UID']);
//If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar
$aFields['USR_CALENDAR'] = $calendarInfo['CALENDAR_APPLIED'] != 'DEFAULT' ? $calendarInfo['CALENDAR_UID'] : "";
$aFields['CALENDAR_NAME'] = $calendarInfo['CALENDAR_NAME'];
#verifying if it has any preferences on the configurations table
$oConf = new Configurations();
$oConf->loadConfig($x, 'USER_PREFERENCES', '', '', $aFields['USR_UID'], '');
$aFields['PREF_DEFAULT_MENUSELECTED'] = '';
$aFields['PREF_DEFAULT_CASES_MENUSELECTED'] = '';
$aFields['PREF_DEFAULT_LANG'] = isset($oConf->aConfig['DEFAULT_LANG']) ? $oConf->aConfig['DEFAULT_LANG'] : SYS_LANG;
if (isset($oConf->aConfig['DEFAULT_MENU'])) {
$aFields['PREF_DEFAULT_MENUSELECTED'] = $oConf->aConfig['DEFAULT_MENU'];
} else {
switch ($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']) {
case 'PROCESSMAKER_ADMIN':
$aFields['PREF_DEFAULT_MENUSELECTED'] = 'PM_SETUP';
break;
case 'PROCESSMAKER_OPERATOR':
$aFields['PREF_DEFAULT_MENUSELECTED'] = 'PM_CASES';
break;
foreach ($results['data'] as $record) {
$arrayUser[] = [
'USR_UID' => $record['USR_UID'],
'USER_FULLNAME' => G::getFormatUserList($arrayConfFormat['format'], $record)
];
}
}
$aFields['PREF_DEFAULT_CASES_MENUSELECTED'] = isset($oConf->aConfig['DEFAULT_CASES_MENU']) ? $oConf->aConfig['DEFAULT_CASES_MENU'] : '';
if ($aFields['USR_REPLACED_BY'] != '') {
echo G::json_encode($arrayUser);
break;
case 'availableCalendars':
$calendar = new Calendar();
$calendarObj = $calendar->getCalendarList(true, true);
$data = [['CALENDAR_UID' => '', 'CALENDAR_NAME' => '- ' . G::LoadTranslation('ID_NONE') . ' -']];
foreach ($calendarObj['array'] as $rowId => $row) {
if ($rowId > 0) {
$data[] = ['CALENDAR_UID' => $row['CALENDAR_UID'], 'CALENDAR_NAME' => $row['CALENDAR_NAME']];
}
}
print(G::json_encode($data));
break;
case 'rolesList':
$roles = new Roles();
$rolesData = $roles->getAllRoles();
$data = [];
foreach ($rolesData as $rowId => $row) {
$data[] = ['ROL_UID' => $row['ROL_CODE'], 'ROL_CODE' => $row['ROL_NAME']];
}
print(G::json_encode($data));
break;
case 'getUserLogedRole':
$user = new Users();
$u = $user->load($aFields['USR_REPLACED_BY']);
if ($u['USR_STATUS'] == 'CLOSED') {
$replaced_by = '';
$aFields['USR_REPLACED_BY'] = '';
} else {
$c = new Configurations();
$arrayConfFormat = $c->getFormats();
$replaced_by = G::getFormatUserList($arrayConfFormat['format'], $u);
$userLog = $user->loadDetailed($_SESSION['USER_LOGGED']);
print(G::json_encode([
'USR_UID' => $userLog['USR_UID'],
'USR_USERNAME' => $userLog['USR_USERNAME'],
'USR_ROLE' => $userLog['USR_ROLE']
]));
break;
case 'languagesList':
$translations = new Translation();
$languages = $translations->getTranslationEnvironments();
$data = [['LAN_ID' => '', 'LAN_NAME' => '- ' . G::LoadTranslation('ID_NONE') . ' -']];
foreach ($languages as $lang) {
$data[] = [
'LAN_ID' => $lang['LOCALE'],
'LAN_NAME' => $lang['LANGUAGE']
];
}
} else {
$replaced_by = '';
}
print(G::json_encode($data));
break;
case 'saveUser':
case 'savePersonalInfo':
try {
verifyCsrfToken($_POST);
$user = new BmUser();
$form = $_POST;
$permissionsToSaveData = $user->getPermissionsForEdit();
$form = $user->checkPermissionForEdit($_SESSION['USER_LOGGED'], $permissionsToSaveData, $form);
$aFields['REPLACED_NAME'] = $replaced_by;
switch ($_POST['action']) {
case 'saveUser':
if (!$user->checkPermission($_SESSION['USER_LOGGED'], 'PM_USERS')) {
throw new Exception(G::LoadTranslation('ID_USER_NOT_HAVE_PERMISSION',
[$_SESSION['USER_LOGGED']]));
}
break;
case 'savePersonalInfo':
if (!$user->checkPermission($_SESSION['USER_LOGGED'], 'PM_USERS') &&
!$user->checkPermission($_SESSION['USER_LOGGED'], 'PM_EDITPERSONALINFO')
) {
throw new Exception(G::LoadTranslation('ID_USER_NOT_HAVE_PERMISSION',
[$_SESSION['USER_LOGGED']]));
}
break;
default:
throw new Exception(G::LoadTranslation('ID_INVALID_DATA'));
break;
}
$menuSelected = '';
if (array_key_exists('USR_LOGGED_NEXT_TIME', $form)) {
$form['USR_LOGGED_NEXT_TIME'] = ($form['USR_LOGGED_NEXT_TIME']) ? 1 : 0;
}
if ($aFields['PREF_DEFAULT_MENUSELECTED'] != '') {
foreach ($RBAC->aUserInfo['PROCESSMAKER']['PERMISSIONS'] as $permission) {
if ($aFields['PREF_DEFAULT_MENUSELECTED'] == $permission['PER_CODE']) {
switch ($permission['PER_CODE']) {
case 'PM_USERS':
case 'PM_SETUP':
$menuSelected = strtoupper(G::LoadTranslation('ID_SETUP'));
break;
case 'PM_CASES':
$menuSelected = strtoupper(G::LoadTranslation('ID_CASES'));
break;
case 'PM_FACTORY':
$menuSelected = strtoupper(G::LoadTranslation('ID_APPLICATIONS'));
break;
case 'PM_DASHBOARD':
$menuSelected = strtoupper(G::LoadTranslation('ID_DASHBOARD'));
break;
}
$userUid = '';
$auditLogType = '';
if (empty($form['USR_UID'])) {
$arrayUserData = $user->create($form);
$userUid = $arrayUserData['USR_UID'];
$auditLogType = 'INS';
} else {
if ($aFields['PREF_DEFAULT_MENUSELECTED'] == 'PM_STRATEGIC_DASHBOARD') {
$menuSelected = strtoupper(G::LoadTranslation('ID_STRATEGIC_DASHBOARD'));
if (array_key_exists('USR_NEW_PASS', $form) && $form['USR_NEW_PASS'] == '') {
unset($form['USR_NEW_PASS']);
}
$results = $user->update($form['USR_UID'], $form, $_SESSION['USER_LOGGED']);
$userUid = $form['USR_UID'];
$arrayUserData = $user->getUserRecordByPk($userUid, [], false);
$auditLogType = 'UPD';
}
$user->auditLog($auditLogType,
array_merge(['USR_UID' => $userUid, 'USR_USERNAME' => $arrayUserData['USR_USERNAME']], $form));
/* Saving preferences */
$def_lang = isset($form['PREF_DEFAULT_LANG']) ? $form['PREF_DEFAULT_LANG'] : '';
$def_menu = isset($form['PREF_DEFAULT_MENUSELECTED']) ? $form['PREF_DEFAULT_MENUSELECTED'] : '';
$def_cases_menu = isset($form['PREF_DEFAULT_CASES_MENUSELECTED']) ? $form['PREF_DEFAULT_CASES_MENUSELECTED'] : '';
$configuration = new Configurations();
$configuration->aConfig = [
'DEFAULT_LANG' => $def_lang,
'DEFAULT_MENU' => $def_menu,
'DEFAULT_CASES_MENU' => $def_cases_menu
];
$configuration->saveConfig('USER_PREFERENCES', '', '', $userUid);
if ($user->checkPermission($userUid, 'PM_EDIT_USER_PROFILE_PHOTO')) {
try {
$user->uploadImage($userUid);
} catch (Exception $e) {
$result->success = false;
$result->fileError = true;
echo G::json_encode($result);
exit(0);
}
}
if ($_SESSION['USER_LOGGED'] == $form['USR_UID']) {
/* UPDATING SESSION VARIABLES */
$userInfo = $RBAC->userObj->load($_SESSION['USER_LOGGED']);
$_SESSION['USR_FULLNAME'] = $userInfo['USR_FIRSTNAME'] . ' ' . $userInfo['USR_LASTNAME'];
}
$result->success = true;
print(G::json_encode($result));
} catch (Exception $e) {
$result->success = false;
$result->error = $e->getMessage();
print(G::json_encode($result));
}
break;
case 'userData':
// Check if the user logged has the correct permission
if (($_POST['USR_UID'] !== $_SESSION['USER_LOGGED']) && ($RBAC->userCanAccess('PM_USERS') !== 1)) {
throw new Exception(G::LoadTranslation('ID_USER_NOT_HAVE_PERMISSION', [$_SESSION['USER_LOGGED']]));
}
$_SESSION['CURRENT_USER'] = $_POST['USR_UID'];
$user = new Users();
$fields = $user->loadDetailed($_POST['USR_UID']);
//Load Calendar options and falue for this user
$calendar = new Calendar();
$calendarInfo = $calendar->getCalendarFor($_POST['USR_UID'], $_POST['USR_UID'], $_POST['USR_UID']);
//If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar
$fields['USR_CALENDAR'] = $calendarInfo['CALENDAR_APPLIED'] != 'DEFAULT' ? $calendarInfo['CALENDAR_UID'] : "";
$fields['CALENDAR_NAME'] = $calendarInfo['CALENDAR_NAME'];
//verifying if it has any preferences on the configurations table
$configuration = new Configurations();
$configuration->loadConfig($x, 'USER_PREFERENCES', '', '', $fields['USR_UID'], '');
$fields['PREF_DEFAULT_MENUSELECTED'] = '';
$fields['PREF_DEFAULT_CASES_MENUSELECTED'] = '';
$fields['PREF_DEFAULT_LANG'] = isset($configuration->aConfig['DEFAULT_LANG']) ? $configuration->aConfig['DEFAULT_LANG'] : SYS_LANG;
if (isset($configuration->aConfig['DEFAULT_MENU'])) {
$fields['PREF_DEFAULT_MENUSELECTED'] = $configuration->aConfig['DEFAULT_MENU'];
} else {
switch ($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']) {
case 'PROCESSMAKER_ADMIN':
$fields['PREF_DEFAULT_MENUSELECTED'] = 'PM_SETUP';
break;
case 'PROCESSMAKER_OPERATOR':
$fields['PREF_DEFAULT_MENUSELECTED'] = 'PM_CASES';
break;
}
}
$fields['PREF_DEFAULT_CASES_MENUSELECTED'] = isset($configuration->aConfig['DEFAULT_CASES_MENU']) ? $configuration->aConfig['DEFAULT_CASES_MENU'] : '';
if ($fields['USR_REPLACED_BY'] != '') {
$user = new Users();
$u = $user->load($fields['USR_REPLACED_BY']);
if ($u['USR_STATUS'] == 'CLOSED') {
$replaced_by = '';
$fields['USR_REPLACED_BY'] = '';
} else {
$c = new Configurations();
$arrayConfFormat = $c->getFormats();
$replaced_by = G::getFormatUserList($arrayConfFormat['format'], $u);
}
} else {
$replaced_by = '';
}
$fields['REPLACED_NAME'] = $replaced_by;
$menuSelected = '';
if ($fields['PREF_DEFAULT_MENUSELECTED'] != '') {
foreach ($RBAC->aUserInfo['PROCESSMAKER']['PERMISSIONS'] as $permission) {
if ($fields['PREF_DEFAULT_MENUSELECTED'] == $permission['PER_CODE']) {
switch ($permission['PER_CODE']) {
case 'PM_USERS':
case 'PM_SETUP':
$menuSelected = strtoupper(G::LoadTranslation('ID_SETUP'));
break;
case 'PM_CASES':
$menuSelected = strtoupper(G::LoadTranslation('ID_CASES'));
break;
case 'PM_FACTORY':
$menuSelected = strtoupper(G::LoadTranslation('ID_APPLICATIONS'));
break;
case 'PM_DASHBOARD':
$menuSelected = strtoupper(G::LoadTranslation('ID_DASHBOARD'));
break;
}
} else {
if ($fields['PREF_DEFAULT_MENUSELECTED'] == 'PM_STRATEGIC_DASHBOARD') {
$menuSelected = strtoupper(G::LoadTranslation('ID_STRATEGIC_DASHBOARD'));
}
}
}
}
}
$aFields['MENUSELECTED_NAME'] = $menuSelected;
$fields['MENUSELECTED_NAME'] = $menuSelected;
$oMenu = new Menu();
$oMenu->load('cases');
$casesMenuSelected = '';
$menu = new Menu();
$menu->load('cases');
$casesMenuSelected = '';
if ($aFields['PREF_DEFAULT_CASES_MENUSELECTED'] != '') {
foreach ($oMenu->Id as $i => $item) {
if ($aFields['PREF_DEFAULT_CASES_MENUSELECTED'] == $item) {
$casesMenuSelected = $oMenu->Labels[$i];
if ($fields['PREF_DEFAULT_CASES_MENUSELECTED'] != '') {
foreach ($menu->Id as $i => $item) {
if ($fields['PREF_DEFAULT_CASES_MENUSELECTED'] == $item) {
$casesMenuSelected = $menu->Labels[$i];
}
}
}
}
require_once 'classes/model/Users.php';
$oUser = new Users();
$aUserLog = $oUser->loadDetailed($_SESSION['USER_LOGGED']);
$aFields['USER_LOGGED_NAME'] = $aUserLog['USR_USERNAME'];
$aFields['USER_LOGGED_ROLE'] = $aUserLog['USR_ROLE'];
$user = new Users();
$userLog = $user->loadDetailed($_SESSION['USER_LOGGED']);
$fields['USER_LOGGED_NAME'] = $userLog['USR_USERNAME'];
$fields['USER_LOGGED_ROLE'] = $userLog['USR_ROLE'];
$aFields['CASES_MENUSELECTED_NAME'] = $casesMenuSelected;
$fields['CASES_MENUSELECTED_NAME'] = $casesMenuSelected;
require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties();
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($aFields['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array($oUser->getUsrPassword()))));
$aFields['USR_LOGGED_NEXT_TIME'] = $aUserProperty['USR_LOGGED_NEXT_TIME'];
$userProperties = new UsersProperties();
$properties = $userProperties->loadOrCreateIfNotExists($fields['USR_UID'],
['USR_PASSWORD_HISTORY' => serialize([$user->getUsrPassword()])]);
$fields['USR_LOGGED_NEXT_TIME'] = $properties['USR_LOGGED_NEXT_TIME'];
if (array_key_exists('USR_PASSWORD', $aFields)) {
unset($aFields['USR_PASSWORD']);
}
$userPermissions = new \ProcessMaker\BusinessModel\User();
$permissions = $userPermissions->loadDetailedPermissions($aFields);
$result->success = true;
$result->user = $aFields;
$result->permission = $permissions;
print(G::json_encode($result));
break;
case 'defaultMainMenuOptionList':
foreach ($RBAC->aUserInfo['PROCESSMAKER']['PERMISSIONS'] as $permission) {
switch ($permission['PER_CODE']) {
case 'PM_USERS':
case 'PM_SETUP':
$rows[] = array('id' => 'PM_SETUP', 'name' => strtoupper(G::LoadTranslation('ID_SETUP'))
);
break;
case 'PM_CASES':
$rows[] = array('id' => 'PM_CASES', 'name' => strtoupper(G::LoadTranslation('ID_CASES'))
);
break;
case 'PM_FACTORY':
$rows[] = array('id' => 'PM_FACTORY', 'name' => strtoupper(G::LoadTranslation('ID_APPLICATIONS'))
);
break;
case 'PM_DASHBOARD':
$rows[] = array('id' => 'PM_DASHBOARD', 'name' => strtoupper(G::LoadTranslation('ID_DASHBOARD'))
);
/*----------------------------------********---------------------------------*/
// NEW DASHBOARD MODULE
$licensedFeatures = PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=')) {
$rows[] = array('id' => 'PM_STRATEGIC_DASHBOARD', 'name' => strtoupper(G::LoadTranslation('ID_STRATEGIC_DASHBOARD'))
);
}
/*----------------------------------********---------------------------------*/
break;
if (array_key_exists('USR_PASSWORD', $fields)) {
unset($fields['USR_PASSWORD']);
}
}
print(G::json_encode($rows));
break;
case 'defaultCasesMenuOptionList':
$oMenu = new Menu();
$oMenu->load('cases');
$userPermissions = new BmUser();
$permissions = $userPermissions->loadDetailedPermissions($fields);
foreach ($oMenu->Id as $i => $item) {
if ($oMenu->Types[$i] != 'blockHeader') {
$rowsCasesMenu[] = array('id' => $item, 'name' => $oMenu->Labels[$i]);
$result->success = true;
$result->user = $fields;
$result->permission = $permissions;
print(G::json_encode($result));
break;
case 'defaultMainMenuOptionList':
$rows = [];
foreach ($RBAC->aUserInfo['PROCESSMAKER']['PERMISSIONS'] as $permission) {
switch ($permission['PER_CODE']) {
case 'PM_USERS':
case 'PM_SETUP':
$rows[] = [
'id' => 'PM_SETUP',
'name' => strtoupper(G::LoadTranslation('ID_SETUP'))
];
break;
case 'PM_CASES':
$rows[] = [
'id' => 'PM_CASES',
'name' => strtoupper(G::LoadTranslation('ID_CASES'))
];
break;
case 'PM_FACTORY':
$rows[] = [
'id' => 'PM_FACTORY',
'name' => strtoupper(G::LoadTranslation('ID_APPLICATIONS'))
];
break;
case 'PM_DASHBOARD':
$rows[] = [
'id' => 'PM_DASHBOARD',
'name' => strtoupper(G::LoadTranslation('ID_DASHBOARD'))
];
/*----------------------------------********---------------------------------*/
// NEW DASHBOARD MODULE
$licensedFeatures = PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=')) {
$rows[] = [
'id' => 'PM_STRATEGIC_DASHBOARD',
'name' => strtoupper(G::LoadTranslation('ID_STRATEGIC_DASHBOARD'))
];
}
/*----------------------------------********---------------------------------*/
break;
}
}
}
print(G::json_encode($rowsCasesMenu));
break;
case 'testPassword':
require_once 'classes/model/UsersProperties.php';
$userProperty = new UsersProperties();
print(G::json_encode($rows));
break;
case 'defaultCasesMenuOptionList':
$menu = new Menu();
$menu->load('cases');
$fields = [];
$color = '';
$img = '';
$dateNow = date('Y-m-d H:i:s');
$errorInPassword = $userProperty->validatePassword($_POST['PASSWORD_TEXT'], $dateNow, 0);
if (!empty($errorInPassword)) {
$img = '/images/delete.png';
$color = 'red';
if (!defined('NO_DISPLAY_USERNAME')) {
define('NO_DISPLAY_USERNAME', 1);
foreach ($menu->Id as $i => $item) {
if ($menu->Types[$i] != 'blockHeader') {
$rowsCasesMenu[] = ['id' => $item, 'name' => $menu->Labels[$i]];
}
}
$fields = $userProperty->getMessageValidatePassword($errorInPassword);
$fields['STATUS'] = false;
} else {
$color = 'green';
$img = '/images/dialog-ok-apply.png';
$fields['DESCRIPTION'] = G::LoadTranslation('ID_PASSWORD_COMPLIES_POLICIES') . '</span>';
$fields['STATUS'] = true;
}
$span = '<span style="color: ' . $color . '; font: 9px tahoma,arial,helvetica,sans-serif;">';
$gif = '<img width="13" height="13" border="0" src="' . $img . '">';
$fields['DESCRIPTION'] = $span . $gif . $fields['DESCRIPTION'];
print(G::json_encode($fields));
break;
case 'testUsername':
require_once 'classes/model/Users.php';
$_POST['NEW_USERNAME'] = trim($_POST['NEW_USERNAME']);
$USR_UID = isset($_POST['USR_UID']) ? $_POST['USR_UID'] : '';
print(G::json_encode($rowsCasesMenu));
break;
case 'testPassword':
$userProperty = new UsersProperties();
$response = array("success" => true);
$fields = [];
$color = '';
$img = '';
$dateNow = date('Y-m-d H:i:s');
$errorInPassword = $userProperty->validatePassword($_POST['PASSWORD_TEXT'], $dateNow, 0);
$oCriteria = new Criteria();
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
if (!empty($errorInPassword)) {
$img = '/images/delete.png';
$color = 'red';
if (!defined('NO_DISPLAY_USERNAME')) {
define('NO_DISPLAY_USERNAME', 1);
}
$fields = $userProperty->getMessageValidatePassword($errorInPassword);
$fields['STATUS'] = false;
} else {
$color = 'green';
$img = '/images/dialog-ok-apply.png';
$fields['DESCRIPTION'] = G::LoadTranslation('ID_PASSWORD_COMPLIES_POLICIES') . '</span>';
$fields['STATUS'] = true;
}
$span = '<span style="color: ' . $color . '; font: 9px tahoma,arial,helvetica,sans-serif;">';
$gif = '<img width="13" height="13" border="0" src="' . $img . '">';
$fields['DESCRIPTION'] = $span . $gif . $fields['DESCRIPTION'];
print(G::json_encode($fields));
break;
case 'testUsername':
$_POST['NEW_USERNAME'] = trim($_POST['NEW_USERNAME']);
$usrUid = isset($_POST['USR_UID']) ? $_POST['USR_UID'] : '';
$oCriteria->add(UsersPeer::USR_USERNAME, utf8_encode($_POST['NEW_USERNAME']));
if ($USR_UID != '') {
$oCriteria->add(UsersPeer::USR_UID, array($_POST['USR_UID']), Criteria::NOT_IN);
}
$oDataset = UsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
$response = ["success" => true];
if (is_array($aRow) || $_POST['NEW_USERNAME'] == '') {
$color = 'red';
$img = '/images/delete.png';
$dataVar['USER_ID'] = $_POST['NEW_USERNAME'];
$text = G::LoadTranslation('ID_USERNAME_ALREADY_EXISTS', $dataVar);
$text = ($_POST['NEW_USERNAME'] == '') ? G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME') : $text;
$response['exists'] = true;
} else {
$color = 'green';
$img = '/images/dialog-ok-apply.png';
$text = G::LoadTranslation('ID_USERNAME_CORRECT');
$response['exists'] = false;
}
$criteria = new Criteria();
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
$span = '<span style="color: ' . $color . '; font: 9px tahoma,arial,helvetica,sans-serif;">';
$gif = '<img width="13" height="13" border="0" src="' . $img . '">';
$response['descriptionText'] = $span . $gif . $text . '</span>';
echo G::json_encode($response);
break;
case "passwordValidate":
$messageResultLogin = "";
$password = $_POST["password"];
$resultLogin = $RBAC->VerifyLogin($_SESSION["USR_USERNAME"], $password);
$criteria->add(UsersPeer::USR_USERNAME, utf8_encode($_POST['NEW_USERNAME']));
if ($usrUid != '') {
$criteria->add(UsersPeer::USR_UID, [$_POST['USR_UID']], Criteria::NOT_IN);
}
$dataSet = UsersPeer::doSelectRS($criteria);
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataSet->next();
$row = $dataSet->getRow();
if ($resultLogin == $_SESSION["USER_LOGGED"]) {
$messageResultLogin = "OK";
} else {
$messageResultLogin = "ERROR";
}
if (is_array($row) || $_POST['NEW_USERNAME'] == '') {
$color = 'red';
$img = '/images/delete.png';
$dataVar = ['USER_ID' => $_POST['NEW_USERNAME']];
$text = G::LoadTranslation('ID_USERNAME_ALREADY_EXISTS', $dataVar);
$text = ($_POST['NEW_USERNAME'] == '') ? G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME') : $text;
$response['exists'] = true;
} else {
$color = 'green';
$img = '/images/dialog-ok-apply.png';
$text = G::LoadTranslation('ID_USERNAME_CORRECT');
$response['exists'] = false;
}
$response = array();
$response["result"] = $messageResultLogin;
echo G::json_encode($response);
break;
$span = '<span style="color: ' . $color . '; font: 9px tahoma,arial,helvetica,sans-serif;">';
$gif = '<img width="13" height="13" border="0" src="' . $img . '">';
$response['descriptionText'] = $span . $gif . $text . '</span>';
echo G::json_encode($response);
break;
case "passwordValidate":
$messageResultLogin = "";
$password = $_POST["password"];
$resultLogin = $RBAC->VerifyLogin($_SESSION["USR_USERNAME"], $password);
if ($resultLogin == $_SESSION["USER_LOGGED"]) {
$messageResultLogin = "OK";
} else {
$messageResultLogin = "ERROR";
}
$response = [];
$response["result"] = $messageResultLogin;
echo G::json_encode($response);
break;
}
} catch (Exception $e) {
$result->success = false;
$result->error = $e->getMessage();
echo G::json_encode($result);
}

0
workflow/engine/plugins/.gitignore vendored Normal file
View File

View File

@@ -1,29 +0,0 @@
<?php
class chartsPlugin extends PMPlugin
{
public function chartsPlugin($sNamespace, $sFilename = null)
{
$res = parent::PMPlugin($sNamespace, $sFilename);
$this->sFriendlyName = 'Charts Plugin';
$this->sDescription = 'This plugin shows generic charts for ProcessMaker';
$this->sPluginFolder = 'charts';
$this->sSetupPage = 'setupPage';
$this->aWorkspaces = array( );
$this->iVersion = 0.45;
$this->bPrivate = true;
return $res;
}
public function setup()
{
$this->registerTrigger(10000, 'createCaseFolder');
}
public function install()
{
}
}
$oPluginRegistry = PMPluginRegistry::getSingleton();
$oPluginRegistry->registerPlugin('charts', __FILE__);

View File

@@ -1,106 +0,0 @@
<?php
require_once ( "classes/model/Application.php" );
require_once ( "classes/model/AppDelegation.php" );
require_once ( "classes/model/Process.php" );
class chartsClass extends PMPlugin {
function __construct ( ) {
}
function readConfig () {
$fileConf = PATH_PLUGINS . 'charts' . PATH_SEP . 'config' . PATH_SEP . 'setup.conf';
if ( !file_exists( dirname($fileConf) ) )
throw ( new Exception ("The directory " . dirname($fileConf) . " doesn't exist." ) );
if ( file_exists ( $fileConf ) && !is_writable( $fileConf ) )
throw ( new Exception ("The file $fileConf doesn't exist or this file is not writable." ) );
$content = file_get_contents ( $fileConf);
$fields = unserialize ($content);
return $fields;
}
function getFieldsForPageSetup () {
$fileConf = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . 'config' . PATH_SEP . 'setup.conf';
if ( !file_exists( dirname($fileConf) ) )
throw ( new Exception ("The directory " . dirname($fileConf) . " doesn't exist." ) );
if ( file_exists ( $fileConf ) && !is_writable( $fileConf ) )
throw ( new Exception ("The file $fileConf doesn't exist or this file is not writable." ) );
if ( file_exists ( $fileConf ) ) {
$content = file_get_contents ( $fileConf);
$fields = unserialize ($content);
}
else
$fields = array();
return $fields;
}
function updateFieldsForPageSetup ( $oData) {
$content = serialize ($oData['form']);
$fileConf = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . 'config' . PATH_SEP . 'setup.conf';
if ( !is_writable( dirname($fileConf) ) )
throw ( new Exception ("The directory " . dirname($fileConf) . " doesn't exist or this directory is not writable." ) );
if ( file_exists ( $fileConf ) && !is_writable( $fileConf ) )
throw ( new Exception ("The file $fileConf doesn't exist or this file is not writable." ) );
file_put_contents ( $fileConf, $content);
return true;
}
function setup() {
}
function getDatasetCasesByStatus ( ) {
$dataSet = new XYDataSet();
$c = new Criteria('workflow');
$c->clearSelectColumns();
$c->addSelectColumn ( ApplicationPeer::APP_STATUS );
$c->addSelectColumn ( 'COUNT(*) AS CANT') ;
$c->addGroupByColumn(ApplicationPeer::APP_STATUS);
$rs = ApplicationPeer::doSelectRS( $c );
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
while ( is_array ( $row ) ) {
$label = $row['APP_STATUS'];
$value = $row['CANT'];
$dataSet->addPoint(new Point($label , (int)$value ) );
$rs->next();
$row = $rs->getRow();
}
return $dataSet;
}
//we are trying to obtain the process title thru the long way, using the process object.
//there is a short way, if you use a more complex query joining Content Table.
function getDatasetCasesByProcess ( ) {
$dataSet = new XYDataSet();
$processObj = new Process;
$c = new Criteria('workflow');
$c->clearSelectColumns();
$c->addSelectColumn ( ApplicationPeer::PRO_UID );
$c->addSelectColumn ( 'COUNT(*) AS CANT') ;
//$c->addJoin( ProcessPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->addGroupByColumn(ApplicationPeer::PRO_UID);
$rs = ApplicationPeer::doSelectRS( $c );
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
while ( is_array ( $row ) ) {
$processObj->load ( $row['PRO_UID'] );
$label = $processObj->getProTitle();
$value = $row['CANT'];
$dataSet->addPoint(new Point($label , (int)$value) );
$rs->next();
$row = $rs->getRow();
}
return $dataSet;
}
}

View File

@@ -1 +0,0 @@
a:1:{s:6:"ACCEPT";s:4:"Save";}

View File

@@ -1,60 +0,0 @@
<?php
/**
* dashboard.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
//if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response;
require_once ( "class.charts.php" );
header("Content-type: image/png");
//type of chart, pie, vertical bar, horizontal, etc.
$type = isset ( $_GET['type']) ? $_GET['type'] : '1' ;
$chartType = isset ( $_GET['chart']) ? $_GET['chart'] : '1' ;
$user = isset ( $_GET['user']) ? $_GET['user'] : $_SESSION['USER_LOGGED'] ;
$chartsObj = new chartsClass();
//$chart = new PieChart(450,300);
switch ( $type ) {
case '1' :
$chart = new VerticalBarChart(430, 280); break;
case '2' :
$chart = new HorizontalBarChart(430, 200); break;
case '3' :
$chart = new LineChart(430, 280); break;
case '4' :
$chart = new PieChart(430, 200 ); break;
}
switch ( $chartType ) {
case '1' :
$dataSet = $chartsObj->getDatasetCasesByStatus(); break;
default :
$dataSet = $chartsObj->getDatasetCasesByProcess(); break;
}
$chart->setDataSet($dataSet);
$chart->setTitle( "Cases list" );
$chart->render();

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm
name="About Charts Plugin"
type="xmlform"
width="550"
>
<TITLE type="title" >
<en>About charts Plugin</en>
</TITLE>
<sTITLE type="subtitle" >
<en>This is the Charts Plugin, with this plugin you can see many differents charts</en>
</sTITLE>
<ACCEPT type="submit" >
<en>Save</en>
</ACCEPT>
</dynaForm>

View File

@@ -1,61 +0,0 @@
<?php
/**
* processTemplate.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
class processTemplatePlugin extends PMPlugin
{
public function processTemplatePlugin($sNamespace, $sFilename = null)
{
$res = parent::PMPlugin($sNamespace, $sFilename);
$this->sFriendlyName = 'Process Map Templates';
$this->sDescription = 'This plugin includes various templates for quick and easy Process Map creation. Users can customize Process Maps based on pre-defined templates of common process designs (including Parallel, Dual Start Task, and Selection).';
$this->sPluginFolder = 'processTemplate';
$this->sSetupPage = null;
$this->iVersion = 0.78;
$this->bPrivate = true;
$this->aWorkspaces = array( '__' );
return $res;
}
public function setup()
{
//$this->registerTrigger( PM_NEW_PROCESS_LIST, 'getNewProcessTemplateList' );
//$this->registerTrigger( PM_NEW_PROCESS_SAVE, 'saveNewProcess' );
//$this->registerTrigger( PM_NEW_DYNAFORM_LIST, 'getNewDynaformTemplateList' );
//$this->registerTrigger( PM_NEW_DYNAFORM_SAVE, 'saveNewDynaform' );
}
public function install()
{
}
public function enable()
{
}
public function disable()
{
}
}
$oPluginRegistry = PMPluginRegistry::getSingleton();
$oPluginRegistry->registerPlugin('processTemplate', __FILE__);

View File

@@ -1,195 +0,0 @@
<?php
/**
* class.processTemplate.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
class processTemplateClass extends PMPlugin {
function __construct ( ) {
}
function getNewProcessTemplateList ( $oData ) {
global $_DBArray;
$rows[] = array ( 'uid' => 'char', 'name' => 'char', );
$rows[] = array ( 'uid' => '', 'name' => 'blank process' );
$rows[] = array ( 'uid' => 1, 'name' => 'simple process, three tasks' );
$rows[] = array ( 'uid' => 2, 'name' => 'simple parallel process' );
$rows[] = array ( 'uid' => 3, 'name' => 'conditional process' );
$rows[] = array ( 'uid' => 4, 'name' => 'double starting task' );
$rows[] = array ( 'uid' => 5, 'name' => 'advanced parallel process' );
$_DBArray['ProcessesNew'] = $rows;
}
function saveNewProcess ( $oData ) {
switch ($oData['PRO_TEMPLATE']) {
case 1 : $this->simpleProcess ( $oData);
break;
case 2 : $this->simpleParallel ( $oData);
break;
case 3 : $this->conditional ( $oData);
break;
case 4 : $this->doubleStart ( $oData);
break;
case 5 : $this->fullParallel ( $oData);
break;
default :
}
}
function simpleProcess ($oData ) {
//$oJSON = new Services_JSON();
$sProUid = $oData['PRO_UID'];
$sTemplate = $oData['PRO_TEMPLATE'];
$oProcessMap = $oData['PROCESSMAP'];
$t1 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 70) );
$t2 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 160) );
$t3 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 250) );
$task1 = $t1->uid;
$task2 = $t2->uid;
$task3 = $t3->uid;
$aData = array("TAS_START"=>"TRUE","TAS_UID"=>$task1);
$oTask = new Task();
$oTask->update($aData);
$oProcessMap->saveNewPattern($sProUid, $task1, $task2, 'SEQUENTIAL' );
$oProcessMap->saveNewPattern($sProUid, $task2, $task3, 'SEQUENTIAL' );
$oProcessMap->saveNewPattern($sProUid, $task3, -1, 'SEQUENTIAL' );
}
function simpleParallel ($oData ) {
//$oJSON = new Services_JSON();
$sProUid = $oData['PRO_UID'];
$sTemplate = $oData['PRO_TEMPLATE'];
$oProcessMap = $oData['PROCESSMAP'];
$t1 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 70) );
$t2 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 200, 160) );
$t3 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 400, 160) );
$t5 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 250) );
$aData = array("TAS_START"=>"TRUE","TAS_UID"=>$t1->uid);
$oTask = new Task();
$oTask->update($aData);
$oProcessMap->saveNewPattern($sProUid, $t1->uid, $t2->uid, 'PARALLEL' );
$oProcessMap->saveNewPattern($sProUid, $t1->uid, $t3->uid, 'PARALLEL' );
$oProcessMap->saveNewPattern($sProUid, $t2->uid, $t5->uid, 'SEC-JOIN' );
$oProcessMap->saveNewPattern($sProUid, $t3->uid, $t5->uid, 'SEC-JOIN' );
$oProcessMap->saveNewPattern($sProUid, $t5->uid, -1, 'SEQUENTIAL' );
}
function fullParallel ($oData ) {
//$oJSON = new Services_JSON();
$sProUid = $oData['PRO_UID'];
$sTemplate = $oData['PRO_TEMPLATE'];
$oProcessMap = $oData['PROCESSMAP'];
$t1 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 70) );
$t2 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 100, 160) );
$t3 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 160) );
$t4 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 500, 160) );
$t5 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 200, 250) );
$t6 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 500, 250) );
$t7 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 350, 340) );
$aData = array("TAS_START"=>"TRUE","TAS_UID"=>$t1->uid);
$oTask = new Task();
$oTask->update($aData);
$oProcessMap->saveNewPattern($sProUid, $t1->uid, $t2->uid, 'PARALLEL' );
$oProcessMap->saveNewPattern($sProUid, $t1->uid, $t3->uid, 'PARALLEL' );
$oProcessMap->saveNewPattern($sProUid, $t1->uid, $t4->uid, 'PARALLEL' );
$oProcessMap->saveNewPattern($sProUid, $t2->uid, $t5->uid, 'SEC-JOIN' );
$oProcessMap->saveNewPattern($sProUid, $t3->uid, $t5->uid, 'SEC-JOIN' );
$oProcessMap->saveNewPattern($sProUid, $t4->uid, $t6->uid, 'SEQUENTIAL' );
$oProcessMap->saveNewPattern($sProUid, $t5->uid, $t7->uid, 'SEC-JOIN' );
$oProcessMap->saveNewPattern($sProUid, $t6->uid, $t7->uid, 'SEC-JOIN' );
$oProcessMap->saveNewPattern($sProUid, $t7->uid, -1, 'SEQUENTIAL' );
}
function conditional ($oData ) {
//$oJSON = new Services_JSON();
$sProUid = $oData['PRO_UID'];
$sTemplate = $oData['PRO_TEMPLATE'];
$oProcessMap = $oData['PROCESSMAP'];
$t1 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 70) );
$t2 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 200, 160) );
$t3 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 400, 160) );
$t4 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 250) );
$task1 = $t1->uid;
$task2 = $t2->uid;
$task3 = $t3->uid;
$task4 = $t4->uid;
$aData = array("TAS_START"=>"TRUE","TAS_UID"=>$task1);
$oTask = new Task();
$oTask->update($aData);
$oProcessMap->saveNewPattern($sProUid, $task1, $task2, 'SELECT' );
$oProcessMap->saveNewPattern($sProUid, $task1, $task3, 'SELECT' );
$oProcessMap->saveNewPattern($sProUid, $task2, $task4, 'SEQUENTIAL' );
$oProcessMap->saveNewPattern($sProUid, $task3, $task4, 'SEQUENTIAL' );
$oProcessMap->saveNewPattern($sProUid, $task4, -1, 'SEQUENTIAL' );
}
function doubleStart ($oData ) {
//$oJSON = new Services_JSON();
$sProUid = $oData['PRO_UID'];
$sTemplate = $oData['PRO_TEMPLATE'];
$oProcessMap = $oData['PROCESSMAP'];
$t1 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 200, 70) );
$t2 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 400, 70) );
$t3 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 160) );
$task1 = $t1->uid;
$task2 = $t2->uid;
$task3 = $t3->uid;
$aData = array("TAS_START"=>"TRUE","TAS_UID"=>$task1);
$oTask = new Task();
$oTask->update($aData);
$aData = array("TAS_START"=>"TRUE","TAS_UID"=>$task2);
$oTask = new Task();
$oTask->update($aData);
$oProcessMap->saveNewPattern($sProUid, $task1, $task3, 'SEQUENTIAL' );
$oProcessMap->saveNewPattern($sProUid, $task2, $task3, 'SEQUENTIAL' );
$oProcessMap->saveNewPattern($sProUid, $task3, -1, 'SEQUENTIAL' );
}
function setup()
{
}
}

View File

@@ -40,6 +40,7 @@ use ProcessMaker\BusinessModel\Task as BmTask;
use ProcessMaker\BusinessModel\User as BmUser;
use ProcessMaker\Core\System;
use ProcessMaker\Exception\UploadException;
use ProcessMaker\Model\Application as ModelApplication;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Services\OAuth2\Server;
@@ -1114,35 +1115,37 @@ class Cases
* Delete case
*
* @access public
* @param string $app_uid, Uid for case
* @param string $usr_uid, Uid user
* @param string $appUid, Uid for case
* @param string $usrUid, Uid user
*
* @return void
* @throws Exception
*/
public function deleteCase($app_uid, $usr_uid)
public function deleteCase($appUid, $usrUid)
{
Validator::isString($app_uid, '$app_uid');
Validator::appUid($app_uid, '$app_uid');
Validator::isString($appUid, '$app_uid');
Validator::appUid($appUid, '$app_uid');
$criteria = new Criteria();
$criteria->addSelectColumn(ApplicationPeer::APP_STATUS);
$criteria->addSelectColumn(ApplicationPeer::APP_INIT_USER);
$criteria->add(ApplicationPeer::APP_UID, $app_uid, Criteria::EQUAL);
$dataset = ApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
if ($aRow['APP_STATUS'] != 'DRAFT') {
throw (new Exception(G::LoadTranslation("ID_DELETE_CASE_NO_STATUS")));
// Review the permission for delete case
global $RBAC;
if ($RBAC->userCanAccess('PM_DELETECASE') != 1) {
throw new Exception(G::LoadTranslation('ID_NOT_ABLE_DELETE_CASES'));
}
if ($aRow['APP_INIT_USER'] != $usr_uid) {
throw (new Exception(G::LoadTranslation("ID_DELETE_CASE_NO_OWNER")));
// Review the status and user
$caseInfo = ModelApplication::getCase($appUid);
if (!empty($caseInfo)){
// Review the status
if ($caseInfo['APP_STATUS'] != 'DRAFT') {
throw new Exception(G::LoadTranslation("ID_DELETE_CASE_NO_STATUS"));
}
// Review the user requester
if ($caseInfo['APP_INIT_USER'] != $usrUid) {
throw new Exception(G::LoadTranslation("ID_DELETE_CASE_NO_OWNER"));
}
}
$case = new ClassesCases();
$case->removeCase($app_uid);
$case->removeCase($appUid);
}
/**
@@ -1733,7 +1736,7 @@ class Cases
* @return array
* @throws Exception
*/
private function __getFieldsAndValuesByDynaFormAndAppData(array $form, array $appData, array $caseVariable)
private function getFieldsAndValuesByDynaFormAndAppData(array $form, array $appData, array $caseVariable)
{
try {
foreach ($form['items'] as $value) {
@@ -1754,7 +1757,7 @@ class Cases
}
}
} else {
$caseVariableAux = $this->__getFieldsAndValuesByDynaFormAndAppData($field, $appData,
$caseVariableAux = $this->getFieldsAndValuesByDynaFormAndAppData($field, $appData,
$caseVariable);
$caseVariable = array_merge($caseVariable, $caseVariableAux);
}
@@ -1827,7 +1830,7 @@ class Cases
$arrayAppData = $fields['APP_DATA'];
$arrayCaseVariable = $this->__getFieldsAndValuesByDynaFormAndAppData(
$arrayCaseVariable = $this->getFieldsAndValuesByDynaFormAndAppData(
$arrayDynContent['items'][0], $arrayAppData, $arrayCaseVariable
);
} else {
@@ -2406,7 +2409,7 @@ class Cases
* @return array
* @throws Exception
*/
private function __getStatusInfoDataByRsCriteria($rsCriteria)
private function getStatusInfoDataByRsCriteria($rsCriteria)
{
try {
$arrayData = [];
@@ -2489,7 +2492,7 @@ class Cases
$rsCriteria = AppDelayPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$arrayData = $this->__getStatusInfoDataByRsCriteria($rsCriteria);
$arrayData = $this->getStatusInfoDataByRsCriteria($rsCriteria);
if (!empty($arrayData)) {
return $arrayData;
@@ -2522,7 +2525,7 @@ class Cases
$rsCriteria = AppCacheViewPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$arrayData = $this->__getStatusInfoDataByRsCriteria($rsCriteria);
$arrayData = $this->getStatusInfoDataByRsCriteria($rsCriteria);
if (!empty($arrayData)) {
return $arrayData;
@@ -2565,7 +2568,7 @@ class Cases
$rsCriteria = ApplicationPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$arrayData = $this->__getStatusInfoDataByRsCriteria($rsCriteria);
$arrayData = $this->getStatusInfoDataByRsCriteria($rsCriteria);
if (!empty($arrayData)) {
return $arrayData;
@@ -2605,7 +2608,7 @@ class Cases
$rsCriteria2 = ApplicationPeer::doSelectRS($criteria2);
$rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$arrayData = $this->__getStatusInfoDataByRsCriteria($rsCriteria2);
$arrayData = $this->getStatusInfoDataByRsCriteria($rsCriteria2);
if (!empty($arrayData)) {
return $arrayData;
@@ -3152,7 +3155,7 @@ class Cases
*
* @return array Returns array with Case data updated
*/
private function __applicationDataDeleteMultipleFile(
private function applicationDataDeleteMultipleFile(
array $arrayApplicationData,
$variable1,
$variable2,
@@ -3198,7 +3201,7 @@ class Cases
case 'GRID':
foreach ($arrayApplicationData[$variable1] as $key => $value) {
if (array_key_exists($variable2, $value)) {
$arrayApplicationData[$variable1][$key] = $this->__applicationDataDeleteMultipleFile(
$arrayApplicationData[$variable1][$key] = $this->applicationDataDeleteMultipleFile(
$value, $variable2, null, 'NORMAL', $arrayDocumentToDelete
);
}
@@ -3254,7 +3257,7 @@ class Cases
foreach ($arrayDocumentDelete as $value2) {
$appDocument->remove($value2['appDocUid'], (int)($value2['version']));
$arrayApplicationData['APP_DATA'] = $this->__applicationDataDeleteMultipleFile(
$arrayApplicationData['APP_DATA'] = $this->applicationDataDeleteMultipleFile(
$arrayApplicationData['APP_DATA'], $variable, null, $type, $value2
);
@@ -3272,7 +3275,7 @@ class Cases
foreach ($arrayDocumentDelete as $value4) {
$appDocument->remove($value4['appDocUid'], (int)($value4['version']));
$arrayApplicationData['APP_DATA'] = $this->__applicationDataDeleteMultipleFile(
$arrayApplicationData['APP_DATA'] = $this->applicationDataDeleteMultipleFile(
$arrayApplicationData['APP_DATA'], $grid, $variable, $type, $value4
);

View File

@@ -90,7 +90,7 @@ class Variable extends Attribute
* @return mixed Returns array with Application, AppDelegation and Variable record,
* ThrowTheException/FALSE otherwise
*/
private function __getApplicationAppDelegationAndVariableRecordByData(
private function getApplicationAppDelegationAndVariableRecordByData(
$applicationUid,
$delIndex,
$variableName,
@@ -144,7 +144,7 @@ class Variable extends Attribute
*
* @return array Returns an array with Fields of a Grid
*/
private function __getGridFieldDefinitions($projectUid, $gridName)
private function getGridFieldDefinitions($projectUid, $gridName)
{
try {
$arrayGridField = [];
@@ -202,7 +202,7 @@ class Variable extends Attribute
*
* @return bool Returns TRUE when array data is valid, ThrowTheException/FALSE otherwise
*/
private function __validateData(array $arrayData, array $arrayVariableData, $throwException = true)
private function validateData(array $arrayData, array $arrayVariableData, $throwException = true)
{
try {
if (empty($arrayData)) {
@@ -303,7 +303,7 @@ class Variable extends Attribute
{
try {
//Verify data and Set variables
$result = $this->__getApplicationAppDelegationAndVariableRecordByData(
$result = $this->getApplicationAppDelegationAndVariableRecordByData(
$applicationUid, $delIndex, $variableName, $throwException
);
@@ -329,12 +329,12 @@ class Variable extends Attribute
}
if ($arrayVariableData['VAR_FIELD_TYPE'] == 'grid') {
$arrayVariableData['arrayGridField'] = $this->__getGridFieldDefinitions(
$arrayVariableData['arrayGridField'] = $this->getGridFieldDefinitions(
$arrayVariableData['PRJ_UID'], $arrayVariableData['VAR_NAME']
);
}
$result = $this->__validateData($arrayData, $arrayVariableData, $throwException);
$result = $this->validateData($arrayData, $arrayVariableData, $throwException);
if ($result === false) {
return false;
@@ -396,7 +396,7 @@ class Variable extends Attribute
{
try {
//Verify data and Set variables
$result = $this->__getApplicationAppDelegationAndVariableRecordByData(
$result = $this->getApplicationAppDelegationAndVariableRecordByData(
$applicationUid, $delIndex, $variableName, $throwException
);
@@ -420,12 +420,12 @@ class Variable extends Attribute
}
if ($arrayVariableData['VAR_FIELD_TYPE'] == 'grid') {
$arrayVariableData['arrayGridField'] = $this->__getGridFieldDefinitions(
$arrayVariableData['arrayGridField'] = $this->getGridFieldDefinitions(
$arrayVariableData['PRJ_UID'], $arrayVariableData['VAR_NAME']
);
}
$result = $this->__validateData($arrayData, $arrayVariableData, $throwException);
$result = $this->validateData($arrayData, $arrayVariableData, $throwException);
if ($result === false) {
return false;
@@ -490,7 +490,7 @@ class Variable extends Attribute
{
try {
//Verify data and Set variables
$result = $this->__getApplicationAppDelegationAndVariableRecordByData(
$result = $this->getApplicationAppDelegationAndVariableRecordByData(
$applicationUid, $delIndex, $variableName, $throwException
);
@@ -605,7 +605,7 @@ class Variable extends Attribute
$arrayVariable = [];
//Verify data and Set variables
$result = $this->__getApplicationAppDelegationAndVariableRecordByData(
$result = $this->getApplicationAppDelegationAndVariableRecordByData(
$applicationUid, $delIndex, $variableName, $throwException
);
@@ -696,7 +696,7 @@ class Variable extends Attribute
}
}
$result = $this->__getApplicationAppDelegationAndVariableRecordByData(
$result = $this->getApplicationAppDelegationAndVariableRecordByData(
$applicationUid, $delIndex, $variableName, $throwException
);

View File

@@ -226,7 +226,7 @@ class Department
* @param array $record Record
* @return array Return an array with custom record
*/
private function __getUserCustomRecordFromRecord(array $record)
private function getUserCustomRecordFromRecord(array $record)
{
try {
$recordc = [
@@ -414,7 +414,7 @@ class Department
break;
}
$arrayUser[] = ($flagRecord)? $record : $this->__getUserCustomRecordFromRecord($record);
$arrayUser[] = ($flagRecord)? $record : $this->getUserCustomRecordFromRecord($record);
}
//Return

View File

@@ -696,9 +696,8 @@ class Light
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename());
$ext = (isset($info['extension']) ? $info['extension'] : '');//BUG fix: must handle files without any extension
$ext = (isset($info['extension']) ? $info['extension'] : ''); //BUG fix: must handle files without any extension
//$app_uid = G::getPathFromUID($oAppDocument->Fields['APP_UID']);
$file = G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid);
$realPath = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
@@ -1358,12 +1357,14 @@ class Light
*/
public function getConfiguration($params)
{
$response = [];
$sysConf = Bootstrap::getSystemConfiguration('', '', config("system.workspace"));
$multiTimeZone = false;
//Set Time Zone
/*----------------------------------********---------------------------------*/
if (\PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
$multiTimeZone = (int)($sysConf['system_utc_time_zone']) == 1;
$multiTimeZone = (int) ($sysConf['system_utc_time_zone']) == 1;
}
/*----------------------------------********---------------------------------*/
$tz = isset($_SESSION['USR_TIME_ZONE']) ? $_SESSION['USR_TIME_ZONE'] : $sysConf['time_zone'];
@@ -1423,6 +1424,8 @@ class Light
$response['tz'] = isset($_SESSION['USR_TIME_ZONE']) ? $_SESSION['USR_TIME_ZONE'] : $sysConf['time_zone'];
}
$response['mobile_offline_tables_download_interval'] = $sysConf['mobile_offline_tables_download_interval'];
return $response;
}
@@ -1431,13 +1434,13 @@ class Light
switch (substr($size_str, -1)) {
case 'M':
case 'm':
return (int)$size_str * 1048576;
return (int) $size_str * 1048576;
case 'K':
case 'k':
return (int)$size_str * 1024;
return (int) $size_str * 1024;
case 'G':
case 'g':
return (int)$size_str * 1073741824;
return (int) $size_str * 1073741824;
default:
return $size_str;
}

View File

@@ -18,7 +18,7 @@ class ReportTable
*
* @return object
*/
private function __getDefaultColumns($type = 'NORMAL')
private function getDefaultColumns($type = 'NORMAL')
{
$defaultColumns = [];
$application = new \stdClass(); //APPLICATION KEY
@@ -97,7 +97,7 @@ class ReportTable
*
* @return string
*/
private function __populateData(array $arrayTableData, array $tableNameMap)
private function populateData(array $arrayTableData, array $tableNameMap)
{
try {
$errors = '';
@@ -408,7 +408,7 @@ class ReportTable
//New report table
if ($flagIsReportTable && $flagAlterTable) {
//Setting default columns
$defaultColumns = $this->__getDefaultColumns($arrayData['REP_TAB_TYPE']);
$defaultColumns = $this->getDefaultColumns($arrayData['REP_TAB_TYPE']);
$columns = array_merge($defaultColumns, $columns);
}
@@ -486,7 +486,9 @@ class ReportTable
'DBS_UID' => ($arrayData['REP_TAB_CONNECTION']) ? $arrayData['REP_TAB_CONNECTION'] : 'workflow',
'PRO_UID' => $arrayData['PRO_UID'],
'ADD_TAB_TYPE' => $arrayData['REP_TAB_TYPE'],
'ADD_TAB_GRID' => $arrayData['REP_TAB_GRID']
'ADD_TAB_GRID' => $arrayData['REP_TAB_GRID'],
'ADD_TAB_OFFLINE' => !empty($arrayData['REP_TAB_OFFLINE']) ?? 0,
'ADD_TAB_UPDATE_DATE' => date('Y-m-d H:i:s'),
];
if ($arrayData['REP_TAB_UID'] == '' || (isset($arrayData['forceUid']) && $arrayData['forceUid'])) {
@@ -806,6 +808,8 @@ class ReportTable
$tableData->REP_TAB_CONNECTION = $contentSchema['DBS_UID'];
$tableData->REP_TAB_TYPE = (isset($contentSchema['ADD_TAB_TYPE'])) ? $contentSchema['ADD_TAB_TYPE'] : '';
$tableData->REP_TAB_GRID = (isset($contentSchema['ADD_TAB_GRID'])) ? $contentSchema['ADD_TAB_GRID'] : '';
$tableData->REP_TAB_OFFLINE = (isset($contentSchema['ADD_TAB_OFFLINE'])) ? $contentSchema['ADD_TAB_OFFLINE'] : '0';
$tableData->REP_TAB_UPDATE_DATE = date('Y-m-d H:i:s');
$tableData->columns = G::json_encode($columns);
$tableData->forceUid = true;
@@ -835,7 +839,7 @@ class ReportTable
}
if (!empty($tableNameMap)) {
$errors = $this->__populateData($arrayTableData, $tableNameMap);
$errors = $this->populateData($arrayTableData, $tableNameMap);
}
//Return

View File

@@ -20,7 +20,7 @@ class Table
*
* @return array
*/
public function getTables($pro_uid = '', $reportFlag = false)
public function getTables($pro_uid = '', $reportFlag = false, $offline = false)
{
//VALIDATION
if ($reportFlag) {
@@ -87,6 +87,7 @@ class Table
$tabData['PMT_UID'] = $tab_uid;
$tabData['PMT_TAB_NAME'] = $table['ADD_TAB_NAME'];
$tabData['PMT_TAB_DESCRIPTION'] = $table['ADD_TAB_DESCRIPTION'];
$tabData['PMT_TAB_OFFLINE'] = $table['ADD_TAB_OFFLINE'];
$tabData['PMT_TAB_CLASS_NAME'] = $table['ADD_TAB_CLASS_NAME'];
$tabData['PMT_NUM_ROWS'] = $tableData['count'];
}
@@ -384,6 +385,8 @@ class Table
'ADD_TAB_NAME' => $dataValidate['REP_TAB_NAME'],
'ADD_TAB_CLASS_NAME' => $repTabClassName,
'ADD_TAB_DESCRIPTION' => $dataValidate['REP_TAB_DSC'],
'ADD_TAB_OFFLINE' => 0,
'ADD_TAB_UPDATE_DATE' => date('Y-m-d H:i:s'),
'ADD_TAB_PLG_UID' => '',
'DBS_UID' => ($dataValidate['REP_TAB_CONNECTION'] ? $dataValidate['REP_TAB_CONNECTION'] : 'workflow'),
'PRO_UID' => $dataValidate['PRO_UID'],
@@ -396,6 +399,8 @@ class Table
'ADD_TAB_NAME' => $dataValidate['PMT_TAB_NAME'],
'ADD_TAB_CLASS_NAME' => $repTabClassName,
'ADD_TAB_DESCRIPTION' => $dataValidate['PMT_TAB_DSC'],
'ADD_TAB_OFFLINE' => !empty($dataValidate['PMT_TAB_OFFLINE']) ?? 0,
'ADD_TAB_UPDATE_DATE' => date('Y-m-d H:i:s'),
'ADD_TAB_PLG_UID' => '',
'DBS_UID' => ($dataValidate['PMT_TAB_CONNECTION'] ? $dataValidate['PMT_TAB_CONNECTION'] : 'workflow'),
'PRO_UID' => '',
@@ -549,6 +554,11 @@ class Table
$dataValidate['rep_tab_dsc'] = $tableData['pmt_tab_dsc'];
$tableDsc = true;
}
if (!empty($tableData['pmt_tab_offline'])) {
$dataValidate['rep_tab_offline'] = $tableData['pmt_tab_offline'];
$tableDsc = true;
}
$dataValidate['rep_tab_update_date'] = date('Y-m-d H:i:s');
}
if (!empty($tableData['fields'])) {
$dataValidate['fields'] = $tableData['fields'];

View File

@@ -640,7 +640,7 @@ class User
* @return array Return an array with custom record
* @throws Exception
*/
private function __getUserCustomRecordFromRecord(array $record)
private function getUserCustomRecordFromRecord(array $record)
{
try {
//Get Calendar
@@ -1084,7 +1084,7 @@ class User
$row = $rsCriteria->getRow();
//Return
return (!$flagGetRecord) ? $this->__getUserCustomRecordFromRecord($row) : $row;
return (!$flagGetRecord) ? $this->getUserCustomRecordFromRecord($row) : $row;
} catch (Exception $e) {
throw $e;
}
@@ -1494,7 +1494,7 @@ class User
while ($rsCriteria->next()) {
$record = $rsCriteria->getRow();
$arrayUser[] = ($flagRecord) ? $record : $this->__getUserCustomRecordFromRecord($record);
$arrayUser[] = ($flagRecord) ? $record : $this->getUserCustomRecordFromRecord($record);
}
//Return

View File

@@ -73,7 +73,8 @@ class System
'files_white_list' => '',
'delay' => '0',
'tries' => '10',
'retry_after' => '90'
'retry_after' => '90',
'mobile_offline_tables_download_interval' => 24
];
/**
@@ -1206,6 +1207,15 @@ class System
$config['proxy_pass'] = G::decrypt($config['proxy_pass'], 'proxy_pass');
}
/**
* Here if you validate if the type of data obtained from the configuration
* files are valid, otherwise the default value is used.
*/
$value = (string) $config['mobile_offline_tables_download_interval'];
if (!is_numeric($value)) {
$config['mobile_offline_tables_download_interval'] = self::$defaultConfig['mobile_offline_tables_download_interval'];
}
return $config;
}

View File

@@ -0,0 +1,105 @@
<?php
namespace ProcessMaker\Model;
use AdditionalTables as ModelAdditionalTables;
use Illuminate\Database\Eloquent\Model;
class AdditionalTables extends Model
{
protected $table = 'ADDITIONAL_TABLES';
public $timestamps = false;
/**
* Get the fields related to the table belongs to
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function columns()
{
return $this->belongsTo(Fields::class, 'ADD_TAB_UID', 'ADD_TAB_UID');
}
/**
* Scope a query to get the offline tables
*
* @param \Illuminate\Database\Eloquent\Builder $query
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeOffline($query)
{
return $query->where('ADD_TAB_OFFLINE', '=', 1);
}
/**
* Get the structure of offline tables
*
* @return array
*/
public static function getTablesOfflineStructure()
{
$query = AdditionalTables::query()->select([
'ADD_TAB_UID',
'ADD_TAB_NAME',
'ADD_TAB_DESCRIPTION',
'ADD_TAB_CLASS_NAME'
]);
$query->offline();
$results = $query->get();
$data = [];
$results->each(function ($item, $key) use (&$data) {
$data[$key] = array_change_key_case($item->toArray(), CASE_LOWER);
$data[$key]['fields'] = Fields::getFields($item->ADD_TAB_UID);
});
return $data;
}
/**
* Get the data of offline tables
*
* @return array
*/
public static function getTablesOfflineData()
{
$query = AdditionalTables::query()->select([
'ADD_TAB_UID',
'ADD_TAB_NAME',
'ADD_TAB_DESCRIPTION',
'ADD_TAB_CLASS_NAME'
]);
$query->offline();
$results = $query->get();
$data = [];
$results->each(function ($item, $key) use (&$data) {
$data[$key] = array_change_key_case($item->toArray(), CASE_LOWER);
$additionalTables = new ModelAdditionalTables();
$result = $additionalTables->getAllData($item->ADD_TAB_UID);
if (empty($result['rows'])) {
$data[$key]['rows'] = [];
} else {
foreach ($result['rows'] as $i => $row) {
$data[$key]['rows'][$i] = $row;
}
}
});
return $data;
}
/**
* Update the offline property.
* @param array $tablesUid
* @param int $value
* @return void
*/
public static function updatePropertyOffline(array $tablesUid, $value): void
{
$query = AdditionalTables::whereIn('ADD_TAB_UID', $tablesUid)
->update(['ADD_TAB_OFFLINE' => $value]);
}
}

View File

@@ -27,24 +27,23 @@ class Application extends Model
}
/**
* Get Applications by PRO_UID, ordered by APP_NUMBER.
* @param string $proUid
* @return object
* @see ReportTables->populateTable()
* Scope for query to get the application by APP_UID.
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $appUid
* @return \Illuminate\Database\Eloquent\Builder
*/
public static function getByProUid($proUid)
public function scopeAppUid($query, $appUid)
{
$query = Application::query()
->select()
->proUid($proUid)
->orderBy('APP_NUMBER', 'ASC');
return $query->get();
$result = $query->where('APP_UID', '=', $appUid);
return $result;
}
/**
* Scope for query to get the applications by PRO_UID.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $proUid
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeProUid($query, $proUid)
@@ -52,4 +51,38 @@ class Application extends Model
$result = $query->where('PRO_UID', '=', $proUid);
return $result;
}
/**
* Get Applications by PRO_UID, ordered by APP_NUMBER.
*
* @param string $proUid
*
* @return object
* @see ReportTables->populateTable()
*/
public static function getByProUid($proUid)
{
$query = Application::query()
->select()
->proUid($proUid)
->orderBy('APP_NUMBER', 'ASC');
return $query->get();
}
/**
* Get information related to the created case
*
* @param string $appUid
*
* @return array|bool
*/
public static function getCase($appUid)
{
$query = Application::query()->select(['APP_STATUS', 'APP_INIT_USER']);
$query->appUid($appUid);
$result = $query->get()->toArray();
$firstElement = head($result);
return $firstElement;
}
}

View File

@@ -13,6 +13,10 @@ class Delegation extends Model
// We don't have our standard timestamp columns
public $timestamps = false;
// Static properties to preserve values
public static $usrUid = '';
public static $groups = [];
/**
* Returns the application this delegation belongs to
*/
@@ -478,39 +482,81 @@ class Delegation extends Model
*/
public static function countSelfService($usrUid)
{
//Get the task self services related to the user
$taskSelfService = TaskUser::getSelfServicePerUser($usrUid);
//Get the task self services value based related to the user
$selfServiceValueBased = AppAssignSelfServiceValue::getSelfServiceCasesByEvaluatePerUser($usrUid);
// Set the 'usrUid' property to preserve
Delegation::$usrUid = $usrUid;
//Start the query for get the cases related to the user
$query = Delegation::query()->select('APP_NUMBER');
//Add Join with task filtering only the type self-service
$query->join('TASK', function ($join) {
$join->on('APP_DELEGATION.TAS_ID', '=', 'TASK.TAS_ID')
->where('TASK.TAS_ASSIGN_TYPE', '=', 'SELF_SERVICE');
// Get and build the groups parameter related to the user
$groups = GroupUser::getGroups($usrUid);
$groups = array_map(function ($value) {
return "'" . $value['GRP_ID'] . "'";
}, $groups);
// Add dummy value to avoid syntax error in complex join
$groups[] = "'-1'";
// Set the 'groups' property to preserve
Delegation::$groups = $groups;
// Start the first query
$query1 = Delegation::query()->select('APP_NUMBER');
// Add the join clause
$query1->join('TASK', function ($join) {
// Build partial plain query for a complex Join, because Eloquent doesn't support this type of Join
$complexJoin = "
((`APP_DELEGATION`.`APP_NUMBER`, `APP_DELEGATION`.`DEL_INDEX`, `APP_DELEGATION`.`TAS_ID`) IN (
SELECT
`APP_ASSIGN_SELF_SERVICE_VALUE`.`APP_NUMBER`,
`APP_ASSIGN_SELF_SERVICE_VALUE`.`DEL_INDEX`,
`APP_ASSIGN_SELF_SERVICE_VALUE`.`TAS_ID`
FROM
`APP_ASSIGN_SELF_SERVICE_VALUE`
INNER JOIN `APP_ASSIGN_SELF_SERVICE_VALUE_GROUP` ON
`APP_ASSIGN_SELF_SERVICE_VALUE`.`ID` = `APP_ASSIGN_SELF_SERVICE_VALUE_GROUP`.`ID`
WHERE (
`APP_ASSIGN_SELF_SERVICE_VALUE_GROUP`.`GRP_UID` = '%s' OR (
`APP_ASSIGN_SELF_SERVICE_VALUE_GROUP`.`ASSIGNEE_ID` IN (%s) AND
`APP_ASSIGN_SELF_SERVICE_VALUE_GROUP`.`ASSIGNEE_TYPE` = '2')
)
))";
$groups = implode(',', Delegation::$groups);
$complexJoin = sprintf($complexJoin, Delegation::$usrUid, $groups);
// Add joins
$join->on('APP_DELEGATION.TAS_ID', '=', 'TASK.TAS_ID');
$join->on('TASK.TAS_ASSIGN_TYPE', '=', DB::raw("'SELF_SERVICE'"));
$join->on('APP_DELEGATION.DEL_THREAD_STATUS', '=', DB::raw("'OPEN'"));
$join->on('APP_DELEGATION.USR_ID', '=', DB::raw("'0'"))->
whereRaw($complexJoin);
});
//Filtering the open threads and without users
$query->isThreadOpen()->noUserInThread();
//Get the cases unassigned
if (!empty($selfServiceValueBased)) {
$query->where(function ($query) use ($selfServiceValueBased, $taskSelfService) {
//Get the cases related to the task self service
$query->tasksIn($taskSelfService);
foreach ($selfServiceValueBased as $case) {
//Get the cases related to the task self service value based
$query->orWhere(function ($query) use ($case) {
$query->case($case['APP_NUMBER'])->index($case['DEL_INDEX'])->task($case['TAS_ID']);
});
}
});
// Get self services tasks related to the user
$selfServiceTasks = TaskUser::getSelfServicePerUser($usrUid);
if (!empty($selfServiceTasks)) {
// Start the first query
$query2 = Delegation::query()->select('APP_NUMBER');
$query2->tasksIn($selfServiceTasks);
$query2->noUserInThread();
// Build the complex query that uses "UNION DISTINCT" clause
$unionQuery = sprintf('select count(*) as aggregate from ((%s) union distinct (%s)) self_service_cases',
toSqlWithBindings($query1), toSqlWithBindings($query2));
// Execute the query
$result = DB::selectOne($unionQuery);
$count = $result->aggregate;
} else {
//Get the cases related to the task self service
$query->tasksIn($taskSelfService);
// Execute the query
$count = $query1->count();
}
return $query->count();
// Clean static properties
Delegation::$usrUid = '';
Delegation::$groups = [];
// Return value
return $count;
}
/**

View File

@@ -0,0 +1,55 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
class Fields extends Model
{
protected $table = 'FIELDS';
public $timestamps = false;
/**
* Get the fields related to the table belongs to
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function table()
{
return $this->belongsTo(AdditionalTables::class, 'ADD_TAB_UID', 'ADD_TAB_UID');
}
/**
* Scope a query to get the offline tables
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $tabUid
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeTable($query, $tabUid)
{
return $query->where('ADD_TAB_UID', '=', $tabUid);
}
/**
* Get the offline tables
*
* @param string $tabUid
*
* @return array
*/
public static function getFields($tabUid)
{
$query = Fields::query();
$query->table($tabUid);
$results = $query->get();
$data = [];
$results->each(function ($item, $key) use (&$data) {
$data[$key] = array_change_key_case($item->toArray(), CASE_LOWER);
});
return $data;
}
}

View File

@@ -1502,6 +1502,7 @@ class PluginRegistry
return $oMenuFromPlugin[$strMenuName];
}
}
return [];
}
/**

View File

@@ -87,9 +87,9 @@ class WorkflowBpmn extends Project\Workflow
return parent::getList($start, $limit, $filter, $changeCaseTo);
}
public function remove()
public function remove($flagRemoveCases = true, $onlyDiagram = false)
{
parent::remove();
parent::remove($flagRemoveCases, $onlyDiagram);
$this->bp->remove();
}

View File

@@ -1169,12 +1169,13 @@ class Workflow extends Handler
//Getting DynaForms
foreach ($workflowData["dynaforms"] as $dynaform) {
$dynFile = PATH_DYNAFORM . $dynaform["DYN_FILENAME"] . ".xml";
$dynFile = PATH_DYNAFORM . $dynaform["PRO_UID"] . "/" . $dynaform["DYN_UID"] . ".xml";
$content = file_exists($dynFile) ? file_get_contents($dynFile) : '';
$workflowFile["DYNAFORMS"][] = array(
"filename" => $dynaform["DYN_TITLE"],
"filepath" => $dynaform["DYN_FILENAME"] . ".xml",
"file_content" => file_get_contents($dynFile)
"file_content" => $content
);
$htmlFile = PATH_DYNAFORM . $dynaform["DYN_FILENAME"] . ".html";

View File

@@ -1,9 +1,11 @@
<?php
namespace ProcessMaker\Services\Api;
use Exception;
use Luracast\Restler\RestException;
use ProcessMaker\BusinessModel\Table as BusinessModelTable;
use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Services\Api;
/**
@@ -14,85 +16,137 @@ use ProcessMaker\Services\Api;
class Pmtable extends Api
{
/**
* @return array
* Get a list of the PM tables in the workspace. It does not include any Report Table
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @url GET
* @status 200
*
* @param boolean $offline {@from path}
*
* @return array
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @url GET
* @class AccessControl {@permission PM_LOGIN}
* @link https://wiki.processmaker.com/3.1/REST_API_Administration/PM_Tables#PM_Tables_List:_GET_.2Fpmtable
*/
public function doGetPmTables()
public function doGetPmTables($offline = false)
{
try {
$oPmTable = new \ProcessMaker\BusinessModel\Table();
$response = $oPmTable->getTables();
if ($offline) {
$response = AdditionalTables::getTablesOfflineStructure();
} else {
$pmTable = new BusinessModelTable();
$response = $pmTable->getTables();
}
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @param string $pmt_uid {@min 1} {@max 32}
* Get the data of the offline PM tables
*
* @url GET /offline/data
* @status 200
*
* @param boolean $compress {@from path}
*
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @class AccessControl {@permission PM_LOGIN}
* @link https://wiki.processmaker.com/3.1/REST_API_Administration/PM_Tables#PM_Tables_List:_GET_.2Fpmtable
*/
public function doGetPmTablesDataOffline($compress = true)
{
try {
$data = AdditionalTables::getTablesOfflineData();
if ($compress) {
$json = json_encode($data);
$compressed = gzcompress($json, 5);
echo $compressed;
} else {
return $data;
}
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get the structure from a specific PM Table, including a list of its fields and their properties.
*
* @url GET /:pmt_uid
* @status 200
*
* @param string $pmt_uid {@min 1} {@max 32}
*
* @return array
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @link https://wiki.processmaker.com/3.1/REST_API_Administration/PM_Tables#Get_PM_Table_Structure:_GET_.2Fpmtable.2F.7Bpmt_uid.7D
*/
public function doGetPmTable($pmt_uid)
{
try {
$oPmTable = new \ProcessMaker\BusinessModel\Table();
$oPmTable = new BusinessModelTable();
$response = $oPmTable->getTable($pmt_uid);
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get the data from a PM table
*
* @url GET /:pmt_uid/data
* @status 200
*
* @param string $pmt_uid {@min 1} {@max 32}
* @param string $filter
* @param string $q
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @return array
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @url GET /:pmt_uid/data
*
*/
public function doGetPmTableData($pmt_uid, $filter = null, $q = "")
{
try {
$oPmTable = new \ProcessMaker\BusinessModel\Table();
$oPmTable = new BusinessModelTable();
$response = $oPmTable->getTableData($pmt_uid, null, $filter, false, $q);
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Create a new PM Table
*
* @url POST
* @status 201
*
* @param array $request_data
* @param string $pmt_tab_name {@from body}
* @param string $pmt_tab_dsc {@from body}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @return array
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @url POST
* @status 201
*/
public function doPostPmTable(
$request_data,
@@ -100,58 +154,58 @@ class Pmtable extends Api
$pmt_tab_dsc = ''
) {
try {
$oReportTable = new \ProcessMaker\BusinessModel\Table();
$oReportTable = new BusinessModelTable();
$response = $oReportTable->saveTable($request_data);
if (isset($response['pro_uid'])) {
unset($response['pro_uid']);
}
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @param string $pmt_uid {@min 1} {@max 32}
* Add a new record to a PM Table
*
* @param array $request_data
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @url POST /:pmt_uid/data
* @status 201
*
* @param string $pmt_uid {@min 1} {@max 32}
* @param array $request_data
*
* @return array
* @throws RestException
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
*/
public function doPostPmTableData(
$pmt_uid,
$request_data
) {
try {
$oReportTable = new \ProcessMaker\BusinessModel\Table();
$oReportTable = new BusinessModelTable();
$response = $oReportTable->saveTableData($pmt_uid, $request_data);
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Update pm-table.
* Update the structure of a PM table.
*
* @url PUT /:pmt_uid
* @status 200
*
* @param string $pmt_uid {@min 1} {@max 32}
* @param array $request_data
*
* @return void
* @throw RestException
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @throws RestException
*/
public function doPutPmTable(
$pmt_uid,
@@ -167,9 +221,10 @@ class Pmtable extends Api
}
/**
* Update pm-table data.
* Update the data of an existing record in a PM table.
*
* @url PUT /:pmt_uid/data
* @status 200
*
* @param string $pmt_uid {@min 1} {@max 32}
* @param array $request_data
@@ -185,37 +240,47 @@ class Pmtable extends Api
$request_data
) {
try {
$oReportTable = new \ProcessMaker\BusinessModel\Table();
$oReportTable = new BusinessModelTable();
$response = $oReportTable->updateTableData($pmt_uid, $request_data);
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Delete a specified PM table and all its data.
*
* @url DELETE /:pmt_uid
* @status 200
*
* @param string $pmt_uid {@min 1} {@max 32}
*
* @return void
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @url DELETE /:pmt_uid
*/
public function doDeletePmTable($pmt_uid)
{
try {
$oReportTable = new \ProcessMaker\BusinessModel\Table();
$oReportTable = new BusinessModelTable();
$response = $oReportTable->deleteTable($pmt_uid);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Delete a record from a PM table, by specifying its primary key(s). The PM Table can have up to 3 primary key
* fields.
*
* @url DELETE /:pmt_uid/data/:key1/:value1
* @url DELETE /:pmt_uid/data/:key1/:value1/:key2/:value2
* @url DELETE /:pmt_uid/data/:key1/:value1/:key2/:value2/:key3/:value3
* @status 200
*
* @param string $pmt_uid {@min 1} {@max 32}
* @param string $key1 {@min 1}
* @param string $value1 {@min 1}
@@ -225,15 +290,10 @@ class Pmtable extends Api
* @param string $value3
*
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @url DELETE /:pmt_uid/data/:key1/:value1
* @url DELETE /:pmt_uid/data/:key1/:value1/:key2/:value2
* @url DELETE /:pmt_uid/data/:key1/:value1/:key2/:value2/:key3/:value3
*/
public function doDeletePmTableData($pmt_uid, $key1, $value1, $key2 = '', $value2 = '', $key3 = '', $value3 = '')
{
@@ -245,10 +305,10 @@ class Pmtable extends Api
if ($key3 != '') {
$rows[$key3] = $value3;
}
$oReportTable = new \ProcessMaker\BusinessModel\Table();
$oReportTable = new BusinessModelTable();
$response = $oReportTable->deleteTableData($pmt_uid, $rows);
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace ProcessMaker\Services\OAuth2;
use OAuth2\Server;
/**
* Extended class where the properties are correctly initialized, compatibility with PHP 7.3.x
*/
class OAuth2Server extends Server
{
protected $responseTypes = [];
}

View File

@@ -3,6 +3,7 @@ namespace ProcessMaker\Services\OAuth2;
use Luracast\Restler\iAuthenticate;
use Luracast\Restler\RestException;
use OAuth2\Request;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog;
/*----------------------------------********---------------------------------*/
@@ -53,7 +54,7 @@ class Server implements iAuthenticate
}
// Pass a storage object or array of storage objects to the OAuth2 server class
$this->server = new \OAuth2\Server($this->storage, array('allow_implicit' => true, 'access_lifetime' => 86400));
$this->server = new OAuth2Server($this->storage, array('allow_implicit' => true, 'access_lifetime' => 86400));
$this->server->setConfig('enforce_state', false);
@@ -411,6 +412,19 @@ class Server implements iAuthenticate
public static function getUserId()
{
// If is empty, get the User Uid using the current request
if (empty(self::$userId) && !empty(self::$dsn)) {
// Get current request object
$request = Request::createFromGlobals();
// Get token data
$serverInstance = new Server();
$server = $serverInstance->getServer();
$tokenData = $server->getAccessTokenData($request);
// Set the User Uid
self::$userId = $tokenData['user_id'];
}
return self::$userId;
}

View File

@@ -545,3 +545,34 @@ function updateUserLastLogin($userLog, $keyLastLogin = 'LOG_INIT_DATE')
}
}
/**
* Return raw query with the bindings replaced
*
* @param \Illuminate\Database\Eloquent\Builder $queryObject
* @return string
*/
function toSqlWithBindings(Illuminate\Database\Eloquent\Builder $queryObject) {
// Get some values from the object
$bindings = $queryObject->getBindings();
$originalQuery = $queryObject->toSql();
// If not exist bindings, return the original query
if (empty($bindings)) {
return $originalQuery;
}
// Initializing another variables
$queryParts = explode('?', $originalQuery);
$pdo = $queryObject->getConnection()->getPdo();
$query = '';
// Walking the parts of the query replacing the bindings
foreach ($queryParts as $index => $part) {
if ($index < count($queryParts) - 1) {
$query .= $part . $pdo->quote($bindings[$index]);
}
}
// Return query
return $query;
}

View File

@@ -70,18 +70,18 @@ class ValidationUploadedFiles
->validate($file, function($file) {
$systemConfiguration = System::getSystemConfiguration('', '', config("system.workspace"));
$filesWhiteList = explode(',', $systemConfiguration['upload_attempts_limit_per_user']);
$userId = Server::getUserId();
$userId = !empty($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : Server::getUserId();
$key = config("system.workspace") . '/' . $userId;
$attemps = (int) trim($filesWhiteList[0]);
$attempts = (int) trim($filesWhiteList[0]);
$minutes = (int) trim($filesWhiteList[1]);
$pastAttemps = Cache::remember($key, $minutes, function() {
return 1;
});
$pastAttempts = Cache::remember($key, $minutes, function() {
return 1;
});
//We only increase when the file path exists, useful when pre-validation is done.
if (isset($file->path)) {
Cache::increment($key, 1);
}
if ($pastAttemps <= $attemps) {
if ($pastAttempts <= $attempts) {
return false;
}
return true;

View File

@@ -218,26 +218,31 @@ function deleteCase() {
_('ID_CONFIRM'),
(rows.length == 1) ? _('ID_MSG_CONFIRM_DELETE_CASE') : _('ID_MSG_CONFIRM_DELETE_CASES'),
function(btn, text){
if ( btn == 'yes' ) {
Ext.MessageBox.show({ msg: _('ID_DELETING_ELEMENTS'), wait:true,waitConfig: {interval:200} });
if (btn == 'yes') {
Ext.MessageBox.show({
msg: _('ID_DELETING_ELEMENTS'),
wait: true,
waitConfig: {interval: 200}
});
Ext.Ajax.request({
url: 'cases_Delete',
success: function(response) {
success: function (response) {
try {
parent.updateCasesView(true);
}
catch (e) {
} catch (e) {
// Nothing to do
}
Ext.MessageBox.hide();
try {
parent.updateCasesTree();
}
catch (e) {
} catch (e) {
// Nothing to do
}
if (typeof (response.responseText) != 'undefined') {
Ext.MessageBox.alert(_('ID_INFO'), response.responseText);
}
},
params: {APP_UIDS:APP_UIDS}
params: {APP_UIDS: APP_UIDS}
});
}
}
@@ -1899,10 +1904,12 @@ Ext.onReady ( function() {
case 'draft':
menuItems = [optionMenuPause, optionMenuSummary, optionMenuNotes];
if( varReassignCase == 'true' || varReassignCaseSupervisor == 'true'){
if (varReassignCase == 'true' || varReassignCaseSupervisor == 'true') {
menuItems.push(optionMenuReassign);
}
menuItems.push(optionMenuDelete);
if (varDeleteCase == 'true') {
menuItems.push(optionMenuDelete);
}
break;
@@ -2595,12 +2602,6 @@ Ext.onReady ( function() {
// Nothing to do
}
try {
parent.updateCasesTree();
}
catch (e) {
// Nothing to do
}
if (action === "search") {
comboCategory.setValue(
typeof filtersValues !== 'undefined' && filtersValues.advanced && filtersValues.advanced.category ?

View File

@@ -593,8 +593,6 @@ Ext.onReady(function () {
}
}
parent.updateCasesTree();
function inArray(arr, obj) {
for (var i = 0; i < arr.length; i++) {
if (arr[i] == obj)

View File

@@ -6,16 +6,6 @@ Ext.chart.Chart.CHART_URL = '/images/charts.swf';
Ext.FlashComponent.EXPRESS_INSTALL_URL = '/images/expressinstall.swf';
// The Quicktips are used for the toolbar and Tree mouseover tooltips!
// Refresh treePanel
try {
if (typeof(parent.timer) != 'undefined') {
parent.timer();
}
} catch(theError) {
// This try-catch is for Zimbra error
}
var conn = new Ext.data.Connection();
Docs = {};

View File

@@ -496,8 +496,12 @@ Ext.onReady(function(){
/**hide*/
menuPanelC.hide();
menuPanelC.ownerCt.doLayout();
//FORMATS.casesListRefreshTime is in seconds
setTimeout("timer()", parseInt(FORMATS.casesListRefreshTime) * 1000);
// Get the counters the first time
updateCasesTree();
// FORMATS.casesListRefreshTime is in seconds
setInterval("timer()", parseInt(FORMATS.casesListRefreshTime) * 1000);
});
function updateCasesView(viewList) {
@@ -562,8 +566,6 @@ function timer() {
updateCasesTree();
updateCasesView();
}
//FORMATS.casesListRefreshTime is in seconds
setTimeout("timer()", parseInt(FORMATS.casesListRefreshTime) * 1000);
}
Ext.data.DynamicJsonReader = function(config){

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -15,14 +15,11 @@ require_once __DIR__ . '/../../bootstrap/app.php';
AppEvent::getAppEvent();
register_shutdown_function(
create_function(
"",
"
if (class_exists(\"Propel\")) {
function () {
if (class_exists('Propel')) {
Propel::close();
}
"
)
}
);
ini_set("session.cookie_httponly", 1);

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B