diff --git a/gulliver/system/class.dbMaintenance.php b/gulliver/system/class.dbMaintenance.php index 977499065..221476d6e 100755 --- a/gulliver/system/class.dbMaintenance.php +++ b/gulliver/system/class.dbMaintenance.php @@ -267,7 +267,7 @@ class DataBaseMaintenance // mysql_escape_string("';"); if (! @mysql_query( $sql )) { $ws = (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined"; - Bootstrap::registerMonolog('MysqlCron', 400, mysql_error(), array('sql'=>$sql), $ws, 'mysql.log'); + Bootstrap::registerMonolog('MysqlCron', 400, mysql_error(), array('sql'=>$sql), $ws, 'processmaker.log'); $varRes = mysql_error() . "\n"; G::outRes( $varRes ); return false; @@ -288,7 +288,7 @@ class DataBaseMaintenance $sql = "LOAD DATA INFILE '$backupFile' INTO TABLE $tableName FIELDS TERMINATED BY '\t|\t' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\t\t\r\r\n'"; if (! @mysql_query( $sql )) { $ws = (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined"; - Bootstrap::registerMonolog('MysqlCron', 400, mysql_error(), array('sql'=>$sql), $ws, 'mysql.log'); + Bootstrap::registerMonolog('MysqlCron', 400, mysql_error(), array('sql'=>$sql), $ws, 'processmaker.log'); $varRes = mysql_error() . "\n"; G::outRes( $varRes ); return false; @@ -520,7 +520,7 @@ class DataBaseMaintenance * @return string $tableSchema */ function getSchemaFromTable ($tablename) - { + { //$tableSchema = "/* Structure for table `$tablename` */\n"; //$tableSchema .= "DROP TABLE IF EXISTS `$tablename`;\n\n"; $tableSchema = ""; diff --git a/gulliver/system/class.pmException.php b/gulliver/system/class.pmException.php index d615f6b25..273529b47 100755 --- a/gulliver/system/class.pmException.php +++ b/gulliver/system/class.pmException.php @@ -22,7 +22,6 @@ class PMException extends Exception public function registerErrorLog($error, $token){ $ws = (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined"; - Bootstrap::registerMonolog('ExceptionCron', 400, $error->getMessage(), array('token'=>$token), $ws, 'exception.log'); + Bootstrap::registerMonolog('ExceptionCron', 400, $error->getMessage(), array('token'=>$token), $ws, 'processmaker.log'); } } - diff --git a/workflow/engine/classes/class.processes.php b/workflow/engine/classes/class.processes.php index 2449396eb..3cf3c8c43 100755 --- a/workflow/engine/classes/class.processes.php +++ b/workflow/engine/classes/class.processes.php @@ -4129,7 +4129,7 @@ class Processes try { $result = $scriptTask->create($processUid, $record); } catch (Exception $e) { - Bootstrap::registerMonolog('DataError', 400, $e->getMessage(), $record, SYS_SYS, 'processImporter.log'); + Bootstrap::registerMonolog('DataError', 400, $e->getMessage(), $record, SYS_SYS, 'processmaker.log'); } } } catch (Exception $e) { diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php index 520d5ec8d..50fa3d84a 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php @@ -475,7 +475,7 @@ class EmailEvent \PMFSendMessage($appUID, $configEmailData['MESS_ACCOUNT'], $emailTo, '', '', $subject, $contentFile['prf_filename'], array(), array(), true, 0, $configEmailData); } else { - \Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], SYS_SYS, 'emailEvent.log'); + \Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], SYS_SYS, 'processmaker.log'); } } } @@ -530,4 +530,3 @@ class EmailEvent } } } - diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php index 454b4b638..6de225cc8 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php @@ -303,7 +303,7 @@ class Light $response['caseNumber'] = $aData['CASE_NUMBER']; //Log - \Bootstrap::registerMonolog('create-case', 200, "Create case", ['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], SYS_SYS, 'mobileLogs.log'); + \Bootstrap::registerMonolog('MobileCreateCase', 200, "Create case", ['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], SYS_SYS, 'processmaker.log'); } catch (Exception $e) { $response['status'] = 'failure'; $response['message'] = $e->getMessage(); @@ -539,7 +539,7 @@ class Light } //Log - \Bootstrap::registerMonolog('route-case', 200, 'Route case', ['application_uid' => $applicationUid, 'usr_uid' => $userUid], SYS_SYS, 'mobileLogs.log'); + \Bootstrap::registerMonolog('MobileRouteCase', 200, 'Route case', ['application_uid' => $applicationUid, 'usr_uid' => $userUid], SYS_SYS, 'processmaker.log'); } catch (\Exception $e) { throw $e; } @@ -1343,4 +1343,3 @@ class Light } } - diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php b/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php index 5674215cb..6841a6628 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php @@ -661,10 +661,9 @@ class MessageApplication ,'inpDocUid'=> $inpDocUid ,'url' => $url ); - \Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, SYS_SYS, 'messageevent.log'); + \Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, SYS_SYS, 'processmaker.log'); } catch (\Exception $e) { throw $e; } } } - diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php index de31ea93b..5104d8517 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php @@ -1211,7 +1211,7 @@ class TimerEvent ,'inpDocUid'=> $inpDocUid ,'url' => $url ); - \Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, SYS_SYS, 'timerevent.log'); + \Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, SYS_SYS, 'processmaker.log'); } catch (\Exception $e) { throw $e; } @@ -1733,4 +1733,3 @@ class TimerEvent } } } - diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php index 9d36b4add..6408ff059 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php @@ -685,9 +685,13 @@ class WebEntryEvent } //Route - if (isset($arrayData["ACT_UID"]) && $arrayData["ACT_UID"] != $arrayWebEntryEventData["ACT_UID"]) { - //Delete - $result = $task->deleteAllRoutesOfTask($arrayWebEntryEventData["PRJ_UID"], $arrayWebEntryEventData["WEE_WE_TAS_UID"], true); + if (array_key_exists('ACT_UID', $arrayData)) { + if ($arrayData['ACT_UID'] != $arrayWebEntryEventData['ACT_UID']) { + //Delete + $result = $task->deleteAllRoutesOfTask( + $arrayWebEntryEventData['PRJ_UID'], $arrayWebEntryEventData['WEE_WE_TAS_UID'], true + ); + } //Add $workflow = \ProcessMaker\Project\Workflow::load($arrayWebEntryEventData["PRJ_UID"]); @@ -1001,4 +1005,3 @@ class WebEntryEvent } } } - diff --git a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php index 7d8551df9..09d2ffb8e 100755 --- a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php +++ b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php @@ -351,7 +351,7 @@ class BpmnWorkflow extends Project\Bpmn //$this->updateEventStartObjects($data["FLO_ELEMENT_ORIGIN"], $data["FLO_ELEMENT_DEST"]); //WebEntry-Event - Update - $this->updateWebEntryEventByEvent($data["FLO_ELEMENT_ORIGIN"], array("ACT_UID" => $data["FLO_ELEMENT_DEST"])); + $this->__updateWebEntryEventByEvent($data['FLO_ELEMENT_ORIGIN'], ['ACT_UID' => $data['FLO_ELEMENT_DEST']]); break; case "bpmnEvent": $messageEventRelationUid = $this->createMessageEventRelationByBpmnFlow(\BpmnFlowPeer::retrieveByPK($floUid)); @@ -401,7 +401,7 @@ class BpmnWorkflow extends Project\Bpmn //$this->updateEventStartObjects($flowCurrent->getFloElementOrigin(), $flowCurrent->getFloElementDest()); //WebEntry-Event - Update - $this->updateWebEntryEventByEvent($flowCurrent->getFloElementOrigin(), array("ACT_UID" => $flowCurrent->getFloElementDest())); + $this->__updateWebEntryEventByEvent($flowCurrent->getFloElementOrigin(), ['ACT_UID' => $flowCurrent->getFloElementDest()]); } } @@ -487,11 +487,9 @@ class BpmnWorkflow extends Project\Bpmn $event = \BpmnEventPeer::retrieveByPK($flow->getFloElementOrigin()); if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "EMPTY") { - $activity = \BpmnActivityPeer::retrieveByPK($flow->getFloElementDest()); - //Remove as start Task - if (!is_null($activity)) { - $this->wp->setStartTask($activity->getActUid(), false); + if (!is_null(\BpmnActivityPeer::retrieveByPK($flow->getFloElementDest()))) { + $this->wp->setStartTask($flow->getFloElementDest(), false); } } } @@ -500,7 +498,7 @@ class BpmnWorkflow extends Project\Bpmn //WebEntry-Event - Update if (is_null($bpmnFlow)) { - $this->updateWebEntryEventByEvent($flow->getFloElementOrigin(), array("WEE_STATUS" => "DISABLED")); + $this->__updateWebEntryEventByEvent($flow->getFloElementOrigin(), ['WEE_STATUS' => 'DISABLED']); } } elseif ($flow->getFloElementOriginType() == "bpmnActivity" && $flow->getFloElementDestType() == "bpmnEvent") { @@ -509,11 +507,9 @@ class BpmnWorkflow extends Project\Bpmn $event = \BpmnEventPeer::retrieveByPK($flow->getFloElementDest()); if (!is_null($event) && $event->getEvnType() == "END" && $event->getEvnMarker() == "EMPTY") { - $activity = \BpmnActivityPeer::retrieveByPK($flow->getFloElementOrigin()); - //Remove as end Task - if (! is_null($activity)) { - $this->wp->setEndTask($activity->getActUid(), false); + if (!is_null(\BpmnActivityPeer::retrieveByPK($flow->getFloElementOrigin()))) { + $this->wp->setEndTask($flow->getFloElementOrigin(), false); } } } else { @@ -549,7 +545,7 @@ class BpmnWorkflow extends Project\Bpmn // TODO Complete for other routes, activity->activity, activity->gateway and viceversa } - public function updateEventActivityDefinition(\BpmnEvent $bpmnEvent, $flagStartTask) + private function __updateEventActivityDefinition(\BpmnEvent $bpmnEvent, $flagStartTask) { try { if ($bpmnEvent->getEvnType() == "START") { @@ -568,9 +564,10 @@ class BpmnWorkflow extends Project\Bpmn //Setting as start Task //or //Remove as start Task - $bwp = new self; - if ($bwp->getActivity($arrayFlowData["FLO_ELEMENT_DEST"])) { - $this->wp->setStartTask($arrayFlowData["FLO_ELEMENT_DEST"], $flagStartTask); + if (!is_null(\BpmnActivityPeer::retrieveByPK($arrayFlowData['FLO_ELEMENT_DEST']))) { + $this->wp->setStartTask($arrayFlowData['FLO_ELEMENT_DEST'], $flagStartTask); + + $this->__updateWebEntryEventByEvent($bpmnEvent->getEvnUid()); } break; } @@ -673,7 +670,7 @@ class BpmnWorkflow extends Project\Bpmn if ((isset($arrayEventData["EVN_TYPE"]) && $arrayEventData["EVN_TYPE"] != $bpmnEvent->getEvnType()) || (isset($arrayEventData["EVN_MARKER"]) && $arrayEventData["EVN_MARKER"] != $bpmnEvent->getEvnMarker()) ) { - $this->updateEventActivityDefinition($bpmnEvent, false); + $this->__updateEventActivityDefinition($bpmnEvent, false); $this->removeEventDefinition($bpmnEvent); } @@ -688,7 +685,7 @@ class BpmnWorkflow extends Project\Bpmn try { $bpmnEvent = \BpmnEventPeer::retrieveByPK($eventUid); - $this->updateEventActivityDefinition($bpmnEvent, false); + $this->__updateEventActivityDefinition($bpmnEvent, false); $this->removeEventDefinition($bpmnEvent); parent::removeEvent($eventUid); @@ -1167,7 +1164,7 @@ class BpmnWorkflow extends Project\Bpmn $this->mapBpmnEventToWorkflowRoutes($taskUid, $event["EVN_UID"]); break; case "EMPTY": - $this->updateEventActivityDefinition(\BpmnEventPeer::retrieveByPK($event["EVN_UID"]), true); + $this->__updateEventActivityDefinition(\BpmnEventPeer::retrieveByPK($event['EVN_UID']), true); break; } break; @@ -1973,7 +1970,7 @@ class BpmnWorkflow extends Project\Bpmn $this->wp->setDisabled($value); } - public function updateWebEntryEventByEvent($eventUid, array $arrayData) + private function __updateWebEntryEventByEvent($eventUid, array $arrayData = null) { try { $bpmnEvent = \BpmnEventPeer::retrieveByPK($eventUid); @@ -1987,7 +1984,11 @@ class BpmnWorkflow extends Project\Bpmn $bpmn = \ProcessMaker\Project\Bpmn::load($bpmnEvent->getPrjUid()); $bpmnProject = $bpmn->getProject("object"); - $arrayResult = $webEntryEvent->update($arrayWebEntryEventData["WEE_UID"], $bpmnProject->getPrjAuthor(), $arrayData); + $arrayResult = $webEntryEvent->update( + $arrayWebEntryEventData['WEE_UID'], + $bpmnProject->getPrjAuthor(), + (!is_null($arrayData))? $arrayData : $arrayWebEntryEventData + ); } } } catch (\Exception $e) {