public function handleEvent($handlerType, $entityData)
 {
     ob_start();
     $buqkvslhibra = "wfManager";
     if (isset($_REQUEST["tableblocks"])) {
         $fcbnalas = "tableBlocks";
         ${$fcbnalas} = $_REQUEST["tableblocks"];
         unset($_REQUEST["tableblocks"]);
     }
     ${$buqkvslhibra} = new \Workflow\Manager();
     ${"GLOBALS"}["miokdjdmdfu"] = "handlerType";
     EntityDelta::refreshDelta($entityData->getModuleName(), $entityData->focus->id);
     if (empty($_SERVER["HTTP_X_REQUESTED_WITH"]) || strtolower($_SERVER["HTTP_X_REQUESTED_WITH"]) != "xmlhttprequest") {
         Workflow2::${${"GLOBALS"}["ulovgcim"]} = false;
     }
     Workflow2::log($entityData->focus->id, 0, 0, "Start EventHandler");
     $snkisgyf = "tableBlocks";
     if ($entityData->getModuleName() == "Emails") {
         ${"GLOBALS"}["wykgomknt"] = "recordid";
         $blnoxjqmlwd = "from_email";
         ${${"GLOBALS"}["jivgrzryssor"]} = explode("|", $entityData->get("parent_id"));
         if (!empty($_REQUEST["pmodule"]) && !empty($_REQUEST["sorce_ids"])) {
             $swvglcac = "parent_ids";
             ${$swvglcac}[] = $_REQUEST["sorce_ids"];
         }
         $lioxtho = "from_email";
         ${$blnoxjqmlwd} = $entityData->get("from_email");
         ${${"GLOBALS"}["bichpdpooc"]} = $entityData->get("saved_toid");
         if (empty(${${"GLOBALS"}["jouqmwctl"]})) {
             if (!empty($_REQUEST["from_email"])) {
                 ${"GLOBALS"}["rbujprnbgdx"] = "email_val";
                 ${"GLOBALS"}["fitxeffb"] = "type";
                 list(${${"GLOBALS"}["fitxeffb"]}, ${${"GLOBALS"}["mhnoosvdd"]}) = explode("::", addslashes($_REQUEST["from_email"]), 2);
                 if (${${"GLOBALS"}["rbujprnbgdx"]} != "") {
                     global $adb;
                     if (${${"GLOBALS"}["bhmfosqagd"]} == "a") {
                         ${"GLOBALS"}["fqvigntr"] = "sql_a";
                         ${"GLOBALS"}["jncqqplmd"] = "from_email";
                         $igxjijlcydv = "sql_a";
                         ${${"GLOBALS"}["fqvigntr"]} = "select * from vtiger_systems where from_email_field != ? AND server_type = ?";
                         ${${"GLOBALS"}["xprvdcgf"]} = $adb->pquery(${$igxjijlcydv}, array("", "email"));
                         ${${"GLOBALS"}["jncqqplmd"]} = $adb->query_result(${${"GLOBALS"}["xprvdcgf"]}, 0, "from_email_field");
                     } else {
                         ${"GLOBALS"}["evgeluzfpjrb"] = "sql_u";
                         ${"GLOBALS"}["jbhzfdfy"] = "sql_u";
                         ${${"GLOBALS"}["evgeluzfpjrb"]} = "SELECT first_name, last_name, " . ${${"GLOBALS"}["bhmfosqagd"]} . " AS email  FROM vtiger_users WHERE id = '" . ${${"GLOBALS"}["mhnoosvdd"]} . "'";
                         ${${"GLOBALS"}["eldowmraukw"]} = $adb->pquery(${${"GLOBALS"}["jbhzfdfy"]}, array());
                         ${${"GLOBALS"}["jouqmwctl"]} = $adb->query_result(${${"GLOBALS"}["eldowmraukw"]}, 0, "email");
                     }
                 }
             } else {
                 $gpvvsxkue = "from_email";
                 global $current_user;
                 ${$gpvvsxkue} = $current_user->column_fields["email1"];
             }
         }
         ${${"GLOBALS"}["ijfuwupmdh"]} = array("subject" => $entityData->get("subject"), "content" => $entityData->get("description"), "from" => ${$lioxtho}, "to" => ${${"GLOBALS"}["bichpdpooc"]});
         foreach (${${"GLOBALS"}["jivgrzryssor"]} as ${${"GLOBALS"}["wykgomknt"]}) {
             $ypgvphf = "recordid";
             if (empty(${${"GLOBALS"}["oubotd"]})) {
                 continue;
             }
             ${${"GLOBALS"}["lcnizm"]} = VTEntity::getForId(${$ypgvphf});
             if (${${"GLOBALS"}["lcnizm"]} !== false) {
                 ${"GLOBALS"}["lxtohylj"] = "workflows";
                 ${${"GLOBALS"}["lxtohylj"]} = $wfManager->GetWorkflows($context->getModuleName(), Workflow\Main::SENDMAIL_START);
                 if (count(${${"GLOBALS"}["qyirwsbmmu"]}) > 0) {
                     ${"GLOBALS"}["ccnmigsavy"] = "maildata";
                     $smkkdars = "wf";
                     $context->setEnvironment("email", ${${"GLOBALS"}["ccnmigsavy"]});
                     foreach (${${"GLOBALS"}["qyirwsbmmu"]} as ${$smkkdars}) {
                         $wf->setExecutionTrigger("WF2_CREATION");
                         if (!$context->isAvailable()) {
                             break;
                         }
                         $wf->setContext(${${"GLOBALS"}["lcnizm"]});
                         if ($wf->checkCondition(${${"GLOBALS"}["zltonpc"]})) {
                             $wf->start();
                         }
                     }
                 }
             }
         }
     }
     if ($entityData->getModuleName() == "ModComments") {
         ${${"GLOBALS"}["iasgnhr"]} = array("commentcontent" => $entityData->get("commentcontent"), "assigned_user_id" => $entityData->get("assigned_user_id"));
         $tvesqluqa = "parent_ids";
         ${$tvesqluqa} = array($entityData->get("related_to"));
         foreach (${${"GLOBALS"}["jivgrzryssor"]} as ${${"GLOBALS"}["oubotd"]}) {
             ${${"GLOBALS"}["lcnizm"]} = VTEntity::getForId(${${"GLOBALS"}["oubotd"]});
             $context->loadEnvironment(array_merge($context->getEnvironment(), ${${"GLOBALS"}["iasgnhr"]}));
             if (${${"GLOBALS"}["lcnizm"]} !== false) {
                 $fpzckemsvm = "wf";
                 ${${"GLOBALS"}["qyirwsbmmu"]} = $wfManager->GetWorkflows($context->getModuleName(), Workflow\Main::COMMENT_START);
                 foreach (${${"GLOBALS"}["qyirwsbmmu"]} as ${$fpzckemsvm}) {
                     $wwheuivbjc = "context";
                     $wf->setExecutionTrigger("WF2_CREATION");
                     if (!$context->isAvailable()) {
                         break;
                     }
                     $gtfpogfmp = "entityData";
                     $wf->setContext(${$wwheuivbjc});
                     if ($wf->checkCondition(${$gtfpogfmp})) {
                         $wf->start();
                     }
                 }
             }
         }
     }
     if (${${"GLOBALS"}["miokdjdmdfu"]} == "vtiger.entity.aftersave") {
         $obmqbokjajz = "context";
         ${$obmqbokjajz} = VTEntity::getForId($entityData->focus->id, $entityData->getModuleName());
         ${"GLOBALS"}["ubninbunb"] = "wf";
         ${"GLOBALS"}["jefljf"] = "context";
         Queue::updateDynamicDate(${${"GLOBALS"}["jefljf"]});
         ${${"GLOBALS"}["qyirwsbmmu"]} = $wfManager->GetWorkflows($entityData->getModuleName(), array(Workflow\Main::ON_FIRST_SAVE, Workflow\Main::ON_EVERY_SAVE));
         ${${"GLOBALS"}["qwvmufvez"]} = $entityData->isNew();
         foreach (${${"GLOBALS"}["qyirwsbmmu"]} as ${${"GLOBALS"}["ubninbunb"]}) {
             $uhytlcpqip = "context";
             if (!$wf->checkExecuteCondition(${$uhytlcpqip})) {
                 continue;
             }
             $wf->setExecutionTrigger(${${"GLOBALS"}["qwvmufvez"]} ? "WF2_CREATION" : "WF2_EVERY_SAVE");
             Workflow2::log($entityData->focus->id, $wf->getId(), 0, "Found WF");
             $fbdjnio = "isNew";
             if (PHP_SAPI === "cli") {
                 echo "Start of Workflow " . $wf->getId() . "\n";
             }
             ${${"GLOBALS"}["lcnizm"]} = VTEntity::getForId($entityData->focus->id, $entityData->getModuleName());
             $context->setIsNew(${$fbdjnio});
             if (!$context->isAvailable()) {
                 break;
             }
             $wf->setContext(${${"GLOBALS"}["lcnizm"]});
             if ($wf->checkCondition(${${"GLOBALS"}["zltonpc"]})) {
                 $wf->start();
                 if ($wf->getSuccessRedirection() !== false) {
                     header("Location:" . $wf->getSuccessRedirection());
                     exit;
                 }
             }
         }
     }
     if (${${"GLOBALS"}["tgrrmbvg"]} == "vtiger.entity.beforedelete") {
         ${${"GLOBALS"}["qyirwsbmmu"]} = $wfManager->GetWorkflows($entityData->getModuleName(), array(Workflow\Main::BEFOREDELETE_START));
         foreach (${${"GLOBALS"}["qyirwsbmmu"]} as ${${"GLOBALS"}["moypxyiw"]}) {
             if (!$wf->checkExecuteCondition(${${"GLOBALS"}["lcnizm"]})) {
                 continue;
             }
             $wf->setExecutionTrigger(Workflow\Main::BEFOREDELETE_START);
             Workflow2::log($entityData->focus->id, $wf->getId(), 0, "Found WF");
             if (PHP_SAPI === "cli") {
                 echo "Start of Workflow " . $wf->getId() . "\n";
             }
             ${${"GLOBALS"}["lcnizm"]} = VTEntity::getForId($entityData->focus->id, $entityData->getModuleName());
             $context->setIsNew(false);
             if (!$context->isAvailable()) {
                 break;
             }
             $wf->setContext(${${"GLOBALS"}["lcnizm"]});
             if ($wf->checkCondition(${${"GLOBALS"}["zltonpc"]})) {
                 $wf->start();
                 if ($wf->getSuccessRedirection() !== false) {
                     Workflow2::error_handler(E_NONBREAK_ERROR, "Redirections do not work on \"before delete\" triggered Workflows.");
                 }
             }
         }
     }
     if (isset(${$snkisgyf})) {
         $_REQUEST["tableblocks"] = ${${"GLOBALS"}["ujnutvf"]};
     }
     Workflow2::${${"GLOBALS"}["ihoxvzlniq"]} = false;
 }