Merge branch 'master' of bitbucket.org:colosa/processmaker into PM-2039

This commit is contained in:
Victor Saisa Lopez
2015-04-15 15:05:17 -04:00
28 changed files with 581 additions and 692 deletions

View File

@@ -1654,18 +1654,23 @@ class AppCacheView extends BaseAppCacheView
public function getTotalCasesByAllUsers()
{
$oCriteria = new Criteria("workflow");
$oCriteria->addSelectColumn(AppCacheViewPeer::USR_UID);
$oCriteria->addAsColumn("CNT", "COUNT(DISTINCT(APP_UID))");
$oCriteria->addAsColumn("CNT", "COUNT(DISTINCT(APP_CACHE_VIEW.APP_UID))");
$oCriteria->addJoin(AppCacheViewPeer::DEL_INDEX , AppDelayPeer::APP_DEL_INDEX, Criteria::LEFT_JOIN);
$oCriteria->add(
$oCriteria->getNewCriterion(AppDelayPeer::APP_TYPE, NULL, Criteria::ISNULL)->addOr(
$oCriteria->getNewCriterion(AppDelayPeer::APP_TYPE, 'REASSIGN', Criteria::NOT_EQUAL))
);
$oCriteria->addGroupByColumn(AppCacheViewPeer::USR_UID);
$dat = AppCacheViewPeer::doSelectRS($oCriteria);
$dat->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$aRows = array();
while ($dat->next()) {
$row = $dat->getRow();
$aRows[$row["USR_UID"]] = $row["CNT"];
}

View File

@@ -666,11 +666,11 @@ class CaseScheduler extends BaseCaseScheduler
$this->Update( $Fields );
}
public function updateNextRun ($sOption, $sValue = '', $sActualTime = '', $sDaysPerformTask = '', $sWeeks = '', $sStartDay = '', $sMonths = '', $currentDate = '')
public function updateNextRun($sOption, $sValue = "", $sActualTime = "", $sDaysPerformTask = "", $sWeeks = "", $sStartDay = "", $sMonths = "", $currentDate = "", $flagNextRun = true)
{
$nActualDate = $currentDate . " " . $sActualTime;
$dEstimatedDate = '';
$sWeeks = trim($sWeeks, "|");
$sWeeks = trim($sWeeks, " |");
switch ($sOption) {
case '1':
@@ -694,48 +694,47 @@ class CaseScheduler extends BaseCaseScheduler
}
break;
case '2':
if (strlen( $sWeeks ) > 0) {
//die($sActualTime);
$nDayOfTheWeek = (int)(date("w", strtotime($sActualTime)));
//$nDayOfTheWeek = 1;
$aWeeks = explode( '|', $sWeeks );
$nFirstDay = (int)($aWeeks[0]) - 1;
if ($sWeeks != "") {
$aDaysWeek = array ('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
$nDayOfTheWeek = ($nDayOfTheWeek == 0) ? 7 : $nDayOfTheWeek;
$day = 0;
$nSW = 0;
$flagIsTheSameDay = false;
foreach ($aWeeks as $value) {
if ($nDayOfTheWeek <= (int)($value)) {
$day = (int)($value) - 1;
$nSW = 1;
$flagIsTheSameDay = $nDayOfTheWeek == (int)($value);
break;
$nDayOfTheWeek = (int)(date("w", strtotime($sActualTime)));
$nDayOfTheWeek = ($nDayOfTheWeek == 0)? 7 : $nDayOfTheWeek;
$arrayWeekdays = explode("|", $sWeeks);
$firstDay = (int)($arrayWeekdays[0]);
$flagFound = $nDayOfTheWeek < $firstDay || in_array($nDayOfTheWeek, $arrayWeekdays);
if ($flagFound) {
$typeStatement = "this";
$indexDay = (in_array($nDayOfTheWeek, $arrayWeekdays))? $nDayOfTheWeek : $firstDay;
if ($flagNextRun) {
$index = array_search($nDayOfTheWeek, $arrayWeekdays);
if ($index !== false && isset($arrayWeekdays[$index + 1])) {
$indexDay = $arrayWeekdays[$index + 1];
} else {
$typeStatement = "next";
$indexDay = $firstDay;
}
}
}
if ($nSW == 1) {
$dEstimatedDate = date("Y-m-d", strtotime("$nActualDate " . (($flagIsTheSameDay)? "this" : "next") . " " . $aDaysWeek[$day])) . " " . date("H:i:s", strtotime($sActualTime));
$indexDay--;
$dEstimatedDate = date("Y-m-d", strtotime($nActualDate . " " . $typeStatement . " " . $aDaysWeek[$indexDay])) . " " . date("H:i:s", strtotime($sActualTime));
} else {
$nEveryDays = $sDaysPerformTask;
// $nEveryDays = '1';
if ($nFirstDay >= $nDayOfTheWeek || $nEveryDays == 1) {
$sTypeOperation = "next";
} else {
$sTypeOperation = "last";
}
$typeStatement = ($firstDay >= $nDayOfTheWeek || $nEveryDays == 1)? "next" : "last";
$indexDay = $firstDay - 1;
if ($nEveryDays == 1) {
//echo "**** $nActualDate *" . $sTypeOperation . "* *" . $aDaysWeek[$nFirstDay] . '*****' . date('H:i:s', strtotime($sActualTime)). "**";
$dEstimatedDate = date( 'Y-m-d', strtotime( "$nActualDate " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
//echo "(date)*".$dEstimatedDate."*";
//die("01");
$dEstimatedDate = date("Y-m-d", strtotime($nActualDate . " " . $typeStatement . " " . $aDaysWeek[$indexDay])) . " " . date("H:i:s", strtotime($sActualTime));
} else {
$nEveryDays = 1;
//$nActualDate = date('Y-m-d').' '.$sActualTime;
$nDataTmp = date( 'Y-m-d', strtotime( "$nActualDate + " . $nEveryDays . " Week" ) );
$dEstimatedDate = date( 'Y-m-d', strtotime( "$nDataTmp " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
$dEstimatedDate = date("Y-m-d", strtotime($nDataTmp . " " . $typeStatement . " " . $aDaysWeek[$indexDay])) . " " . date("H:i:s", strtotime($sActualTime));
}
}
}

View File

@@ -365,7 +365,7 @@ class Content extends BaseContent
$workSpace = new workspaceTools( $workSpace );
$workSpace->getDBInfo();
$link = mysql_pconnect( $workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass) or die( "Could not connect" );
$link = @mysql_pconnect( $workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass) or die( "Could not connect" );
mysql_select_db( $workSpace->dbName, $link );
mysql_query( "SET NAMES 'utf8';" );

View File

@@ -150,8 +150,15 @@ class InputDocument extends BaseInputDocument
if(!empty($aData['INP_DOC_DESTINATION_PATH'])){
$description .= ", Destination Path: ".$aData['INP_DOC_DESTINATION_PATH'];
}
$inputDocMaxFileSize = $aData['INP_DOC_MAX_FILESIZE']? $aData['INP_DOC_MAX_FILESIZE'].' '.$aData['INP_DOC_MAX_FILESIZE_UNIT'] : "256 MB";
$description .= ", Extensions: ".$aData['INP_DOC_TYPE_FILE'].", Maximum Input Document file size: ".$inputDocMaxFileSize;
$inputDocMaxFileSize = "";
if(!empty($aData['INP_DOC_MAX_FILESIZE'])){
$inputDocMaxFileSize = $aData['INP_DOC_MAX_FILESIZE']? $aData['INP_DOC_MAX_FILESIZE'].' '.$aData['INP_DOC_MAX_FILESIZE_UNIT'] : "256 MB";
$inputDocMaxFileSize = ", Maximum Input Document file size: ".$inputDocMaxFileSize;
}
if(!empty($aData['INP_DOC_MAX_FILESIZE'])){
$description .= ", Extensions: ".$aData['INP_DOC_TYPE_FILE'];
}
$description .= $inputDocMaxFileSize;
G::auditLog("CreateInputDocument", $description);
return $aData['INP_DOC_UID'];
@@ -217,8 +224,15 @@ class InputDocument extends BaseInputDocument
if(!empty($aData['INP_DOC_DESTINATION_PATH'])){
$description .= ", Destination Path: ".$aData['INP_DOC_DESTINATION_PATH'];
}
$inputDocMaxFileSize = $aData['INP_DOC_MAX_FILESIZE']? $aData['INP_DOC_MAX_FILESIZE'].' '.$aData['INP_DOC_MAX_FILESIZE_UNIT'] : "256 MB";
$description .= ", Extensions: ".$aData['INP_DOC_TYPE_FILE'].", Maximum Input Document file size: ".$inputDocMaxFileSize;
$inputDocMaxFileSize = "";
if(!empty($aData['INP_DOC_MAX_FILESIZE'])){
$inputDocMaxFileSize = $aData['INP_DOC_MAX_FILESIZE']? $aData['INP_DOC_MAX_FILESIZE'].' '.$aData['INP_DOC_MAX_FILESIZE_UNIT'] : "256 MB";
$inputDocMaxFileSize = ", Maximum Input Document file size: ".$inputDocMaxFileSize;
}
if(!empty($aData['INP_DOC_MAX_FILESIZE'])){
$description .= ", Extensions: ".$aData['INP_DOC_TYPE_FILE'];
}
$description .= $inputDocMaxFileSize;
G::auditLog("UpdateInputDocument", $description);
return $iResult;

View File

@@ -178,7 +178,12 @@ class OutputDocument extends BaseOutputDocument
if(!empty($aData['OUT_DOC_DESCRIPTION'])){
$description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION'];
}
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'].", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'];
}
if(!empty($aData['OUT_DOC_GENERATE'])){
$description .= ", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
}
if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){
$pdfSecurity = 'Disabled';
}else{
@@ -194,12 +199,14 @@ class OutputDocument extends BaseOutputDocument
if(!empty($aData['OUT_DOC_TAGS'])){
$description .= ", Tags: ".$aData['OUT_DOC_TAGS'];
}
if($aData['OUT_DOC_OPEN_TYPE']==0){
$genLink = 'Open the file';
}else{
$genLink = 'Download the file';
}
$description .= ", By clicking on the generated file link: ".$genLink;
if(!empty($aData['OUT_DOC_OPEN_TYPE'])){
if($aData['OUT_DOC_OPEN_TYPE']==0){
$genLink = 'Open the file';
}else{
$genLink = 'Download the file';
}
$description .= ", By clicking on the generated file link: ".$genLink;
}
G::auditLog("CreateOutputDocument", $description);
return $aData['OUT_DOC_UID'];
@@ -261,7 +268,12 @@ class OutputDocument extends BaseOutputDocument
if(!empty($aData['OUT_DOC_DESCRIPTION'])){
$description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION'];
}
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'].", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'];
}
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
$description .= ", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
}
if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){
$pdfSecurity = 'Disabled';
}else{
@@ -277,12 +289,14 @@ class OutputDocument extends BaseOutputDocument
if(!empty($aData['OUT_DOC_TAGS'])){
$description .= ", Tags: ".$aData['OUT_DOC_TAGS'];
}
if($aData['OUT_DOC_OPEN_TYPE']==0){
$genLink = 'Open the file';
}else{
$genLink = 'Download the file';
}
$description .= ", By clicking on the generated file link: ".$genLink;
if(!empty($aData['OUT_DOC_OPEN_TYPE'])){
if($aData['OUT_DOC_OPEN_TYPE']==0){
$genLink = 'Open the file';
}else{
$genLink = 'Download the file';
}
$description .= ", By clicking on the generated file link: ".$genLink;
}
if (isset($aData['OUT_DOC_TEMPLATE'])) {
$description .= ", [EDIT TEMPLATE]";
}