Compare commits
5 Commits
libraryvia
...
SD-32
Author | SHA1 | Date | |
---|---|---|---|
|
fe0fb41d04 | ||
|
220aa8e27c | ||
|
9a8a008d03 | ||
|
65831d3194 | ||
|
b63addf2a4 |
@ -1070,7 +1070,7 @@ class FinanceController extends Zend_Controller_Action
|
||||
|
||||
|
||||
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
|
||||
$this->view->assign('banques', $infos->result->item);
|
||||
$this->view->assign('banques', isset($infos->result->item)?$infos->result->item:array());
|
||||
$this->view->assign('raisonSociale', $entreprise->getRaisonSociale());
|
||||
$this->view->assign('siren', substr($this->siret, 0, 9));
|
||||
$this->view->assign('exportObjet', $infos);
|
||||
|
@ -407,6 +407,8 @@ class IdentiteController extends Zend_Controller_Action
|
||||
}
|
||||
} else {
|
||||
$pageTotal = $pageCurrent = 1;
|
||||
$pagePrev = 1;
|
||||
$pageNext = 1;
|
||||
}
|
||||
$this->view->assign('PageTotal', $pageTotal);
|
||||
$this->view->assign('PagePrev', $pagePrev);
|
||||
@ -1171,6 +1173,8 @@ class IdentiteController extends Zend_Controller_Action
|
||||
}
|
||||
} else {
|
||||
$pageTotal = $pageCurrent = 1;
|
||||
$pagePrev = 1;
|
||||
$pageNext = 1;
|
||||
}
|
||||
$this->view->assign('PageTotal', $pageTotal);
|
||||
$this->view->assign('PagePrev', $pagePrev);
|
||||
|
@ -154,6 +154,8 @@ class JuridiqueController extends Zend_Controller_Action
|
||||
}
|
||||
} else {
|
||||
$pageTotal = $pageCurrent = 1;
|
||||
$pagePrev = 1;
|
||||
$pageNext = 1;
|
||||
}
|
||||
$this->view->assign('PageTotal', $pageTotal);
|
||||
$this->view->assign('PagePrev', $pagePrev);
|
||||
@ -381,12 +383,9 @@ class JuridiqueController extends Zend_Controller_Action
|
||||
$this->view->msg = "Erreur";
|
||||
} else {
|
||||
|
||||
$this->view->List = $response->List->item;
|
||||
$this->view->List = isset($response->List->item)?$response->List->item:null;
|
||||
// --- Pagination
|
||||
$nbReponsesTotal = $response->Nb;
|
||||
$pageTotal = $pageCurrent = 1;
|
||||
$pagePrev = null;
|
||||
$pageNext = null;
|
||||
if ($nbReponses < $nbReponsesTotal) {
|
||||
$pageTotal = ceil( $nbReponsesTotal / $nbReponses );
|
||||
$pageCurrent = $page;
|
||||
@ -398,6 +397,10 @@ class JuridiqueController extends Zend_Controller_Action
|
||||
if( $pageNext > $pageTotal ) {
|
||||
$pageNext = $pageTotal;
|
||||
}
|
||||
} else {
|
||||
$pageTotal = $pageCurrent = 1;
|
||||
$pagePrev = 1;
|
||||
$pageNext = 1;
|
||||
}
|
||||
$this->view->assign('PageTotal', $pageTotal);
|
||||
$this->view->assign('PagePrev', $pagePrev);
|
||||
|
@ -806,6 +806,8 @@ class RechercheController extends Zend_Controller_Action
|
||||
//Calcul pagination
|
||||
$nbReponses = $reponse->nbReponses;
|
||||
$nbReponsesTotal = $reponse->nbReponsesTotal;
|
||||
$pagePrev=1;
|
||||
$pageNext=1;
|
||||
if ($nbReponses < $nbReponsesTotal) {
|
||||
$pageTotal = ceil( $nbReponsesTotal / $nbAffichage );
|
||||
$pageCurrent = $page;
|
||||
|
@ -2910,15 +2910,21 @@ class SaisieController extends Zend_Controller_Action
|
||||
$mode = $request->getParam('mode');
|
||||
$guichetMod = $request->getParam('guichetMod');
|
||||
$banqueMod = $request->getParam('banqueMod');
|
||||
|
||||
$ws = new WsScores();
|
||||
$result = $ws->getIdentite($siren);
|
||||
$infos = $ws->getBanques($siren);
|
||||
|
||||
$this->view->assign('actif',$result->Actif);
|
||||
$result='';
|
||||
if($mode!='add'){
|
||||
$params= new stdClass();
|
||||
$values=array(
|
||||
'siren' => str_replace(' ', '',$request->getParam('siren')),
|
||||
'codeBanque' => $banqueMod,
|
||||
'codeGuichet' => $guichetMod,
|
||||
);
|
||||
$params->infos=json_encode($values);
|
||||
$ws = new Scores_Ws_Client('saisie', '0.2');
|
||||
$result = $ws->getRib($params);
|
||||
}
|
||||
$this->view->assign('siren', $siren);
|
||||
$this->view->assign('mode', $mode);
|
||||
$this->view->assign('banques', $infos->result->item);
|
||||
$this->view->assign('banques', $result);
|
||||
|
||||
$this->view->assign('guichetMod', $guichetMod);
|
||||
$this->view->assign('banqueMod', $banqueMod);
|
||||
@ -2929,20 +2935,56 @@ class SaisieController extends Zend_Controller_Action
|
||||
public function ribansaveAction(){
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$request = $this->getRequest();
|
||||
$codeBanque = str_replace(' ', '',$request->getParam('code_banque'));
|
||||
$codeGuichet = str_replace(' ', '',$request->getParam('code_guichet'));
|
||||
$numCompte = str_replace(' ', '',$request->getParam('num_compte'));
|
||||
$bicSwift = str_replace(' ', '',$request->getParam('bic_swift'));
|
||||
$iban = str_replace(' ', '',$request->getParam('iban'));
|
||||
$mode = $request->getParam('mode');
|
||||
$params= new stdClass();
|
||||
$values=array(
|
||||
'siren' => str_replace(' ', '',$request->getParam('siren')),
|
||||
'codeBanque' => str_replace(' ', '',$request->getParam('code_banque')),
|
||||
'codeGuichet' => str_replace(' ', '',$request->getParam('code_guichet')),
|
||||
'numCompte' => str_replace(' ', '',$request->getParam('num_compte')),
|
||||
'bic' => str_replace(' ', '',$request->getParam('bic_swift')),
|
||||
'iban' => str_replace(' ', '',$request->getParam('iban')),
|
||||
'mode' => $request->getParam('mode'),
|
||||
);
|
||||
$params->infos=json_encode($values);
|
||||
|
||||
$ws = new Scores_Ws_Client('saisie', '0.2');
|
||||
$result = $ws->setRib($params);
|
||||
if($result){
|
||||
echo 'Opération enregistrée';
|
||||
}else {
|
||||
echo 'Opération échouée ';
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
$this->view->assign('code_banque', $guichetMod);
|
||||
$this->view->assign('code_guichet', $codeGuichet);
|
||||
$this->view->assign('num_compte', $numCompte);
|
||||
$this->view->assign('bic_swift', $bicSwift);
|
||||
$this->view->assign('iban', $iban);
|
||||
public function testwsAction(){
|
||||
$c = Zend_Registry::get('config');
|
||||
$wsdl = 'http://webservice.sd.dev/saisie/v0.2?wsdl-auto';
|
||||
$options = array( '0.2' => array(
|
||||
'setRib' => array(
|
||||
'debug' => true,
|
||||
'log' => 'mail',
|
||||
),
|
||||
),
|
||||
);
|
||||
$options['features'] = SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS;
|
||||
$options['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE;
|
||||
$options['login'] = 'cdelbos';
|
||||
$options['password'] = 'coucou';
|
||||
if (APPLICATION_ENV == 'development'){
|
||||
$options['cache_wsdl'] = WSDL_CACHE_NONE;
|
||||
}
|
||||
$options['trace'] = true;
|
||||
$options['encoding'] = 'utf-8';
|
||||
$client = false;
|
||||
$client = new SoapClient($wsdl, $options);
|
||||
$params = new stdClass();
|
||||
$params->infos=json_encode(array('siren' => '809613144','mode' => 'add', 'codeBanque' => '20041'));
|
||||
$reponse = $client->setRib($params);
|
||||
var_dump($reponse);die;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -118,6 +118,7 @@ class SurveillanceController extends Zend_Controller_Action
|
||||
|
||||
$page = $request->getParam('page');
|
||||
$from = $request->getParam('from');
|
||||
$q = $request->getParam('q');
|
||||
|
||||
$siret = $request->getParam('siret', '');
|
||||
$email = $request->getParam('email', '');
|
||||
@ -136,6 +137,8 @@ class SurveillanceController extends Zend_Controller_Action
|
||||
}
|
||||
} elseif (isset($page)) {
|
||||
$this->redirect('surveillance/liste/page/'.$page);
|
||||
} elseif (isset($q)) {
|
||||
$this->redirect('surveillance/liste/q/'.$q);
|
||||
} else {
|
||||
$this->redirect('surveillance/liste');
|
||||
}
|
||||
@ -380,7 +383,7 @@ class SurveillanceController extends Zend_Controller_Action
|
||||
$ws = new WsScores();
|
||||
$infos = $ws->getSurveillances($filtre, $position, $nbAffichage);
|
||||
|
||||
$surveillances = $infos->result->item;
|
||||
$surveillances = isset($infos->result->item)?$infos->result->item:null;
|
||||
|
||||
$listTrier = array();
|
||||
if ( count($surveillances)>0 ) {
|
||||
@ -422,10 +425,12 @@ class SurveillanceController extends Zend_Controller_Action
|
||||
}
|
||||
} else {
|
||||
$pageTotal = $pageCurrent = 1;
|
||||
$pagePrev = 1;
|
||||
$pageNext = 1;
|
||||
}
|
||||
$this->view->assign('PageTotal', $pageTotal);
|
||||
$this->view->assign('PagePrev', $pagePrev);
|
||||
$this->view->assign('PageNext', $pageNext);
|
||||
$this->view->assign('PagePrev', isset($pagePrev)?$pagePrev:1);
|
||||
$this->view->assign('PageNext', isset($pageNext)?$pageNext:1);
|
||||
$this->view->assign('PageCurrent', $pageCurrent);
|
||||
|
||||
$this->view->assign('nbReponses', empty($nbReponses) ? 0 : $nbReponses);
|
||||
@ -641,6 +646,8 @@ class SurveillanceController extends Zend_Controller_Action
|
||||
}
|
||||
} else {
|
||||
$pageTotal = $pageCurrent = 1;
|
||||
$pagePrev = 1;
|
||||
$pageNext = 1;
|
||||
}
|
||||
$this->view->assign('PageTotal', $pageTotal);
|
||||
$this->view->assign('PagePrev', $pagePrev);
|
||||
@ -1152,4 +1159,56 @@ class SurveillanceController extends Zend_Controller_Action
|
||||
$html2pdf->WriteHTML(utf8_decode($output));
|
||||
$html2pdf->Output(str_replace('.csv', '.pdf', $nomFic), 'D');
|
||||
}
|
||||
|
||||
/**
|
||||
* Import surveillance en fichier csv
|
||||
*/
|
||||
public function surveillanceserieAction(){
|
||||
//echo 'coucou';die;
|
||||
$request = $this->getRequest();
|
||||
if($request->getParam('ref')>""){
|
||||
$cs=new Scores_Import_FileCsv();
|
||||
$verif=$cs->verifandupload($_FILES,$request);
|
||||
if($verif['success']){
|
||||
$this->view->assign('msg', 'Nous avons enregistré votre fichier de '.$verif['message'].' lignes.<br><br>Les surveillances seront enregistrées durant la nuit.');
|
||||
$this->view->assign('step', 2);
|
||||
}else{
|
||||
$this->view->assign('msg', $verif['message']);
|
||||
$this->view->assign('step', 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//Affichage formulaire demande ref et email
|
||||
$this->_helper->layout->disableLayout();
|
||||
$source = $request->getParam('source', '');
|
||||
$encours = $request->getParam('encours', 0);
|
||||
$this->view->pathScript=$this->theme->pathScript;
|
||||
$this->view->pathStyle=$this->theme->pathStyle;
|
||||
$user = new Scores_Utilisateur();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$source = $request->getParam('source');
|
||||
|
||||
$tabSource = array();
|
||||
$user = new Scores_Utilisateur();
|
||||
|
||||
// Main email
|
||||
$email = $user->getEmail();
|
||||
$ref=$user->identity->id . 'surv'.Date('YmdHis');
|
||||
foreach ($this->sourceDroit as $s => $perm) {
|
||||
if ($user->checkPerm($perm)) {
|
||||
$tabSource[] = array(
|
||||
'value' => $s,
|
||||
'name' => $this->sourceTxt[$s],
|
||||
'select' => (!empty($source) && $source==$s) ? ' selected' : '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->assign('tabSource', $tabSource);
|
||||
$this->view->assign('email', $email);
|
||||
$this->view->assign('ref', $ref);
|
||||
$this->view->assign('encours', $encours);
|
||||
$this->view->msg="Sélectionnez votre fichier";
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@
|
||||
<td valign="top" ><p style="text-decoration:underline;"><?=$relation->libBanque?></p>
|
||||
<?php if (empty($this->AutrePage) && $this->edition) {?>
|
||||
<a class="dialog" title="Edition RIB/IBAN" href="<?=$this->url(array('controller'=>'saisie','action'=>'ribiban','mode'=>'edit','siren'=>$this->siren, 'guichetMod'=>$relation->codeGuichet, 'banqueMod'=>$relation->codeBanque), null, true)?>"><img src="/themes/default/images/interfaces/editer.png" /></a>
|
||||
<a class="dialog" title="Supprimer RIB/IBAN" href="<?=$this->url(array('controller'=>'saisie','action'=>'ribiban','mode'=>'delete','siren'=>$this->siren,'siret'=>$this->siret), null, true)?>"><img src="/themes/default/images/interfaces/supprimer.png" /></a>
|
||||
<a class="dialog" title="Supprimer RIB/IBAN" href="<?=$this->url(array('controller'=>'saisie','action'=>'ribiban','mode'=>'delete','siren'=>$this->siren, 'guichetMod'=>$relation->codeGuichet, 'banqueMod'=>$relation->codeBanque), null, true)?>"><img src="/themes/default/images/interfaces/supprimer.png" /></a>
|
||||
<?php }?>
|
||||
</td>
|
||||
<td>
|
||||
|
@ -4,13 +4,19 @@ div#dialog fieldset {border:1px solid; padding:1px; }
|
||||
div#dialog fieldset legend {padding:5px; font-weight:bold; }
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<?php
|
||||
$bq=new Scores_Finance_Banques();
|
||||
$banques=$bq->getBDF_Etabs('php');
|
||||
$list_bq=json_encode($banques);
|
||||
$list_guichets=$bq->getBDF_Guichets();
|
||||
$lbanque = (array)json_decode($this->banques);
|
||||
//var_dump($lbanque);
|
||||
?>
|
||||
|
||||
<form name="saveRiban" action="<?=$this->url(array('controller'=>'saisie', 'action'=>'ribansave'),null, true)?>" method="post">
|
||||
<?php if($this->mode == add || $this->mode == edit){?>
|
||||
<input type="hidden" name="mode" value="<?=$this->mode?>" />
|
||||
<input type="hidden" name="siren" value="<?=$this->siren?>" />
|
||||
<?php if($this->mode == 'add' || $this->mode == 'edit'){?>
|
||||
<div class="fieldgrp">
|
||||
<label>Siren</label>
|
||||
<div class="field">
|
||||
@ -23,10 +29,12 @@ div#dialog fieldset legend {padding:5px; font-weight:bold; }
|
||||
<label>Situation RIB</label>
|
||||
<div class="field">
|
||||
<?php
|
||||
if ($this->actif==1){
|
||||
if ($this->actif==1 || (isset($lbanque['dateSuppr']) && $lbanque['dateSuppr']=='0000-00-00 00:00:00') ){
|
||||
$checkActive = 'checked';
|
||||
$checkInactive = '';
|
||||
} else {
|
||||
$checkInactive = 'checked';
|
||||
$checkActive = '';
|
||||
}
|
||||
?>
|
||||
<div style="float:left;">Active<input type="radio" name="actif" value="1" <?=$checkActive;?>/></div>
|
||||
@ -35,79 +43,127 @@ if ($this->actif==1){
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
|
||||
|
||||
<fieldset>
|
||||
<legend>Saisie RIB</legend>
|
||||
<div class="fieldgrp">
|
||||
<label>Banque</label>
|
||||
<div class="field" >
|
||||
<select name="Banque" style="width:160px;" >
|
||||
<select name="Banque" type="text" value="<?=$this->banqueMod?>" >
|
||||
<option value="<?=$this->banqueMod?>"><?=isset($banques[$this->banqueMod])?$banques[$this->banqueMod]:$this->banqueMod?></option>
|
||||
<?php foreach($banques as $num => $name):?>
|
||||
<option value="<?=$num?>"><?=substr($name,0,40)?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<span id="denombque"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Guichet</label>
|
||||
<div class="field" >
|
||||
<select name="Guichet" style="width:160px;" >
|
||||
<option value=""><?=$this->banqueMod?></option>
|
||||
<?php foreach( $this->banques as $val ) {?>
|
||||
<option value="<?=$val->codeBanque?>"><?=$val->codeBanque?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Guichet</label>
|
||||
<div class="field" >
|
||||
<select name="Guichet" style="width:160px;" >
|
||||
<option value=""><?=$this->guichetMod?></option>
|
||||
<?php foreach( $this->banques as $val ) {?>
|
||||
<option value="<?=$val->codeGuichet?>"><?=$val->codeGuichet?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
<span id="denomgcht"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>RIB</label>
|
||||
<div class="field">
|
||||
<input type="text" name="code_banque" size="4" value=""/>
|
||||
<input type="text" name="code_guichet" size="4" value=""/>
|
||||
<input type="text" name="num_compte" size="32" value=""/>
|
||||
<input type="text" name="code_banque" size="4" value="<?=(isset($lbanque['codeBanque'])?$lbanque['codeBanque']:'') ?>"/>
|
||||
<input type="text" name="code_guichet" size="4" value="<?=(isset($lbanque['codeGuichet'])?$lbanque['codeGuichet']:'') ?>"/>
|
||||
<input type="text" name="num_compte" size="32" value="<?=(isset($lbanque['numCompte'])?$lbanque['numCompte']:'') ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="fieldgrp">
|
||||
<fieldset>
|
||||
<legend>Saisie BIC/IBAN</legend>
|
||||
<div class="fieldgrp">
|
||||
<label>BIC/SWIFT</label>
|
||||
<div class="field">
|
||||
<input type="text" name="bic_swift" value="" size="20"/>
|
||||
<input type="text" name="bic_swift" value="<?=(isset($lbanque['bic'])?$lbanque['bic']:'') ?>" size="20"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>IBAN</label>
|
||||
<div class="field">
|
||||
<input type="text" name="iban" value="" size="47"/>
|
||||
<input type="text" name="iban" value="<?=(isset($lbanque['iban'])?$lbanque['iban']:'') ?>" size="47"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<?php }else {?>
|
||||
<input type="hidden" name="code_banque" value="<?=(isset($lbanque['codeBanque'])?$lbanque['codeBanque']:'') ?>" />
|
||||
<input type="hidden" name="code_guichet" value="<?=(isset($lbanque['codeGuichet'])?$lbanque['codeGuichet']:'') ?>" />
|
||||
<input type="hidden" name="num_compte" value="<?=(isset($lbanque['numCompte'])?$lbanque['numCompte']:'') ?>" />
|
||||
<input type="hidden" name="bic_swift" value="<?=(isset($lbanque['bic'])?$lbanque['bic']:'') ?>" />
|
||||
<input type="hidden" name="iban" value="<?=(isset($lbanque['iban'])?$lbanque['iban']:'') ?>" />
|
||||
<p>Voulez vous supprimer ce RIB ?</p>
|
||||
<?php }?>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var tab_bqu=<?=$list_bq?>;
|
||||
var tab_guichet=<?=$list_guichets?>;
|
||||
var selecthtml1='<option value="<?=$this->banqueMod?>"><?=$this->banqueMod?></option>';
|
||||
$('select[name=Banque]').change(function(e){
|
||||
var num=$('select[name=Banque]').val();
|
||||
$('select[name=code_banque]').val(num);
|
||||
var selecthtml2=selecthtml1;
|
||||
for(var numg in tab_guichet[num]){
|
||||
selecthtml2+='<option value="'+numg+'">'+numg+'</option>';
|
||||
}
|
||||
$('select[name=Guichet]').html(selecthtml2);
|
||||
if($('input[name=code_banque]').val()==""){
|
||||
$('input[name=code_banque]').val(num);
|
||||
}
|
||||
});
|
||||
$('select[name=Guichet]').change(function(){
|
||||
var num=$('select[name=Banque]').val();
|
||||
var numg=$('select[name=Guichet]').val();
|
||||
$('#denomgcht').html(tab_guichet[num][numg]);
|
||||
if($('input[name=code_guichet]').val()==""){
|
||||
$('input[name=code_guichet]').val(numg);
|
||||
}
|
||||
});
|
||||
$('input[name=code_banque]').change(function(e){
|
||||
var num=$('input[name=code_banque]').val();
|
||||
$('select[name=Banque]').val(num);
|
||||
$('select[name=Banque]').change();
|
||||
});
|
||||
$('input[name=iban]').change(function(e){
|
||||
var regex = new RegExp(' ', "igm");
|
||||
var iban=$('input[name=iban]').val().replace(regex,"");
|
||||
$('input[name=iban]').val(iban);
|
||||
var num=iban.substr(4,5);
|
||||
$('select[name=Banque]').val(num);
|
||||
$('select[name=Banque]').change();
|
||||
var numg=iban.substr(9,5);
|
||||
$('select[name=Guichet]').val(num);
|
||||
$('select[name=Guichet]').change();
|
||||
});
|
||||
|
||||
$('#dialog').dialog({ buttons: [
|
||||
{ text: "Valider", click: function() {
|
||||
var form = $('form[name=saveRiban]');
|
||||
$.post(form.attr('action'), form.serialize(), function(data){
|
||||
form.replaceWith(data);
|
||||
}).done(function(data){ alert(data);
|
||||
}).fail(function(){ alert('Unknow error'); });
|
||||
} },
|
||||
{ text: "Annuler", click: function() { $(this).dialog("close"); } }
|
||||
|
@ -28,9 +28,14 @@ if ( empty($this->source) ){
|
||||
?>
|
||||
</div>
|
||||
|
||||
<h2>Extraction des surveillances</h2>
|
||||
<h2>Traitements de masse</h2>
|
||||
<div class="paragraph">
|
||||
<?=$this->action('surveillancecsv', 'surveillance')?>
|
||||
<p class="options">Demande de surveillance en série :
|
||||
<a class="dialogsurv" href="/surveillance/surveillanceserie" title="Demande de surveillance en série ">
|
||||
OK</a></p>
|
||||
|
||||
</div>
|
||||
<h2>Options de recherche</h2>
|
||||
|
||||
<div class="paragraph">
|
||||
@ -152,7 +157,8 @@ par
|
||||
'siret' => $item['siren'].$item['nic'],
|
||||
'ref' => urlencode($surveillance['ref']),
|
||||
'email' => $surveillance['email'],
|
||||
'source' => $surveillance['source']
|
||||
'source' => $surveillance['source'],
|
||||
'q' => $this->q,
|
||||
))?>" title="Supprimer la surveillance <?=$surveillance['source']?>">
|
||||
<img src="/themes/default/images/interfaces/supprimer.png"/>
|
||||
</a>
|
||||
@ -295,4 +301,3 @@ $(function() {
|
||||
?>
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -0,0 +1,70 @@
|
||||
<div id="survForm">
|
||||
<link href="<?=$this->pathStyle?>/bsmain.css" media="all" rel="stylesheet" type="text/css">
|
||||
<?php if(intval($this->step==0)):?>
|
||||
<?php
|
||||
$cs=new Scores_Import_FileCsv();
|
||||
$msg=$cs->standardhelptext;
|
||||
?>
|
||||
<div id="msgintro" class="alert-sm alert-success"><?=$msg?>
|
||||
<br><br><center>
|
||||
<button id="btnstart" class="btn btn-sm btn-info">Le fichier est pret</button>
|
||||
</center><br><br>
|
||||
</div>
|
||||
|
||||
<?php endif;?>
|
||||
<?php if(intval($this->step==2)):?>
|
||||
<div id="center">
|
||||
<h1 class="titre">SURVEILLANCE</h1>
|
||||
<div class="paragraph">
|
||||
<div id="msgintro" class="alert-sm alert-warning"><?=$this->msg?>
|
||||
<br><br>
|
||||
|
||||
<br><br><center>
|
||||
<a href="<?=$this->url(array('controller' => 'surveillance', 'action' => 'liste'))?>" class="submit">Retour</a>
|
||||
</center><br><br>
|
||||
</div>
|
||||
|
||||
<?php endif;?>
|
||||
<div id="msg" class="alert-sm alert-danger"></div>
|
||||
<form enctype="multipart/form-data" id="fileform" action="<?=$this->url(array('controller' => 'surveillance', 'action' => 'surveillanceserie'))?>" method="POST">
|
||||
<input class="required" type="file" name="fichier" size="50000" >
|
||||
<div class="form-group">
|
||||
<?php foreach($this->tabSource as $s) : ?>
|
||||
<input type="checkbox" name="source[]" value="<?=$s['value']?>"<?=$s['select']?>/> <?=$s['name']?><br/>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="email">Adresse email du destinataire</label>
|
||||
<input class="required" name="email" type="text" value="<?=$this->email?>"/>
|
||||
</div>
|
||||
<input class="btn btn-sm btn-info" name="loadfile" value="Charger le fichier" type="submit">
|
||||
<input name="ref" type="hidden" value="<?=$this->ref?>"/></div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
$( "#fileform" ).hide();
|
||||
$('#btnstart').click(function( event ) {
|
||||
$( "#fileform" ).show();
|
||||
$( "#msgintro" ).hide();
|
||||
});
|
||||
$( "#fileform" ).submit(function( event ) {
|
||||
var ok=false;
|
||||
if($('input[name="source[]"]:checked').length > 0){
|
||||
ok=true;
|
||||
}
|
||||
if ( $( ".required" ).val().length === 0 ) {
|
||||
ok=false;
|
||||
}
|
||||
if(!ok){
|
||||
$('#msg').html('Merci de remplir tous les champs');
|
||||
}
|
||||
if ( $( "input[name=fichier]" ).val().substr(-4,4) != '.csv' ) {
|
||||
$('#msg').html('Format de fichier incorrect');
|
||||
ok=false;
|
||||
}
|
||||
if(!ok){
|
||||
event.preventDefault();
|
||||
}
|
||||
});</script>
|
73
composer.lock
generated
73
composer.lock
generated
@ -92,21 +92,21 @@
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "6.2.2",
|
||||
"version": "6.2.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60"
|
||||
"reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60",
|
||||
"reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006",
|
||||
"reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/promises": "^1.0",
|
||||
"guzzlehttp/psr7": "^1.3.1",
|
||||
"guzzlehttp/psr7": "^1.4",
|
||||
"php": ">=5.5"
|
||||
},
|
||||
"require-dev": {
|
||||
@ -150,7 +150,7 @@
|
||||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"time": "2016-10-08T15:01:37+00:00"
|
||||
"time": "2017-02-28T22:50:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/promises",
|
||||
@ -205,16 +205,16 @@
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
"version": "1.3.1",
|
||||
"version": "1.4.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/psr7.git",
|
||||
"reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b"
|
||||
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
|
||||
"reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
|
||||
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -250,29 +250,36 @@
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
},
|
||||
{
|
||||
"name": "Tobias Schultze",
|
||||
"homepage": "https://github.com/Tobion"
|
||||
}
|
||||
],
|
||||
"description": "PSR-7 message implementation",
|
||||
"description": "PSR-7 message implementation that also provides common utility methods",
|
||||
"keywords": [
|
||||
"http",
|
||||
"message",
|
||||
"request",
|
||||
"response",
|
||||
"stream",
|
||||
"uri"
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"time": "2016-06-24T23:00:38+00:00"
|
||||
"time": "2017-03-20T17:10:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.22.0",
|
||||
"version": "1.22.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "bad29cb8d18ab0315e6c477751418a82c850d558"
|
||||
"reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/bad29cb8d18ab0315e6c477751418a82c850d558",
|
||||
"reference": "bad29cb8d18ab0315e6c477751418a82c850d558",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/1e044bc4b34e91743943479f1be7a1d5eb93add0",
|
||||
"reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -337,7 +344,7 @@
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-11-26T00:15:39+00:00"
|
||||
"time": "2017-03-13T07:08:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoffice/phpexcel",
|
||||
@ -597,16 +604,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/browser-kit",
|
||||
"version": "v3.2.2",
|
||||
"version": "v3.2.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/browser-kit.git",
|
||||
"reference": "548f8230bad9f77463b20b15993a008f03e96db5"
|
||||
"reference": "2fe0caa60c1a1dfeefd0425741182687a9b382b8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/548f8230bad9f77463b20b15993a008f03e96db5",
|
||||
"reference": "548f8230bad9f77463b20b15993a008f03e96db5",
|
||||
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/2fe0caa60c1a1dfeefd0425741182687a9b382b8",
|
||||
"reference": "2fe0caa60c1a1dfeefd0425741182687a9b382b8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -650,20 +657,20 @@
|
||||
],
|
||||
"description": "Symfony BrowserKit Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-01-02T20:32:22+00:00"
|
||||
"time": "2017-02-21T09:12:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"version": "v3.2.2",
|
||||
"version": "v3.2.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/css-selector.git",
|
||||
"reference": "f0e628f04fc055c934b3211cfabdb1c59eefbfaa"
|
||||
"reference": "a48f13dc83c168f1253a5d2a5a4fb46c36244c4c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/f0e628f04fc055c934b3211cfabdb1c59eefbfaa",
|
||||
"reference": "f0e628f04fc055c934b3211cfabdb1c59eefbfaa",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/a48f13dc83c168f1253a5d2a5a4fb46c36244c4c",
|
||||
"reference": "a48f13dc83c168f1253a5d2a5a4fb46c36244c4c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -703,20 +710,20 @@
|
||||
],
|
||||
"description": "Symfony CssSelector Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-01-02T20:32:22+00:00"
|
||||
"time": "2017-02-21T09:12:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
"version": "v3.2.2",
|
||||
"version": "v3.2.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dom-crawler.git",
|
||||
"reference": "27d9790840a4efd3b7bb8f5f4f9efc27b36b7024"
|
||||
"reference": "403944e294cf4ceb3b8447f54cbad88ea7b99cee"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/27d9790840a4efd3b7bb8f5f4f9efc27b36b7024",
|
||||
"reference": "27d9790840a4efd3b7bb8f5f4f9efc27b36b7024",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/403944e294cf4ceb3b8447f54cbad88ea7b99cee",
|
||||
"reference": "403944e294cf4ceb3b8447f54cbad88ea7b99cee",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -759,7 +766,7 @@
|
||||
],
|
||||
"description": "Symfony DomCrawler Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-01-02T20:32:22+00:00"
|
||||
"time": "2017-02-21T09:12:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
|
8
library/Application/Model/CommandesSurveillance.php
Normal file
8
library/Application/Model/CommandesSurveillance.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
class Application_Model_CommandesSurveillance extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'commandes_surveillance';
|
||||
|
||||
|
||||
|
||||
}
|
26375
library/Scores/Finance/Banques.php
Normal file
26375
library/Scores/Finance/Banques.php
Normal file
File diff suppressed because one or more lines are too long
@ -1368,7 +1368,8 @@ class IdentiteEntreprise
|
||||
if($i==2) break;
|
||||
}
|
||||
switch($i){
|
||||
case 1: $unite = ' K'; break;
|
||||
case 0: $unite = ' '; break;
|
||||
case 1: $unite = ' K'; break;
|
||||
case 2: $unite = ' M'; break;
|
||||
}
|
||||
return number_format($number, 0, '', ' ').$unite;
|
||||
|
186
library/Scores/Import/FileCsv.php
Normal file
186
library/Scores/Import/FileCsv.php
Normal file
@ -0,0 +1,186 @@
|
||||
<?php
|
||||
class Scores_Import_FileCsv
|
||||
{
|
||||
private $filepath='';
|
||||
private $standardcolumns=array(
|
||||
'siren','nic','ref'
|
||||
);
|
||||
private $standarddelimiter=',';
|
||||
private $standardencoding='utf-8';
|
||||
public $standardhelptext='Le fichier attendu est un csv standard : fichier texte extension .csv contenant 3 colonnes (siren nic ref) séparées par des virgules';
|
||||
public function __construct()
|
||||
{
|
||||
$c = new Zend_Config_Ini(realpath(APPLICATION_PATH) . '/configs/application.ini');
|
||||
$ct = $c->toArray();
|
||||
$this->config=$ct[APPLICATION_ENV];
|
||||
//home/vhosts/data/extranet
|
||||
$this->filepath=$this->config['profil']['path']['shared'].'/persist/surveillance/';
|
||||
if(!is_dir($this->filepath)){
|
||||
mkdir($this->filepath);
|
||||
}
|
||||
}
|
||||
public function verifandupload($file,$request){
|
||||
$ref=$request->getParam('ref');
|
||||
$user = new Scores_Utilisateur();
|
||||
$this->login = $user->identity->username;
|
||||
//var_dump($user->identity);die;
|
||||
$this->email=$request->getParam('email');
|
||||
$this->sources=$request->getParam('source');
|
||||
|
||||
$fileinname=$file["fichier"]["name"];
|
||||
$fileType = pathinfo($fileinname,PATHINFO_EXTENSION);
|
||||
if($fileType!='csv'){
|
||||
return array('success' => false, 'message' => 'Extension incorrecte');
|
||||
}
|
||||
$fileoutname=$ref.'.csv';
|
||||
$target=$this->filepath.$fileinname;
|
||||
if (!move_uploaded_file($file["fichier"]["tmp_name"], $target)) {
|
||||
return array('success' => false, 'message' => 'Le fichier '
|
||||
. basename( $file["fichier"]["name"]). ' ne peut pas être chargé.');
|
||||
}
|
||||
$result=$this->verifyformat($fileinname,$fileoutname);
|
||||
if($result['success']){
|
||||
$row=$result['message'];
|
||||
}else{
|
||||
return $result;
|
||||
}
|
||||
$result=$this->sendtoftp($fileoutname);
|
||||
if(!$result['success']){
|
||||
return $result;
|
||||
}
|
||||
|
||||
$cmd=new Application_Model_CommandesSurveillance();
|
||||
foreach($sources as $source){
|
||||
$data= array(
|
||||
'ref' => $ref,
|
||||
'login' =>$this->login,
|
||||
'email' => $this->email,
|
||||
'filename' => $fileinname,
|
||||
'surv_source' => $source,
|
||||
'date_created' => Date('Y-m-d')
|
||||
);
|
||||
$cmd->insert($data);
|
||||
}
|
||||
$mail = new Zend_Mail('UTF-8');
|
||||
// --- Configuration du transport SMTP
|
||||
if ( $this->config['profil']['mail']['method'] == 'smtp' ) {
|
||||
$config = array();
|
||||
if ( isset($this->config['profil']['mail']['username']) ) {
|
||||
$config['username'] = $this->config['profil']['mail']['username'];
|
||||
}
|
||||
if ( isset($this->config['profil']['mail']['password']) ) {
|
||||
$config['password'] = $this->config['profil']['mail']['password'];
|
||||
}
|
||||
|
||||
if ( isset($this->config['profil']['mail']['port']) ) {
|
||||
$config['port'] = $c->profil->mail->port;
|
||||
}
|
||||
$tr = new Zend_Mail_Transport_Smtp($this->config['profil']['mail']['host'], $config);
|
||||
}
|
||||
// --- Configuration transport Sendmail
|
||||
if ( $this->config['profil']['mail']['method']== 'sendmail' ) {
|
||||
$tr = new Zend_Mail_Transport_Sendmail();
|
||||
}
|
||||
$mail->setDefaultTransport($tr);
|
||||
$mail->setBodyText(implode('###',$data));
|
||||
$mail->setFrom('support@scores-decisions.com', 'Extranet');
|
||||
$mail->addTo('supportdev@scores-decisions.com', 'Support');
|
||||
$mail->setSubject('Commande de surveillance '.$ref);
|
||||
try{
|
||||
$mail->send(); // Ne fonctionne pas en dev....
|
||||
}catch(Exception $e){
|
||||
// Ne fonctionne pas en dev.... voir en prod
|
||||
}
|
||||
|
||||
return array('success' => true, 'message' => $row);
|
||||
}
|
||||
private function verifyformat($fileinname,$fileoutname){
|
||||
$handle=fopen($this->filepath.$fileinname,'r');
|
||||
$h2=fopen($this->filepath.$fileoutname,'w');
|
||||
if(!$handle){
|
||||
return array('success' => false, 'message' => 'Fichier illisible.');
|
||||
}
|
||||
if(!$h2){
|
||||
return array('success' => false, 'message' => 'Un probleme technique est survenu merci de nous contacter avec le code erreur '.__LINE__);
|
||||
}
|
||||
ini_set("auto_detect_line_endings", true);
|
||||
$row=1;
|
||||
while (($data = fgetcsv($handle)) !== FALSE) {
|
||||
$num = count($data);
|
||||
if($num!=3){
|
||||
return array('success' => false, 'message' => 'Nombre de colonnes erronné à la ligne '.$row.'.');
|
||||
}
|
||||
if($data[0]=='siren' & $row==1){
|
||||
continue;
|
||||
}
|
||||
$data[0]=trim($data[0]);
|
||||
if(strlen($data[0])>9){
|
||||
return array('success' => false, 'message' => 'Siren mal formaté à la ligne '.$row.'.');
|
||||
}
|
||||
if(!is_numeric($data[0])){
|
||||
return array('success' => false, 'message' => 'Siren non numérique '.$data[0].' à la ligne '.$row.'.');
|
||||
}
|
||||
$siren=substr('000000000'.$data[0],-9,9);
|
||||
if(!$this->estValide($siren)){
|
||||
return array('success' => false, 'message' => 'Siren invalide '.$data[0].' à la ligne '.$row.'.');
|
||||
}
|
||||
$row++;
|
||||
$data[3]='';
|
||||
$data[4]=$this->login;
|
||||
$data[5]=$this->email;
|
||||
foreach($this->sources as $source){
|
||||
$data[3]=$source;
|
||||
fputcsv($h2,$data);
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
fclose($h2);
|
||||
|
||||
return array('success' => true, 'message' => $row);
|
||||
|
||||
}
|
||||
private function sendtoftp($filename){
|
||||
$connection = ftp_connect('ftp.scores-decisions.com',21);
|
||||
|
||||
$login = ftp_login($connection, 'internesd', 'internesd2017');
|
||||
|
||||
$dest='/send/'.$filename;
|
||||
|
||||
$source=$this->filepath.$filename;
|
||||
|
||||
if (!$connection || !$login) {
|
||||
return array('success' => false, 'message' => 'Un probleme technique est survenu merci de nous contacter avec le code erreur '.__LINE__);
|
||||
}
|
||||
|
||||
if(!ftp_pasv($connection, true)){
|
||||
return array('success' => false, 'message' => 'Un probleme technique est survenu merci de nous contacter avec le code erreur '.__LINE__);
|
||||
}
|
||||
$upload = ftp_put($connection, $dest, $source, FTP_BINARY);
|
||||
|
||||
if (!$upload) {
|
||||
return array('success' => false, 'message' => 'Un probleme technique est survenu merci de nous contacter avec le code erreur '.__LINE__);
|
||||
}
|
||||
|
||||
ftp_close($connection);
|
||||
return array('success' => true, 'message' => '');
|
||||
}
|
||||
private function estValide($siren){
|
||||
// Donc le SIREN est un numérique à 9 chiffres
|
||||
$somme = 0;
|
||||
for ($cpt = 0; $cpt<strlen($siren); $cpt++) {
|
||||
if (($cpt % 2) == 1) { // Les positions paires : 2ème, 4ème, 6ème et 8ème chiffre
|
||||
$tmp = substr($siren,$cpt,1) * 2; // On le multiplie par 2
|
||||
if ($tmp > 9)
|
||||
$tmp -= 9; // Si le résultat est supérieur à 9, on lui soustrait 9
|
||||
}
|
||||
else
|
||||
$tmp = substr($siren,$cpt,1);
|
||||
$somme += (int)$tmp;
|
||||
}
|
||||
if (($somme % 10) == 0)
|
||||
return true; // Si la somme est un multiple de 10 alors le SIREN est valide
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
@ -10,5 +10,15 @@ return array(
|
||||
'errorMsg' => array('MSG'),
|
||||
'log' => 'mail',
|
||||
),
|
||||
'setRib' => array(
|
||||
'debug' => true,
|
||||
'errorMsg' => array('MSG'),
|
||||
'log' => 'mail',
|
||||
),
|
||||
'getRib' => array(
|
||||
'debug' => true,
|
||||
'errorMsg' => array('MSG'),
|
||||
'log' => 'mail',
|
||||
),
|
||||
)
|
||||
);
|
1
public/themes/default/styles/bsmain.css
Normal file
1
public/themes/default/styles/bsmain.css
Normal file
@ -0,0 +1 @@
|
||||
@import url("./../../../libs/bootstrap-3.3.7/css/bootstrap.min.css");
|
Loading…
Reference in New Issue
Block a user