merge develop + fix conflict

This commit is contained in:
benoitpotier 2017-04-05 14:49:43 +02:00
commit e22e863440
12 changed files with 262 additions and 37 deletions

View File

@ -117,6 +117,7 @@ class IndexController extends Zend_Controller_Action
);
$commandesM->update($data, "id=$id");
}
$this->view->request=$request;
}
public function repriseAction()

View File

@ -8,6 +8,7 @@ class ProfilController extends Zend_Controller_Action
$sql = $profilM->select()->order('reference ASC');
$rows = $profilM->fetchAll($sql);
$this->view->assign('profils', $rows);
$this->view->assign('request', $this->getRequest());
}
public function detailAction()
@ -24,6 +25,8 @@ class ProfilController extends Zend_Controller_Action
foreach ($criteres as $critere) {
$tmp[] = $data->getDicoLib($critere);
}
$this->view->assign('request', $request);
$this->view->assign('id', $id);
$this->view->assign('profil', $tmp);
$this->view->assign('reference', $profil->current()->reference);
}
@ -47,7 +50,8 @@ class ProfilController extends Zend_Controller_Action
if( $profil->current()->doublon!='' ) {
$doublon = json_decode($profil->current()->doublon, true);
}
$tmp = array();
$tmp = array();
if(empty($criteres)){$criteres=array();}
foreach ($criteres as $critere) {
$values = false;
if (preg_match('/(.*)\((.*)\)/', $critere, $matches))
@ -72,6 +76,7 @@ class ProfilController extends Zend_Controller_Action
$this->view->assign('reference', $profil->current()->reference);
}
$this->view->assign('request', $request);
$this->view->assign('doublon', $doublon);
$this->view->assign('id', $id);
$this->view->assign('edit', true);
@ -167,5 +172,6 @@ class ProfilController extends Zend_Controller_Action
$this->view->assign('lib', $dico->getDicoLib($key));
$this->view->assign('help', $dico->getDicoHelp($key));
$this->view->assign('columns', $dico->getDicoColumns($key));
$this->view->assign('values', $dico->getDicoValues($key));
}
}

View File

