Change client parameters
This commit is contained in:
parent
05a7a3df36
commit
d28ba0de01
@ -260,10 +260,17 @@ class GestionController extends Zend_Controller_Action
|
||||
*/
|
||||
public function customerparamAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
//Fields
|
||||
require_once 'Scores/Enrichissement.php';
|
||||
$fieldsM = new Enrichissement();
|
||||
$allFields = $fieldsM->getFields();
|
||||
$this->view->assign('fields', $allFields);
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$idClient= $request->getParam('id', null);
|
||||
|
||||
$this->view->assign('idClient', $idClient);
|
||||
|
||||
if ($idClient !== null) {
|
||||
$paramsM = new Application_Model_CustomerParams();
|
||||
$sql = $paramsM->select()->where('idClient = ?', $idClient);
|
||||
@ -271,6 +278,7 @@ class GestionController extends Zend_Controller_Action
|
||||
$infos = null;
|
||||
if ($params!==null){
|
||||
$infos = $params->toArray();
|
||||
$infos['criteres'] = json_decode($infos['criteres'], true);
|
||||
}
|
||||
$this->view->assign('infos',$infos);
|
||||
|
||||
@ -293,7 +301,7 @@ class GestionController extends Zend_Controller_Action
|
||||
$request = $this->getRequest();
|
||||
|
||||
//Sauvegarde du formulaire
|
||||
if ( $request->isPost() && $request->getParam('submit')=='Enregistrer' ) {
|
||||
if ( $request->isPost() && in_array($request->getParam('submit'), array('Enregistrer','Modifier')) ) {
|
||||
$params = $request->getParams();
|
||||
|
||||
//Vérifier le formulaire
|
||||
@ -331,16 +339,68 @@ class GestionController extends Zend_Controller_Action
|
||||
'limitFiles' => $params['limitFiles'],
|
||||
'criteres' => json_encode($params['criteres']),
|
||||
'dateAdded' => date('Y-m-d H:i:s'),
|
||||
);
|
||||
$customerParamsM = new Application_Model_CustomerParams();
|
||||
if ( $customerParamsM->insert($data) ){
|
||||
$this->view->assign('message', "Profil enregistré");
|
||||
} else {
|
||||
$this->view->assign('message', "Erreur lors de la sauvegarde");
|
||||
}
|
||||
);
|
||||
|
||||
if ($request->getParam('submit')=='Modifier') {
|
||||
//Overwrite default profil for each login
|
||||
$profilM = new Application_Model_EnrichissementProfils();
|
||||
$profilM->update(
|
||||
array('criteres', json_encode($params['criteres'])),
|
||||
"reference='default' AND idClient=".$params['idClient']);
|
||||
|
||||
//Set parameters
|
||||
$customerParamsM = new Application_Model_CustomerParams();
|
||||
if ( $customerParamsM->update($data, 'id='.$params['id']) ){
|
||||
$this->view->assign('message', "Profil enregistré");
|
||||
} else {
|
||||
$this->view->assign('message', "Erreur lors de la sauvegarde");
|
||||
}
|
||||
|
||||
} else {
|
||||
//Set parameters
|
||||
$customerParamsM = new Application_Model_CustomerParams();
|
||||
if ( $customerParamsM->insert($data) ){
|
||||
$this->view->assign('message', "Profil enregistré");
|
||||
} else {
|
||||
$this->view->assign('message', "Erreur lors de la sauvegarde");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->view->assign('message', "Erreur lors de la saisie");
|
||||
}
|
||||
} else {
|
||||
|
||||
$idClient = $request->getParam('id', null);
|
||||
|
||||
if ($idClient !== null) {
|
||||
$paramsM = new Application_Model_CustomerParams();
|
||||
$sql = $paramsM->select()->where('idClient = ?', $idClient);
|
||||
$params = $paramsM->fetchRow($sql);
|
||||
if ( $params!==null ) {
|
||||
foreach ( $params as $key => $value ) {
|
||||
switch ( $key ) {
|
||||
case 'criteres':
|
||||
$this->view->assign($key, json_decode($value,true));
|
||||
break;
|
||||
case 'dateContrat':
|
||||
$this->view->assign($key, substr($value,0,10));
|
||||
break;
|
||||
default:
|
||||
$this->view->assign($key, $value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->view->assign('filterRNCS', 1);
|
||||
$this->view->assign('licenceINSEE', 0);
|
||||
$this->view->assign('immediatExtract', 0);
|
||||
$this->view->assign('limitLines', 50000);
|
||||
$this->view->assign('limitFiles', 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,17 @@
|
||||
<tr><td>forfait</td><td><?=$this->infos['forfait']?></td></tr>
|
||||
<tr><td>limitLines</td><td><?=$this->infos['limitLines']?></td></tr>
|
||||
<tr><td>limitFiles</td><td><?=$this->infos['limitFiles']?></td></tr>
|
||||
<tr><td>criteres</td><td><pre><?php print_r(json_decode($this->infos['criteres'],true))?></td></tr>
|
||||
<tr><td>criteres</td><td>
|
||||
<?php foreach ( $this->infos['criteres'] as $item ) {?>
|
||||
<?=$this->fields[$item]['label']?><br/>
|
||||
<?php }?>
|
||||
</td>
|
||||
<tr><td>dataInsee</td><td><?=$this->infos['dataInsee']?></td></tr>
|
||||
<tr><td>dateAdded</td><td><?=$this->infos['dateAdded']?></td></tr>
|
||||
</table>
|
||||
|
||||
<a href="<?=$this->url(array('controller'=>'gestion','action'=>'customerparamadd','id'=>$this->idClient),null,true)?>">Modifier</a>
|
||||
|
||||
<h2>Logins autorisés</h2>
|
||||
<div class="paragraph">
|
||||
<form method="post" action="<?=$this->url(array('controller'=>'gestion', 'action'=>'profiladd'), null, true)?>">
|
||||
|
@ -3,76 +3,100 @@
|
||||
<?=$this->message?>
|
||||
|
||||
<form name="profil" method="post" action="<?=$this->url(array('controller'=>'gestion', 'action'=>'customerparamadd'))?>">
|
||||
|
||||
<?php if ($this->id) {?>
|
||||
<input type="hidden" name="id" value="<?=$this->id?>"/>
|
||||
<?php }?>
|
||||
|
||||
<div>
|
||||
<label>idClient</label>
|
||||
<input type="text" name="idClient" />
|
||||
<br/>
|
||||
<input type="text" name="idClient" value="<?=$this->idClient?>"/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>service</label>
|
||||
<input type="text" name="service" />
|
||||
<br/>
|
||||
<input type="text" name="service" value="<?=$this->service?>"/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>filterRNCS</label>
|
||||
<input type="checkbox" name="filterRNCS" value="1" />
|
||||
<?php $select = ''; if ($this->filterRNCS==1) $select = ' checked'?>
|
||||
<input type="checkbox" name="filterRNCS" value="1"<?=$select?>/>
|
||||
Filtrer au RNCS
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>licenceINSEE</label>
|
||||
<input type="checkbox" name="licenceINSEE" value="1" />
|
||||
<?php $select = ''; if ($this->licenceInsee==1) $select = ' checked'?>
|
||||
<input type="checkbox" name="licenceINSEE" value="1"<?=$select?>/>
|
||||
Le client possède la licence INSEE
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>immediatExtract</label>
|
||||
<input type="text" name="immediatExtract" value="0" />
|
||||
<input type="text" name="immediatExtract" value="<?=$this->immediatExtract?>" />
|
||||
Nombre de ligne maximum pour une extraction immédiate
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>dateContrat</label>
|
||||
<input type="text" name="dateContrat" />
|
||||
<input type="text" name="dateContrat" value="<?=$this->dateContrat?>"/>
|
||||
Date de début du contract (AAAA-MM-JJ)
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>periodContrat</label>
|
||||
<input type="text" name="periodContrat" />
|
||||
<input type="text" name="periodContrat" value="<?=$this->periodContrat?>"/>
|
||||
Durée du contrat (1,3,6,12 mois)
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>periodPaiement</label>
|
||||
<input type="text" name="periodPaiement" />
|
||||
<input type="text" name="periodPaiement" value="<?=$this->periodPaiement?>"/>
|
||||
Emission des factures (tous les 1,3,6,12 mois)
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>priceLine</label>
|
||||
<input type="text" name="priceLine" /> €
|
||||
<input type="text" name="priceLine" value="<?=$this->priceLine?>"/> €
|
||||
Prix à la ligne (obligatoire même en forfait pour pouvoir décompter)
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>forfait</label>
|
||||
<input type="text" name="forfait" value="0" />
|
||||
<input type="text" name="forfait" value="<?=$this->forfait?>"/>
|
||||
Montant du forfait pour l'extraction de fichier
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>limitLines</label>
|
||||
<input type="text" name="limitLines" value="50000" />
|
||||
<input type="text" name="limitLines" value="<?=$this->limitLines?>"/>
|
||||
Nombre maximal de lignes dans un fichier
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>limitFiles</label>
|
||||
<input type="text" name="limitFiles" value="0" />
|
||||
<input type="text" name="limitFiles" value="<?=$this->limitFiles?>"/>
|
||||
Nombre maximal de fichier pouvant être extrait
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>Enrichissement</label>
|
||||
<select style="padding:5px;" name="criteres[]" multiple size="20">
|
||||
<?php if ( count($this->fields)>0 ) {?>
|
||||
<?php foreach ( $this->fields as $value => $item ) {?>
|
||||
<option value="<?=$value?>"><?=$item['label']?></option>
|
||||
<?php $select = ''; if (in_array($value, $this->criteres)) $select = ' selected'; ?>
|
||||
<option value="<?=$value?>"<?=$select?>><?=$item['label']?></option>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<?php if ($this->idClient) {?>
|
||||
<input type="submit" name="submit" value="Modifier"/>
|
||||
<?php } else {?>
|
||||
<input type="submit" name="submit" value="Enregistrer"/>
|
||||
<?php }?>
|
||||
</form>
|
||||
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user