Merge from branch 2.4

This commit is contained in:
Michael RICOIS 2013-07-02 09:45:41 +00:00
parent 8469589a2d
commit 1c9c29a1e1
7 changed files with 211 additions and 85 deletions

View File

@ -1011,28 +1011,30 @@ class DashboardController extends Zend_Controller_Action
$ws = new WsScores();
if ($request->isPost()){
$log = $request->getParam('log');
$service = $request->getParam('service');
$type = $request->getParam('type');
$priceUnit = $request->getParam('priceUnit');
$limit = $request->getParam('limit');
$date = $request->getParam('date');
$duree = $request->getParam('duree');
$doublon = $request->getParam('doublon');
$result = $ws->setClientTarif($idClient, $log, $service, $type, $priceUnit, $limit, $date, $duree, $doublon);
if(is_int($result)) {
$url = $this->view->url(array('controller'=>'dashboard','action'=>'tarifs','idClient'=>$idClient));
$this->redirect($url);
} else {
$this->view->assign('log', $log);
$this->view->assign('service', $service);
$this->view->assign('type', $type);
$this->view->assign('priceUnit', $priceUnit);
$this->view->assign('date', $date);
$this->view->assign('duree', $duree);
$this->view->assign('doublon', $doublon);
$this->view->assign('error', $result);
if ( $request->isXmlHttpRequest() ) {
$this->_helper->layout()->disableLayout();
if ( $request->isPost() ) {
$log = $request->getParam('log');
$service = $request->getParam('service');
$type = $request->getParam('type');
$priceUnit = $request->getParam('priceUnit');
$limit = $request->getParam('limit');
$date = $request->getParam('date');
$duree = $request->getParam('duree');
$doublon = $request->getParam('doublon');
$result = $ws->setClientTarif($idClient, $log, $service, $type, $priceUnit, $limit, $date, $duree, $doublon);
if(is_int($result)) {
//OK
} else {
$this->view->assign('log', $log);
$this->view->assign('service', $service);
$this->view->assign('type', $type);
$this->view->assign('priceUnit', $priceUnit);
$this->view->assign('date', $date);
$this->view->assign('duree', $duree);
$this->view->assign('doublon', $doublon);
$this->view->assign('error', $result);
}
}
}

View File

@ -1,9 +1,6 @@
<div id="center">
<h1>Ajout d'un tarif</h1>
<?php if ($this->error) {?>
<?=$this->error?>
<?php }?>
<div class="paragraph">
<?php } else {?>
<form method="post" action="<?=$this->url(array('controller'=>'dashboard','action'=>'tarif'),null,true)?>">
<input type="hidden" name="idClient" value="<?=$this->idClient?>"/>
@ -45,7 +42,20 @@
</select>
<br/>
<input type="submit" name="submit" value="Ajouter" class="button"/>
</form>
</div>
</div>
<script>
var windowhref = window.location.href;
$('#dialog').dialog({ buttons: [
{ text: "Valider", click: function() { survSubmit(); } },
{ text: "Annuler", click: function() { $(this).dialog("close"); } }
]});
function survSubmit(){
$('#dialogsurv').dialog({buttons: []});
$('#dialogsurv').dialog({ buttons: [
{ text: "Fermer", click: function() { window.location.href = windowhref; $(this).dialog("close"); } }
]});
}
</script>
<?php }?>

View File

@ -9,20 +9,21 @@
<?php if(count($this->contrats)>0) {?>
<style>
table {width:100%;}
table th {border:1px solid #cccccc; padding:2px;}
table td {border:1px solid #cccccc; padding:2px; height:16px;}
table th {border:1px solid #cccccc; padding:2px; text-align:center;}
table td {border:1px solid #cccccc; padding:2px; height:16px; text-align:center;}
</style>
<?php foreach ( $this->contrats as $contrat ) {?>
<div class="contrat">
<div>Du <span><?=$contrat->dateBegin?></span> au <span><?=$contrat->dateEnd?></span></div>
<div>Du <span class="date-begin"><?=$contrat->dateBegin?></span> au <span><?=$contrat->dateEnd?></span></div>
<br/>
<table>
<tr>
<th>Log</th>
<th>Element</th>
<th>Service</th>
<th>Type</th>
<th>Prix unitaire</th>
<th>Limit</th>
<th>Limite</th>
<th>Dédoublonnage</th>
</tr>
<?php foreach ($contrat->tarifs->item as $tarif ) {?>
@ -36,13 +37,17 @@ table td {border:1px solid #cccccc; padding:2px; height:16px;}
</tr>
<?php }?>
</table>
<br/>
<div style="line-height:16px;">
<a class="tarif-add" title="Ajouter un tarif" href="#">
<a class="tarif-add" title="Ajouter un tarif" href="<?=$this->url(array('controller'=>'dashboard','action'=>'tarif','date'=>$contrat->dateBegin))?>">
<img style="vertical-align:middle;" src="/themes/default/images/interfaces/ajouter.png" />Ajouter un tarif</a>
</div>
<br/>
</div>
<?php }?>
<hr/>
<?php } else {?>
Aucun tarif défini.
<?php }?>
@ -50,60 +55,48 @@ Aucun tarif défini.
</div>
</div>
<script src="/libs/editable/jquery.jeditable.js" type="text/javascript"></script>
<script>
var waitTarifAdd = false;
var services = "{'DEFAULT':'DEFAULT',<?php foreach($this->services as $i => $service) {?>'<?=$service->code?>':'<?=$service->label?>'<?php if($i<count($this->services)){?>,<?php } }?>}";
var logs = "{<?php foreach($this->logs as $i => $log) {?>'<?=$log->code?>':'<?=$log->desc?>'<?php if($i<count($this->logs)){?>,<?php } }?>}";
$('a.tarif-add').click(function(e){
e.preventDefault();
if (waitTarifAdd){
} else {
$(this).parents('div.contrat').find('table').append('<tr><td class="edit-log"></td><td class="edit-service"></td><td class="edit-type"></td><td class="edit-priceUnit"></td><td class="edit-limit"></td><td class="edit-doublon"></td></tr>');
$(this).html('Enregistrer');
waitTarifAdd = true;
}
e.preventDefault();
var title = "Ajout d'un tarif";
var href = $(this).attr('href');
var dialogOpts = {
bgiframe: true,
title: title,
width: 500,
height: 400,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
},
buttons: {
Annuler: function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
$('<div id="dialog"></div>').dialog(dialogOpts);
});
$('a.contrat-add').click(function(e){
e.preventDefault();
e.preventDefault();
var title = "Ajout d'un contrat";
var href = $(this).attr('href');
var dialogOpts = {
bgiframe: true,
title: title,
width: 500,
height: 200,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
},
buttons: {
Annuler: function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
$('<div id="dialog"></div>').dialog(dialogOpts);
});
$('td.edit-log').editable(function(value, settings){
}, {
data: logs,
type: 'select',
});
$('td.edit-service').editable(function(value, settings){
}, {
data: services,
type: 'select',
});
$('td.edit-type').editable(function(value, settings){
}, {
data: "{'Unitaire':'Unitaire','ForfaitLimit':'ForfaitLimit','ForfaitNoLimit':'ForfaitNoLimit'}",
type: 'select',
});
$('td.edit-priceUnit').editable(function(value, settings){
}, {
type: 'text',
});
$('td.edit-limit').editable(function(value, settings){
}, {
type: 'text',
});
$('td.edit-doublon').editable(function(value, settings){
}, {
data: "{'none':'none', 'jour':'jour', 'mois':'mois','period';'period'}",
type: 'select',
});
</script>

View File

@ -0,0 +1,91 @@
<?php
class WsWorldCheck
{
protected $webservices = array();
protected $cacheEnable = false;
protected $cacheWrite = false;
protected $headerData = array();
public function __construct()
{
$c = Zend_Registry::get('config');
$location = ($c->profil->webservice->location == 'production') ? 'production' : 'pilot';
$cWC = new Zend_Config_Ini('/Worldcheck/webservicesWC.ini', $location);
$config = $cWC->toArray();
$this->webservices = $config['webservices'];
$configWC = new Zend_Config_Ini('/Worldcheck/applicationWC.ini');
$data = $configWC->toArray();
$this->headerData = $data['worldcheck'];
}
/**
* loadClientWC
* @param string $webservice
* @return SOAP client with Header
*/
protected function loadClientWC($webservice)
{
$wsdl = $this->webservices[$webservice]['wsdl'];
$options['soap_version'] = SOAP_1_1;
$options['features'] = SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS;
$options['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE;
$options['style'] = SOAP_DOCUMENT;
$options['use'] = SOAP_LITERAL;
$options['trace'] = true;
$options['encoding'] = 'utf-8';
$client = false;
$header = $this->headerWC();
try {
$client = new SoapClient($wsdl, $options);
$client->__setSoapHeaders($header);
} catch (Exception $e) {
throw new Exception('Application Error');
}
return $client;
}
/**
* Create security Header for WorldCheck
* @return SoapHeader
*/
protected function headerWC()
{
$headerPart = '<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">';
$headerPart .= '<wsse:UsernameToken wsu:Id="UsernameToken-19" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">';
$headerPart .= '<wsse:Username>'.$this->headerData['username'].'</wsse:Username>';
$headerPart .= '<wsse:Password Type="'.$this->headerData['passwordType'].'">'.$this->headerData['password'].'</wsse:Password>';
$headerPart .= '</wsse:UsernameToken></wsse:Security>';
$headerVar = new SoapVar($headerPart, XSD_ANYXML);
$header = new SoapHeader($this->headerData['namespace'], $this->headerData['securityType'], $headerVar, true);
return $header;
}
/**
* getScreener
* @param object $data
* @return NameIdentifier
*/
public function getScreener($data)
{
$params = new stdClass();
$params->screenRequest = $data;
$client = $this->loadClientWC('screener');
try {
return $client->screen($params)->return;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
return false;
}
}
}
}

View File

@ -0,0 +1,5 @@
worldcheck.username = ylenaour@scores-decisions.com
worldcheck.password = accelus
worldcheck.passwordType = http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText
worldcheck.namespace = http://screening.complinet.com/
worldcheck.securityType = Security

View File

@ -0,0 +1,25 @@
[pilot]
webservices.actionLog.wsdl = "https://screeningpilot.accelus.com/pilot-v1/actionLog?wsdl"
webservices.batch.wsdl = "https://screeningpilot.accelus.com/pilot-v1/batch?wsdl"
webservices.name.wsdl = "https://screeningpilot.accelus.com/pilot-v1/name?wsdl"
webservices.screener.wsdl = "https://screeningpilot.accelus.com/pilot-v1/screener?wsdl"
webservices.storedName.wsdl = "https://screeningpilot.accelus.com/pilot-v1/storedName?wsdl"
webservices.content.wsdl = "https://screeningpilot.accelus.com/pilot-v1/content?wsdl"
webservices.group.wsdl = "https://screeningpilot.accelus.com/pilot-v1/group?wsdl"
webservices.preference.wsdl = "https://screeningpilot.accelus.com/pilot-v1/preference?wsdl"
webservices.role.wsdl = "https://screeningpilot.accelus.com/pilot-v1/role?wsdl"
webservices.user.wsdl = "https://screeningpilot.accelus.com/pilot-v1/user?wsdl"
webservices.match.wsdl = "https://screeningpilot.accelus.com/pilot-v1/match?wsdl"
[production]
webservices.actionLog.wsdl = "https://screening.complinet.com/soap/v1/actionLog?wsdl"
webservices.batch.wsdl = "https://screening.complinet.com/soap/v1/batch?wsdl"
webservices.name.wsdl = "https://screening.complinet.com/soap/v1/name?wsdl"
webservices.screener.wsdl = "https://screening.complinet.com/soap/v1/screener?wsdl"
webservices.storedName.wsdl = "https://screening.complinet.com/soap/v1/storedName?wsdl"
webservices.content.wsdl = "https://screening.complinet.com/soap/v1/content?wsdl"
webservices.group.wsdl = "https://screening.complinet.com/soap/v1/group?wsdl"
webservices.preference.wsdl = "https://screening.complinet.com/soap/v1/preference?wsdl"
webservices.role.wsdl = "https://screening.complinet.com/soap/v1/role?wsdl"
webservices.user.wsdl = "https://screening.complinet.com/soap/v1/user?wsdl"
webservices.match.wsdl = "https://screening.complinet.com/soap/v1/match?wsdl"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB