Issue #0001903: [Commandes KBIS] Référencer les commandes de kbis. Adresse email est pris du compte de l'utilisateur
This commit is contained in:
parent
8549ca1623
commit
3945b0cb14
@ -641,10 +641,14 @@ class PiecesController extends Zend_Controller_Action
|
||||
|
||||
switch($method) {
|
||||
|
||||
case 'M':
|
||||
$email = $request->getParam('emailKbisM', '');
|
||||
case 'M':
|
||||
$emails = explode(';',$user->getEmail());
|
||||
$email = $emails[0];
|
||||
|
||||
$validator = new Zend_Validate_EmailAddress();
|
||||
|
||||
//Vérification des champs
|
||||
if (!empty($email)) {
|
||||
if (!empty($email) && $validator->isValid($email)) {
|
||||
//Envoi du mail
|
||||
$mail = new Scores_Mail();
|
||||
$mail->setFrom('contact');
|
||||
@ -671,7 +675,7 @@ class PiecesController extends Zend_Controller_Action
|
||||
'adresse' => '',
|
||||
'cp' => '',
|
||||
'ville' => '',
|
||||
'siren' => substr($this->siret,0,9),
|
||||
'siren' => $siren,
|
||||
'raisonSociale' => $session->getRaisonSociale(),
|
||||
'type' => 'M',
|
||||
'dateCommande' => date('Y-m-d H:i:s'),
|
||||
@ -681,16 +685,18 @@ class PiecesController extends Zend_Controller_Action
|
||||
$message = 'Votre demande de reception de Kbis par email a été prise en compte';
|
||||
$ws = new WsScores();
|
||||
$ws->setLog('kbis', $this->siret, 0, 'mail');
|
||||
$ws->getKbis($siren, $method, $ref);
|
||||
} else {
|
||||
$message = '<font color="red">Erreur : adresse email non renseignée.</font>';
|
||||
$message = '<font color="red">Erreur : adresse email non renseignée ou n\'est pas correcte.</font>';
|
||||
$this->view->assign('ref', $ref);
|
||||
$this->view->assign('method', $method);
|
||||
$this->view->assign('emailKbisM', $email);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
$email = $ref = $request->getParam('emailKbisC', '');
|
||||
$emails = explode(';',$user->getEmail());
|
||||
$email = $ref = $emails[0];
|
||||
|
||||
//Vérification des champs
|
||||
$fields = array('societe', 'nom', 'prenom', 'adresse', 'cp', 'ville');
|
||||
$params = $request->getParams();
|
||||
@ -731,7 +737,7 @@ class PiecesController extends Zend_Controller_Action
|
||||
'adresse' => $params['adresse'],
|
||||
'cp' => $params['cp'],
|
||||
'ville' => $params['ville'],
|
||||
'siren' => substr($this->siret,0,9),
|
||||
'siren' => $siren,
|
||||
'raisonSociale' => $session->getRaisonSociale(),
|
||||
'type' => 'C',
|
||||
'dateCommande' => date('Y-m-d H:i:s'),
|
||||
@ -741,11 +747,11 @@ class PiecesController extends Zend_Controller_Action
|
||||
$message = 'Votre commande à été prise en compte, vous recevrez ce document sous 3/5 jours';
|
||||
$ws = new WsScores();
|
||||
$ws->setLog('kbis', $this->siret, 0, 'courrier');
|
||||
$ws->getKbis($siren, $method, $ref);
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<font color="red">Erreur : Tous les champs doivent être renseigner.</font>';
|
||||
$this->view->assign('emailKbisC', $email);
|
||||
$this->view->assign('method', $method);
|
||||
$this->view->assign('societe', $params['societe']);
|
||||
$this->view->assign('nom', $params['nom']);
|
||||
@ -1096,7 +1102,7 @@ class PiecesController extends Zend_Controller_Action
|
||||
{
|
||||
require_once 'Scores/WsScores.php';
|
||||
$ws = new WsScores();
|
||||
$info = $ws->getKbis($siren);
|
||||
$info = $ws->getKbis($siren, 'T');
|
||||
|
||||
if ( substr($info,0,7)=='http://' ) {
|
||||
//Suppression du fichier si il existe
|
||||
|
@ -34,17 +34,9 @@ dont vous trouverez les coordonnées <a href="<?=$this->url(array(
|
||||
</div>
|
||||
|
||||
<div id="kbisM">
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>E-mail</label>
|
||||
<div class="field">
|
||||
<?php
|
||||
$user = $this->partial()->view->user;
|
||||
?>
|
||||
<input type="text" class="longfield" name="emailKbisM" value="<?=$user->getEmail()?>">
|
||||
<span>Précisez votre e-mail pour recevoir le kbis.</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Référence</label>
|
||||
@ -62,10 +54,6 @@ $user = $this->partial()->view->user;
|
||||
|
||||
<div id="kbisC">
|
||||
<div class="fieldgrp">
|
||||
<label>Votre E-mail</label>
|
||||
<div class="field"><input class="longfield" type="text" name="emailKbisC" value="<?=$user->getEmail()?>"/></div>
|
||||
</div>
|
||||
<div class="fieldgrp">
|
||||
<label>Votre Societe</label>
|
||||
<div class="field"><input class="longfield" type="text" name="societe" value="<?=$this->partial()->view->societe?>"/></div>
|
||||
</div>
|
||||
|
@ -4,10 +4,12 @@ class Scores_Ws_Pieces extends Scores_Ws_Abstract
|
||||
/**
|
||||
* Récupération des kbis
|
||||
*/
|
||||
public function getKbis($siren)
|
||||
public function getKbis($siren, $diffusion, $reference='')
|
||||
{
|
||||
$params = new StdClass;
|
||||
$params->siren = $siren;
|
||||
$params->diffusion = $diffusion;
|
||||
$params->reference = $reference;
|
||||
$client = $this->loadClient('pieces');
|
||||
try {
|
||||
$reponse = $client->getKbis($params);
|
||||
|
@ -1137,10 +1137,12 @@ class WsScores
|
||||
/**
|
||||
* Récupération des kbis
|
||||
*/
|
||||
public function getKbis($siren)
|
||||
public function getKbis($siren, $diffusion, $reference='')
|
||||
{
|
||||
$params = new StdClass;
|
||||
$params->siren = $siren;
|
||||
$params->diffusion = $diffusion;
|
||||
$params->reference = $reference;
|
||||
$client = $this->loadClient('pieces');
|
||||
try {
|
||||
$reponse = $client->getKbis($params);
|
||||
|
Loading…
Reference in New Issue
Block a user