Association : Suppression upload fichier - tout dans le backoffice

This commit is contained in:
Michael RICOIS 2016-03-04 13:11:29 +00:00
parent 7f8c21a1b7
commit ec16449ace
4 changed files with 0 additions and 149 deletions

View File

@ -850,7 +850,6 @@ class PiecesController extends Zend_Controller_Action
}
$this->view->assign('actes', $actes);
$this->view->assign('ModeEdition', $user->checkModeEdition());
$this->view->assign('email', $user->getEmail());
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);

View File

@ -906,95 +906,6 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('siret', $siret);
}
public function associationAction()
{
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$type = $request->getParam('type');
$siren = $request->getParam('siren');
$waldec = $request->getParam('waldec');
//Téléchargement du fichier
if ( isset($_FILES) && count($_FILES)==1 ) {
$this->_helper->viewRenderer->setNoRender(true);
if ( empty($siren) ) {
echo "Pas d'identifiant!";
} else {
$c = Zend_Registry::get('config');
$path = $c->profil->path->shared.'/persist/association';
if ( $type=='bilan' ){
$dateCloture = $request->getParam('dateCloture');
if (strlen($dateCloture)!=8) {
echo "Erreur format date cloture";
}
$path.= '/bilans';
$name = $siren.'_'.$dateCloture;
} elseif ( $type=='acte' ) {
$date = $request->getParam('date');
if (strlen($date)!=8) {
echo "Erreur format date";
}
$name = 'ST-'.$siren.'-'.$date;
$path.= '/actes';
}
$n = $_FILES['fichier']['name'];
$s = $_FILES['fichier']['size'];
$tmp_name = $_FILES['fichier']['tmp_name'];
$extValide = array('pdf');
$extension = strrchr($n,'.');
$extension = strtolower(substr($extension,1));
//Vérifier l'extension du fichier
if( !in_array($extension, $extValide) ){
echo "Extension de fichier incorrect !";
} elseif ( move_uploaded_file($tmp_name, $path.'/'.$name.'.'.$extension) ){
$result = true;
//Send info to webservice
if ( $type='acte' ) {
$ws = new WsScores();
$info = $ws->setActeAsso($siren, $waldec, 'ST', 'Statut', $date);
if (is_string($info)) {
$result = false;
}
}
//Display message
if ($result) {
echo "Fichier envoyé, <a target=\"_blank\" href=\"".$this->view->url(array(
'controller' => 'fichier',
'action' => 'pdfassociation',
'file' => $name.'.'.$extension,
), 'default', true)."\">Cliquez pour voir le fichier</a>";
}
} else {
echo "Erreur lors du déplacement du fichier !";
}
}
//Affichage formulaire
} else {
$this->view->inlineScript()->appendFile('/libs/form/jquery.form.min.js');
if ( intval($siren)==0 ) {
$session = new Scores_Session_Entreprise();
$siren = '';
if ( substr($session->AutreId,0,1)=='W' ) {
$siren = $session->AutreId;
}
}
$this->view->assign('siren', $siren);
$this->view->assign('type', $type);
}
}
public function liasseAction()
{
$request = $this->getRequest();

View File

@ -80,40 +80,6 @@
</tbody>
</table>
<?php }?>
<?php
//Lien pour upload acte association
if ($this->ModeEdition) {
?>
<a id="acteUpload" href="<?=$this->url(array('controller'=>'saisie', 'action'=>'association', 'type'=>'acte', 'siren'=>$this->siren))?>" title="Envoi Acte/Statut Association">
<b>Envoyer un acte</b>
</a>
<script>
$('#acteUpload').on('click', function(e){
e.preventDefault();
var url = $(this).attr('href');
var title = $(this).attr('title');
var dialogOpts = {
bgiframe: true,
title: title,
width: 500,
height: 400,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(url);
},
buttons: {
Fermer: function() { $(this).dialog('close'); }
},
close: function() { $('#dialogacteupload').remove(); }
};
$('<div id="dialogacteupload"></div>').dialog(dialogOpts);
return false;
});
</script>
<?php }?>
</div>
</div>

View File

@ -1,25 +0,0 @@
<form action="<?=$this->url(array('controller'=>'saisie', 'action'=>'association'))?>" method="post" name="sendfile">
<input type="hidden" name="siren" value="<?=$this->siren?>" />
<input type="hidden" name="type" value="<?=$this->type?>" />
<?php if ( $this->type=='bilan' ) {?>
Date Cloture : <input type="text" name="dateCloture" /> (JJMMAAAA)<br/><br/>
Bilan : <input type="file" name="fichier" />
<?php } elseif ($this->type=='acte') {?>
Date : <input type="text" name="date" /> (AAAAMMJJ)<br/><br/>
Status : <input type="file" name="fichier" />
<?php } ?>
<input type="submit" name="Envoyer" />
</form>
<i>Uniquement fichier pdf</i>
<div id="output"></div>
<?=$this->inlineScript()?>
<script>
$('form[name=sendfile]').ajaxForm({
beforeSubmit: function() {
$('#output').html('Envoi en cours...');
},
success: function(data) {
$('#output').html('<strong>' + data + '</strong>');
}
});
</script>