Merge remote branch 'upstream/master' into BUG-12374

This commit is contained in:
Hector Cortez
2013-07-31 15:10:02 -04:00
11 changed files with 157 additions and 39 deletions

View File

@@ -3,7 +3,6 @@
* cron.php * cron.php
* @package workflow-engine-bin * @package workflow-engine-bin
*/ */
ini_set('display_errors', 1); ini_set('display_errors', 1);
error_reporting(E_ALL); error_reporting(E_ALL);
ini_set('memory_limit', '300M'); // nore: this may need to be higher for many projects ini_set('memory_limit', '300M'); // nore: this may need to be higher for many projects
@@ -58,15 +57,24 @@ $bCronIsRunning = false;
$sLastExecution = null; $sLastExecution = null;
$processcTimeProcess = 0; $processcTimeProcess = 0;
$processcTimeStart = 0; $processcTimeStart = 0;
if (file_exists(PATH_DATA . "cron")) { if (file_exists(PATH_DATA . "cron")) {
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); $force = false;
$bCronIsRunning = (boolean)($arrayCron["bCronIsRunning"]); for ($i = 1; $i <= count($argv) - 1; $i++) {
$sLastExecution = $arrayCron["sLastExecution"]; if (strpos($argv[$i], "+force") !== false) {
$processcTimeProcess = (isset($arrayCron["processcTimeProcess"]))? intval($arrayCron["processcTimeProcess"]) : 10; //Minutes $force = true;
$processcTimeStart = (isset($arrayCron["processcTimeStart"]))? $arrayCron["processcTimeStart"] : 0; break;
}
}
if (!$force) {
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
$bCronIsRunning = (boolean)($arrayCron["bCronIsRunning"]);
$sLastExecution = $arrayCron["sLastExecution"];
$processcTimeProcess = (isset($arrayCron["processcTimeProcess"]))? intval($arrayCron["processcTimeProcess"]) : 10; //Minutes
$processcTimeStart = (isset($arrayCron["processcTimeStart"]))? $arrayCron["processcTimeStart"] : 0;
} else {
G::rm_dir(PATH_DATA . "cron");
}
} }
if ($bCronIsRunning && $processcTimeStart != 0) { if ($bCronIsRunning && $processcTimeStart != 0) {
if ((time() - $processcTimeStart) > ($processcTimeProcess * 60)) { if ((time() - $processcTimeStart) > ($processcTimeProcess * 60)) {
//Cron finished his execution for some reason //Cron finished his execution for some reason
@@ -138,5 +146,6 @@ if (!$bCronIsRunning) {
@file_put_contents(PATH_DATA . "cron", serialize($arrayCron)); @file_put_contents(PATH_DATA . "cron", serialize($arrayCron));
} else { } else {
eprintln("The cron is running, please wait for it to finish.\nStarted in $sLastExecution"); eprintln("The cron is running, please wait for it to finish.\nStarted in $sLastExecution");
eprintln("If do you want force the execution use the option '+force', example: php -f +wworkflow +force" ,"green");
} }

View File

@@ -4920,10 +4920,10 @@ class Cases
case "SELF_SERVICE": case "SELF_SERVICE":
if ($swtplDefault == 1) { if ($swtplDefault == 1) {
G::verifyPath($pathEmail, true); //Create if it does not exist G::verifyPath($pathEmail, true); //Create if it does not exist
$fileTemplate = $pathEmail . "unassignedMessage.html"; $fileTemplate = $pathEmail . G::LoadTranslation('ID_UNASSIGNED_MESSAGE');
if (!file_exists($fileTemplate)) { if (!file_exists($fileTemplate)) {
@copy(PATH_TPL . "mails" . PATH_SEP . "unassignedMessage.html", $fileTemplate); @copy(PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'), $fileTemplate);
} }
$sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields); $sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields);
@@ -5932,6 +5932,7 @@ class Cases
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_TYPE); $oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_TYPE);
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_CREATE_DATE); $oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_CREATE_DATE);
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_INDEX); $oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_INDEX);
$oCriteria->addSelectColumn(AppDocumentPeer::DOC_VERSION);
$oCriteria->add(ApplicationPeer::PRO_UID, $PRO_UID); $oCriteria->add(ApplicationPeer::PRO_UID, $PRO_UID);
$oCriteria->addJoin(ApplicationPeer::APP_UID, AppDocumentPeer::APP_UID); $oCriteria->addJoin(ApplicationPeer::APP_UID, AppDocumentPeer::APP_UID);

View File

