SD-32
This commit is contained in:
parent
9a8a008d03
commit
220aa8e27c
@ -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', isset($infos->result->item)?$infos->result->item:array());
|
||||
$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', $codeBanque);
|
||||
$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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1190,7 +1190,7 @@ class SurveillanceController extends Zend_Controller_Action
|
||||
|
||||
// Main email
|
||||
$email = $user->getEmail();
|
||||
$ref=$user->identity->id . 'www'.Date('YmdHis');
|
||||
$ref=$user->identity->id . 'surv'.Date('YmdHis');
|
||||
foreach ($this->sourceDroit as $s => $perm) {
|
||||
if ($user->checkPerm($perm)) {
|
||||
$tabSource[] = array(
|
||||
|
@ -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,7 +29,7 @@ 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 {
|
||||
@ -43,12 +49,13 @@ if ($this->actif==1){
|
||||
<div class="fieldgrp">
|
||||
<label>Banque</label>
|
||||
<div class="field" >
|
||||
<select name="Banque" style="width:160px;" >
|
||||
<option value=""><?=$this->banqueMod?></option>
|
||||
<?php foreach( $this->banques as $val ) {?>
|
||||
<option value="<?=$val->codeBanque?>"><?=$val->codeBanque?></option>
|
||||
<?php }?>
|
||||
<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>
|
||||
|
||||
@ -56,20 +63,21 @@ if ($this->actif==1){
|
||||
<label>Guichet</label>
|
||||
<div class="field" >
|
||||
<select name="Guichet" style="width:160px;" >
|
||||
<option value=""><?=$this->guichetMod?></option>
|
||||
<option value=""><?=$this->banqueMod?></option>
|
||||
<?php foreach( $this->banques as $val ) {?>
|
||||
<option value="<?=$val->codeGuichet?>"><?=$val->codeGuichet?></option>
|
||||
<option value="<?=$val->codeBanque?>"><?=$val->codeBanque?></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>
|
||||
@ -82,20 +90,25 @@ if ($this->actif==1){
|
||||
<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 }?>
|
||||
|
||||
@ -105,11 +118,52 @@ if ($this->actif==1){
|
||||
|
||||
<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"); } }
|
||||
|
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
@ -12,9 +12,9 @@ class Scores_Import_FileCsv
|
||||
{
|
||||
$c = new Zend_Config_Ini(realpath(APPLICATION_PATH) . '/configs/application.ini');
|
||||
$ct = $c->toArray();
|
||||
$config=$ct[APPLICATION_ENV];
|
||||
$this->config=$ct[APPLICATION_ENV];
|
||||
//home/vhosts/data/extranet
|
||||
$this->filepath=$config['profil']['path']['shared'].'/persist/surveillance/';
|
||||
$this->filepath=$this->config['profil']['path']['shared'].'/persist/surveillance/';
|
||||
if(!is_dir($this->filepath)){
|
||||
mkdir($this->filepath);
|
||||
}
|
||||
@ -22,10 +22,10 @@ class Scores_Import_FileCsv
|
||||
public function verifandupload($file,$request){
|
||||
$ref=$request->getParam('ref');
|
||||
$user = new Scores_Utilisateur();
|
||||
$login = $user->identity->username;
|
||||
$this->login = $user->identity->username;
|
||||
//var_dump($user->identity);die;
|
||||
$email=$request->getParam('email');
|
||||
$sources=$request->getParam('source');
|
||||
$this->email=$request->getParam('email');
|
||||
$this->sources=$request->getParam('source');
|
||||
|
||||
$fileinname=$file["fichier"]["name"];
|
||||
$fileType = pathinfo($fileinname,PATHINFO_EXTENSION);
|
||||
@ -33,12 +33,12 @@ class Scores_Import_FileCsv
|
||||
return array('success' => false, 'message' => 'Extension incorrecte');
|
||||
}
|
||||
$fileoutname=$ref.'.csv';
|
||||
$target=$this->filepath.$fileoutname;
|
||||
$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($fileoutname);
|
||||
$result=$this->verifyformat($fileinname,$fileoutname);
|
||||
if($result['success']){
|
||||
$row=$result['message'];
|
||||
}else{
|
||||
@ -48,27 +48,61 @@ class Scores_Import_FileCsv
|
||||
if(!$result['success']){
|
||||
return $result;
|
||||
}
|
||||
$user = new Scores_Utilisateur();
|
||||
|
||||
$cmd=new Application_Model_CommandesSurveillance();
|
||||
foreach($sources as $source){
|
||||
$data= array(
|
||||
'ref' => $ref,
|
||||
'login' =>$login,
|
||||
'email' => $email,
|
||||
'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($filename){
|
||||
$handle=fopen($this->filepath.$filename,'r');
|
||||
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) {
|
||||
@ -91,8 +125,16 @@ class Scores_Import_FileCsv
|
||||
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);
|
||||
|
||||
@ -107,16 +149,16 @@ class Scores_Import_FileCsv
|
||||
$source=$this->filepath.$filename;
|
||||
|
||||
if (!$connection || !$login) {
|
||||
return array('success' => false, 'message' => 'Un problement technique est survenu merci de nous contacter avec le code erreur '.__LINE__);
|
||||
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 problement technique est survenu merci de nous contacter avec le code erreur '.__LINE__);
|
||||
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 problement technique est survenu merci de nous contacter avec le code erreur '.__LINE__);
|
||||
return array('success' => false, 'message' => 'Un probleme technique est survenu merci de nous contacter avec le code erreur '.__LINE__);
|
||||
}
|
||||
|
||||
ftp_close($connection);
|
||||
|
@ -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',
|
||||
),
|
||||
)
|
||||
);
|
Loading…
Reference in New Issue
Block a user