Session
This commit is contained in:
parent
6c555c7da0
commit
94cf63e5a3
@ -16,6 +16,11 @@ class ReportController extends Zend_Controller_Action
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
//Open session to backup the state of the process
|
||||
$cmdState = 0;
|
||||
$session = new Zend_Session_Namespace('Cmd');
|
||||
$session->state = $cmdState;
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
//Define title
|
||||
@ -31,14 +36,42 @@ class ReportController extends Zend_Controller_Action
|
||||
$ws = new WsScores('mricois', 'ju2loh6o');
|
||||
$response = $ws->getIdentiteLight($siren);
|
||||
if ($response !== false) {
|
||||
|
||||
//Identite
|
||||
$this->view->Siren = $response->Siren;
|
||||
$this->view->RaisonSociale = $response->Nom;
|
||||
$this->view->AdresseL1 = $response->Adresse;
|
||||
$this->view->AdresseL2 = $response->CP . ' ' . $response->Ville;
|
||||
$this->view->SirenExiste = true;
|
||||
$this->view->ButtonUrl = $this->view->url(array(
|
||||
'controller'=>'report',
|
||||
'action'=>'cmd',
|
||||
'siren'=>$response->Siren
|
||||
));
|
||||
|
||||
//Nombre
|
||||
$response = $ws->getLiens($siren);
|
||||
if ( $response !== false ) {
|
||||
$this->view->NbLiens = count($response->actionnaires->item)
|
||||
+ count($response->participations->item)
|
||||
+ count($response->directions->item);
|
||||
}
|
||||
|
||||
$response = $ws->getAnnoncesNum($siren);
|
||||
if ( $response !== false ) {
|
||||
foreach ( $response->item as $nb) {
|
||||
if ( $nb->type == 'bodacc' ) {
|
||||
$this->view->NbAnnonces = $nb->num;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$response = $ws->getListeBilans($siren);
|
||||
if ( $response !== false ) {
|
||||
$this->view->NbBilans = $response->nbReponses;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,10 +88,29 @@ class ReportController extends Zend_Controller_Action
|
||||
|
||||
$siren = $request->getParam('siren');
|
||||
|
||||
$url = $this->view->url(array(
|
||||
'controller' => 'report',
|
||||
'action' => 'index',
|
||||
'siren' => $siren,
|
||||
));
|
||||
|
||||
//Affichage du formulaires
|
||||
$form = new Application_Form_Command();
|
||||
if ( $request->isPost() ) {
|
||||
|
||||
//Write the state to the session
|
||||
$cmdState = 2;
|
||||
if ( Zend_Session::namespaceIsset('Cmd') ) {
|
||||
$session = new Zend_Session_Namespace('Cmd');
|
||||
if ( $session->state > $cmdState ) {
|
||||
$this->redirect($url);
|
||||
} else {
|
||||
$session->state = $cmdState;
|
||||
}
|
||||
} else {
|
||||
$this->redirect($url);
|
||||
}
|
||||
|
||||
$values = $request->getPost();
|
||||
$form->populate($values);
|
||||
|
||||
@ -79,26 +131,44 @@ class ReportController extends Zend_Controller_Action
|
||||
$this->view->msg = "Impossible de passer la commande.";
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (intval($siren)>100) {
|
||||
//Get report
|
||||
$report = new Scores_Partner_Report('indiscore3', $siren, 'mricois', 'ju2loh6o');
|
||||
$html = $report->getContent();
|
||||
//Write the state to the session
|
||||
$cmdState = 1;
|
||||
$session = new Zend_Session_Namespace('Cmd');
|
||||
if ( $session->state > $cmdState ) {
|
||||
$this->redirect($url);
|
||||
} else {
|
||||
$session->state = $cmdState;
|
||||
}
|
||||
|
||||
if ( $html !== false ) {
|
||||
if ( !isset($session->CmdID) || empty($session->CmdID) ) {
|
||||
|
||||
$c = Zend_Registry::get('config');
|
||||
$pathCmd = $c->profil->path->data;
|
||||
//Get the report
|
||||
if (intval($siren)>100) {
|
||||
$report = new Scores_Partner_Report('indiscore3', $siren, 'mricois', 'ju2loh6o');
|
||||
$html = $report->getContent();
|
||||
|
||||
$id = uniqid();
|
||||
//Write the file (name with commande id)
|
||||
if ( file_put_contents($pathCmd . DIRECTORY_SEPARATOR . $id.'.html', $html) ) {
|
||||
if ( $html !== false ) {
|
||||
|
||||
$this->view->CmdID = $id;
|
||||
$c = Zend_Registry::get('config');
|
||||
$pathCmd = $c->profil->path->data;
|
||||
|
||||
$id = uniqid();
|
||||
//Write the file (name with commande id)
|
||||
if ( file_put_contents($pathCmd . DIRECTORY_SEPARATOR . $id.'.html', $html) ) {
|
||||
|
||||
$session->CmdID = $this->view->CmdID = $id;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$this->view->CmdID = $session->CmdID;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -121,6 +191,20 @@ class ReportController extends Zend_Controller_Action
|
||||
//Commande ID
|
||||
$cmdId = $request->getParam('id');
|
||||
|
||||
//Write the state to the session
|
||||
$cmdState = 3;
|
||||
if ( Zend_Session::namespaceIsset('Cmd') ) {
|
||||
$session = new Zend_Session_Namespace('Cmd');
|
||||
if ( $session->state > $cmdState || $session->CmdID != $cmdId ) {
|
||||
$this->redirect($url);
|
||||
} else {
|
||||
$session->state = $cmdState;
|
||||
}
|
||||
} else {
|
||||
$this->redirect($url);
|
||||
}
|
||||
|
||||
|
||||
//Est ce que la commande existe
|
||||
$commandM = new Application_Model_Command();
|
||||
$where = $commandM->select()->where('cmdId=?', $cmdId);
|
||||
|
@ -14,19 +14,21 @@
|
||||
<div class="container">
|
||||
|
||||
<div class="page-header">
|
||||
<h2>Achat Bilan Financier <small>Commande</small></h2>
|
||||
<h2>RAPPORT FINANCIER COMPLET <small>Informations et paiement</small></h2>
|
||||
</div>
|
||||
|
||||
<?php if ( $this->siren && $this->CmdID ) {?>
|
||||
|
||||
<div><?=$this->msg?></div>
|
||||
|
||||
<p>* Champs obligatoires</p>
|
||||
|
||||
<form role="form" name="commande" action="<?=$this->form->getAction()?>" method="<?=$this->form->getMethod()?>">
|
||||
<input type="hidden" name="cmdId" value="<?=$this->CmdID?>" />
|
||||
<input type="hidden" name="siren" value="<?=$this->siren?>" />
|
||||
|
||||
<div class="form-group">
|
||||
<label><?=$this->form->email->getLabel()?></label>
|
||||
<label><?=$this->form->email->getLabel()?><?php if ($this->form->email->isRequired()) { echo ' *'; }?></label>
|
||||
<input type="email" name="<?=$this->form->email->getName()?>" class="form-control" value="<?=$this->form->email->getValue()?>" placeholder="<?=$this->form->email->getDescription()?>">
|
||||
<?php if ($this->form->email->hasErrors()) {?>
|
||||
<div class="alert alert-danger">
|
||||
@ -38,7 +40,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><?=$this->form->rs->getLabel()?></label>
|
||||
<label><?=$this->form->rs->getLabel()?><?php if ($this->form->rs->isRequired()) { echo ' *'; }?></label>
|
||||
<input type="text" name="<?=$this->form->rs->getName()?>" class="form-control" value="<?=$this->form->rs->getValue()?>" placeholder="<?=$this->form->rs->getDescription()?>">
|
||||
<?php if ($this->form->rs->hasErrors()) {?>
|
||||
<div class="alert alert-danger">
|
||||
@ -50,7 +52,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><?=$this->form->nom->getLabel()?></label>
|
||||
<label><?=$this->form->nom->getLabel()?><?php if ($this->form->nom->isRequired()) { echo ' *'; }?></label>
|
||||
<input type="text" name="<?=$this->form->nom->getName()?>" class="form-control" value="<?=$this->form->nom->getValue()?>" placeholder="<?=$this->form->nom->getDescription()?>">
|
||||
<?php if ($this->form->nom->hasErrors()) {?>
|
||||
<div class="alert alert-danger">
|
||||
@ -62,7 +64,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><?=$this->form->prenom->getLabel()?></label>
|
||||
<label><?=$this->form->prenom->getLabel()?><?php if ($this->form->prenom->isRequired()) { echo ' *'; }?></label>
|
||||
<input type="text" name="<?=$this->form->prenom->getName()?>" class="form-control" value="<?=$this->form->prenom->getValue()?>" placeholder="<?=$this->form->prenom->getDescription()?>">
|
||||
<?php if ($this->form->prenom->hasErrors()) {?>
|
||||
<div class="alert alert-danger">
|
||||
@ -74,7 +76,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><?=$this->form->adresse->getLabel()?></label>
|
||||
<label><?=$this->form->adresse->getLabel()?><?php if ($this->form->adresse->isRequired()) { echo ' *'; }?></label>
|
||||
<input type="text" name="<?=$this->form->adresse->getName()?>" class="form-control" value="<?=$this->form->adresse->getValue()?>" placeholder="<?=$this->form->adresse->getDescription()?>">
|
||||
<?php if ($this->form->adresse->hasErrors()) {?>
|
||||
<div class="alert alert-danger">
|
||||
@ -86,7 +88,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><?=$this->form->cp->getLabel()?></label>
|
||||
<label><?=$this->form->cp->getLabel()?><?php if ($this->form->cp->isRequired()) { echo ' *'; }?></label>
|
||||
<input type="text" name="<?=$this->form->cp->getName()?>" class="form-control" value="<?=$this->form->cp->getValue()?>" placeholder="<?=$this->form->cp->getDescription()?>">
|
||||
<?php if ($this->form->cp->hasErrors()) {?>
|
||||
<div class="alert alert-danger">
|
||||
@ -98,7 +100,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><?=$this->form->ville->getLabel()?></label>
|
||||
<label><?=$this->form->ville->getLabel()?><?php if ($this->form->ville->isRequired()) { echo ' *'; }?></label>
|
||||
<input type="text" name="<?=$this->form->ville->getName()?>" class="form-control" value="<?=$this->form->ville->getValue()?>" placeholder="<?=$this->form->ville->getDescription()?>">
|
||||
<?php if ($this->form->ville->hasErrors()) {?>
|
||||
<div class="alert alert-danger">
|
||||
@ -110,7 +112,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><?=$this->form->tel->getLabel()?></label>
|
||||
<label><?=$this->form->tel->getLabel()?><?php if ($this->form->tel->isRequired()) { echo ' *'; }?></label>
|
||||
<input type="text" name="<?=$this->form->tel->getName()?>" class="form-control" value="<?=$this->form->tel->getValue()?>" placeholder="<?=$this->form->tel->getDescription()?>">
|
||||
<?php if ($this->form->tel->hasErrors()) {?>
|
||||
<div class="alert alert-danger">
|
||||
@ -122,7 +124,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><?=$this->form->mobile->getLabel()?></label>
|
||||
<label><?=$this->form->mobile->getLabel()?><?php if ($this->form->mobile->isRequired()) { echo ' *'; }?></label>
|
||||
<input type="text" name="<?=$this->form->mobile->getName()?>" class="form-control" value="<?=$this->form->mobile->getValue()?>" placeholder="<?=$this->form->mobile->getDescription()?>">
|
||||
<?php if ($this->form->mobile->hasErrors()) {?>
|
||||
<div class="alert alert-danger">
|
||||
|
@ -14,7 +14,7 @@
|
||||
<div class="container">
|
||||
|
||||
<div class="page-header">
|
||||
<h2>Achat Bilan Financier <small>Livraison</small></h2>
|
||||
<h2>RAPPORT FINANCIER COMPLET <small>Livraison du rapport complet</small></h2>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
@ -14,7 +14,7 @@
|
||||
<div class="container">
|
||||
|
||||
<div class="page-header">
|
||||
<h2>Achat Bilan Financier <small>Commande d'un bilan financier</small></h2>
|
||||
<h2>RAPPORT FINANCIER COMPLET <small>Commande d'un rapport financier</small></h2>
|
||||
</div>
|
||||
|
||||
<?php if ( $this->SirenExiste === false ) {?>
|
||||
@ -23,10 +23,58 @@
|
||||
|
||||
<?php } else {?>
|
||||
|
||||
<div>Siren : <?=$this->Siren?></div>
|
||||
<div>Raison Sociale : <?=$this->RaisonSociale?></div>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Siren : </dt>
|
||||
<dd><?=$this->Siren?></dd>
|
||||
<dt>Raison Sociale : </dt>
|
||||
<dd><?=$this->RaisonSociale?></dd>
|
||||
<dt>Adresse : </dt>
|
||||
<dd><?=$this->AdresseL1?></dd>
|
||||
<dt></dt>
|
||||
<dd><?=$this->AdresseL2?></dd>
|
||||
</dl>
|
||||
|
||||
<div><a type="button" class="btn btn-primary" href="<?=$this->ButtonUrl?>">Commander</a></div>
|
||||
<div><b>Liste des informations disponibles</b></div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<span class="badge">Inclus</span>
|
||||
Identité complète
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<span class="badge">Inclus</span>
|
||||
Dirigeants
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<span class="badge"><?=$this->NbLiens?></span>
|
||||
Liens inter-entreprises
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<span class="badge"><?=$this->NbAnnonces?></span>
|
||||
Annonces légales
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<span class="badge"><?=$this->NbBilans?></span>
|
||||
Bilans, ratios et SIG
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<span class="badge">Inclus</span>
|
||||
Analyse financière et les commentaires
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<span class="badge">Inclus</span>
|
||||
Indiscore (scoring financier) et encours conseillé
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<div class="clearfix"><a type="button" class="btn btn-primary pull-right" href="<?=$this->ButtonUrl?>">Commander</a></div>
|
||||
|
||||
<?php }?>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user