https://cr.airmob.net
* Si Msisdn inconnu alors (demande le rio) BLOQUE !
* Sinon le renseigne auto (dans email précisé auto ou manuel)
* Passe le client zoho de client potentiel à client
* Ajout du lien vers compte ZOHO du site
* envoi un email à BV et LV (me dire quand test ok pour passer email prod)
*
* */
session_start();
error_reporting(E_ALL);
ini_set("display_errors", 0);
require "lib/gestion.lib.php";
$CRouge = new CRouge();
$ListeSites = $CRouge->ListeSites();
// Initialize
$etape = "formulaire";
// POST
if($_REQUEST['BTN_VALIDE']) {
// Releve la saisie
foreach ($_REQUEST as $NomChamp => $val) {
list($form, $nom) = explode('_', $NomChamp);
if ($form == "form") {
$L[$nom] = $val;
}
}
// AJoute
list($email, $site, $type, $id_zoho) = explode('|', $_SESSION['CROUGE']['Sites'][$_REQUEST['form_sites']]);
$L['site_nom'] = $site;
$L['site_email'] = $email;
$L['rio_auto'] = $_SESSION['CROUGE']['rio'];
$L['type'] = $type; //Client potentiel OU Client
$L['id_zoho'] = "https://crm.zoho.com/crm/org602944158/tab/Accounts/".$id_zoho."/";
// 1er fois
if($type=="Client potentiel") {
$txt = "Le client n'a jamais signé de bon de commande.
";
}
// Autre passage
else if($type=="Client") {
$txt = "Normalement, le client a déjà signé un bon de commande pour ce site
";
}
// ...
else {
}
$txt .= "Site : " . $L['site_nom'] . "
";
$txt .= "E-mail(site) : " . $L['site_email'] . "
";
$txt .= "Prénom, Nom : " . $L['prenom'] . " " . $L['nom'] . "
";
$txt .= "Téléphone : " . $L['tel'] . "
";
// RIO Manuel // SESSION vide SAISIE ok
if (!$_SESSION['CROUGE']['rio_auto'] && $L['rio']) {
$txt .= "Code RIO (manuel) : " . $L['rio'] . "
";
}
// RIO auto // SESSION ok SAISIE vide
if ($_SESSION['CROUGE']['rio']) {
$txt .= "Code RIO (auto) : " . $L['rio_auto'] . "
";
}
$txt .= "Forfait : " . $L['forfait'] . "
";
$txt .= "Adresse : " . $L['adresse'] . "
";
if ($L['etage'] ) $txt .= "Etage : " . $L['etage']."
";
if ($L['noappart']) $txt .= "No Appart : " . $L['noappart'] . "
";
$txt .= "
Compte ZOHO : " . $L['id_zoho'] ;
/*
echo $txt;
echo "
"; print_r($_REQUEST); echo ""; echo "
"; print_r($L); echo ""; echo "
"; print_r($_SESSION['CROUGE']); echo ""; exit; */ // A envoyer au validateur $L['site_email'] $emailTO = "service-commercial@airmob.net"; $emailFROM = "service-commercial@airmob.net"; /* $emailTO = "luc@bvcs.fr"; $emailFROM = "luc@bvcs.fr"; */ $Array = ['to' => $emailTO, 'subject' => '[Croix-Rouge] Demande de Sim', 'body' => utf8_decode($txt), 'from' => $emailFROM]; $SendMail = $CRouge->MySendMail($Array); // Enregsitre if($SendMail) { $UrlZoho = "https://www.zohoapis.com/crm/v2/functions/updateaccounttype/actions/execute?auth_type=apikey&zapikey=1003.0a4f67d4caf25a2aff721ead55a2e279.2cd44560efe6f1665359bdb5c79f7c8a"; $UrlParam = "&id=" . $id_zoho; $Result_json = $CRouge->pushToZoho($UrlZoho . $UrlParam); $_SESSION['CROUGE'] = []; } $etape = "valide_1"; } ?>