@@ -3866,7 +3866,11 @@ class Processes
} }
if (! file_exists( $dir . "unassignedMessage.html" )) { if (! file_exists( $dir . "unassignedMessage.html" )) {
@copy( PATH_TPL . "mails" . PATH_SEP . "unassignedMessage.html", $dir . "unassignedMessage.html" ); if (defined('PARTNER_FLAG')) {
@copy( PATH_TPL . "mails" . PATH_SEP . "unassignedMessagePartner.html", $dir . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'));
} else {
@copy( PATH_TPL . "mails" . PATH_SEP . "unassignedMessage.html", $dir . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'));
}
} }
$files = glob( $dir . "*.*" ); $files = glob( $dir . "*.*" );
@@ -3874,9 +3878,8 @@ class Processes
foreach ($files as $file) { foreach ($files as $file) {
$fileName = basename( $file ); $fileName = basename( $file );
if ($fileName != "alert_message.html" && $fileName != "unassignedMessage.html") { if ($fileName != "alert_message.html" && $fileName != G::LoadTranslation('ID_UNASSIGNED_MESSAGE')) {
$filesList[] = array ("filepath" => $file,"filename" => $fileName $filesList[] = array ("filepath" => $file,"filename" => $fileName);
);
} }
} }
return $filesList; return $filesList;

View File

@@ -974,9 +974,14 @@ class wsBase
$hasEmailFrom = preg_match( '/(.+)@(.+)\.(.+)/', $sFrom, $match ); $hasEmailFrom = preg_match( '/(.+)@(.+)\.(.+)/', $sFrom, $match );
if (! $hasEmailFrom || strpos( $sFrom, $aSetup['MESS_ACCOUNT'] ) === false) { if (!$hasEmailFrom || strpos($sFrom, $aSetup["MESS_ACCOUNT"]) === false) {
$sFrom = '"' . stripslashes( $sFrom ) . '" <' . $aSetup['MESS_ACCOUNT'] . ">"; if (trim($aSetup["MESS_ACCOUNT"]) != "") {
$sFrom = "\"" . stripslashes($sFrom) . "\" <" . $aSetup["MESS_ACCOUNT"] . ">";
} else {
$sFrom = "<info@" . $_SERVER["HTTP_HOST"] . ">";
}
} }
$showMessage = ($showMessage) ? 1 : 0 ; $showMessage = ($showMessage) ? 1 : 0 ;
$messageArray = array( $messageArray = array(

View File

@@ -672,6 +672,7 @@ class OutputDocument extends BaseOutputDocument
$html2pdf->pdf->SetAuthor($aFields['USR_USERNAME']); $html2pdf->pdf->SetAuthor($aFields['USR_USERNAME']);
$html2pdf->pdf->SetTitle('Processmaker'); $html2pdf->pdf->SetTitle('Processmaker');
$html2pdf->pdf->SetSubject($sFilename); $html2pdf->pdf->SetSubject($sFilename);
$html2pdf->pdf->SetCompression(true);
//$html2pdf->pdf->SetKeywords('HTML2PDF, TCPDF, processmaker'); //$html2pdf->pdf->SetKeywords('HTML2PDF, TCPDF, processmaker');
@@ -798,6 +799,7 @@ class OutputDocument extends BaseOutputDocument
$pdf->SetAuthor($aFields['USR_USERNAME']); $pdf->SetAuthor($aFields['USR_USERNAME']);
$pdf->SetTitle('Processmaker'); $pdf->SetTitle('Processmaker');
$pdf->SetSubject($sFilename); $pdf->SetSubject($sFilename);
$pdf->SetCompression(true);
$margins = $aProperties['margins']; $margins = $aProperties['margins'];
$margins["left"] = ($margins["left"] >= 0) ? $margins["left"] : PDF_MARGIN_LEFT; $margins["left"] = ($margins["left"] >= 0) ? $margins["left"] : PDF_MARGIN_LEFT;
@@ -906,7 +908,7 @@ class OutputDocument extends BaseOutputDocument
'margins' => array('left' => 15, 'right' => 15, 'top' => 15, 'bottom' => 15,), 'margins' => array('left' => 15, 'right' => 15, 'top' => 15, 'bottom' => 15,),
'encoding' => '', 'encoding' => '',
'ps2pdf' => false, 'ps2pdf' => false,
'compress' => false, 'compress' => true,
'output' => 2, 'output' => 2,
'pdfversion' => '1.3', 'pdfversion' => '1.3',
'transparency_workaround' => false, 'transparency_workaround' => false,

View File

@@ -736,7 +736,7 @@ class Installer extends Controller
if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) { if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) {
$this->setPartner(); $this->setPartner();
$this->setConfiguration(); //$this->setConfiguration();
} }
// Create the triggers // Create the triggers
@@ -1506,11 +1506,13 @@ class Installer extends Controller
$dataPlugin = pathinfo($value); $dataPlugin = pathinfo($value);
$namePlugin = $dataPlugin['filename']; $namePlugin = $dataPlugin['filename'];
if ($value != 'enterprise') { if ($value != 'enterprise') {
$db_host = trim( $_REQUEST['db_hostname'] ); $db_hostname = trim( $_REQUEST['db_hostname'] );
$db_port = trim( $_REQUEST['db_port'] );
$db_username = trim( $_REQUEST['db_username'] ); $db_username = trim( $_REQUEST['db_username'] );
$db_password = trim( $_REQUEST['db_password'] ); $db_password = trim( $_REQUEST['db_password'] );
$wf = trim( $_REQUEST['wfDatabase'] ); $wf = trim( $_REQUEST['wfDatabase'] );
$db_host = ($db_port != '' && $db_port != 3306) ? $db_hostname . ':' . $db_port : $db_hostname;
$link = @mysql_connect( $db_host, $db_username, $db_password ); $link = @mysql_connect( $db_host, $db_username, $db_password );
@mysql_select_db($wf, $link); @mysql_select_db($wf, $link);
$res = mysql_query( "SELECT STORE_ID FROM ADDONS_MANAGER WHERE ADDON_NAME = '" . $namePlugin . "'", $link ); $res = mysql_query( "SELECT STORE_ID FROM ADDONS_MANAGER WHERE ADDON_NAME = '" . $namePlugin . "'", $link );

View File

@@ -68,8 +68,73 @@ function getLoadTreeMenuData ()
} }
} }
} }
//now build the menu in xml format
$xml = '<menu_cases>'; // Build xml nodes for a specific child node by its "id" on var "$_POST['node']" passed in a POST request
if (isset($_POST['node']) && in_array($_POST['node'], array_keys($menuCases))) {
$xml = new SimpleXMLElement('<?xml version="1.0" standalone="yes"?><menu_cases />');
if (array_key_exists('blockItems', $menuCases[$_POST['node']]) && is_array($menuCases[$_POST['node']]['blockItems'])) {
foreach ($menuCases[$_POST['node']]['blockItems'] as $key => $item) {
$option = $xml->addChild('option');
$option->addAttribute('id', $key);
$option->addAttribute('title', $item['label']);
$option->addAttribute('url', $item['link']);
if (! empty($item['cases_count'])) {
$option->addAttribute('cases_count', $item['cases_count']);
}
}
}
echo $xml->asXML();
die;
}
// Build xml document for all tree nodes
$xml = new SimpleXMLElement('<?xml version="1.0" standalone="yes"?><menu_cases />');
foreach ($menuCases as $menuId => $menuBlock) {
if (isset($menuBlock['blockItems']) && count($menuBlock['blockItems']) > 0) {
// adding "menu_block" node
$menuBlockNode = $xml->addChild('menu_block');
$menuBlockNode->addAttribute('id', $menuId);
$menuBlockNode->addAttribute('blockTitle', $menuBlock['blockTitle']);
if (! empty($menuBlock['link'])) {
$menuBlockNode->addAttribute('url', $menuBlock['link']);
}
// adding "menu_block" childs nodes
foreach ($menuBlock['blockItems'] as $id => $menu)
{
$option = $menuBlockNode->addChild('option');
$option->addAttribute('id', $id);
$option->addAttribute('title', $menu['label']);
$option->addAttribute('url', $menu['link']);
if (! empty($menu['cases_count'])) {
$option->addAttribute('cases_count', $menu['cases_count']);
}
}
} elseif (isset($menuBlock['blockType']) && $menuBlock['blockType'] == "blockNestedTree") {
$menuBlockNode = $xml->addChild('menu_block');
$menuBlockNode->addAttribute('id', $menuId);
$menuBlockNode->addAttribute('folderId', "0");
$menuBlockNode->addAttribute('blockTitle', $menuBlock['blockTitle']);
$menuBlockNode->addAttribute('blockNestedTree', $menuBlock['loaderurl']);
} elseif (isset($menuBlock['blockType']) && $menuBlock['blockType'] == "blockHeaderNoChild") {
$menuBlockNode = $xml->addChild('menu_block');
$menuBlockNode->addAttribute('id', $menuId);
$menuBlockNode->addAttribute('blockTitle', $menuBlock['blockTitle']);
$menuBlockNode->addAttribute('blockHeaderNoChild', "blockHeaderNoChild");
$menuBlockNode->addAttribute('url', $menuBlock['link']);
}
}
echo $xml->asXML();
die;
// Build xml document for all tree nodes
/*$xml = '<menu_cases>';
$i = 0; $i = 0;
foreach ($menuCases as $menu => $aMenuBlock) { foreach ($menuCases as $menu => $aMenuBlock) {
if (isset( $aMenuBlock['blockItems'] ) && sizeof( $aMenuBlock['blockItems'] ) > 0) { if (isset( $aMenuBlock['blockItems'] ) && sizeof( $aMenuBlock['blockItems'] ) > 0) {
@@ -100,7 +165,7 @@ function getLoadTreeMenuData ()
} }
$xml .= '</menu_cases>'; $xml .= '</menu_cases>';
print $xml; print $xml;*/
} }
// get the process summary of specific case list type, // get the process summary of specific case list type,

View File

@@ -86,7 +86,7 @@ try {
$result->msg .= G::LoadTranslation("ID_FAILED_RECORD") . ($importResults->recordsCount - $importResults->recordsCountSuccess) . "\n"; $result->msg .= G::LoadTranslation("ID_FAILED_RECORD") . ($importResults->recordsCount - $importResults->recordsCountSuccess) . "\n";
if ($importResults->errMsg != '') { if ($importResults->errMsg != '') {
$result->msg .= "Errors registered: \n" . $importResults->errMsg . "\n"; $result->msg .= G::LoadTranslation("ID_ERROR_REGISTERED"). " \n" . $importResults->errMsg . "\n";
} }
//$result->msg = htmlentities($result->msg); //$result->msg = htmlentities($result->msg);

View File

@@ -20,6 +20,8 @@ var NOTIFIER_FLAG = false;
var result; var result;
var _action = ''; var _action = '';
var _CASE_TITLE; var _CASE_TITLE;
//@var treeMenuItemsLoaded -> added to flag the "treeMenuItems" tree, to ensure that its onload event is executed just once
var treeMenuItemsLoaded = false;
Ext.onReady(function(){ Ext.onReady(function(){
new Ext.KeyMap(document, { new Ext.KeyMap(document, {
@@ -228,25 +230,30 @@ Ext.onReady(function(){
}); });
var loader = treeMenuItems.getLoader(); var loader = treeMenuItems.getLoader();
loader.on("load", function(){ loader.on("load", function() {
document.getElementById('casesSubFrame').src = defaultOption; // it was added since the feature to reload a specific node of tree is now working
if (! treeMenuItemsLoaded) { // this section of code should be executed once
document.getElementById('casesSubFrame').src = defaultOption;
// check if a case was open directly // check if a case was open directly
if (defaultOption.indexOf('open') > -1) { if (defaultOption.indexOf('open') > -1) {
//if it is, then update cases tree //if it is, then update cases trees
updateCasesTree(); updateCasesTree();
} }
if( _nodeId != '' ){ if( _nodeId != '' ){
treePanel1 = Ext.getCmp('tree-panel') treePanel1 = Ext.getCmp('tree-panel')
if(treePanel1) if(treePanel1)
node = treePanel1.getNodeById(_nodeId); node = treePanel1.getNodeById(_nodeId);
if(node) { if(node) {
node.select(); node.select();
if (_nodeId == 'CASES_START_CASE') { if (_nodeId == 'CASES_START_CASE') {
updateCasesTree(); updateCasesTree();
}
} }
} }
treeMenuItemsLoaded = true;
} }
}); });

View File

@@ -0,0 +1,24 @@
<table width="100%" cellpadding="10" cellspacing="0" style="background: #FFFFFF; font: 11px arial, verdana, helvetica, sans-serif;">
<tr>
<td style="font-size: 14px;">
<strong>CASO NAO ATRIBUÍDOS</strong>
<hr />
</td>
</tr>
<tr>
<td>
O caso <strong>#@#APP_NUMBER</strong> está disponível na lista não atribuído.
<br />
<br />
Nota: Se você quer reivindicar o caso e ele não está disponível na lista, pode ser já tomadas.
</td>
</tr>
<tr>
<td>
<hr />
Este processo de negócio é alimentado por DocSystem
<br />
<a href="http://www.docsystemcorp.com" style="color: #C40000;">www.docsystemcorp.com</a>
</td>
</tr>
</table>

View File

@@ -47,6 +47,7 @@ Ext.onReady(function(){
handler: newPMTable handler: newPMTable
}); });
} }
var flagProcessmap = (typeof('flagProcessmap') != 'undefined') ? flagProcessmap : 0;
newMenuOptions.push({ newMenuOptions.push({
text: _('ID_NEW_REPORT_TABLE'), text: _('ID_NEW_REPORT_TABLE'),
@@ -414,7 +415,6 @@ DoNothing = function(){};
//Load New PM Table Forms //Load New PM Table Forms
NewReportTable = function() { NewReportTable = function() {
var flagProcessmap = (typeof('flagProcessmap') != 'undefined') ? flagProcessmap : 0;
if(PRO_UID !== false) { if(PRO_UID !== false) {
location.href = 'pmTables/edit?PRO_UID='+PRO_UID+'&tableType=report&flagProcessmap='+flagProcessmap; location.href = 'pmTables/edit?PRO_UID='+PRO_UID+'&tableType=report&flagProcessmap='+flagProcessmap;
} else { } else {