2010-10-18 13:51:58 +00:00
|
|
|
<?php
|
2010-10-20 13:32:33 +00:00
|
|
|
require_once realpath(dirname(__FILE__)).'/Types/InterneTypes.php';
|
|
|
|
|
2010-10-18 13:51:58 +00:00
|
|
|
class WsInterne
|
|
|
|
{
|
2010-10-25 07:33:43 +00:00
|
|
|
|
|
|
|
protected $dbConfig;
|
|
|
|
|
|
|
|
function __construct()
|
|
|
|
{
|
|
|
|
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH .
|
|
|
|
'/configs/databases.ini', APPLICATION_ENV);
|
|
|
|
$this->dbConfig = $dbConfig->db;
|
|
|
|
}
|
|
|
|
|
2010-10-18 13:51:58 +00:00
|
|
|
/**
|
|
|
|
* Enregistrement des informations saisie manuellement
|
|
|
|
* @param string $siret
|
|
|
|
* @param int $idEntreprise
|
|
|
|
* @param array $tabInfos
|
|
|
|
*/
|
|
|
|
public function setInfosEntrep( $siret, $idEntreprise, $tabInfos )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2010-10-20 13:32:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Commande de bilan
|
|
|
|
* @param InfoCommandeBilan $infoCommande
|
|
|
|
* @param InfoDemandeur $infoDemandeur
|
|
|
|
* @return SetCommandeReturnType
|
|
|
|
*/
|
|
|
|
public function setCommandeBilan( $infoCommande, $infoDemandeur )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-10-25 07:33:43 +00:00
|
|
|
/**
|
|
|
|
* Renvoi des informations sur une commande de bilan
|
|
|
|
* @param string $reference
|
|
|
|
* @return CommandeReturnType
|
|
|
|
*/
|
|
|
|
public function getCommandeBilan( $reference )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-10-20 13:32:33 +00:00
|
|
|
/**
|
|
|
|
* Commande d'acte
|
|
|
|
* @param InfoCommandeActe $infoCommande
|
|
|
|
* @param InfoDemandeur $infoDemandeur
|
|
|
|
* @return SetCommandeReturnType
|
|
|
|
*/
|
|
|
|
public function setCommandeActe( $infoCommande, $infoDemandeur )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-10-25 07:33:43 +00:00
|
|
|
/**
|
|
|
|
* Renvoi des informations sur une commande d'acte
|
|
|
|
* @param string $reference
|
|
|
|
* @return CommandeReturnType
|
|
|
|
*/
|
|
|
|
public function getCommandeActe( $reference ){}
|
|
|
|
|
2010-10-20 13:32:33 +00:00
|
|
|
/**
|
|
|
|
* Commande de kbis
|
|
|
|
* @param InfoCommandeKbis $infoCommande
|
|
|
|
* @param InfoDemandeur $infoDemandeur
|
|
|
|
* @return SetCommandeReturnType
|
|
|
|
*/
|
2010-10-25 07:33:43 +00:00
|
|
|
public function setCommandeKbis( $infoCommande, $infoDemandeur ){}
|
2010-10-20 13:32:33 +00:00
|
|
|
|
2010-10-25 07:33:43 +00:00
|
|
|
/**
|
|
|
|
* Renvoi des informations sur une commande de Kbis
|
|
|
|
* @param string $reference
|
|
|
|
* @return CommandeReturnType
|
|
|
|
*/
|
|
|
|
public function getCommandeKbis( $reference ){}
|
2010-10-20 13:32:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Commande de statut association
|
2010-10-25 07:33:43 +00:00
|
|
|
* @param InfoCommandeAsso $infoCommande
|
2010-10-20 13:32:33 +00:00
|
|
|
* @param InfoDemandeur $infoDemandeur
|
|
|
|
* @return SetCommandeReturnType
|
|
|
|
*/
|
2010-10-25 07:33:43 +00:00
|
|
|
public function setCommandeAsso( $infoCommande, $infoDemandeur ){}
|
2010-10-20 13:32:33 +00:00
|
|
|
|
|
|
|
/**
|
2010-10-25 07:33:43 +00:00
|
|
|
* Renvoi des informations sur une commande association
|
2010-10-20 13:32:33 +00:00
|
|
|
* @param string $reference
|
|
|
|
* @return CommandeReturnType
|
|
|
|
*/
|
2010-10-25 07:33:43 +00:00
|
|
|
public function getCommandeAsso( $reference ){}
|
2010-10-20 13:32:33 +00:00
|
|
|
|
|
|
|
/**
|
2010-10-25 07:33:43 +00:00
|
|
|
* Commande de privilèges et nantissements par email
|
|
|
|
* @param InfoCommandePieces $infoCommande
|
|
|
|
* @param InfoDemandeur $infoDemandeur
|
2010-10-20 13:32:33 +00:00
|
|
|
* @return CommandeReturnType
|
|
|
|
*/
|
2010-10-25 07:33:43 +00:00
|
|
|
public function setCommandePieces( $infoCommande, $infoDemandeur )
|
|
|
|
{
|
|
|
|
$error = new ErrorType();
|
|
|
|
$ref = new RefCommande();
|
|
|
|
|
|
|
|
if (!empty($infoCommande->siren))
|
|
|
|
{
|
|
|
|
$login = $_SERVER['PHP_AUTH_USER'];
|
|
|
|
//Vérification SIREN
|
|
|
|
//Vérification email - Si infoDemandeur->email vide alors on prend user_email
|
|
|
|
try {
|
|
|
|
$db = Zend_Db::factory($this->dbConfig->Commandes);
|
|
|
|
} catch (Zend_Db_Adapter_Exception $e) {
|
|
|
|
Zend_Registry::get('WsLogger')->err("setCommandePieces - ".$e->getMessage());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Insertion des données commande
|
|
|
|
$dataCommandes = array(
|
|
|
|
'user_login' => $login,
|
|
|
|
'user_email' => '',
|
|
|
|
'type' => 'pieces',
|
|
|
|
'statut' => 0,
|
|
|
|
'demandeurReference' => $infoDemandeur->reference,
|
|
|
|
'demandeurEmail' => $infoDemandeur->email,
|
|
|
|
'demandeurTel' => $infoDemandeur->tel,
|
|
|
|
'demandeurNom' => $infoDemandeur->nom,
|
|
|
|
'demandeurService' => $infoDemandeur->service,
|
|
|
|
'demandeurSociete' => $infoDemandeur->societe,
|
|
|
|
'demandeurAdresse' => $infoDemandeur->adresse,
|
|
|
|
'demandeurCp' => $infoDemandeur->cp,
|
|
|
|
'demandeurVille' => $infoDemandeur->ville,
|
|
|
|
'infoCommande' => serialize($infoCommande),
|
|
|
|
'date_added' => date('Y-m-d H:i:s')
|
|
|
|
);
|
|
|
|
try {
|
|
|
|
$row = $db->insert('commandes', $dataCommandes);
|
|
|
|
} catch (Zend_Exception $e) {
|
|
|
|
Zend_Registry::get('WsLogger')->err("setCommandePieces - ".$e->getMessage());
|
|
|
|
}
|
|
|
|
if ($row > 0)
|
|
|
|
{
|
|
|
|
$commandes_id = $db->lastInsertId('commandes');
|
|
|
|
//Enregistrement des détails de commande
|
|
|
|
$dataCommandesPieces = array(
|
|
|
|
'commandes_id' => $commandes_id,
|
|
|
|
'siren' => $infoCommande->siren,
|
|
|
|
'raisonSociale' => '',
|
|
|
|
);
|
|
|
|
$db->insert('commandes_pieces', $dataCommandesPieces);
|
|
|
|
try {
|
|
|
|
$commande = $db->fetchRow("SELECT * FROM commandes WHERE id=".$commandes_id);
|
|
|
|
} catch (Zend_Exception $e) {
|
|
|
|
Zend_Registry::get('WsLogger')->err("setCommandePieces - ".$e->getMessage());
|
|
|
|
}
|
|
|
|
$ref->reference = $commande['id'];
|
|
|
|
$ref->dateCommande = $commande['date_added'];
|
|
|
|
$ref->dateMaj = $commande['date_updated'];
|
|
|
|
$ref->dateReception = $commande['date_closed'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$error->errnum = 0;
|
|
|
|
$error->errmsg = "Erreur enregistrement commande";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$error->errnum = 0;
|
|
|
|
$error->errmsg = 'Erreur SIREN invalide';
|
|
|
|
}
|
|
|
|
$output = new CommandeReturnType();
|
|
|
|
$output->error = $error;
|
|
|
|
$output->ref = $ref;
|
|
|
|
return $output;
|
|
|
|
}
|
2010-10-20 13:32:33 +00:00
|
|
|
|
|
|
|
/**
|
2010-10-25 07:33:43 +00:00
|
|
|
* Renvoi des informations sur une commande pièces
|
2010-10-20 13:32:33 +00:00
|
|
|
* @param string $reference
|
|
|
|
* @return CommandeReturnType
|
|
|
|
*/
|
2010-10-25 07:33:43 +00:00
|
|
|
public function getCommandePieces( $reference ){}
|
2010-10-20 13:32:33 +00:00
|
|
|
|
|
|
|
/**
|
2010-10-25 07:33:43 +00:00
|
|
|
* Obtenir la liste des commandes passées
|
|
|
|
* @param ListeCommandeFiltre $filtre
|
|
|
|
* @param int $position
|
|
|
|
* @param int $nbRep
|
|
|
|
* @param int $maxRep
|
|
|
|
* @return ListeCommande
|
2010-10-20 13:32:33 +00:00
|
|
|
*/
|
2010-10-25 07:33:43 +00:00
|
|
|
public function getListeCommande( $filtre, $position = 0, $nbRep = 20, $maxRep = 200 ){}
|
2010-10-20 13:32:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Liste des bilans
|
|
|
|
* @param string $siren
|
|
|
|
* @param string $waldec
|
|
|
|
* @param int $idEntreprise
|
|
|
|
* @return ListeBilan
|
|
|
|
*/
|
2010-10-25 07:33:43 +00:00
|
|
|
public function getListeBilan( $siren, $waldec = null, $idEntreprise = null ){}
|
2010-10-20 13:32:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Liste des actes
|
|
|
|
* @param string $siren
|
|
|
|
* @return ListeActe
|
|
|
|
*/
|
2010-10-25 07:33:43 +00:00
|
|
|
public function getListeActe( $siren ){}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retourne la liste des statuts de commande
|
|
|
|
* @param string $type
|
|
|
|
* @return Statut[]
|
|
|
|
*/
|
|
|
|
public function getListeStatut( $type )
|
|
|
|
{
|
|
|
|
Zend_Registry::get('WsLogger')->info("getListeStatut - ".$type);
|
|
|
|
try {
|
|
|
|
$db = Zend_Db::factory($this->dbConfig->Commandes);
|
|
|
|
require_once APPLICATION_PATH . '/models/Commandes.php';
|
|
|
|
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
|
|
|
$dbStatut = new CommandesStatut();
|
|
|
|
$result = $dbStatut->fetchAll(array("commande_type = '$type'"));
|
|
|
|
}
|
|
|
|
catch (Zend_Db_Adapter_Exception $e)
|
|
|
|
{
|
|
|
|
Zend_Registry::get('WsLogger')->err("getListeStatut - ".$e->getMessage());
|
|
|
|
}
|
|
|
|
$listeStatut = array();
|
|
|
|
if (count($result)>0)
|
|
|
|
{
|
|
|
|
foreach($result as $r)
|
|
|
|
{
|
|
|
|
$statut = new Statut();
|
|
|
|
$statut->code = $r['code'];
|
|
|
|
$statut->lib = $r['libelle'];
|
|
|
|
$listeStatut[] = $statut;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $listeStatut;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ajouter un évenement lors du traitement de la commande
|
|
|
|
* @param string $reference
|
|
|
|
* @param string $comment
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function setCommandeEven ( $reference, $comment )
|
|
|
|
{
|
|
|
|
$login = $_SERVER['PHP_AUTH_USER'];
|
|
|
|
//Vérifier que la commande existe
|
|
|
|
|
|
|
|
//Enregistrer l'information
|
|
|
|
try {
|
|
|
|
$db = Zend_Db::factory($this->dbConfig->Commandes);
|
|
|
|
require_once APPLICATION_PATH . '/models/Commandes.php';
|
|
|
|
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
|
|
|
$commandeEven = new CommandesEven();
|
|
|
|
$insert = $commandeEven->createRow();
|
|
|
|
$insert->commandes_id = (int)$reference;
|
|
|
|
$insert->commentaire = $comment;
|
|
|
|
$insert->user_login = $login;
|
|
|
|
$insert->date_added = date('Y-m-d H:i:s');
|
|
|
|
$insert->save();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
catch (Zend_Db_Adapter_Exception $e)
|
|
|
|
{
|
|
|
|
Zend_Registry::get('WsLogger')->err("getListeStatut - ".$e->getMessage());
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ajout du nom de fichier liée à la commande
|
|
|
|
* @param string $reference
|
|
|
|
* @param string $filename
|
|
|
|
*/
|
|
|
|
public function setCommandeDocument( $reference, $filename )
|
2010-10-20 13:32:33 +00:00
|
|
|
{
|
2010-10-25 07:33:43 +00:00
|
|
|
//Suivant la référence,
|
|
|
|
|
|
|
|
//On détermine le type
|
|
|
|
|
|
|
|
|
2010-10-20 13:32:33 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-10-25 07:33:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-10-18 13:51:58 +00:00
|
|
|
}
|