<?php

/*
  workflows invoke custom function example method function file (myexample.inc)

  put this file in the modules/workflow/ directory. if the directory does
   not exist, then just create it.
  
  see the myexample_register.php file for more information.
*/

function function_sendmail_haycotizacion( $entity ) {
    require_once 'modules/Emails/mail.php';
    global $adb;
    global $site_URL;

    $data = $entity->data;

    $id_ = explode("x", $data['id'])[1];
    $ticket_no = $data['ticket_no'];
    $ticket_title = $data['ticket_title'];


    //$query = $adb->pquery("SELECT email1 FROM vtiger_users INNER JOIN vtiger_user2role ON vtiger_users.id = vtiger_user2role.userid WHERE roleid = 'H17'", array());
    //$email1 = $adb->query_result($query, 0, 'email1');
    $email1 = "fiorella.berio@fursysperu.com.pe";
    $url = $site_URL . "index.php?module=HelpDesk&view=Detail&record=$id_";
$mensaje1 = <<<EOT
<!DOCTYPE html>
<html>
<head>
  <title>Notificacion VTIGER </title>
</head>
<body>
<p>
<h2>La Incidencia ha sido marcada como 'Cotización Enviada a Ventas': </h2>
<h3>Ticket Nro $ticket_no : $ticket_title</h3> 
Ver: <a href='$url'> $ticket_no - $ticket_title</a>
</body>
</html>
EOT;
        //echo $email1;
        //echo $mensaje1;
    $bcc='jjpena@creantis.com';
        send_mail('HelpDesk', $email1, 'CRM Fursys', 'vtiger-admin@fursys.com.pe',"CRM Fursys",$mensaje1, $cc='', $bcc, $atc="",$eid="",$logo='',$ug='');

}