Exemplo n.º 1
0
 public static function saveAclaratoria(IConnection $connectSQL, IConnection $connect, $idNomenclatura, $idReason, CampaignData $objCampaignData, CampaignOutbound $objCampaign, $username, $causalTimes = '')
 {
     if ($idNomenclatura == ACLARATORIA_FALLA_TECNICA || $idNomenclatura == ACLARATORIA_MALA_GESTION) {
         $objConfigVar = ConfigVar::getConfigVar();
         $arrayReasons = ConfigVar::getReasonsNoGestion($connect);
         $agentTMK = Altitude::getUserAltitudeID($connectSQL, $objCampaignData->getUsernameTMK());
         $agentResubmit = 'NULL';
         $resubmitAtt = TRUE;
         if ($idNomenclatura == ACLARATORIA_FALLA_TECNICA) {
             $agentResubmit = $agentTMK[0]['code'];
         } else {
             if ($idNomenclatura == ACLARATORIA_MALA_GESTION && $objCampaign->getErrorInformation() == 'N' && array_search($idReason, $arrayReasons) !== FALSE) {
                 $resubmitAtt = FALSE;
             }
         }
         if ($resubmitAtt) {
             Altitude::updateContact($connectSQL, $objCampaignData->getEasycode(), $agentResubmit, 'NULL', 'NULL', $objCampaign->getPriorityAclaratory(), '0');
         }
         Altitude::updateDataCampaign($connectSQL, $objCampaignData->getShortname(), $objCampaignData->getEasycode(), $idNomenclatura, $idReason, $objCampaignData->getCommentAUD() . "\n\rFecha Hora TMK: " . Util::formatDBWEB($objCampaignData->getDateTMK()) . " " . $objCampaignData->getTimeTMK() . "\n\n" . $causalTimes, $objCampaignData->getDeficiencia());
         CampaignData::saveAclaratoryCampaign($connect, $objCampaign->getCode(), $objCampaignData->getContactID(), Util::getDateSQL(true, true), $username, $objCampaignData->getUsernameTMK());
         CampaignData::updateCustomData($connect, $objCampaignData->getShortname() . '_custom', 'I', $objCampaignData->getContactID(), array('aclaratoria' => '1'));
         CampaignData::updateCustomData($connectSQL, $objCampaignData->getShortname(), 'E', $objCampaignData->getEasycode(), array('aclaratoria' => '1'));
         $objAlertAltiva = AlertAltiva::getAlertAltiva($connect, ALERT_BAD_GESTION);
         $objCampOutbound = CampaignOutbound::getCampaignOutbound($connect, $objCampaign->getCode());
         if ($idNomenclatura == ACLARATORIA_MALA_GESTION && $objAlertAltiva->getStatus() == 'A' && $objCampOutbound->getMismanagementAlerts() == 'S') {
             $objDataAlert = new DataAlerts();
             $objDataAlert->setAddressee($objAlertAltiva->getMails());
             $objDataAlert->setContent(DataAlerts::getContentDataAlertBadGestion($objCampaignData, $username, "{$objCampaign->getDescription()} ( {$objCampaign->getShortName()} )"));
             $objDataAlert->setDatetime(Util::getDateSQL(true, true));
             $objDataAlert->setIssue("MALA GESTION [ {$objCampaign->getDescription()} ] [ {$objCampaignData->getUsernameTMK()} ]");
             $objDataAlert->setSender($objAlertAltiva->getFrom());
             $objDataAlert->setStatus('A');
             $objDataAlert->insertDataAlert($connect);
         }
     }
 }