Statut associations

This commit is contained in:
Michael RICOIS 2015-07-21 09:31:36 +00:00
parent 58becead4b
commit 03c6a7f37f
4 changed files with 102 additions and 5 deletions

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_JoAssoStatut extends Zend_Db_Table_Abstract
{
protected $_name = 'asso_statut';
protected $_schema = 'jo';
}

View File

@ -3,5 +3,6 @@ return array(
'Bilans' => 'Bilans',
'Bilan' => 'Bilan',
'Actes' => 'Actes',
'Acte' => 'Acte',
);
'Acte' => 'Acte',
'AssoActe' => 'AssoActe',
);

View File

@ -554,9 +554,6 @@ class Pieces extends Scores_Ws_Server
}
}
}
//@todo : Marquer les éléments en commande courrier si déjà commandé ModeDiffusion = O
}
$this->wsLog('greffe_actes', $identifiant, 'Liste');
@ -885,6 +882,82 @@ class Pieces extends Scores_Ws_Server
return false;
}
/**
* Statut association - Liste
* @param string $companyId
* @param string $type
* @return AssoActe[]
*/
public function getAssoActes($companyId, $type = null)
{
$this->authenticate();
// --- Lecture de la table des actes associations
$statutM = new Application_Model_JoAssoStatut();
$statutSql = $statutM->select()->where('companyId=?', $companyId);
$statutResult = $statutM->fetchAll($sql);
$output = array();
if (count($statutResult) > 0) {
foreach ($statutResult as $item) {
$statut = new AssoActe();
$statut->Date = $item->statutDate;
$statut->File = $item->statutFile;
$statut->DateInsert = $item->dateInsert;
$output[] = $statut;
}
}
return $output;
}
/**
* Statut association - Fichier
* @param string $companyId
* Identifiant, siren de l'entreprise
* @param string $type
* @param string $date
* Date au format AAAAMMJJ
* @throws SoapFault
* @return string
* URL ou identifiant de commande
*/
public function getAssoActe($companyId, $type = null, $date)
{
$this->authenticate();
$this->permission('actes');
// --- Lecture table des actes associations
$statutM = new Application_Model_JoAssoStatut();
$statutSql = $statutM->select()
->where('companyId=?', $companyId)
->where('satutDate=?', $date);
$statutResult = $statutM->fetchRow($sql);
if ($statutResult === null) {
return false;
}
// --- Distribuer le fichier
if ( !empty($statutResult->statutFile) ) {
$c = Zend_Registry::get('config');
$file = $c->profil->path->secure.'/association/actes/' . $statutResult->statutFile;
$dest = $c->profil->path->files . '/' . basename($file);
if ( file_exists($file) && copy($file, $dest)) {
$hostname = 'http://'.$_SERVER['SERVER_NAME'];
if ( $_SERVER['SERVER_PORT'] != '80' ) {
$hostname.= ':'.$_SERVER['SERVER_PORT'];
}
$output = $hostname . '/fichier/greffes/' . basename($dest);
$this->wsLog('assoacte', $companyId, basename($dest));
return $output;
} else {
throw new SoapFault('ERR', 'Fichier introuvable.');
}
}
return false;
}
/**
* Commande de statut association
* @param string $companyId

View File

@ -162,3 +162,20 @@ class Acte
public $infos;
}
class AssoActe
{
/**
* @var string
*/
public $Date;
/**
* @var string
*/
public $File;
/**
* @var string
*/
public $DateInsert;
}