2011-04-19 07:37:39 +00:00
|
|
|
<?php
|
|
|
|
class PiecesController extends Zend_Controller_Action
|
|
|
|
{
|
2011-05-11 13:38:14 +00:00
|
|
|
protected $association_cj = array(
|
|
|
|
'9150', // Association syndicale libre
|
|
|
|
'9220', // Association déclarée
|
|
|
|
'9221', // Association déclarée "entreprises d'insertion par l'économique"
|
|
|
|
'9222', // Association intermédiaire
|
|
|
|
'9223', // Groupement d'employeurs
|
|
|
|
'9230', // Association déclarée reconnue d'utilité publique
|
|
|
|
'9240', // Congrégation
|
|
|
|
'9260', // Association de droit local
|
|
|
|
'9300', // Fondation
|
|
|
|
);
|
|
|
|
|
|
|
|
protected $siret;
|
|
|
|
protected $id;
|
|
|
|
protected $entrep;
|
|
|
|
|
2011-04-19 07:37:39 +00:00
|
|
|
public function init()
|
|
|
|
{
|
2011-05-11 13:38:14 +00:00
|
|
|
require_once 'Scores/WsScores.php';
|
2011-05-05 12:04:47 +00:00
|
|
|
require_once 'Scores/Utilisateur.php';
|
|
|
|
require_once 'Scores/SessionEntreprise.php';
|
|
|
|
require_once 'common/dates.php';
|
2011-05-11 13:38:14 +00:00
|
|
|
require_once 'Infogreffe/Infogreffe.php';
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$this->siret = $request->getParam('siret');
|
|
|
|
$this->id = $request->getParam('id', 0);
|
|
|
|
$this->entrep = new SessionEntreprise($this->siret, $this->id);
|
2011-04-19 07:37:39 +00:00
|
|
|
}
|
|
|
|
|
2011-05-11 13:38:14 +00:00
|
|
|
public function indexAction(){}
|
|
|
|
|
2011-05-17 07:35:54 +00:00
|
|
|
public function cmdassociationAction()
|
2011-05-11 13:38:14 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function assocationAction()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function actesAction()
|
2011-04-19 07:37:39 +00:00
|
|
|
{
|
2011-05-11 13:38:14 +00:00
|
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/pieces.css', 'all');
|
|
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/pieces.js', 'text/javascript');
|
2011-05-05 12:04:47 +00:00
|
|
|
|
2011-05-11 13:38:14 +00:00
|
|
|
//Catégorie Juridique
|
|
|
|
$cj = $this->entrep->getFormeJuridique();
|
|
|
|
if( in_array($cj, $this->association_cj) ) {
|
|
|
|
$this->_forward($action);
|
|
|
|
}
|
|
|
|
|
|
|
|
$user = new Utilisateur();
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
|
|
|
|
$siren = substr($this->siret,0,9);
|
|
|
|
$vecteur = 'XL';
|
|
|
|
$ref = '';
|
|
|
|
|
|
|
|
//Affichage des actes disponible
|
|
|
|
$infogreffe = new Infogreffe();
|
|
|
|
$reponse = $infogreffe->getGreffeActes($siren, $vecteur, $ref);
|
|
|
|
//Gestion des erreurs dans la réponse
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Construire la réponse pour affichage
|
|
|
|
* Date, Type, Décisions,
|
|
|
|
*/
|
|
|
|
$infosActes = array();
|
|
|
|
|
|
|
|
if (count($reponse['result'])>0) {
|
|
|
|
|
|
|
|
$items = $reponse['result'];
|
|
|
|
//Traitement dernier statut à jour
|
2011-05-19 07:12:51 +00:00
|
|
|
if(array_key_exists(0, $items)) {
|
|
|
|
|
|
|
|
$acteS = $items[0]['actes'][0];
|
|
|
|
|
|
|
|
//Commande enregistré dans la bdd et fichier existe
|
|
|
|
$lienCommande = '';
|
|
|
|
$checkFile = false;
|
|
|
|
if( $user->checkModeEdition() ) {
|
|
|
|
$lib = 'Voir le dernier ficher dans le système.';
|
|
|
|
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH.'/configs/databases.ini');
|
|
|
|
$db = Zend_Db::factory($dbConfig->db->sdv1);
|
|
|
|
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
|
|
|
$commandes = new Application_Model_Commandes();
|
|
|
|
$rowset = $commandes->select('*')
|
|
|
|
->where('siren = ?', $siren)
|
|
|
|
->order('dateCommande DESC');
|
|
|
|
$rows = $commandes->fetchAll($rowset);
|
|
|
|
} else {
|
|
|
|
$lib = 'Télécharger votre dernière commande.';
|
|
|
|
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH.'/configs/databases.ini');
|
|
|
|
$db = Zend_Db::factory($dbConfig->db->sdv1);
|
|
|
|
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
|
|
|
$commandes = new Application_Model_Commandes();
|
|
|
|
$rowset = $commandes->select('*')
|
|
|
|
->where('siren = ?', $siren)
|
|
|
|
->andWhere('login = ?', $user->getLogin())
|
|
|
|
->order('dateCommande DESC');
|
|
|
|
$rows = $commandes->fetchAll($rowset);
|
|
|
|
}
|
|
|
|
|
|
|
|
$rows = $commandes->fetchAll($rowset);
|
|
|
|
$nbCommandes = count($rows);
|
|
|
|
if ($nbCommandes>0) {
|
|
|
|
foreach($rows as $commande) {
|
|
|
|
if(substr($commande->refDocument, 0, 3) == 'ST-') {
|
|
|
|
$ref = trim($commande->refDocument);
|
|
|
|
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
|
|
|
|
$refFile = realpath($config->data).'/'.
|
|
|
|
$config->pdf.'/acte-'.$siren.'-'.trim($commande->refDocument).'.pdf';
|
|
|
|
$checkFile = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( $checkFile && file_exists($refFile) ) {
|
|
|
|
$lienCommande = '<br/>'.
|
|
|
|
'<a href="./fichier/pdf/acte-'.$siren.'-'.$ref.'.pdf'.
|
|
|
|
'" target="_blank">'.$lib.'</a>';
|
|
|
|
}
|
2011-05-11 13:38:14 +00:00
|
|
|
//Génération du lien de commande suivant le mode de diffusion
|
2011-05-19 07:12:51 +00:00
|
|
|
switch($acteS['mode']) {
|
2011-05-11 13:38:14 +00:00
|
|
|
case 'C':
|
2011-05-19 07:12:51 +00:00
|
|
|
if( $user->checkPerm('actes') ) {
|
2011-05-11 13:38:14 +00:00
|
|
|
$title = 'Commander le document correspondant';
|
2011-05-19 07:12:51 +00:00
|
|
|
$href = $this->view->url(array(
|
|
|
|
'controller' => 'pieces',
|
|
|
|
'action' => 'statuts',
|
|
|
|
'mode' => 'C',
|
|
|
|
'siret' => $siren,
|
|
|
|
'ref' => $acteS['ref'],
|
|
|
|
));
|
|
|
|
} else {
|
2011-05-11 13:38:14 +00:00
|
|
|
$title = 'Vous n\'avez pas les droits nécessaires pour commander le document correspondant.';
|
2011-05-19 07:12:51 +00:00
|
|
|
$href = '#';
|
2011-05-11 13:38:14 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2011-05-19 07:12:51 +00:00
|
|
|
|
|
|
|
$infosStatut['mode'] = $acteS['mode'];
|
|
|
|
$infosStatut['lib'] = $acteS['type_lib'];
|
|
|
|
$infosStatut['ref'] = $acteS['ref'];
|
|
|
|
$infosStatut['href'] = $href;
|
|
|
|
$infosStatut['title'] = $title;
|
|
|
|
$infosStatut['decision'] = 'Le dernier statut à jour';
|
|
|
|
|
|
|
|
$infosActes[] = $infosStatut;
|
2011-05-11 13:38:14 +00:00
|
|
|
//Suppression du dernier statut à jour
|
|
|
|
unset($items[0]);
|
|
|
|
}
|
|
|
|
//Fin traitement dernier statut à jour
|
|
|
|
|
|
|
|
//Traitement des actes normaux
|
|
|
|
foreach($items as $key => $depot)
|
|
|
|
{
|
|
|
|
$infosActe = array();
|
|
|
|
//Parcours standard des actes pour affichage
|
|
|
|
foreach($depot['actes'] as $num => $acte)
|
|
|
|
{
|
|
|
|
$infosActe['date'] = $acte['date_acte'];
|
|
|
|
$infosActe['mode'] = $acte['mode'];
|
|
|
|
$infosActe['lib'] = $acte['type_lib'];
|
|
|
|
$infosActe['ref'] = $acte['ref'];
|
|
|
|
|
|
|
|
$infos = array(
|
|
|
|
'num_acte' => $acte['num_acte'],
|
|
|
|
'date_acte' => $acte['date_acte'],
|
|
|
|
'type' => $acte['type'],
|
|
|
|
'type_lib' => $acte['type_lib'],
|
|
|
|
'decision' => $acte['decision']
|
|
|
|
);
|
|
|
|
|
|
|
|
switch($acte['mode'])
|
|
|
|
{
|
|
|
|
case 'fichier':
|
|
|
|
if ( $user->checkPerm('actes') ) {
|
|
|
|
$href = $this->view->url(array(
|
|
|
|
'controller' => 'pieces',
|
|
|
|
'action' => 'acte',
|
|
|
|
'mode' => 'fichier',
|
|
|
|
'siret' => $siren,
|
|
|
|
'ref' => $acte['ref'],
|
|
|
|
));
|
|
|
|
$title = 'Télécharger le document correspondant';
|
|
|
|
} else {
|
|
|
|
$href = '#';
|
|
|
|
$title = 'Vous n\'avez pas les droits nécessaires pour commander le document correspondant.';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'T':
|
|
|
|
if ( $user->checkPerm('actes') ) {
|
|
|
|
$href = $this->view->url(array(
|
|
|
|
'controller' => 'pieces',
|
|
|
|
'action' => 'acte',
|
|
|
|
'mode' => 'T',
|
|
|
|
'siret' => $siren,
|
|
|
|
'ref' => $acte['ref'],
|
|
|
|
));
|
|
|
|
$title = 'Télécharger le document correspondant';
|
|
|
|
} else {
|
|
|
|
$href = '#';
|
|
|
|
$title = 'Vous n\'avez pas les droits nécessaires pour commander le document correspondant.';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'C':
|
|
|
|
if ( $user->checkPerm('actes') ) {
|
|
|
|
$href = $this->view->url(array(
|
|
|
|
'controller' => 'pieces',
|
|
|
|
'action' => 'acte',
|
|
|
|
'mode' => 'C',
|
|
|
|
'siret' => $siren,
|
|
|
|
'ref' => $acte['ref'],
|
2011-05-17 07:35:54 +00:00
|
|
|
'info' => urlencode(serialize($infos))
|
2011-05-11 13:38:14 +00:00
|
|
|
));
|
|
|
|
$title = 'Recevoir le document directement par mail (sous 3/5 jours ouvrés)';
|
|
|
|
} else {
|
|
|
|
$href = '#';
|
|
|
|
$title = 'Vous n\'avez pas les droits nécessaires pour commander le document correspondant.';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'courrier':
|
|
|
|
if ( $user->checkPerm('actes') ) {
|
|
|
|
$href = $this->view->url(array(
|
|
|
|
'controller' => 'pieces',
|
|
|
|
'action' => 'acte',
|
|
|
|
'mode' => 'courrier',
|
|
|
|
'siret' => $siren,
|
|
|
|
'ref' => $acte['ref'],
|
2011-05-17 07:35:54 +00:00
|
|
|
'info' => urlencode(serialize($infos))
|
2011-05-11 13:38:14 +00:00
|
|
|
));
|
|
|
|
$title = 'Recevoir le document directement par mail (sous 15 jours ouvrés)';
|
|
|
|
} else {
|
|
|
|
$href = '#';
|
|
|
|
$title = 'Vous n\'avez pas les droits nécessaires pour commander le document correspondant.';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$infosActe['href'] = $href;
|
|
|
|
$infosActe['title'] = $title;
|
|
|
|
|
|
|
|
$infosActe['decision'] = '';
|
|
|
|
if($depot['num_depot']>=0)
|
|
|
|
{
|
|
|
|
$data = '';
|
|
|
|
if(!empty($acte['decision']))
|
|
|
|
{
|
|
|
|
$data.= $acte['decision'].'<br/>';
|
|
|
|
}
|
|
|
|
$data.= 'Dépot n°'.$depot['num_depot'].' du '.$depot['date_depot'];
|
|
|
|
if($acte['nbpages_acte']>1) {
|
|
|
|
$data.= ', '.$acte['nbpages_acte'].' pages';
|
|
|
|
} elseif($acte['nbpages_acte']==1) {
|
|
|
|
$data.= ', '.$acte['nbpages_acte'].' page';
|
|
|
|
}
|
|
|
|
$infosActe['decision'] = $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
$infosActes[] = $infosActe;
|
|
|
|
} // Fin acte
|
|
|
|
} // Fin depot
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-05-17 12:23:42 +00:00
|
|
|
$this->view->assign('ModeEdition', $user->checkModeEdition());
|
2011-05-11 13:38:14 +00:00
|
|
|
$this->view->assign('InfosActes', $infosActes);
|
|
|
|
$this->view->assign('siren', $siren);
|
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
$this->view->assign('raisonSociale', $this->entrep->getRaisonSociale());
|
2011-04-19 07:37:39 +00:00
|
|
|
}
|
|
|
|
|
2011-05-11 13:38:14 +00:00
|
|
|
public function bilansAction()
|
|
|
|
{
|
|
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/pieces.css', 'all');
|
|
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/pieces.js', 'text/javascript');
|
|
|
|
|
|
|
|
//Catégorie Juridique
|
|
|
|
$cj = $this->entrep->getFormeJuridique();
|
|
|
|
if( in_array($cj, $this->association_cj) ) {
|
|
|
|
$this->_forward($action);
|
|
|
|
}
|
|
|
|
|
|
|
|
$user = new Utilisateur();
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
|
|
|
|
$siren = substr($this->siret,0,9);
|
|
|
|
$vecteur = 'XL';
|
|
|
|
$ref = '';
|
|
|
|
|
|
|
|
//Affichage des bilans disponible
|
|
|
|
$infogreffe = new Infogreffe();
|
|
|
|
$reponse = $infogreffe->getGreffeBilans($siren, $vecteur, $ref);
|
|
|
|
//Gestion des erreurs dans la réponse
|
|
|
|
|
|
|
|
/*
|
|
|
|
echo '<pre>';
|
|
|
|
print_r($reponse);
|
|
|
|
echo '</pre>';
|
|
|
|
exit;
|
|
|
|
*/
|
|
|
|
|
|
|
|
$infosBilans = array();
|
|
|
|
|
|
|
|
if (count($reponse['result'])>0) {
|
|
|
|
|
|
|
|
$items = $reponse['result'];
|
|
|
|
foreach($items as $key => $item)
|
|
|
|
{
|
|
|
|
$infosBilan = array();
|
|
|
|
$infosBilan['date'] = $item['date_cloture'];
|
|
|
|
$infosBilan['type'] = 'Comptes millésime '.$item['millesime'];
|
|
|
|
$infosBilan['mode'] = $item['mode'];
|
|
|
|
$infos = array(
|
|
|
|
'date_cloture' => $item['date_cloture'],
|
|
|
|
'type' => $item['millesime'],
|
|
|
|
'decision' => $item['num_depot']
|
|
|
|
);
|
|
|
|
switch($item['mode'])
|
|
|
|
{
|
|
|
|
case 'fichier';
|
|
|
|
if ( $user->checkPerm('actes') ) {
|
|
|
|
$href = $this->view->url(array(
|
|
|
|
'controller' => 'pieces',
|
|
|
|
'action' => 'bilan',
|
|
|
|
'siret' => $siren,
|
|
|
|
'ref' => $item['ref'],
|
|
|
|
'mode' => 'fichier',
|
2011-05-17 12:23:42 +00:00
|
|
|
'info' => urlencode(serialize($infos)),
|
2011-05-11 13:38:14 +00:00
|
|
|
));
|
|
|
|
$title = 'Télécharger le document correspondant';
|
|
|
|
} else {
|
|
|
|
$href = '#';
|
|
|
|
$title = 'Vous n\'avez pas les droits nécessaires pour commander le document correspondant.';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'T':
|
|
|
|
if ( $user->checkPerm('actes') ) {
|
|
|
|
$href = $this->view->url(array(
|
|
|
|
'controller' => 'pieces',
|
|
|
|
'action' => 'bilan',
|
|
|
|
'siret' => $siren,
|
|
|
|
'ref' => $item['ref'],
|
|
|
|
'mode' => 'T',
|
|
|
|
));
|
|
|
|
$title = 'Télécharger le document correspondant';
|
|
|
|
} else {
|
|
|
|
$href = '#';
|
|
|
|
$title = 'Vous n\'avez pas les droits nécessaires pour commander le document correspondant.';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'C':
|
|
|
|
if ( $user->checkPerm('actes') ) {
|
|
|
|
$href = $this->view->url(array(
|
|
|
|
'controller' => 'pieces',
|
|
|
|
'action' => 'bilan',
|
|
|
|
'siret' => $siren,
|
|
|
|
'ref' => $item['ref'],
|
|
|
|
'mode' => 'C',
|
2011-05-17 07:35:54 +00:00
|
|
|
'info' => urlencode(serialize($infos)),
|
2011-05-11 13:38:14 +00:00
|
|
|
));
|
|
|
|
$title = 'Recevoir le document directement par mail (sous 3/5 jours ouvrés)';
|
|
|
|
} else {
|
|
|
|
$href = '#';
|
|
|
|
$title = 'Vous n\'avez pas les droits nécessaires pour commander le document correspondant.';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'courrier':
|
|
|
|
if ( $user->checkPerm('actes') ) {
|
|
|
|
$href = $this->view->url(array(
|
|
|
|
'controller' => 'pieces',
|
|
|
|
'action' => 'bilan',
|
|
|
|
'siret' => $siren,
|
|
|
|
'ref' => $item['ref'],
|
|
|
|
'mode' => 'courrier',
|
2011-05-17 07:35:54 +00:00
|
|
|
'info' => urlencode(serialize($infos)),
|
2011-05-11 13:38:14 +00:00
|
|
|
));
|
|
|
|
$title = 'Recevoir le document directement par mail (sous 15 jours ouvrés)';
|
|
|
|
} else {
|
|
|
|
$href = '#';
|
|
|
|
$title = 'Vous n\'avez pas les droits nécessaires pour commander le document correspondant.';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$infosBilan['href'] = $href;
|
|
|
|
$infosBilan['title'] = $title;
|
|
|
|
|
|
|
|
$infosBilan['decision'] = 'Dépot n°'.$item['num_depot'];
|
|
|
|
|
|
|
|
$infosBilans[] = $infosBilan;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-17 12:23:42 +00:00
|
|
|
$this->view->assign('ModeEdition', $user->checkModeEdition());
|
2011-05-11 13:38:14 +00:00
|
|
|
$this->view->assign('InfosBilans', $infosBilans);
|
|
|
|
$this->view->assign('siren', $siren);
|
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
$this->view->assign('raisonSociale', $this->entrep->getRaisonSociale());
|
|
|
|
}
|
|
|
|
|
2011-05-17 07:35:54 +00:00
|
|
|
public function cmdcourrierAction()
|
|
|
|
{
|
|
|
|
//Désactivation affichage
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$dejaCommande = $request->getParam('dejaCommande', false);
|
|
|
|
$noemail = $request->getParam('noemail', false);
|
|
|
|
$sameLogin = $request->getParam('sameLogin', false);
|
|
|
|
|
|
|
|
Zend_Registry::get('firebug')->info('cmdcourrier');
|
|
|
|
|
|
|
|
if(!$dejaCommande || ($dejaCommande && $noemail) )
|
|
|
|
{
|
|
|
|
$user = new Utilisateur();
|
|
|
|
|
|
|
|
$siren = $request->getParam('siret', 0);
|
|
|
|
$info = $request->getParam('info', 0);
|
|
|
|
$typeCommande = $request->getParam('typeCommande', '');
|
|
|
|
$ref = $request->getParam('ref', '');
|
|
|
|
$vue = $request->getParam('vue', '');
|
|
|
|
|
|
|
|
$this->view->assign('siren', $siren);
|
|
|
|
$this->view->assign('info', $info);
|
|
|
|
$this->view->assign('typeCommande', $typeCommande);
|
|
|
|
$this->view->assign('ref', $ref);
|
|
|
|
$this->view->assign('vue', $vue);
|
|
|
|
$this->view->assign('email', $user->getEmail());
|
|
|
|
$this->renderScript('pieces/cmdcourrier.phtml');
|
|
|
|
}
|
|
|
|
elseif(!$noemail && $dejaCommande && $sameLogin)
|
|
|
|
{
|
|
|
|
//typeCommande
|
|
|
|
//idCommande
|
|
|
|
$this->renderScript('pieces/cmdcourrier-cmd1.phtml');
|
|
|
|
}
|
|
|
|
elseif(!$noemail && $dejaCommande && !$sameLogin)
|
|
|
|
{
|
|
|
|
$this->renderScript('pieces/cmdcourrier-cmd2.phtml');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sauvcmdAction()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-05-11 13:38:14 +00:00
|
|
|
public function statutsAction(){}
|
|
|
|
|
|
|
|
public function bilanAction()
|
|
|
|
{
|
2011-05-17 07:35:54 +00:00
|
|
|
//Désactivation affichage
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
2011-05-11 13:38:14 +00:00
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$vecteur = $request->getParam('mode');
|
|
|
|
$info = $request->getParam('info');
|
|
|
|
$ref = $request->getParam('ref');
|
|
|
|
$siren = substr($this->siret,0,9);
|
|
|
|
|
|
|
|
switch($vecteur) {
|
|
|
|
|
2011-05-17 07:35:54 +00:00
|
|
|
case 'C':
|
|
|
|
$dejaCommande = false;
|
|
|
|
$noemail = false;
|
|
|
|
$sameLogin = false;
|
|
|
|
$idCommande = 0;
|
|
|
|
|
|
|
|
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH.'/configs/databases.ini');
|
|
|
|
$db = Zend_Db::factory($dbConfig->db->sdv1);
|
|
|
|
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
|
|
|
$commandes = new Application_Model_Commandes();
|
|
|
|
$rowset = $commandes->select('idCommande, login, emailCommande, dateCommande')
|
|
|
|
->where("siren=$siren AND refDocument='$ref' AND statutCommande!=9");
|
|
|
|
$rows = $commandes->fetchAll($rowset);
|
|
|
|
|
|
|
|
if (count($rows)!=0) {
|
|
|
|
$user = new Utilisateur();
|
|
|
|
|
|
|
|
$dejaCommande = true;
|
|
|
|
if ($rows[0]['login']==$user->getLogin())
|
|
|
|
{
|
|
|
|
$dateCommande = WDate::dateT('Y-m-d','d/m/Y',$rows[0]['dateCommande']);
|
|
|
|
$idCommande = $rows[0]['idCommande'];
|
|
|
|
if(empty($rows[0]['emailCommande'])) $noemail = true;
|
|
|
|
$sameLogin = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$params = array(
|
|
|
|
'idCommande' => $idCommande,
|
|
|
|
'dejaCommande' => $dejaCommande,
|
|
|
|
'noemail' => $noemail,
|
|
|
|
'sameLogin' => $sameLogin,
|
|
|
|
'siren' => $siren,
|
|
|
|
'info' => $info,
|
|
|
|
'vue' => 'bilans',
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->_forward('cmdcourrier', 'pieces', null, $params);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'courrier':
|
|
|
|
|
|
|
|
$dejaCommande = false;
|
|
|
|
$noemail = false;
|
|
|
|
$sameLogin = false;
|
|
|
|
$idCommande = 0;
|
|
|
|
//Vérification des commandes
|
|
|
|
if (preg_match('/^([0-9]{4})[_sociaux-|_-]/', $ref, $matches))
|
|
|
|
{
|
|
|
|
$searchRef = '^'.$matches[1].'[_-|_sociaux-]';
|
|
|
|
}
|
|
|
|
elseif (preg_match('/^([0-9]{4})_consolide-/', $ref, $matches))
|
|
|
|
{
|
|
|
|
$searchRef = '^'.$matches[1].'_consolide-';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$searchRef = $ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH.'/configs/databases.ini');
|
|
|
|
$db = Zend_Db::factory($dbConfig->db->sdv1);
|
|
|
|
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
|
|
|
$commandes = new Application_Model_Commandes();
|
|
|
|
$rowset = $commandes->select('idCommande, login, emailCommande, dateCommande')
|
|
|
|
->where("siren=$siren AND refDocument='$searchRef'");
|
|
|
|
$rows = $commandes->fetchAll($rowset);
|
|
|
|
|
|
|
|
if (count($rows)!=0) {
|
|
|
|
$user = new Utilisateur();
|
|
|
|
|
|
|
|
$dejaCommande = true;
|
|
|
|
if ($rows[0]['login']==$user->getLogin())
|
|
|
|
{
|
|
|
|
$dateCommande = WDate::dateT('Y-m-d','d/m/Y',$rows[0]['dateCommande']);
|
|
|
|
$idCommande = $rows[0]['idCommande'];
|
|
|
|
if(empty($rows[0]['emailCommande'])) $noemail = true;
|
|
|
|
$sameLogin = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$params = array(
|
|
|
|
'idCommande' => $idCommande,
|
|
|
|
'dejaCommande' => $dejaCommande,
|
|
|
|
'noemail' => $noemail,
|
|
|
|
'sameLogin' => $sameLogin,
|
|
|
|
'siren' => $siren,
|
|
|
|
'info' => $info,
|
|
|
|
'vue' => 'bilans',
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->_forward('cmdcourrier', 'pieces', null, $params);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2011-05-11 13:38:14 +00:00
|
|
|
case 'fichier':
|
|
|
|
//$client->setLog('greffe_bilans', $siren, 0, $ref);
|
|
|
|
$info = unserialize($info);
|
2011-05-17 12:23:42 +00:00
|
|
|
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
|
|
|
|
$pathData = realpath($config->data);
|
|
|
|
|
|
|
|
if(file_exists($pathData.'/pdf/bilan-'.$siren.'-'.$ref.'.pdf')){
|
2011-05-11 13:38:14 +00:00
|
|
|
$suffixe = 'bilan';
|
2011-05-17 12:23:42 +00:00
|
|
|
}elseif(file_exists($pathData.'/pdf/acte-'.$siren.'-'.$ref.'.pdf')){
|
2011-05-11 13:38:14 +00:00
|
|
|
$suffixe = 'acte';
|
|
|
|
}
|
|
|
|
$href = '/fichier/pdf/'.$suffixe.'-'.$siren.'-'.$ref.'.pdf';
|
|
|
|
echo '<br/><a href="'.$href.'" target="_blank">Ouvrir le bilan millésime '.$info['type'].'</a>';
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'T':
|
|
|
|
$infogreffe = new Infogreffe();
|
|
|
|
$reponse = $infogreffe->getGreffeBilans($siren, $vecteur, $ref);
|
|
|
|
|
|
|
|
if(empty($reponse['error'])) {
|
|
|
|
$items = $reponse['result']['bilan'];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$error = $reponse['error']['errNum'].' - '.$reponse['error']['errMsg'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($error!='') {
|
|
|
|
//$client->setLog('greffe_bilans', $siren, 0, 'Erreur '.$reponse['error']['errNum']);
|
|
|
|
echo '<br/>Erreur : '.$error;
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$info = unserialize(urldecode($info));
|
|
|
|
foreach($items as $item) {
|
|
|
|
if($item['url_acces']!==false) {
|
|
|
|
//$client->setLog('greffe_bilan', $siren, 0, $ref);
|
|
|
|
$href = '/fichier/pdf/'.$item['url_acces'];
|
|
|
|
echo '<br/><a href="'.$href.'" target="_blank">Ouvrir le bilan millésime '.$item['millesime'].'</a>';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//$client->setLog('greffe_bilans', $siren, 0, 'Erreur telechargement '.$ref);
|
|
|
|
echo '<br/>Impossible de télécharger le fichier auprès de notre partenaire.';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function acteAction()
|
|
|
|
{
|
2011-05-17 07:35:54 +00:00
|
|
|
//Désactivation affichage
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
|
2011-05-11 13:38:14 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$vecteur = $request->getParam('mode');
|
|
|
|
$info = $request->getParam('info');
|
|
|
|
$ref = $request->getParam('ref');
|
|
|
|
$siren = substr($this->siret,0,9);
|
|
|
|
|
|
|
|
switch($vecteur) {
|
|
|
|
|
2011-05-17 07:35:54 +00:00
|
|
|
case 'C':
|
|
|
|
$dejaCommande = false;
|
|
|
|
$noemail = false;
|
|
|
|
$sameLogin = false;
|
|
|
|
$idCommande = 0;
|
|
|
|
|
|
|
|
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH.'/configs/databases.ini');
|
|
|
|
$db = Zend_Db::factory($dbConfig->db->sdv1);
|
|
|
|
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
|
|
|
$commandes = new Application_Model_Commandes();
|
|
|
|
$rowset = $commandes->select('idCommande, login, emailCommande, dateCommande')
|
|
|
|
->where("siren=$siren AND refDocument='$ref' AND statutCommande!=9");
|
|
|
|
$rows = $commandes->fetchAll($rowset);
|
|
|
|
|
|
|
|
if (count($rows)!=0) {
|
|
|
|
$user = new Utilisateur();
|
|
|
|
|
|
|
|
$dejaCommande = true;
|
|
|
|
if ($rows[0]['login']==$user->getLogin())
|
|
|
|
{
|
|
|
|
$dateCommande = WDate::dateT('Y-m-d','d/m/Y',$rows[0]['dateCommande']);
|
|
|
|
$idCommande = $rows[0]['idCommande'];
|
|
|
|
if(empty($rows[0]['emailCommande'])) $noemail = true;
|
|
|
|
$sameLogin = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$params = array(
|
|
|
|
'idCommande' => $idCommande,
|
|
|
|
'dejaCommande' => $dejaCommande,
|
|
|
|
'noemail' => $noemail,
|
|
|
|
'sameLogin' => $sameLogin,
|
|
|
|
'siren' => $siren,
|
|
|
|
'info' => $info,
|
|
|
|
'vue' => 'actes',
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->_forward('cmdcourrier', 'pieces', null, $params);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'courrier':
|
|
|
|
|
|
|
|
$dejaCommande = false;
|
|
|
|
$noemail = false;
|
|
|
|
$sameLogin = false;
|
|
|
|
$idCommande = 0;
|
|
|
|
//Vérification des commandes
|
|
|
|
if (preg_match('/^([0-9]{4})[_sociaux-|_-]/', $ref, $matches))
|
|
|
|
{
|
|
|
|
$searchRef = '^'.$matches[1].'[_-|_sociaux-]';
|
|
|
|
}
|
|
|
|
elseif (preg_match('/^([0-9]{4})_consolide-/', $ref, $matches))
|
|
|
|
{
|
|
|
|
$searchRef = '^'.$matches[1].'_consolide-';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$searchRef = $ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH.'/configs/databases.ini');
|
|
|
|
$db = Zend_Db::factory($dbConfig->db->sdv1);
|
|
|
|
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
|
|
|
$commandes = new Application_Model_Commandes();
|
|
|
|
$rowset = $commandes->select('idCommande, login, emailCommande, dateCommande')
|
|
|
|
->where("siren=$siren AND refDocument='$searchRef'");
|
|
|
|
$rows = $commandes->fetchAll($rowset);
|
|
|
|
|
|
|
|
if (count($rows)!=0) {
|
|
|
|
$user = new Utilisateur();
|
|
|
|
|
|
|
|
$dejaCommande = true;
|
|
|
|
if ($rows[0]['login']==$user->getLogin())
|
|
|
|
{
|
|
|
|
$dateCommande = WDate::dateT('Y-m-d','d/m/Y',$rows[0]['dateCommande']);
|
|
|
|
$idCommande = $rows[0]['idCommande'];
|
|
|
|
if(empty($rows[0]['emailCommande'])) $noemail = true;
|
|
|
|
$sameLogin = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$params = array(
|
|
|
|
'idCommande' => $idCommande,
|
|
|
|
'dejaCommande' => $dejaCommande,
|
|
|
|
'noemail' => $noemail,
|
|
|
|
'sameLogin' => $sameLogin,
|
|
|
|
'siren' => $siren,
|
|
|
|
'info' => $info,
|
|
|
|
'vue' => 'actes',
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->_forward('cmdcourrier', 'pieces', null, $params);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2011-05-11 13:38:14 +00:00
|
|
|
case 'fichier':
|
|
|
|
//$client->setLog('greffe_actes', $siren, 0, $ref);
|
|
|
|
$info = unserialize(urldecode($info));
|
|
|
|
$href = '/fichier/pdf/acte-'.$siren.'-'.$ref.'.pdf';
|
|
|
|
echo '<br/><a href="'.$href.'" target="_blank">Ouvrir le fichier '.$info['type_lib'].' </a>';
|
|
|
|
exit;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'T':
|
|
|
|
|
|
|
|
$infogreffe = new Infogreffe();
|
|
|
|
$reponse = $infogreffe->getGreffeActes($siren, $vecteur, $ref);
|
|
|
|
|
|
|
|
if (empty($reponse['error'])) {
|
|
|
|
$items = $reponse['result']['actes'];
|
|
|
|
} else {
|
|
|
|
$error = $reponse['error']['errNum'].' - '.$reponse['error']['errMsg'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($error!='') {
|
|
|
|
//$client->setLog('greffe_acte', $siren, 0, 'Erreur '.$reponse['error']['errNum']);
|
|
|
|
echo '<br/>Erreur : '.$error;
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach($items as $item) {
|
|
|
|
if($item['num_acte']==$info['num_acte']) {
|
|
|
|
if($item['url_acces']!==false) {
|
|
|
|
//$client->setLog('greffe_actes', $siren, 0, $ref);
|
|
|
|
$href = '/fichier/pdf/'.$item['url_acces'];
|
|
|
|
echo '<br/><a href="'.$href.'" target="_blank">Ouvrir le fichier '.$item['type_acte_libelle'].' </a>';
|
|
|
|
exit;
|
|
|
|
} else {
|
|
|
|
//$client->setLog('greffe_actes', $siren, 0, 'Erreur telechargement '.$ref);
|
|
|
|
echo '<br/>Impossible de télécharger le fichier '.$item['type_acte_libelle'].' auprès de notre partenaire.';
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Commande de pièces, kbis, privileges, nantissements
|
|
|
|
*/
|
2011-05-05 12:04:47 +00:00
|
|
|
public function commandeAction()
|
|
|
|
{
|
2011-05-11 13:38:14 +00:00
|
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/pieces.css', 'all');
|
|
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/pieces.js', 'text/javascript');
|
2011-05-05 12:04:47 +00:00
|
|
|
|
|
|
|
$siren = substr($this->siret, 0, 9);
|
|
|
|
|
|
|
|
$session = new SessionEntreprise($this->siret, $this->id);
|
|
|
|
|
|
|
|
$user = new Utilisateur();
|
|
|
|
$permKbis = false;
|
2011-05-24 15:42:43 +00:00
|
|
|
$kbisErrCJ = false;
|
|
|
|
$kbisErrDEP = false;
|
2011-05-05 12:04:47 +00:00
|
|
|
if ($user->checkPerm('kbis')){
|
|
|
|
$permKbis = true;
|
2011-05-24 15:42:43 +00:00
|
|
|
|
|
|
|
//Vérification que le kbis est disponible
|
|
|
|
//=> FormeJuridique
|
|
|
|
if (($session->getFormeJuridique()>=91 && $session->getFormeJuridique()<=93)
|
|
|
|
|| ($session->getFormeJuridique()>=9110 && $session->getFormeJuridique()<=9300) ) {
|
|
|
|
$kbisErrCJ = true;
|
|
|
|
}
|
|
|
|
//=> Département
|
|
|
|
$dep = substr($session->getCodeCommune(),0,2);
|
|
|
|
if ( in_array($dep, array('00','57','67','68','97','98')) ) {
|
|
|
|
$kbisErrDEP = true;
|
|
|
|
}
|
2011-05-05 12:04:47 +00:00
|
|
|
}
|
|
|
|
$permPriv = false;
|
|
|
|
if ($user->checkPerm('privileges')){
|
|
|
|
$permPriv = true;
|
|
|
|
}
|
|
|
|
$permSurvPriv = false;
|
|
|
|
if ($user->checkPerm('survpriv')){
|
|
|
|
$permSurvPriv = true;
|
|
|
|
}
|
2011-05-24 15:42:43 +00:00
|
|
|
$this->view->assign('KbisErreurCJ', $kbisErrCJ);
|
|
|
|
$this->view->assign('KbisErreurDEP', $kbisErrDEP);
|
|
|
|
$this->view->assign('permKbis', $permKbis);
|
2011-05-05 12:04:47 +00:00
|
|
|
$this->view->assign('permKbis', $permKbis);
|
|
|
|
$this->view->assign('permPriv', $permPriv);
|
|
|
|
$this->view->assign('permSurvPriv', $permSurvPriv);
|
|
|
|
|
2011-05-24 15:42:43 +00:00
|
|
|
$this->view->assign('user', $user);
|
|
|
|
|
2011-05-05 12:04:47 +00:00
|
|
|
$this->view->assign('siren', $siren);
|
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
|
|
|
|
|
|
|
}
|
2011-05-24 15:42:43 +00:00
|
|
|
|
|
|
|
public function kbispasserelleAction(){}
|
|
|
|
|
|
|
|
public function kbisinfogreffeAction(){}
|
|
|
|
|
2011-05-11 13:38:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Affiche les privilèges en surveillance
|
|
|
|
*/
|
2011-05-05 12:04:47 +00:00
|
|
|
public function privilegesAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$type = $request->getParam('type', null);
|
|
|
|
$siren = substr($this->siret, 0, 9);
|
|
|
|
$detail = false;
|
|
|
|
if (!empty($type)){
|
|
|
|
$detail = true;
|
|
|
|
}
|
|
|
|
$session = new SessionEntreprise($this->siret, $this->id);
|
|
|
|
$ws = new WsScores();
|
|
|
|
if ($detail){
|
|
|
|
$infos = $ws->getPrivilegesDetail($siren, array($type));
|
|
|
|
} else {
|
|
|
|
$infos = $ws->getPrivilegesCumul($siren);
|
|
|
|
}
|
|
|
|
$privileges = $infos->result->item;
|
|
|
|
$this->view->assign('privileges', $privileges);
|
|
|
|
$this->view->assign('siren', $siren);
|
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-19 07:37:39 +00:00
|
|
|
}
|