SD-1 Poss de saisir le siret si absent

This commit is contained in:
Claire DELBOS 2017-03-31 16:19:14 +02:00
parent 67ecccb832
commit ca628690ca
4 changed files with 74 additions and 9 deletions

View File

@ -143,6 +143,19 @@ class Achatclient_IndexController extends Zend_Controller_Action
$infos[$item->key][$obj->key]=$obj->value;
}
}
if(empty($infos['societe'])){
$infos['commande']['nb_credit']=$nb_credit;
if(intval($infos['commande']['siret'])==0){
$this->view->message='Merci d\'entrer votre numéro de siret';
}else{
$this->view->message='Votre numero de siret : '.$infos['commande']['siret'].' n\'a pas été trouvé';
}
$this->view->inlineScript()->appendFile($this->theme->pathScript.'/recherche.js', 'text/javascript');
$this->view->infosfact=$infos['commande'];
$this->view->pbparams=null;
return;
}
//Calcul de la TVA
//Si pays France > TVA = 20,00 %
$tva=0.2;
@ -267,13 +280,24 @@ class Achatclient_IndexController extends Zend_Controller_Action
$ok=$this->sendContact($data,$user);
$this->view->msg="Votre message a bien été pris en compte";
}
$this->redirect(array('module' => 'achatclient','controller' => 'index', 'action'=>'contact'));
$this->redirect('/achatclient/index/contact');
}
public function getsiretinfosAction(){
public function setsiretAction(){
//Validation
$request = $this->getRequest();
$user = new Scores_Utilisateur();
echo $user->getSiret();die;
$ok=$user->checkperm($this->libdroits);
if(!$ok){
$this->error('paiement', __LINE__);
}
$siret=$request->getParam('siret');
$nb_credit=$request->getParam('nb_credit');
$ws = new Scores_Ws_Client('account', '0.1');
$parameters = new stdClass();
$parameters->siret = $siret;
$created = $ws->setUserSiret($parameters);
$this->redirect('/achatclient/index/paiement?nb_credit='.$nb_credit);
}
public function consocsvAction(){
//Validation
@ -379,12 +403,15 @@ class Achatclient_IndexController extends Zend_Controller_Action
$request = $this->getRequest();
switch($ligne){
case "index":
$this->redirect("http://".$request->getHttpHost()."/achatclient/index/error?message=".$message);
$this->redirect("/achatclient/index/error?message=".$message);
break;
case "paiement":
$this->redirect("http://".$request->getHttpHost()."/achatclient/?message=".$message);
$this->redirect("/achatclient/?message=".$message);
break;
default:
case "siret":
$this->redirect("/achatclient/index/error?message=".$message);
break;
default:
echo $ligne.' : '.$message;die;
}
}

View File

@ -5,9 +5,44 @@ div .credit{
td.nbr{
text-align:right;
}
alert{
border:1px solid red;
}
</style>
<?php if(empty($this->pbparams)):?>
<div id="center">
<h1>ACHAT de CREDITS <small>Informations complémentaires</small></h1>
<h2><?=$this->message ?></h2>
<div class="credit">
<form id="siretform" method="post" action="<?=$this->url(array('module' => 'achatclient','controller' => 'index', 'action' => 'setSiret'))?>" class="form-inline horizontal">
<input type="hidden" name="nb_credit" value="<?=$this->infosfact['nb_credit'] ?>">
<label for="siret">Siret :</label>
<input type="text" name="siret">
<input type="submit" name="submitsiret" value="Enregistrer" class="button ui-button ui-corner-all ui-widget">
<a href="/achatclient/" class="button ui-button ui-corner-all ui-widget">Abandon</a>
</form>
</div>
<div id="errors"></div>
<script>
$(function(){
$('input[name=submitsiret').click(function(e){
e.preventDefault();
siret=$('input[name=siret]').val();
if(EstSiretValide(siret)){
$('#siretform').submit();
}else{
$('input[name=siret]').addClass('alert alert-danger');
$('#errors').addClass('alert alert-danger');
$('#errors').html('Veuillez entrer un siret valide pour vous identifier');
}
//$('form[name=cgu]').submit();
});
});
</script>
<?php echo $this->inlineScript(); ?>
<?php else:?>
<div id="center">
<h1>ACHAT de CREDITS <small>Confirmation</small></h1>
@ -19,7 +54,7 @@ td.nbr{
<tr><td>Société : </td><td><?=$this->infosfact->siret?><br><b><?=$this->infosfact->ClientName?></b>
<br><i><?=$this->infosfact->ClientFacAdr1?>-<?=$this->infosfact->ClientFacAdr2?> <?=$this->infosfact->ClientFacAdr3?></i>
<br><?=$this->infosfact->Clienttvanbr?></td></tr>
<tr><td>Nombre de crédits commandés : </td><td><?=$this->pbparams['nb_credit']?></td></tr>
<tr><td>Nombre de crédits commandés : </td><td class="nbr"><?=$this->pbparams['nb_credit']?></td></tr>
<tr><td>Montant HT : </td><td class="nbr"><?=number_format($this->pbparams['montantht']/100,2,","," ")?> euros</td></tr>
<tr><td>Tva : </td><td class="nbr"><?=number_format($this->pbparams['tva']/100,2,","," ")?> euros</td></tr>
<tr><td>Montant TTC : </td><td class="nbr"><?=number_format($this->pbparams['montant']/100,2,","," ")?> euros</td></tr>
@ -51,3 +86,4 @@ td.nbr{
<?php }?>
</div>
<?php endif;?>

View File

@ -283,7 +283,6 @@ class Scores_Utilisateur
*/
public function getSiret()
{
var_dump($this->identity);die;
return $this->identity->siret;
}

View File

@ -46,6 +46,9 @@ return array(
'setUserEmail' => array(
'log' => 'mail',
),
'setUserSiret' => array(
'log' => 'mail',
),
'setUserPassword' => array(
'log' => 'mail',
),