Lissage complet des getRapport/getIndiscore2/getIndiscore + page contact
This commit is contained in:
parent
92db1b7c0d
commit
645ce94332
@ -46,6 +46,9 @@ class Achatclient_IndexController extends Zend_Controller_Action
|
||||
{
|
||||
//Validation des droits
|
||||
$request = $this->getRequest();
|
||||
if(!$this->verifHttps()){
|
||||
$this->error('index','Connexion imposible');
|
||||
}
|
||||
$this->view->msg=$request->getParam('message');
|
||||
$user = new Scores_Utilisateur();
|
||||
$ok=$user->checkperm($this->libdroits);
|
||||
@ -106,6 +109,9 @@ class Achatclient_IndexController extends Zend_Controller_Action
|
||||
{
|
||||
//Validation
|
||||
$request = $this->getRequest();
|
||||
if(!$this->verifHttps()){
|
||||
$this->error('index','Connexion imposible');
|
||||
}
|
||||
$user = new Scores_Utilisateur();
|
||||
$ok=$user->checkperm($this->libdroits);
|
||||
if(!$ok){
|
||||
@ -175,20 +181,58 @@ class Achatclient_IndexController extends Zend_Controller_Action
|
||||
$this->view->PayboxValues = $paybox->getFormParameters();
|
||||
|
||||
}
|
||||
public function pbanswerAction(){
|
||||
$user = new Scores_Utilisateur();
|
||||
//var_dump($user);
|
||||
//echo $user->identity->siret;die;
|
||||
$ws = new Scores_Ws_Client('credit', '0.1');
|
||||
$infocredit = $ws->canUse('synthese');
|
||||
var_dump($infocredit);die;
|
||||
}
|
||||
public function errorAction(){
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->view->msg=$request->getParam('message');
|
||||
|
||||
}
|
||||
public function contactAction(){
|
||||
$request = $this->getRequest();
|
||||
$user = new Scores_Utilisateur();
|
||||
$ok=$user->checkperm($this->libdroits);
|
||||
|
||||
$message=$request->getParam('message');
|
||||
$objet=$request->getParam('objet');
|
||||
if(empty($message) || !empty($objet)){
|
||||
$this->view->msg="Merci de remplir votre message";
|
||||
}else{
|
||||
//@todo envoyer le mail
|
||||
$c = Zend_Registry::get('config');
|
||||
$mail = new Scores_Mail_Method();
|
||||
$mail->setSubject($objet. ' - '.$user->identity->name.' -'.date('Y-m-d'));
|
||||
$mail->setBodyTextC($message);
|
||||
$mail->setFromKey('support');
|
||||
$mail->addToKey('supportdev');
|
||||
//var_dump($mail);die;
|
||||
//$mail->execute();
|
||||
$this->view->msg="Votre message a bien été pris en compte";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getsiretinfosAction(){
|
||||
$user = new Scores_Utilisateur();
|
||||
echo $user->getSiret();die;
|
||||
|
||||
}
|
||||
|
||||
private function verifHttps(){
|
||||
if (
|
||||
( ! empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|
||||
|| ( ! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
|
||||
|| ( ! empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on')
|
||||
|| (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443)
|
||||
|| (isset($_SERVER['HTTP_X_FORWARDED_PORT']) && $_SERVER['HTTP_X_FORWARDED_PORT'] == 443)
|
||||
|| (isset($_SERVER['REQUEST_SCHEME']) && $_SERVER['REQUEST_SCHEME'] == 'https')
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
if(getenv('APPLICATION_ENV')=='development'){return true;}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function error($ligne=0,$message=""){
|
||||
$request = $this->getRequest();
|
||||
|
@ -9,6 +9,21 @@ class Achatclient_InextensoController extends Zend_Controller_Action
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
protected $tranches=array(
|
||||
'1' => array(
|
||||
'200' => array('montant' => 2000,'montantht' => 1667, 'tva' => 333, ),
|
||||
'500' => array('montant' => 5000,'montantht' => 4167, 'tva' => 833, ),
|
||||
'1000' => array('montant' => 10000,'montantht' => 8333, 'tva' => 1667, ),
|
||||
),
|
||||
'195' => array(
|
||||
'200' => array('montant' => 2000,'montantht' => 1667, 'tva' => 333, ),
|
||||
'500' => array('montant' => 5000,'montantht' => 4167, 'tva' => 833, ),
|
||||
'1000' => array('montant' => 10000,'montantht' => 8333, 'tva' => 1667, ),
|
||||
),
|
||||
);
|
||||
|
||||
protected $maxcredit=2000;
|
||||
|
||||
public function init()
|
||||
{
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
@ -51,68 +66,7 @@ class Achatclient_InextensoController extends Zend_Controller_Action
|
||||
'lastname' => "Claire",
|
||||
),
|
||||
);
|
||||
$identity=$testidentities['nouveau de test'];
|
||||
$mytime = time();
|
||||
$key = 'rh5s4z';
|
||||
$data = $identity['mail'] . '/' . $mytime . '/' . $key;
|
||||
$token = hash('sha256', $data);
|
||||
//$token=base64_encode(hash_hmac('sha256',$data));
|
||||
$url2='http://extranet.sd.dev/sso/inextenso';
|
||||
$url='http://extranet.sd.dev/auth?partner=inextenso';
|
||||
echo '
|
||||
</head>
|
||||
<body onload="document.ssoForm.submit();">
|
||||
<form id="ssoForm" name="ssoForm" method="GET" action="'.$url.'" target="_blank">
|
||||
<?php ?>
|
||||
partner : <input type="text" name="partner" value="'.$identity['partner'].'"><br>
|
||||
mail : <input type="text" name="mail" value="'.$identity['mail'].'"><br>
|
||||
name : <input type="text" name="name" value="'.$identity['name'].'"><br>
|
||||
lastname : <input type="text" name="lastname" value="'.$identity['lastname'].'"><br>
|
||||
codeclient : <input type="text" name="codeclient" value=195><br>
|
||||
token : <input type="text" name="token" value="'.$token.'" size="150"><br>
|
||||
time : <input type="text" name="time" value="'.$mytime.'">'.Date('Y-m-d H:i:s',$mytime).'<br>
|
||||
Si vous n\'êtes pas automatiquement redirigé vers le service, cliquez sur ce bouton :
|
||||
<a target="_blank" href="http://extranet.sd.dev/sso/inextenso?mail='.$identity['mail'].'&name='.$identity['name'].'&lastname='.$identity['lastname'].'&token='.$token.'&time='.$mytime.'">Ouvrir</a>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
|
||||
$login = $identity['mail'];
|
||||
$name = $identity['name'];
|
||||
$lastname = $identity['lastname'];
|
||||
$time = $mytime;
|
||||
|
||||
/*
|
||||
$login = 'jpdurail.demo@gmail .com';
|
||||
$name = 'Jean Paul';
|
||||
$lastname = 'DURAIL';
|
||||
$time = '1434629722';
|
||||
*/
|
||||
|
||||
$key = 'rh5s4z';
|
||||
$data = $login . '/' . $time . '/' . $key;
|
||||
$token = hash('sha256', $data);
|
||||
|
||||
echo "Lien : <a target=\"_blank\" href=\"http://extranet.sd.dev/sso/inextenso?mail=".$login."&name=".$name."&lastname=".$lastname."&token=".$token."&time=".$time."\">Ouvrir</a>";
|
||||
echo "<br/>";
|
||||
echo "SHA256 : ".$token;
|
||||
echo "<br/>";
|
||||
echo "TOKEN : ".base64_encode($token);
|
||||
echo "<br/>";
|
||||
echo "SHA256 HMAC : ".hash_hmac('sha256',$data,$key);
|
||||
echo "<br/>";
|
||||
echo "TOKEN : ".base64_encode(hash_hmac('sha256',$data,$key));
|
||||
echo "<br/>";
|
||||
|
||||
/*
|
||||
echo "<br/><br/>";
|
||||
$algos = hash_algos();
|
||||
foreach ($algos as $item) {
|
||||
echo $item." TOKEN : ".hash($item, $data)." - BASE64 : ".base64_encode(hash($item, $data));
|
||||
echo "<br/>";
|
||||
}
|
||||
*/
|
||||
die;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
<style>
|
||||
div .credit{
|
||||
margin:25px;
|
||||
padding:50px;
|
||||
background-color:#bebebe;
|
||||
|
||||
}
|
||||
td.nbr{
|
||||
text-align:right;
|
||||
}
|
||||
#message{
|
||||
color:red;
|
||||
font-size:14px;
|
||||
}
|
||||
.spacer{
|
||||
min-height=20px;
|
||||
}
|
||||
.top{
|
||||
text-align:top;
|
||||
}
|
||||
</style>
|
||||
<div id="center">
|
||||
|
||||
<h1>Votre compte crédits en ligne</h1>
|
||||
|
||||
<h2>Demande de contact</h2>
|
||||
<div id="credit">
|
||||
<div id="message"><?=$this->msg?></div>
|
||||
<form action="<?=$this->url(array('controller'=>'index', 'action'=>'contact'))?>" method="POST" id="contactform">
|
||||
<div class="credit">
|
||||
<div class="form-group">
|
||||
<label for="objet" class="required">Votre demande concerne :</label>
|
||||
<select name="objet"><option>Le fonctionnement logiciel</option><option>Vos achats</option><option>Vos consommations</option><option>Autre</option></select>
|
||||
</div>
|
||||
<div class="spacer"> </div>
|
||||
<div class="form-group">
|
||||
<textarea name="message" ROWS=5 COLS=50 placeholder="Entrez votre message"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="submit">
|
||||
<p class="submit-button">
|
||||
<input type="submit" class="button" value="Envoyer" />
|
||||
<a href="<?=$this->url(array('controller'=>'index', 'action'=>'index'))?>" class="button ui-button ui-corner-all ui-widget" >
|
||||
Retour</a>
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
@ -27,6 +27,8 @@ Dernière mise à jour le <?=Date('d/m/Y',strtotime($this->infos['balance']['upd
|
||||
<?php endif;?>
|
||||
</p>
|
||||
<div id="message" class="alert alert-info"><?=$this->msg?></div>
|
||||
Une remarque ? <a href="<?=$this->url(array('controller'=>'index', 'action'=>'contact'))?>">
|
||||
<button name="contact" id="contact" class="button ui-button ui-corner-all ui-widget" role="button">Nous contacter</button></a>
|
||||
</div>
|
||||
<?php if(isset($this->infos) && isset($this->infos['tranches'])):?>
|
||||
<h2>Commander des crédits</h2>
|
||||
@ -50,21 +52,25 @@ Dernière mise à jour le <?=Date('d/m/Y',strtotime($this->infos['balance']['upd
|
||||
<?php endif;?>
|
||||
<?php if(isset($this->infos) && isset($this->infos['paid'])):?>
|
||||
<h2>Historique de vos achats</h2>
|
||||
<table class="data" style="max-width:80%;">
|
||||
<table class="data" style="max-width:90%;">
|
||||
<tr><th></th><th>Date d'achat</th><th>Montant de l'achat</th><th>Nb Crédits</th><th>Statut</th><th>Date de <br>validité des crédits</th></tr>
|
||||
<?php foreach($this->infos['paid'] as $row):?>
|
||||
<tr>
|
||||
<tr><td></td>
|
||||
<td><?=Date('d/m/Y H:i:s',strtotime($row['date_sent']))?></td>
|
||||
<td class="nbr"><?=$row['amount']/100?> Euros</td>
|
||||
<td class="nbr"><?=$row['nbCredit']?> Credits</td>
|
||||
<td><?=($row['valid']==0?'Annulée':'Enregistrée')?></td>
|
||||
<td><?=($row['valid']==1?Date('d/m/Y',strtotime($row['date_sent'])+365*24*3600):'-')?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</table>
|
||||
<?php endif;?>
|
||||
<?php if(isset($this->infos) && isset($this->infos['used'])):?>
|
||||
<h2>Historique de vos consommations</h2>
|
||||
<table class="data" style="max-width:80%;">
|
||||
<table class="data" style="max-width:90%;">
|
||||
<tr><th></th><th>Date d'utilisation</th><th>Nb Crédits</th><th>Fonctionnalité utilisée</th></tr>
|
||||
<?php foreach($this->infos['used'] as $row):?>
|
||||
<tr>
|
||||
<tr><td></td>
|
||||
<td><?=Date('d/m/Y H:i:s',strtotime($row['created']))?></td>
|
||||
<td class="nbr"><?=$row['consumption']?> Credit</td>
|
||||
<td><?=$row['idLog']?></td>
|
||||
|
@ -88,7 +88,13 @@ class ErrorController extends Zend_Controller_Action
|
||||
}
|
||||
}
|
||||
|
||||
public function soapAction(){}
|
||||
public function soapAction($error_code=null){
|
||||
try{
|
||||
$user=new Scores_Utilisateur();
|
||||
}catch(Exception $e){$user=stdClass;}
|
||||
//var_dump($user);die;
|
||||
$this->view->User=$user;
|
||||
}
|
||||
|
||||
public function permsAction(){}
|
||||
|
||||
|
@ -279,12 +279,14 @@ class EvaluationController extends Zend_Controller_Action
|
||||
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
|
||||
//@todo : transformer le webservice pour ne faire qu'une seule requete
|
||||
$ws = new WsScores();
|
||||
$ws->freeService=true;
|
||||
$indiscore = $ws->getIndiScore($siren, 0, 1);
|
||||
if ($indiscore === false) {
|
||||
$this->forward('soap', 'error');
|
||||
}
|
||||
$identite = $ws->getIdentite($siren);
|
||||
$infos = $ws->getRatios($siren, 'indiscore2');
|
||||
$ws->freeService=false;
|
||||
|
||||
$score = array();
|
||||
$tabRatio = array(
|
||||
@ -438,9 +440,9 @@ class EvaluationController extends Zend_Controller_Action
|
||||
$this->view->headTitle()->prepend("Siret ".$this->siret);
|
||||
|
||||
$user = new Scores_Utilisateur();
|
||||
if(!$user->checkPerm('INDISCORE3') && !$user->checkPerm('INDISCORE3P'))
|
||||
if(!$user->checkPerm('INDISCORE3') && !$user->checkPerm('INDISCORE3P')){
|
||||
$this->forward('perms', 'error');
|
||||
|
||||
}
|
||||
// Lien pour le rapport personnalisé
|
||||
if ($user->getIdClient() == '110' || $user->checkModeEdition()) {
|
||||
$this->view->assign('customRapport', $this->view->url(array(
|
||||
|
@ -228,7 +228,7 @@ class FinanceController extends Zend_Controller_Action
|
||||
$this->view->headTitle()->prepend("Bilan, Compte de résultat");
|
||||
$this->view->headTitle()->prepend("Siret ".$this->siret);
|
||||
$ws = new WsScores();
|
||||
$infos = $ws->getRatios(substr($this->siret, 0, 9), 'ratios');
|
||||
$infos = $ws->getRatios(substr($this->siret, 0, 9), 'bilan');
|
||||
if ($infos === false) $this->_forward('soap', 'error');
|
||||
} else {
|
||||
$infos = $this->getRequest()->getParam('infos');
|
||||
@ -1085,7 +1085,7 @@ class FinanceController extends Zend_Controller_Action
|
||||
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
|
||||
$this->view->assign('raisonSociale', $entreprise->getRaisonSociale());
|
||||
|
||||
$infos = $ws->getRatios($siren, 'ratios');
|
||||
$infos = $ws->getRatios($siren, 'flux');
|
||||
|
||||
//Formattage des données
|
||||
$ratiosData = new Scores_Finance_Ratios_Data($infos);
|
||||
|
@ -104,7 +104,7 @@ class UserController extends Zend_Controller_Action
|
||||
$this->logger->info('setInfosLogin');
|
||||
$this->logger->info(print_r($options,1));
|
||||
$reponse = $ws->setInfosLogin($login, $action, $options);
|
||||
$this->logger->info(print_r($response,1));
|
||||
$this->logger->info('setInfosLogin'.print_r($response,1));
|
||||
|
||||
$isProfilUpdated = true;
|
||||
$message = 'Erreur lors de la mise à jour du compte !';
|
||||
|
@ -2,12 +2,19 @@
|
||||
<h2>Erreur</h2>
|
||||
|
||||
<div class="paragraph">
|
||||
|
||||
<div style="padding:0.7em;" class="ui-state-error ui-corner-all">
|
||||
<p><span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-alert"></span>
|
||||
<?php if($this->User->identity->idClient==195):?>
|
||||
Votre requete n'a pas abouti.
|
||||
Merci de vérifier que vous possédez les crédits suffisants pour cette opération.
|
||||
Pour consulter ou renouveler vos crédits utiliser le
|
||||
<a href="/achatclient" class="btn">
|
||||
<button name="contact" id="contact" class="button ui-button ui-corner-all ui-widget" role="button">Porte-monnaie en ligne</button></a>
|
||||
<?php else: ?>
|
||||
Une erreur est survenue lors de votre requête...<br/>
|
||||
Un message à été envoyé à l'administrateur.<br/>
|
||||
Nous vous remercions de bien vouloir renouveler votre demande ultérieurement.
|
||||
<?php endif;?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
@ -71,6 +71,7 @@ class Scores_Utilisateur
|
||||
$identity->lang = $lang;
|
||||
$identity->langtmp = $lang;
|
||||
$identity->browser = $this->getBrowserInfo();
|
||||
$identity->siret = $InfosLogin->result->siret;
|
||||
|
||||
$this->identity = $identity;
|
||||
|
||||
@ -277,6 +278,15 @@ class Scores_Utilisateur
|
||||
return $hasPref;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le siret du client
|
||||
*/
|
||||
public function getSiret()
|
||||
{
|
||||
var_dump($this->identity);die;
|
||||
return $this->identity->siret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne la langue par défaut du client
|
||||
*/
|
||||
|
@ -9,6 +9,10 @@ return array(
|
||||
'debug' => true,
|
||||
'errorMsg' => array('MSG'),
|
||||
),
|
||||
)
|
||||
'useCredit' => array(
|
||||
'debug' => true,
|
||||
'errorMsg' => array('MSG'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -45,6 +45,12 @@ class WsScores
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Free service
|
||||
* @var boolean
|
||||
*/
|
||||
public $freeService=false;
|
||||
|
||||
/**
|
||||
* Load WebService config
|
||||
* @param string $login
|
||||
@ -1474,6 +1480,11 @@ class WsScores
|
||||
if ($this->cacheWrite) {
|
||||
$cache = new Cache($filename);
|
||||
if ($cache->exist() && $this->cacheEnable ){
|
||||
$wsc = new Scores_Ws_Client('credit', '0.1');
|
||||
$params = new stdClass();
|
||||
$params->idLog = 'getRapport';
|
||||
$infocredit = $wsc->useCredit($params);
|
||||
|
||||
return $cache->getBlock();
|
||||
}
|
||||
}
|
||||
@ -1588,6 +1599,12 @@ class WsScores
|
||||
if ($this->cacheWrite) {
|
||||
$cache = new Cache($filename);
|
||||
if ($cache->exist() && $this->cacheEnable ){
|
||||
if(!$this->freeService){
|
||||
$wsc = new Scores_Ws_Client('credit', '0.1');
|
||||
$params = new stdClass();
|
||||
$params->idLog = 'getIndiscore';
|
||||
$infocredit = $wsc->useCredit($params);
|
||||
}
|
||||
return $cache->getBlock();
|
||||
}
|
||||
}
|
||||
@ -2597,6 +2614,11 @@ class WsScores
|
||||
if ($this->cacheWrite) {
|
||||
$cache = new Cache($filename);
|
||||
if ($cache->exist() && $this->cacheEnable ){
|
||||
$wsc = new Scores_Ws_Client('credit', '0.1');
|
||||
$params = new stdClass();
|
||||
$params->idLog = 'get'.ucfirst($page);
|
||||
$infocredit = $wsc->useCredit($params);
|
||||
|
||||
return $cache->getBlock();
|
||||
}
|
||||
}
|
||||
|
@ -12,4 +12,5 @@ require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// --- Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
error_reporting(E_ERROR);
|
||||
$application->bootstrap()->run();
|
Loading…
Reference in New Issue
Block a user