@ -27,21 +27,21 @@
<label>Fichier</label>
<div class="field">
<input type="file" id="fichier" name="fichier"/>
<input type="submit" value="Envoi"/>
<input id="submitfileform" class="btn btn-sm btn-danger" type="submit" value="Envoi"/><a id="return" class="btn btn-sm btn-info" href="<?=$this->url(array('controller'=>'index', 'action'=>'index'))?>">Retour</a>
<div id="progressbar"></div>
<div id="output"></div>
</div>
</div>
</form>
</div>
<script>
var timer;
$('form[name=sendfile]').ajaxForm({
beforeSubmit: function() {
timer = setInterval(checkProgress,200);
@ -54,10 +54,9 @@ $('form[name=sendfile]').ajaxForm({
$('#output').html('<strong>' + data + '</strong>');
}
});
function checkProgress() {
$.get('<?=$this->url(array('controller'=>'envoi', 'action'=>'fileprogress'))?>',
{key: $('#key').val()}, function(data) {
$.get('<?=$this->url(array('controller'=>'envoi', 'action'=>'fileprogress'))?>',
{key: $('#key').val()}, function(data) {
var percent = data.current/data.total*100;
$('#progressbar').reportprogress(percent);
}, 'json');

View File

@ -0,0 +1,10 @@
<div class="row alert-info">
<a href="/">Enrichissement</a>&nbsp;/&nbsp;
<a href="<?=$this->url(array('controller' => $this->request->getParam('controller', 'index'),'action' => 'index'))?>">
<?=$this->request->getParam('controller', 'index')?></a>&nbsp;/&nbsp;
<?php if($this->request->getParam('action', 'index')!='index'):?>
<a href="<?=$this->url(array('controller' => $this->request->getParam('controller', 'index'),
'action' => $this->request->getParam('action', 'index')))?>">
<?=$this->request->getParam('action', 'index')?></a>&nbsp;/&nbsp;
<?php endif;?>
</div>

View File

@ -1 +1,3 @@
<?php echo $this->partial('/index/ariane.phtml',array('request' => $this->request));?>
<a href="<?=$this->url(array('controller'=>'index', 'action'=>'index'))?>">Retour</a>

View File

@ -14,6 +14,7 @@ div#dico .panel-body, div#entete .panel-body {
</style>
<div class="row">
<?php echo $this->partial('/index/ariane.phtml',array('request' => $this->request));?>
<div class="col-md-4">
<div class="panel panel-default" id="entete">
<div class="panel-heading">
@ -75,13 +76,15 @@ Clé de dédoublonnage : <br/>
<input type="checkbox" name="doublon" value="nic" <?php if(in_array('nic', $this->doublon)) echo ' checked';?>/> NIC<br/>
<input type="checkbox" name="doublon" value="ref" <?php if(in_array('ref', $this->doublon)) echo ' checked';?>/> REF<br/>
</div>
<div id="message" class="text-danger"></div>
<div style="clear:both;">
Référence <input type="text" name="profil" value="<?=$this->reference?>" />
<?php if ($this->edit) { ?>
<a id="save" href="<?=$this->url(array('controller'=>'profil', 'action'=>'save', 'id'=>$this->id))?>">Modifier</a>
<a id="save" class="btn btn-sm btn-primary" href="<?=$this->url(array('controller'=>'profil', 'action'=>'save', 'id'=>$this->id))?>">Modifier</a>
<?php } else {?>
<a id="save" href="<?=$this->url(array('controller'=>'profil', 'action'=>'save'))?>">Sauvegarder</a>
<a id="save" class="btn btn-sm btn-primary" href="<?=$this->url(array('controller'=>'profil', 'action'=>'save'))?>" >Sauvegarder</a>
<?php }?>
</div>
<a id="return" class="btn btn-sm btn-info" href="<?=$this->url(array('controller'=>'index', 'action'=>'index'))?>">Retour</a>
</div>

View File

@ -1,8 +1,11 @@
<div>
<h2>Profil : <?=$this->reference?></h2>
<?php echo $this->partial('/index/ariane.phtml',array('request' => $this->request));?>
<ol>
<?php foreach ($this->profil as $item) {?>
<li><?=$item?></li>
<?php }?>
</ol>
<a id="return" class="btn btn-sm btn-info" href="<?=$this->url(array('controller'=>'index', 'action'=>'index'))?>">Retour</a>
<a id="edit" class="btn btn-sm btn-warning" href="<?=$this->url(array('controller'=>'profil', 'action'=>'create', 'id' => $this->id))?>">Edition</a>
</div>

View File

@ -4,10 +4,69 @@
<br/>
<p>Colonnes de sortie</p>
<ul>
<?php if ( $this->columns!==false && count($this->columns)>0 ) {?>
<?php if ( $this->values===false ):?>
<?php if ( $this->columns!==false && count($this->columns)>0 ):?>
<?php foreach ( $this->columns as $code => $lib ) {?>
<li><?=$code?> : <?=$lib?></li>
<?php }?>
<?php }?>
</ul>
<?php endif;?>
<?php else:?>
<?php if ( $this->columns!==false && count($this->columns)>0 ):?>
<input type="checkbox" id="checkall" onClick=checkall(this) > Tout cocher / decocher<br>
<?php foreach ( $this->columns as $code => $lib ):?>
<input name="help" type="checkbox" id="help<?=$code?>" onClick=setHelpVal(this) >
<span style="font-size:9px;"><?=$code?> : <?=$lib?></span><br>
<?php endforeach;?>
<script>
setListChecked();
function setHelpVal(obj){
var iref = $('input[name=<?=$this->key?>]').val();
var chp = obj.id.substr(4);
if(obj.checked){
if(iref.length>0){
chp=','+chp;
}
$('input[name=<?=$this->key?>]').val(iref+chp);
}else{
iref=iref.replace(chp,"");
iref=iref.replace(",,",",");
if(iref.substr(0,1)==","){
iref=iref.substr(1);
}
if(iref.substr(iref.length-1,1)==","){
iref=iref.substr(0,iref.length-1);
}
$('input[name=<?=$this->key?>]').val(iref);
}
}
function setListChecked(){
var iref = $('input[name=<?=$this->key?>]').val();
var tab=iref.split(",");
for(var i = 0, l = tab.length; i < l; i++){
var chp=tab[i];
document.getElementById('help'+chp).checked=true;
}
$('input[name=<?=$this->key?>]').val(iref);
}
function checkall(obj){
$('input[name=<?=$this->key?>]').val('');
if(obj.checked){
var lobj=document.getElementsByName('help');
for(var i = 0, l = lobj.length; i < l; i++){
var hob=lobj[i];
hob.checked=obj.checked;
setHelpVal(hob);
}
}else{
var lobj=document.getElementsByName('help');
for(var i = 0, l = lobj.length; i < l; i++){
var hob=lobj[i];
hob.checked=obj.checked;
}
}
}
</script>
<?php endif;?>
<?php endif;?>
</ul>

View File

@ -1,10 +1,15 @@
<div>
<h2>Gestion des profils</h2>
<h2>Gestion des profils
&nbsp;&nbsp;&nbsp;<a id="return" class="btn btn-sm btn-info" href="<?=$this->url(array('controller'=>'index', 'action'=>'index'))?>">Retour</a>
</h2>
<?php echo $this->partial('/index/ariane.phtml',array('request' => $this->request));?>
<?php if (count($this->profils)>0) {?>
<table class="table">
<table class="table table-responsive">
<thead>
<tr>
<th>Référence</th>
<th>Résumé</th>
<th>Action</th>
</tr>
</thead>
@ -12,7 +17,8 @@
<?php foreach($this->profils as $profil) {?>
<tr>
<td><a href="<?=$this->url(array('controller'=>'profil', 'action'=>'detail', 'id'=>$profil->id))?>"><?=$profil->reference?></a></td>
<td><a href="<?=$this->url(array('controller'=>'profil', 'action'=>'create', 'id'=>$profil->id))?>">Edition</a></td>
<td>(<?php echo substr(implode(', ',(array)json_decode($profil->criteres)),0,100)?>...)</td>
<td><a class="btn btn-sm btn-primary" href="<?=$this->url(array('controller'=>'profil', 'action'=>'create', 'id'=>$profil->id))?>">Edition</a></td>
</tr>
<?php }?>
</tbody>
@ -24,6 +30,7 @@ Aucun profils d'enrichissement.
</div>
<p>
<a href="<?=$this->url(array('controller'=>'profil', 'action'=>'create'))?>">Créer un nouveau profil</a>
<a id="return" class="btn btn-sm btn-info" href="<?=$this->url(array('controller'=>'index', 'action'=>'index'))?>">Retour</a>
<a class="btn btn-sm btn-danger" href="<?=$this->url(array('controller'=>'profil', 'action'=>'create'))?>">Créer un nouveau profil</a>
</p>

View File

@ -47,6 +47,23 @@ $(document).ready(function(){
$(document).focusout(function(){
clearInterval(timer);
});
$('#submitfileform').click(function(e){
var reference=$('input[name=ref]').val();
var fichier=$('input[name=fichier]').val();
alert(fichier);
if(reference.length==0){
e.preventDefault();
$('#output').html('<span class="alert alert-danger">Renseigner la reference</span>');
}
if(fichier.length==0){
e.preventDefault();
$('#output').html('<span class="alert alert-danger">Télécharger un fichier</span>');
}
if(fichier.substr(-4)!=".csv"){
e.preventDefault();
$('#output').html('<span class="alert alert-danger">Extension fichier incorrecte</span>');
}
});
//Démarrage du time
timer = setInterval(updateInfo, nbSeconds*1000);

View File

@ -51,6 +51,10 @@ $(function() {
if (data!='Erreur'){ window.location.href = '/'; }
}, 'json');
}
$('#message').hide(500);
$('#message').html('Parametres enregistres');
$('#message').show(500);
});
$('div#dico li').click(function(e){

View File

@ -232,6 +232,8 @@ $tabDico = array(
'cle' => array(
'nbContentieuxDE' => 'SUM(IF(qualite="DE",1,0)) as nbContentieuxDE',
'nbContentieuxDF' => 'SUM(IF(qualite="DF",1,0)) as nbContentieuxDF',
'topContentieuxDE' => 'IF(SUM(IF(qualite="DE",1,0))>0,1,0) as topContentieuxDE',
'topContentieuxDF' => 'IF(SUM(IF(qualite="DF",1,0))>0,1,0) as topContentieuxDF',
),
'where' => ' WHERE entSiren=$siren',
),
@ -269,6 +271,8 @@ $tabDico = array(
'groupes',
'etablissementliste',
'contentieuxliste',
'contentieuxlisteDEseuls',
'contentieuxlisteDFseuls',
),
);
@ -2101,29 +2105,101 @@ function etablissementlisteMultiple($siren, $nic, $values = false)
}
return $tabData;
}
function contentieuxlisteEntete()
function contentieuxlisteDEseulsEntete($values)
{
return array(
'dateAffaire',
'categorieAffaire',
'typeAffaire',
'natureDemande',
'nomDemandeur',
'nomDefendeur',
'statutAffaire',
'codeGreffe',
'nomGreffe',
'representants',
'nomsRepresentants'
);
return contentieuxlisteEntete($values);
}
function contentieuxlisteMultiple($siren, $nic=0, $values = false)
function contentieuxlisteDFseulsEntete($values)
{
return contentieuxlisteEntete($values);
}
function contentieuxlisteEntete($values)
{
if ($values!==false) {
$values = explode(',', $values);
$tmp = array();
foreach($values as $value){
$tmp[] = $value;
}
if(in_array('historique',$tmp)){
$tmp[]='dateDecision';
$tmp[]='libelleDecision';
}
return $tmp;
} else {
return array(
'idAffaire',
);
}
}
function contentieuxlisteDEseulsMultiple($siren, $nic=0, $values = false)
{
$qualite=' AND s.qualite="DE"';
return contentieuxlisteMultiple($siren, $nic, $values,$qualite);
}
function contentieuxlisteDFseulsMultiple($siren, $nic=0, $values = false)
{
$qualite=' AND s.qualite="DF"';
return contentieuxlisteMultiple($siren, $nic, $values,$qualite);
}
function contentieuxlisteMultiple($siren, $nic=0, $values = false,$qualite='')
{
global $iDb;
$histojoin='';
$fields=array(
'IdAffaire' => 'a.idAffaire as IdAffaire',
'Tiers' => 's.qualite as Tiers',
'StatusCode' => 'etatAffaire as StatusCode',
'StatusLabel' => 'etatAffaire as StatusLabel',
'CategoryCode' => 'codNatureDemande as CategoryCode',
'CategoryLabel' => 'codNatureDemande as CategoryLabel',
'Label' => 'natureDemande as Label',
'DateAffaire' => 'dateEnrolement as DateAffaire',
'NomPartie' => 's.nomPartie as NomPartie',
'NomDemandeur' => 'nomDemandeur as NomDemandeur',
'NomDefendeur' => 'nomDefendeur as NomDefendeur',
'CodeGreffe' => 'codeGreffe as CodeGreffe',
'NomGreffe' => 'nomGreffe as NomGreffe',
'Representants' => 'representants as Representants',
'NomsRepresentants' => 'rep0nom as NomsRepresentants',
'Parties' => 'a.parties as Parties',
'CategorieAffaire' => 'typeAffaireEnum as CategorieAffaire',
'Historique' => 'h.numLigneHisto as Historique',
'DateDecision' => 'h.dateDecision as DateDecision',
'LibelleDecision' => 'h.libelleDecision as LibelleDecision'
);
if(!$values){
$tabFields=array(
'IdAffaire' => 'a.idAffaire as IdAffaire',
);
}else{
$tabFields = explode(',', $values);
}
if(in_array('Historique',$tabFields)){
$histojoin=' left join greffes_affaires_histo h on h.idAffaire=a.idAffaire ';
$tabFields[]='DateDecision';
$tabFields[]='LibelleDecision';
}
foreach($tabFields as $field){
if(isset($fields[$field])){
$tabSelect[]=$fields[$field];
}else{
throw new Exception(__METHOD__ . ': ' . $field . ' does not exist');
return;
}
}
$select = implode(',',$tabSelect);
$conn = Zend_Registry::get('doctrine');
$sql='select dateEnrolement as dateAffaire,typeAffaireEnum as categorieAffaire,codNatureDemande as typeAffaire,natureDemande,nomDemandeur,
$sql='select '.$select .'
from (greffes_affaires_siren s inner join greffes_affaires a using(id)) '.$histojoin.' where
entSiren=:siren'.$qualite;
/*$sql='select dateEnrolement as dateAffaire,typeAffaireEnum as categorieAffaire,codNatureDemande as typeAffaire,natureDemande,nomDemandeur,
nomDefendeur,etatAffaire as statutAffaire,codeGreffe,nomGreffe,representants,rep0nom as nomsRepresentants
from greffes_affaires_siren s inner join greffes_affaires a using(id) where entSiren=:siren';
from greffes_affaires_siren s inner join greffes_affaires a using(id) where entSiren=:siren';*/
try {
$stmt=$conn->prepare($sql);
$stmt->bindValue('siren', $siren);
@ -2132,6 +2208,44 @@ function contentieuxlisteMultiple($siren, $nic=0, $values = false)
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
}
$tabData=$stmt->fetchAll(\PDO::FETCH_ASSOC);
//if(false){
if(in_array('StatusLabel',$tabFields) || in_array('CategoryLabel',$tabFields)){
$status = include APPLICATION_PATH . '/../library/Metier/Ctx/AffaireStatus.php';
$categories = include APPLICATION_PATH . '/../library/Metier/Table/AffairesTypes.php';
foreach($tabData as $k => $row){
if(isset($row['StatusLabel']) && isset($status[$row['StatusLabel']])){$tabData[$k]['StatusLabel']=$status[$row['StatusLabel']];}
if(isset($row['CategoryLabel']) && isset($categories[$row['CategoryLabel']])){$tabData[$k]['CategoryLabel']=$categories[$row['CategoryLabel']];}
}
}
if(in_array('Parties',$tabFields) || in_array('Representants',$tabFields)){
foreach($tabData as $k => $row){
if(isset($row['Parties']) && !empty($row['Parties'])){
$text='';
$parties=json_decode($row['Parties']);
foreach($parties as $p){
$text.=(isset($p->nomPartie)?$p->nomPartie:'').' ('.(isset($p->entreprise->siren)?$p->entreprise->siren:'').') ';
if(isset($p->representants) && !empty($p->representants)){
foreach ($p->representants as $r){
$text.=' '.isset($r->nom)?' # '.$r->nom:'';
}
}
$text.=' | ';
}
//echo $tabData[$k]['parties'];echo $text;
$tabData[$k]['Parties']=$text;
}
if(isset($row['Representants']) && !empty($row['Representants'])){
$parties=(array)json_decode($row['Representants']);
if(is_array($parties)){
foreach($parties as $p){
$text=isset($p->nom)?$p->nom.' - ':'';
}}else{
$text=isset($parties['nom'])?$parties['nom']:$row['Representants'];
}
$tabData[$k]['Representants']=$text;
}
}
}
return $tabData;
}