Merge from 2.7

This commit is contained in:
Michael RICOIS 2015-01-19 11:13:00 +00:00
commit 74cfb9db05
837 changed files with 1671352 additions and 550917 deletions

25
ACL Normal file
View File

@ -0,0 +1,25 @@
ROLE
SuperAdministrateur => Aucune restriction
Opérateur => Voir ressource + edition
Administrateur => Voir ressource + administration
Utilisateur => Voir ressource
Ressource - Permission
Liste des permissions
Créer son propre ACL à la connexion définition role et permissions
Scores_Acl
Créer un plugin à charger après l'authentification pour l'association dynamique des Roles et ACLs

40
TODELETE Normal file
View File

@ -0,0 +1,40 @@
table => actes_files
library\Application\Model\ActesFiles.php
table commandes
table commandes_erreur
table commandes_kbis
table commandes_pieces
table commandes_statut
table commandes_tarifs => Needed dans GenCourrier
filesGreffes.php
getActes.php
greffeCmdMois.php
greffeCmdTelechargement
Controller/Dashboard
Dashboard
Client => Gestion client, forcer l'ADV a utiliser le nouveau backoffice
Actes et Bilans
Kbis
GenCourrier => dans backoffice
table aide
Cron OK
=============
sendBilanClient
getAltiScore

View File

@ -23,22 +23,31 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$this->bootstrap('frontController');
$front = $this->getResource('frontController');
$router = $front->getRouter();
$localauthRoute = new Zend_Controller_Router_Route('localauth/', array(
'controller' => 'user',
'action' => 'login'
));
$router->addRoute('localauth', $localauthRoute);
$fichierRoute = new Zend_Controller_Router_Route('fichier/:action/:fichier', array(
'controller' => 'fichier',
'fichier' => '',
));
$router->addRoute('fichier', $fichierRoute);
$printRoute = new Zend_Controller_Router_Route('editer/:action/:fichier', array(
'controller' => 'print',
'fichier' => '',
));
$router->addRoute('localauth', $localauthRoute);
$router->addRoute('fichier', $fichierRoute);
$router->addRoute('print', $printRoute);
$ssoRoute = new Zend_Controller_Router_Route('sso/:partner/', array(
'controller' => 'auth',
'action' => 'index',
));
$router->addRoute('sso', $ssoRoute);
return $router;
}

View File

@ -3,6 +3,7 @@
return array(
'Bootstrap' => dirname(__FILE__) . '/Bootstrap.php',
'AideController' => dirname(__FILE__) . '/controllers/AideController.php',
'AuthController' => dirname(__FILE__) . '/controllers/AuthController.php',
'BdfController' => dirname(__FILE__) . '/controllers/BdfController.php',
'DashboardController' => dirname(__FILE__) . '/controllers/DashboardController.php',
'DirigeantController' => dirname(__FILE__) . '/controllers/DirigeantController.php',

View File

@ -0,0 +1,20 @@
<?php
return array(
'roles' => array(
'Utilisateur' => null,
'Administrateur' => 'Utilisateur',
'Operateur' => 'Utilisateur',
'SuperAdministrateur' => 'Administrateur',
),
'resources' => array(
'identite' => null,
'identitepc' => null,
'admin' => null,
),
'Utilisateur' => array(),
'Administrateur' => array(
//'allow.admin'
),
'Operateur' => array(),
'SuperAdministrateur' => array(),
);

View File

@ -117,12 +117,14 @@ return array(
'module' => 'default',
'controller' => 'identite',
'action' => 'fiche',
'resource' => 'identite',
),
array(
'label'=> "Fiche Procédure Collective",
'module' => 'default',
'controller' => 'identite',
'action' => 'fichepc',
'resource' => 'identitepc',
),
array(
'label'=> "Liste des Établissements",
@ -327,6 +329,12 @@ return array(
'label'=> "Paramètres",
'uri' => '#',
'pages' => array(
array(
'label'=> "Administration",
'controller' => 'admin',
'action' => 'index',
'resource' => 'admin',
),
array(
'label'=> "Général",
'controller' => 'params',

View File

@ -0,0 +1,8 @@
<?php
class AdminController extends Zend_Controller_Action
{
public function indexAction(){}
}

View File

@ -0,0 +1,210 @@
<?php
class AuthController extends Zend_Controller_Action
{
protected $partnerConfig = array(
'inextenso' => array(
'logo' => 'logo-in-extenso.gif',
'clientId' => 195,
'serviceCode' => 'SSO',
'authType' => 'userSSO',
'login' => 'MAIL',
'token' => 'token',
)
);
/**
* Point d'entrée pour les connexions partenaires.
* L'utilisateur s'identifie sur son portail habituel.
*/
public function indexAction()
{
//Désactiver le layout
$this->_helper->layout()->disableLayout();
$this->view->headLink()->appendStylesheet('/themes/default/styles/user.css', 'all');
$request = $this->getRequest();
/**
* Get partner name - see route in bootstrap
*/
$partner = $request->getParam('partner');
if ( array_key_exists($partner, $this->partnerConfig) ) {
$config = $this->partnerConfig[$partner];
$this->view->logo = $config['logo'];
$params = $request->getParams();
$objectParams = array();
foreach ($params as $label => $value) {
if (in_array($label, array('controller', 'action'))) continue;
$object = new stdClass();
$object->label = $label;
$object->value = $value;
$objectParams[] = $object;
}
$this->view->Params = $objectParams;
$login = $params[$config['login']];
$part = strstr($login, '@', true);
if ($part !== false) {
$login = $part;
}
$token = $params[$config['token']];
try {
$ws = new Scores_Ws_Client('gestion', '0.4');
$parameters = new stdClass();
$parameters->client = $config['clientId'];
$parameters->login = $login;
$parameters->token = $token;
$parameters->params = $objectParams;
$hash = $ws->ssoAuthenticate($parameters);
// --- Utilisateur inexistant
if ( $hash === 'false' || $hash === false ) {
$this->view->NoUser = true;
// --- Set form value
$this->view->FormPartner = $partner;
$this->view->FormIdentifiant = $login;
$this->view->FormCourriel = $request->getParam('MAIL');
$this->view->FormSiret = $request->getParam('SIRET');
$this->view->FormNom = $request->getParam('LASTNAME');
$this->view->FormPrenom = $request->getParam('FIRSTNAME');
}
// --- Redirection
else {
$auth = Zend_Auth::getInstance();
// --- Set partial identity
$identity = new stdClass();
$identity->username = $login;
$identity->password = $hash;
$auth->getStorage()->write($identity);
// --- End Set partial identity
// --- Get InfosLogin
$adressIp = $_SERVER['REMOTE_ADDR'];
$parameters = new stdClass();
$parameters->login = $login;
$parameters->ipUtilisateur = $adressIp;
try {
$ws = new Scores_Ws_Client('gestion', '0.3');
$InfosLogin = $ws->getInfosLogin($parameters);
Zend_Registry::get('firebug')->info($InfosLogin);
if ( is_string($InfosLogin) || $InfosLogin->error->errnum != 0 ) {
$this->view->Error = true;
} else {
$user = new Scores_Utilisateur();
$identity = $user->updateProfil($InfosLogin);
$auth->getStorage()->write($identity);
//Redirect
$this->redirect('/');
}
} catch ( Exception $e ) {
switch ( $e->getCode() ) {
case 'MSG':
$this->view->Message = $e->getMessage();
break;
default:
$this->view->Error = true;
break;
}
}
// --- End Get InfosLogin
}
} catch ( Exception $e ) {
switch ( $e->getCode() ) {
case 'MSG':
$this->view->Message = $e->getMessage();
break;
default:
$this->view->Error = true;
break;
}
}
} else {
$this->view->Message = "Erreur dans les paramètres.";
}
}
/**
* Creation d'un utilisateur en SSO
*/
public function userssocreateAction()
{
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$partner = $request->getParam('partner');
if ( array_key_exists($partner, $this->partnerConfig) ) {
$config = $this->partnerConfig[$partner];
$this->view->logo = $config['logo'];
$data = array(
'idClient' => $config['clientId'],
'login' => $request->getParam('login'),
'email' => $request->getParam('email', ''),
'actif' => 1,
'nom' => $request->getParam('nom', ''),
'prenom' => $request->getParam('prenom', ''),
'siret' => str_replace(' ', '', $request->getParam('siret', '')),
'tel' => str_replace(array(' ','.'), array('',''), $request->getParam('tel', '')),
'Service' => $config['serviceCode'],
);
try {
$ws = new Scores_Ws_Client('gestion', '0.4');
$parameters = new stdClass();
$parameters->data = json_encode($data);
$created = $ws->setUserSSO($parameters);
if ($created === false ) {
$this->view->Message = "Erreur lors de la création de votre compte.";
} else {
$this->view->UserCreated = true;
// --- Data to go back
$params = $request->getParams();
$urlArgs = array();
foreach ($params as $label => $value) {
if (in_array($label, array('controller', 'action'))) continue;
if (substr($label, 0, 2) == 'P-') {
$urlArgs[substr($label, 2)] = $value;
}
}
$urlArgs['partner'] = 'inextenso';
$this->view->UrlArgs = $urlArgs;
}
} catch ( Exception $e ) {
switch ( $e->getCode() ) {
case 'MSG':
$this->view->Message = $e->getMessage();
break;
default:
$this->view->Error = true;
break;
}
}
} else {
$this->view->Message = "Erreur dans les paramètres.";
}
}
/**
* Lien de validation depuis email
* Paramètres
* - login ou email
* - key
* L'action renvoi sur un affichage spécifique suivant le type de client
*/
public function validateAction()
{
$request = $this->getRequest();
//Validation en erreur
//Validation invalide
//Validation Ok => Comment afficher les particularités
}
}

View File

@ -658,20 +658,9 @@ class DashboardController extends Zend_Controller_Action
$ws = new WsScores();
$services = $ws->getServices($idClient);
if (is_array($services)) {
$this->view->assign('services', $services->item);
} else {
$this->view->assign('services', array());
}
if ( null === $service ) {
$infos = $ws->getListeUtilisateurs($user->getLogin(), $idClient);
$utilisateurs = $infos->result->item;
} else {
$infos = $ws->getServiceUsers($idClient, $service);
$utilisateurs = $infos->item;
$this->view->assign('service', $service);
}
$this->view->assign('services', array());
$infos = $ws->getListeUtilisateurs($user->getLogin(), $idClient);
$utilisateurs = $infos->result->item;
$this->view->assign('utilisateurs', $utilisateurs);
$this->view->assign('idClient', $idClient);

View File

@ -154,7 +154,7 @@ class FichierController extends Zend_Controller_Action
}
/**
* Gestion des liasses au formats excel
* Gestion des liasses au format excel
*/
public function liasseAction()
{

View File

@ -731,7 +731,7 @@ class FinanceController extends Zend_Controller_Action
$extValide = array('pdf', 'tiff');
$extension = strrchr($n,'.');
$extension = strtolower(substr($extension,1));
if ( in_array($extension, $extValide) ){
if ( in_array($extension, $extValide) ) {
//Lecture dans la bdd des informations
$infos = $bilanSaisie->getInfosBilan($ref);
$name = $infos['ref'].'-'.$infos['siren'].'.'.$extension;
@ -744,7 +744,10 @@ class FinanceController extends Zend_Controller_Action
$type = 'consolidé';
break;
case 'N':
$type = 'réel normal ou simplifié';
$type = 'réel normal';
break;
case 'S':
$type = 'simplifié';
break;
}
$session = new Scores_Session_Entreprise($params['siren']);
@ -812,6 +815,56 @@ class FinanceController extends Zend_Controller_Action
}
}
/**
* Liste des liasses
*/
public function liasselistAction()
{
$request = $this->getRequest();
$this->view->headTitle()->prepend("Liasse fiscale");
$this->view->headTitle()->prepend("Siret ".$this->siret);
//Paramètres utilisateur
$user = new Scores_Utilisateur();
$this->view->assign('edition', $user->checkModeEdition());
if ( $user->checkPerm('UPLOADBILAN') ) {
$this->view->assign('saisiebilan', true);
}
$this->view->assign('surveillance', $user->checkPerm('survbilan'));
$ws = new WsScores();
$bilanList = $ws->getListeBilans(substr($this->siret, 0, 9));
if ($bilanList === false) $this->forward('soap', 'error');
/** La liste des types de bilan existant **/
$liste = array (
'N' => array(),
'S' => array(),
'C' => array(),
'B' => array(),
'A' => array());
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('raisonSociale', $entreprise->getRaisonSociale());
$this->view->assign('siren', substr($this->siret, 0, 9));
$this->view->assign('siret', $this->siret);
$this->view->haveLiasse = ($bilanList->nbReponses > 0) ? true : false;
if( $bilanList->nbReponses > 0 ) {
// Tri des bilans par type
foreach ( array_keys($liste) as $t) {
foreach ( $bilanList->result->item as $item ) {
if ( $t == $item->typeBilan ) {
$liste[$item->typeBilan][] = $item;
}
}
}
$this->view->BilanList = $liste;
}
}
/**
* Affichage des liasses.
* @todo :
@ -827,6 +880,11 @@ class FinanceController extends Zend_Controller_Action
$user = new Scores_Utilisateur();
$this->view->assign('edition', $user->checkModeEdition());
//Gestion saisie bilan
if ( $user->checkPerm('UPLOADBILAN') ) {
$this->view->assign('saisiebilan', true);
}
$this->view->assign('surveillance', $user->checkPerm('survbilan'));
/** Les ancres pour les liens **/
$ancres = array(
@ -870,23 +928,6 @@ class FinanceController extends Zend_Controller_Action
),
);
/** La liste des types de bilan existant **/
$liste = array (
'N' => array(),
'S' => array(),
'C' => array(),
'B' => array(),
'A' => array());
/** Le nom des types pour le select */
$type = array (
'N' => '',
'S' => 'Simplifié',
'C' => 'Consolidé',
'A' => 'Assurance',
'B' => 'Banque',
);
/** Liste des unités que l'ont proposent **/
$unit = array (
'E' => '€',
@ -896,88 +937,56 @@ class FinanceController extends Zend_Controller_Action
$liasse = array ();
$request = $this->getRequest();
$unite = $request->getParam('unit','K');
$ws = new WsScores();
$listBilan = $ws->getListeBilans(substr($this->siret, 0, 9));
if ($listBilan === false) $this->forward('soap', 'error');
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$ws = new WsScores();
if( $listBilan->nbReponses > 0 ) {
// Tri des bilans par type
$i = 0;
foreach ( $type as $t => $text ) {
foreach ( $listBilan->result->item as $item ) {
if ( $t == $item->typeBilan ) {
$liste[$item->typeBilan][] = $item->dateExercice;
// Récupération de la date
$date = $request->getParam('date', $defaultDateExercice.':'.$defaultTypeBilan);
//Bilan par défaut
if ( $i == 0 ) {
$defaultTypeBilan = $item->typeBilan;
$defaultDateExercice = $item->dateExercice;
}
$i++;
}
}
}
if ( !empty($date) ) {
// Récupération de la date
$date = $request->getParam('date', $defaultDateExercice.':'.$defaultTypeBilan);
$dateAndType = explode(':', $date);
if ( !empty($date) ) {
// Récupération des postes du bilan
$infos = $ws->getBilan(substr($this->siret, 0, 9), $dateAndType[0], $dateAndType[1], true);
if ($infos === false) $this->forward('soap', 'error');
$dateAndType = explode(':', $date);
// Formatage de la liasse
$infoLiasse = new Scores_Finance_Liasse($infos, $unite);
$this->view->assign('dateCloture', $infoLiasse->getInfo('dateCloture'));
$this->view->assign('dateCloturePre', $infoLiasse->getInfo('dateCloturePre'));
// Récupération des postes du bilan
$infos = $ws->getBilan(substr($this->siret, 0, 9), $dateAndType[0], $dateAndType[1], true);
if ($infos === false) $this->forward('soap', 'error');
$date = new Zend_Date($infoLiasse->getInfo('dateCloture'), 'yyyyMMdd');
$this->view->assign('dateClotureD', $date->toString('dd/MM/yyyy'));
// Formatage de la liasse
$infoLiasse = new Scores_Finance_Liasse($infos, $unite);
$this->view->assign('dateCloture', $infoLiasse->getInfo('dateCloture'));
$this->view->assign('dateCloturePre', $infoLiasse->getInfo('dateCloturePre'));
$dateCloturePre = $infoLiasse->getInfo('dateCloturePre');
if ( $dateCloturePre == '' ) {
$this->view->assign('dateCloturePreD', '-');
} else {
$date = new Zend_Date($dateCloturePre, 'yyyyMMdd');
$this->view->assign('dateCloturePreD', $date->toString('dd/MM/yyyy'));
}
$date = new Zend_Date($infoLiasse->getInfo('dateCloture'), 'yyyyMMdd');
$this->view->assign('dateClotureD', $date->toString('dd/MM/yyyy'));
$this->view->assign('dureesMois', $infoLiasse->getInfo('dureeMois'));
$this->view->assign('dureesMoisPre', $infoLiasse->getInfo('dureeMoisPre'));
$dateCloturePre = $infoLiasse->getInfo('dateCloturePre');
if ( $dateCloturePre == '' ) {
$this->view->assign('dateCloturePreD', '-');
} else {
$date = new Zend_Date($dateCloturePre, 'yyyyMMdd');
$this->view->assign('dateCloturePreD', $date->toString('dd/MM/yyyy'));
}
$this->view->assign('date', $dateAndType[0]);
$this->view->assign('champType', $dateAndType[1]);
$this->view->assign('liasse', $infoLiasse->getPostes());
$this->view->assign('ancres', $ancres[$dateAndType[1]]);
$this->view->assign('dureesMois', $infoLiasse->getInfo('dureeMois'));
$this->view->assign('dureesMoisPre', $infoLiasse->getInfo('dureeMoisPre'));
$this->view->assign('date', $dateAndType[0]);
$this->view->assign('champType', $dateAndType[1]);
$this->view->assign('liasse', $infoLiasse->getPostes());
$this->view->assign('ancres', $ancres[$dateAndType[1]]);
//Gestion export de la liasse au format XLS
if ( $user->checkPerm('liassexls') & in_array($dateAndType[1],array('C', 'N', 'S')) ) {
$this->view->assign('exportxls', true);
}
//Gestion export de la liasse au format XLS
if ( $user->checkPerm('liassexls') & in_array($dateAndType[1],array('C', 'N', 'S')) ) {
$this->view->assign('exportxls', true);
}
$this->view->assign('liste', $liste);
$this->view->assign('id', $id);
$this->view->assign('type', $type);
$this->view->assign('unite', $unite);
$this->view->assign('unit', $unit);
}
//Gestion saisie bilan
if ( $user->checkPerm('UPLOADBILAN') ) {
$this->view->assign('saisiebilan', true);
}
$this->view->assign('surveillance', $user->checkPerm('survbilan'));
}
$this->view->assign('id', $id);
$this->view->assign('unite', $unite);
$this->view->assign('unit', $unit);
/** Partie vue **/
$this->view->haveLiasse = ($listBilan->nbReponses > 0) ? true : false;
$this->view->assign('raisonSociale', $entreprise->getRaisonSociale());
$this->view->assign('siren', substr($this->siret, 0, 9));
$this->view->assign('siret', $this->siret);
@ -1081,8 +1090,6 @@ class FinanceController extends Zend_Controller_Action
foreach ($bilansInfos as $infos) {
$dateCloture[] = $infos->dateCloture;
}
sort($dateCloture);
$this->view->assign('dateCloture', $dateCloture);
$this->view->assign('bilansInfos', $bilansInfos);
$ratiosInfos = $ratiosData->getTableRatiosInfos();
@ -1257,18 +1264,30 @@ class FinanceController extends Zend_Controller_Action
),
);
//Valeur pour le tableau
rsort($dateCloture);
$dateClotureTable = array();
foreach ($dateCloture as $k => $date) {
if ($k > 5) break;
$dateClotureTable[] = $date;
}
sort($dateClotureTable);
$this->view->assign('dateCloture', $dateClotureTable);
for ( $i=0 ; $i<count($dataTable) ; $i++ ) {
$values = array();
if ( !empty($dataTable[$i]['r']) ) {
foreach ($dateCloture as $k=>$date) {
foreach ($dateClotureTable as $k => $date) {
$values[$date] = $ratiosData->dRatio($typeBilan, $date, 'r'.$dataTable[$i]['r']);
}
}
$dataTable[$i]['values'] = $values;
}
$this->view->assign('dataTable',$dataTable);
//Calcul du graph
//Valeur pour le graphique
$labels = array();
$data = array();
$graphRatio = array(28, 21, 13);
@ -1279,10 +1298,12 @@ class FinanceController extends Zend_Controller_Action
$data[$iRatio]['values'][] = $ratiosEntrep[$date]['r'.$dataTable[$ratio]['r']];
}
}
foreach ($dateCloture as $k=>$date) {
sort($dateCloture);
foreach ($dateCloture as $k => $date) {
$labels[] = substr($date, 0, 4);
}
//Création du graphique
$graph = new Scores_Finance_Ratios_Graph($this->siret, $this->id);
$image = $graph->flux($labels, $data, $typeBilan);
if ( $image != false ){
@ -1403,18 +1424,17 @@ class FinanceController extends Zend_Controller_Action
if ( $response === null ) {
$this->view->assign('msg','Aucun bilan déposé.');
} else {
$date = new Zend_Date($response->DateCloture, 'yyyy-MM-dd');
$this->view->assign('DateCloture', $date->toString('dd/MM/yyyy'));
$this->view->assign('DateClotureIso', $response->DateCloture);
$date = new Zend_Date($response->BilanDateCloture, 'yyyy-MM-dd');
$this->view->assign('BilanDateCloture', $date->toString('dd/MM/yyyy'));
$this->view->assign('BilanDateClotureIso', $response->BilanDateCloture);
$this->view->assign('BilanType', $response->BilanType);
$this->view->assign('SaisieCode', $response->SaisieCode);
$this->view->assign('SaisieLabel', $response->SaisieLabel);
if ( $response->SaisieDate!='' || $response->SaisieDate!='0000-00-00' ) {
$this->view->assign('SaisieDateIso', $response->SaisieDate);
$date = new Zend_Date($response->SaisieDate, 'yyyy-MM-dd');
$this->view->assign('SaisieDate', $date->toString('dd/MM/yyyy'));
}
$this->view->assign('SaisieLabel', $response->SaisieLabel);
}
}

View File

@ -123,6 +123,7 @@ class IdentiteController extends Zend_Controller_Action
'SituationRncs',
'AutreSiren',
'RaisonSociale',
'Nom2',
'NomCommercial',
'EnseigneSigle',
'FormeJuridique',
@ -1457,8 +1458,10 @@ class IdentiteController extends Zend_Controller_Action
$sirenTxt = substr($infos['siren'],0,3).' '.substr($infos['siren'],3,3).' '.substr($infos['siren'],6,3);
$name = $infos['name'];
if ( $infos['siren']!='000000000' ) {
$name.= ' ('.$sirenTxt.')';
if ( intval($infos['siren'])!=0 ) {
$name.= ' ( '.$sirenTxt.' )';
} else {
$name.= ' ( '.$infos['pays'].' )';
}
$structure = array();
@ -1616,7 +1619,7 @@ class IdentiteController extends Zend_Controller_Action
{
//Vérification des permissions
$user = new Scores_Utilisateur();
if( $user->getIdClient()!=1 /*!$user->checkPerm('avisrncs')*/ ){
if( !$user->checkPerm('avisrncs') ){
$this->forward('perms', 'error');
}
@ -1629,6 +1632,7 @@ class IdentiteController extends Zend_Controller_Action
$ws = new WsScores();
$result = $ws->getEntrepriseAvisRncs($siren);
Zend_Registry::get('firebug')->info($result);
if ( $result === false ) {
$this->view->assign('error', true);
@ -1642,7 +1646,15 @@ class IdentiteController extends Zend_Controller_Action
$date = new Zend_Date();
$this->view->assign('AvisDateTxt', $date->toString(Zend_Date::DATE_LONG));
if ($result->RadiationDate !== null && $result->RadiationDate != '0000-00-00' ) {
$date = new Zend_Date($result->RadiationDate, 'yyyy-MM-dd');
$this->view->assign('RadiationDate', $date->toString('dd/MM/yyyy'));
}
$this->view->assign('Nom', $result->Nom);
$this->view->assign('Sigle', $result->Sigle);
$this->view->assign('Enseigne', $result->Enseigne);
$this->view->assign('NomCommercial', $result->NomCommercial);
$this->view->assign('Siren', $result->Siren);
$this->view->assign('Tribunal', $result->TribunalLabel);
@ -1743,13 +1755,14 @@ class IdentiteController extends Zend_Controller_Action
$this->view->assign('Origine', '-');
}
$this->view->assign('Activite', $result->Activite);
$this->view->assign('Activite', $result->NafCode.' : '.$result->NafLabel);
$this->view->assign('BodaccActivite', $result->Activite);
if ( $result->ActiviteDate === null || $result->ActiviteDate == '0000-00-00 00:00:00') {
$this->view->assign('ActiviteDate', '');
} else {
$date = new Zend_Date($result->ActiviteDate, 'yyyy-MM-dd');
$this->view->assign('ActiviteDate', $date->toString('dd/MM/yyyy'));
$date = new Zend_Date($result->ActiviteDate, 'yyyy-MM-dd');
$this->view->assign('ActiviteDate', $date->toString('dd/MM/yyyy'));
}
$tabTypeExploitation = array(
@ -1778,4 +1791,368 @@ class IdentiteController extends Zend_Controller_Action
}
}
/**
* Avis de situation RNCS au format PDF
*/
public function avisrncspdfAction()
{
//Vérification des permissions
$user = new Scores_Utilisateur();
if ( !$user->checkPerm('avisrncs') ) {
$this->forward('perms', 'error');
}
$request = $this->getRequest();
$this->view->assign('siret', $this->siret);
$siren = substr($this->siret, 0, 9);
$infos = null;
$ws = new WsScores();
$result = $ws->getEntrepriseAvisRncs($siren);
Zend_Registry::get('firebug')->info($result);
if ( $result === false ) {
$this->view->assign('error', true);
}
elseif ( is_string($result) ) {
$this->view->assign('message', $result);
} else {
// --- Disable render and layout
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
// --- Variables
$locale = new Zend_Locale('fr_FR');
$date = new Zend_Date();
$AvisDateTxt = $date->toString(Zend_Date::DATE_LONG);
if ($result->RadiationDate !== null && $result->RadiationDate != '0000-00-00' ) {
$date = new Zend_Date($result->RadiationDate, 'yyyy-MM-dd');
$RadiationDate = $date->toString('dd/MM/yyyy');
}
$Nom = $result->Nom;
$Sigle = $result->Sigle;
$Enseigne = $result->Enseigne;
$NomCommercial = $result->NomCommercial;
$Siren = $result->Siren;
$Tribunal = $result->TribunalLabel;
$NumGest = $result->NumGest; // 4 ou 2 + 1 lettre +
if ($result->ImmatDate === null || $result->ImmatDate=='0000-00-00 00:00:00' ) {
$ImmatDate = '';
} else {
$date = new Zend_Date($result->ImmatDate, 'yyyy-MM-dd');
$ImmatDate = $date->toString('dd/MM/yyyy');
}
$FormeJuridique = $result->FjLabel;
$Capital = number_format($result->Capital, 0, ',', ' ').' '.$result->CapitalDev;
$SiegeAdresse = $result->SiegeAdresseNum . ' ' .
$result->SiegeAdresseVoieType . ' ' .
$result->SiegeAdresseVoieLabel . ' ' .
$result->SiegeAdresseCP . ' ' .
$result->SiegeAdresseVille;
if ( $result->CompteArretMois === null ) {
$CompteArretDate = '';
} else {
$date = new Zend_Date();
$date->set($result->CompteArretMois, Zend_Date::MONTH, $locale);
$CompteArretDate = $result->CompteArretJour . ' ' . $date->toString(Zend_Date::MONTH_NAME);
}
if ( $result->ConstitutionDepotDate === null || $result->ConstitutionDepotDate == '0000-00-00 00:00:00') {
$ConstitutionDepotDate = '-';
} else {
$date = new Zend_Date($result->ConstitutionDepotDate, 'yyyy-MM-dd');
$ConstitutionDepotDate = $date->toString('dd/MM/yyyy');
}
if ( $result->ConstitutionActeDate === null || $result->ConstitutionActeDate == '0000-00-00 00:00:00') {
$ConstitutionActeDate = '-';
} else {
$date = new Zend_Date($result->ConstitutionActeDate, 'yyyy-MM-dd');
$ConstitutionActeDate = $date->toString('dd/MM/yyyy');
}
$administration = array();
foreach ($result->Administration->item as $item) {
$lineP1 = $item->Label;
if ( $item->CompanyName != '' ) {
$lineP2 = $item->CompanyName;
if ( intval($item->CompanyId) != 0 ) {
$lineP2.= ' ('.$item->CompanyId.')';
}
} else {
$lineP2 = $item->Civilite . ' ' . $item->Nom . ' ' . $item->Prenom;
if ( $item->NaissanceDate != '' ) {
$lineP2.= ' né le ' . $item->NaissanceDate;
}
if ( $item->NaissanceVille != '' ) {
$lineP2.= ' à ' . $item->NaissanceVille;
}
if ( $item->NaissanceCp!= '' ) {
$lineP2.= ' (' . $item->NaissanceCp . ')';
}
}
$administration[] = array(
'Fct' => $lineP1,
'Txt' => $lineP2,
);
}
$Administration = $administration;
$tabCreation = array(
'a1' => 'Création',
'a2' => 'Création suite à déménagement',
'a3' => 'Achat',
'a4' => 'Apport',
'a6' => 'Prise en location gérance',
'a7' => 'Partage',
'a8' => 'Reprise',
'aA' => 'Reprise globale de l\'exploitation agricole',
'aB' => 'Poursuite de l\'exploitation agricole par le conjoint',
'aC' => 'Transfert de propriété de l\'exploitation agricole',
'aD' => 'Apport d\'exploitation(s) agricole(s) individuelle(s)',
'aE' => 'Reprise d\'exploitation agricole individuelle',
);
$OrigineCreaction = $result->Origine;
if ( ( $OrigineCreaction*1>0 && $OrigineCreaction*1<9 )
|| in_array($OrigineCreaction, array('A', 'B', 'C', 'D', 'E')) ){
$Origine = $tabCreation['a'.$OrigineCreaction];
} else {
$Origine = '-';
}
$Activite = $result->NafCode.' : '.$result->NafLabel;
$BodaccActivite = $result->Activite;
if ( $result->ActiviteDate === null || $result->ActiviteDate == '0000-00-00 00:00:00') {
$ActiviteDate = '';
} else {
$date = new Zend_Date($result->ActiviteDate, 'yyyy-MM-dd');
$ActiviteDate = $date->toString('dd/MM/yyyy');
}
$tabTypeExploitation = array(
0 => "-",
1 => "Locataire du fond de commerce",
2 => "Loueur du fond de commerce",
3 => "Prestation de personnel",
10 => "Exploitation directe"
);
$Exploitation = $tabTypeExploitation[$result->Exploitation];
$Evenements = $result->Evenements->item;
$Depots = $result->Depots->item;
$Etablissements = $result->Etablissements->item;
if ( $result->DateMajRCS === null || $result->DateMajRCS == '0000-00-00 00:00:00') {
$DateMajRCS = '';
} else {
$date = new Zend_Date($result->DateMajRCS, 'yyyy-MM-dd');
$DateMajRCS = $date->toString('dd/MM/yyyy');
}
// --- Création du PDF
$c = Zend_Registry::get('config');
$filepdf = $c->profil->path->files.'/avisrncs-'.$siren.'.pdf';
try {
$pdf = new Scores_Pdf_Tcpdf();
$pdf->SetBackgroundImage('libs/modeles/avisrncs.jpg');
$pdf->SetProtection(array('modify', 'copy'), '', null, 0, null);
$pdf->SetCreator("Scores & Décisions");
$pdf->SetAuthor("Scores & Décisions");
$pdf->SetTitle('Avis de Situation RNCS');
$pdf->SetSubject('Avis de Situation RNCS');
$pdf->SetAutoPageBreak(true, 0);
$pdf->AddPage();
$pdf->SetFont('times', '', 12);
$pdf->setColorArray('fill', array(0,0,140));
$pdf->setColorArray('text', array(255,255,255));
$pdf->Cell(0, 0, "AVIS DE SITUATION RNCS", 0, 1, 'C', true);
$pdf->Cell(0, 0, "", 0, 1, 'L');
$pdf->SetFont('times', '', 10);
$pdf->setColorArray('text', array(0,0,0));
$pdf->Cell(0, 0, "REGISTRE NATIONAL DU COMMERCES ET DES SOCIETES", 0, 1, 'C');
$pdf->Cell(0, 0, "", 0, 1, 'L');
$pdf->Cell(0, 0, "Avis en date du ".$AvisDateTxt, 0, 1, 'C');
$pdf->Cell(0, 0, "", 0, 1, 'L');
$border = array('B' => array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$pdf->SetFont('times', 'B', 10);
$pdf->Cell(0, 0, "IDENTIFICATION", $border, 1, 'L');
$pdf->SetFont('times', '', 10);
$pdf->Ln(1);
if ($RadiationDate) {
$pdf->setColorArray('text', array(255,0,0));
$pdf->Cell(0, 0, "Cette entreprise est radiée au RNCS.", 0, 1, 'C');
}
$pdf->setColorArray('text', array(255,255,255));
$pdf->Cell(0, 0, "Dénomination sociale : ".$Nom, 0, 1, 'L');
if( empty($Sigle) ) {
$pdf->Cell(0, 0, "Sigle : -", 0, 1, 'L');
} else {
$pdf->Cell(0, 0, "Sigle : ".$Sigle, 0, 1, 'L');
}
if( empty($Enseigne) ) {
$pdf->Cell(0, 0, "Enseigne : -", 0, 1, 'L');
} else {
$pdf->Cell(0, 0, "Enseigne : ".$Enseigne, 0, 1, 'L');
}
if( empty($Sigle) ) {
$pdf->Cell(0, 0, "Nom Commercial : -", 0, 1, 'L');
} else {
$pdf->Cell(0, 0, "Nom Commercial : ".$NomComercial, 0, 1, 'L');
}
$pdf->Cell(0, 0, "Numéro d'identification : ".$Siren." RCS ".$Tribunal, 0, 1, 'L');
$pdf->Cell(0, 0, "Numéro de gestion : ".$NumGest, 0, 1, 'L');
$pdf->Cell(0, 0, "Date d'immatriculation : ".$ImmatDate, 0, 1, 'L');
if ($RadiationDate) {
$pdf->Cell(0, 0, "", 0, 1, 'L');
$pdf->Cell(0, 0, "Date de radiation : $RadiationDate", 0, 1, 'L');
} else {
$pdf->Cell(0, 0, "", 0, 1, 'L');
$pdf->SetFont('times', 'B', 10);
$pdf->Cell(0, 0, "RENSEIGNEMENT RELATIF A L'IDENTITE", $border, 1, 'L');
$pdf->SetFont('times', '', 10);
$pdf->Ln(1);
$pdf->Cell(0, 0, "Forme Juridique : $FormeJuridique", 0, 1, 'L');
$pdf->Cell(0, 0, "Au capital de : $Capital", 0, 1, 'L');
$pdf->Cell(0, 0, "Adresse du siège : $SiegeAdresse", 0, 1, 'L');
$pdf->Cell(0, 0, "Date darrêté des comptes : $CompteArretDate", 0, 1, 'L');
$pdf->Cell(0, 0, "Constitution : $ConstitutionActeDate", 0, 1, 'L');
$pdf->Cell(0, 0, "Dépôt de l'acte constitutif: $ConstitutionDepotDate", 0, 1, 'L');
$pdf->Cell(0, 0, "", 0, 1, 'L');
$pdf->SetFont('times', 'B', 10);
$pdf->Cell(0, 0, "ADMINISTRATION", $border, 1, 'L');
$pdf->SetFont('times', '', 10);
$pdf->Ln(1);
foreach ( $Administration as $item ) {
$pdf->Cell(0, 0, $item['Fct']." : ".$item['Txt'], 0, 1, 'L');
}
$pdf->Cell(0, 0, "", 0, 1, 'L');
$pdf->SetFont('times', 'B', 10);
$pdf->Cell(0, 0, "RENSEIGNEMENT RELATIF A L'ACTIVITE", $border, 1, 'L');
$pdf->SetFont('times', '', 10);
$pdf->Ln(1);
$pdf->Cell(0, 0, "Origine de la société $Origine", 0, 1, 'L');
$pdf->MultiCell(0, 0, "Activité : $Activite", 0, 'L', 0, 1);
$pdf->MultiCell(0, 0, "Activité déclarée au BODACC : $BodaccActivite", 0, 'L', 0, 1);
$pdf->Cell(0, 0, "Commencement de l'activité : $ActiviteDate", 0, 1, 'L');
$pdf->Cell(0, 0, "Mode d'exploitation : $Exploitation", 0, 1, 'L');
$pdf->Cell(0, 0, "", 0, 1, 'L');
$pdf->SetFont('times', 'B', 10);
$pdf->Cell(0, 0, "JUGEMENTS RNCS", $border, 1, 'L');
$pdf->SetFont('times', '', 10);
$pdf->Ln(1);
$pdf->Cell(0, 0, "Evénements :", 0, 1, 'L');
//$pdf->SetMargins(50, 0);
if (count($Evenements)>0) {
foreach ( $Evenements as $item ) {
$pdf->Cell(0, 0, $item, 0, 1, 'L');
}
} else {
$pdf->SetX($pdf->GetX() + 20);
$pdf->Cell(0, 0, "Néant.", 0, 1, 'L');
}
$pdf->Cell(0, 0, "", 0, 1, 'L');
//$pdf->SetMargins(0, 0);
$pdf->SetFont('times', 'B', 10);
$pdf->Cell(0, 0, "DEPOT LEGAL", $border, 1, 'L');
$pdf->SetFont('times', '', 10);
$pdf->Ln(1);
$pdf->Cell(0, 0, "Décisions :", 0, 1, 'L');
if ( count($Depots)>0 ) {
foreach ( $Depots as $item ) {
$depot = "Acte n°".$item->ActeNum;
if ( $item->ActeDate != '0000-00-00' ) {
$depot.= " du ".substr($item->ActeDate,8,2)."/".substr($item->ActeDate,5,2)."/".substr($item->ActeDate,0,4);
}
$depot.= " - Depot n°".$item->DepotNum." du ".substr($item->DepotDate,8,2)."/".substr($item->DepotDate,5,2)."/".substr($item->DepotDate,0,4);
$pdf->SetX($pdf->GetX() + 20);
$pdf->Cell(0, 0, $depot, 0, 1, 'L');
$pdf->SetX($pdf->GetX() + 20);
$pdf->Cell(0, 0, $item->ActeTypeLabel, 0, 1, 'L');
foreach ($item->infos->item as $detail) {
$pdf->SetX($pdf->GetX() + 20);
$pdf->Cell(0, 0, $detail, 0, 1, 'L');
}
$pdf->Ln(2);
}
$pdf->Ln(1);
$pdf->SetFont('times', 'I', 10);
$pdf->Cell(0, 0, "Liste non exhaustive", 0, 1, 'L');
}
$pdf->Cell(0, 0, "", 0, 1, 'L');
$pdf->SetFont('times', 'B', 10);
$pdf->Cell(0, 0, "AUTRES ETABLISSEMENTS", $border, 1, 'L');
$pdf->SetFont('times', '', 10);
$pdf->Ln(1);
$pdf->Cell(0, 0, "Liste des établissements actifs :", 0, 1, 'L');
$pdf->Ln(1);
foreach ( $Etablissements as $etab ) {
$pdf->SetX($pdf->GetX() + 20);
$pdf->Cell(0, 0, $etab, 0, 1, 'L');
$pdf->Ln(1);
}
}
$pdf->SetFont('times', '', 10);
$pdf->Cell(0, 0, "", 0, 1, 'L');
$pdf->Cell(0, 0, "Fin de l'avis de situation", 0, 1, 'C');
$pdf->Cell(0, 0, "", 0, 1, 'L');
$cgu = "Informations légales issues des données du Registre National du Commerce et des Sociétés".
"issues de licence 2 dite de distribution RNCS IMR pour Scores & Decisions SAS contractée le 20 novembre 2009\n".
"Scores & Decisions SAS est rediffuseur officiel du RNCS et propose un service privé, distinct du Registre public cité.";
$pdf->SetFont('times', 'I', 8);
$pdf->MultiCell(0, 0, $cgu, 0, 'L', 0, 1);
$pdf->Output($filepdf, 'F');
} catch(Exception $e) {
echo "Erreur à la création du PDF";
}
// --- Fin création PDF
$content_type = 'application/pdf';
if(file_exists($filepdf) && filesize($filepdf)>0) {
header('Content-Transfer-Encoding: none');
header('Content-type: ' . $content_type.'');
header('Content-Length: ' . filesize($filepdf));
header('Content-MD5: ' . base64_encode(md5_file($filepdf)));
header('Content-Disposition: filename="' . basename($filepdf) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
ini_set('zlib.output_compression', '0');
echo file_get_contents($filepdf);
} else {
echo "Erreur lors de l'affichage du fichier.";
}
}
}
}

View File

@ -2,6 +2,9 @@
class IndexController extends Zend_Controller_Action
{
/**
* Page d'accueil et de redirection
*/
public function indexAction()
{
$request = $this->getRequest();
@ -22,7 +25,7 @@ class IndexController extends Zend_Controller_Action
}
else
{
$this->_forward('entreprise', 'recherche');
$this->forward('entreprise', 'recherche');
}
}
@ -93,7 +96,9 @@ class IndexController extends Zend_Controller_Action
}
}
//Only for test
/**
* Display browser agent
*/
public function browserAction()
{
$info = get_browser();

View File

@ -290,7 +290,7 @@ class JuridiqueController extends Zend_Controller_Action
if (!empty($type)){
$ws = new WsScores();
$infos = $ws->getListeCompetences($siret, $type, $session->getCodeCommune());
$infos = $ws->getListeCompetences($this->siret, $type, $session->getCodeCommune());
if ($infos === false) $this->_forward('soap', 'error');
$competences = $infos->result->item;

View File

@ -282,7 +282,9 @@ class PiecesController extends Zend_Controller_Action
$infosBilan = array();
$date = new Zend_Date($item->DateCloture, 'yyyy-MM-dd');
$infosBilan['date'] = $date->toString('dd/MM/yyyy');
$infosBilan['dateIso'] = $date->toString('yyyy-MM-dd');
$infosBilan['type'] = 'Comptes '.$item->Type.' millésime '.$item->Millesime;
$infosBilan['typeCode'] = $item->Type;
$infosBilan['mode'] = $item->ModeDiffusion;
$infosBilan['isFileExist'] = false;
if ($item->File != '') {
@ -344,6 +346,7 @@ class PiecesController extends Zend_Controller_Action
$infosBilan['decision'].= "<br/>Document de ".$item->NumberOfPages." pages";
}
$infosBilan['isEnter'] = 0;
if ( empty($item->SaisieDate) || $item->SaisiDate=='0000-00-00' ) {
$infosBilan['saisie'] = "Bilan non saisi.";
} else if ( $item->SaisieCode == '00' ) {
@ -352,6 +355,7 @@ class PiecesController extends Zend_Controller_Action
if ( !empty($item->SaisieLabel) ) {
$infosBilan['saisie'].= '<img class="ui-icon ui-icon-info" style="float:right;" title="'.$item->SaisieLabel.'">';
}
$infosBilan['isEnter'] = 1;
} else {
$date = new Zend_Date($item->SaisieDate, 'yyyy-MM-dd');
$infosBilan['saisie'] = "Bilan non saisi le ".$date->toString('dd/MM/yyyy').".";
@ -373,6 +377,49 @@ class PiecesController extends Zend_Controller_Action
}
}
/**
* Commande de saisie d'un bilan
* Boite de dialog
*/
public function bilanenterAction()
{
$request = $this->getRequest();
if ( $request->isXmlHttpRequest() ) {
$this->_helper->layout()->disableLayout();
}
$user = new Scores_Utilisateur();
$this->view->assign('isAuthorize', $user->checkPerm('BILANENTER'));
$siren = $request->getParam('siren');
$date = $request->getParam('date');
$type = $request->getParam('type');
if ( $request->isPost() ) {
$ws = new WsScores();
$cmdRef = $ws->setPiecesBilanEnterCmd($siren, $date, $type, 'infogreffe', 0);
if ( $cmdRef === false ) {
$this->view->assign('err', 'Erreur lors du passage de la commande.');
} else {
$this->view->assign('msg', $cmdRef);
}
} else {
$this->view->assign('form', 'display');
$this->view->assign('siren', $siren);
$this->view->assign('date', $date);
if ($type == 'sociaux') {
$type = 'N';
}
if ( $type == 'consolides' ) {
$type = 'C';
}
$this->view->assign('type', $type);
}
}
/**
* Commande de bilan
*/

View File

@ -495,7 +495,7 @@ class RechercheController extends Zend_Controller_Action
$this->view->assign('rechCsv', $user->checkPerm('rechcsv'));
//Criteres recherche dirigeants
} else if ( $type=='dir' ) {
} else if ( $type == 'dir' ) {
// Type de recherche = dirigeants
//$dirNom = preg_replace('/[^0-9A-Z]/', ' ', strtoupper($params['dirNom']));
@ -690,19 +690,19 @@ class RechercheController extends Zend_Controller_Action
}
$item['InfoActivite'] = $activite;
if ($type=='dir') {
if ( $type == 'dir' ) {
$item['InfoDirigeant'] = '<u>Dirigeant recherch&eacute; :</u> ';
if ($etab->DirRs!='') {
$item['InfoDirigeant'].= '<b>'.$etab->DirRs.'</b>, repr&eacute;sent&eacute; par ';
}
$item['InfoDirigeant'].= $etab->DirNom .' '. $etab->DirPrenom;
if ($etab->DirNomUsage<>'' && $etab->DirNomUsage<>$etab->DirNom) {
if ( $etab->DirNomUsage != '' && $etab->DirNomUsage != $etab->DirNom) {
$item['InfoDirigeant'].= ' ('. $etab->DirNomUsage . ')';
}
$item['InfoDirigeant'].= '<i>, '.$etab->DirFonction.'</i><br/>';
} elseif ($type=='act'){
} elseif ( $type == 'act' ) {
$item['InfoActionnaire'] = '<u>Actionnaire recherch&eacute; :</u> ';
if ($etab->ActNomRs<>'') {

View File

@ -453,7 +453,7 @@ class SaisieController extends Zend_Controller_Action
$session->tabSaisie = $tabSaisie;
if ($O->error->errnum!=0){
$message = 'Erreur lors de l\'enregistrement !';
$message = "Erreur lors de l'enregistrement !";
$this->_helper->getHelper('Redirector')->setGotoSimple('fiche', 'saisie', null, array(
'siret' => $siret,
'id' => $id,
@ -1437,9 +1437,16 @@ class SaisieController extends Zend_Controller_Action
substr($params['dateCloturePre'],3,2).
substr($params['dateCloturePre'],0,2);
$originalDateCloture = substr($params['originalDateCloture'],6,4).
substr($params['originalDateCloture'],3,2).
substr($params['originalDateCloture'],0,2);
$originalTypeBilan = $params['originalTypeBilan'];
$ws = new WsScores();
$response = $ws->setBilan(
$params['siren'],
$params['siren'],
$originalDateCloture,
$originalTypeBilan,
$params['unite'],
$dateCloture,
$params['dureeMois'],
@ -1467,7 +1474,7 @@ class SaisieController extends Zend_Controller_Action
'status'=>'ERR',
'message'=>$response,
'postes'=>array(),
));
));
}
}
}
@ -2592,7 +2599,7 @@ class SaisieController extends Zend_Controller_Action
if (is_numeric($cpVille) && strlen($cpVille)<6) {
$sql->where("code LIKE '".$cpVille."%'");
} else {
$sql->where("libelle LIKE '%".$cpVille."%'");
$sql->where('libelle LIKE ?', "%$cpVille%");
}
$sql->limit(20);
$rows = $city->fetchAll($sql);
@ -2684,19 +2691,19 @@ class SaisieController extends Zend_Controller_Action
}
$infos = array(
'siren' => $params['siren'],
'nic' => $params['nic'],
'civilite' => $params['civilite'],
'nom' => $params['nom'],
'prenom' => $params['prenom'],
'nom_usage' => $params['nom_usage'],
'dateNais' => $newDate,
'lieuNais' => $params['naiss_lieu'],
'codFct' => str_pad($params['codFct'], 4, 0, STR_PAD_LEFT),
'tel' => $params['tel'],
'fax' => $params['fax'],
'email' => $params['email']
);
'siren' => $params['siren'],
'nic' => $params['nic'],
'civilite' => $params['civilite'],
'nom' => $params['nom'],
'prenom' => $params['prenom'],
'nom_usage' => $params['nom_usage'],
'dateNais' => $newDate,
'lieuNais' => $params['naiss_lieu'],
'codFct' => str_pad($params['codFct'], 4, 0, STR_PAD_LEFT),
'tel' => $params['tel'],
'fax' => $params['fax'],
'email' => $params['email']
);
$ws = new WsScores();
@ -2721,7 +2728,7 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('message', $message);
}
/**
/**
* Edit contact information
*/
public function contactAction()

View File

@ -427,7 +427,7 @@ class SurveillanceController extends Zend_Controller_Action
}
$this->view->headLink()
->appendStylesheet('/libs/tablesorter/themes/blue/style.css', 'all');
->appendStylesheet('/libs/tablesorter/themes/blue/style.css', 'all');
$this->view->headScript()
->appendFile('/libs/tablesorter/jquery.tablesorter.js', 'text/javascript')
@ -1108,7 +1108,7 @@ class SurveillanceController extends Zend_Controller_Action
}
$count++;
}
}else{
} else {
/*
* Fermeture de la balise page lorsqu'il n'y a aucune annonce
* afin de générer un fichier pdf vide et non pas une erreur

View File

@ -13,6 +13,17 @@ class TelechargementController extends Zend_Controller_Action
*/
protected $path = '';
public function init()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$c = Zend_Registry::get('config');
$this->path = $c->profil->path->files;
require_once 'Scores/WsScores.php';
}
/**
* Vérifie ou télécharge le fichier sur une url
* @param string $url
@ -24,7 +35,7 @@ class TelechargementController extends Zend_Controller_Action
{
if (!is_dir($this->path)) mkdir($this->path);
// Recuperation du nom du fichier
// --- Recuperation du nom du fichier
if ( $filename === null ) {
$tableau = explode('/', $url);
$file = $tableau[sizeof($tableau) - 1];
@ -32,7 +43,7 @@ class TelechargementController extends Zend_Controller_Action
$file = $filename;
}
// Suppression du fichier si le temps de cache est depasse
// --- Suppression du fichier si le temps de cache est depasse
if ( $this->filetime == 0 && file_exists($this->path.'/'.$file) ){
unlink($this->path.'/'.$file);
} elseif ( file_exists($this->path.'/'.$file) ) {
@ -46,39 +57,39 @@ class TelechargementController extends Zend_Controller_Action
unlink($this->path.'/'.$file);
}
}
// Recuperation du fichier sur le serveur
if (file_exists($this->path.'/'.$file)) {
// --- Lock file exist
if ( file_exists($this->path.'/'.$file.'.lock') ) {
return null;
}
// --- Recuperation du fichier sur le serveur
if ( file_exists($this->path.'/'.$file) ) {
return $file;
} else {
// On check si le fichier est present sur l'url
// --- On check si le fichier est present sur l'url
try {
$client = new Zend_Http_Client($url);
$client->setStream();
$response = $client->request('GET');
if ( $response->isSuccessful() ) {
if ( copy($response->getStreamName(), $this->path.'/'.$file) ) {
// --- Add a lock
file_put_contents($this->path.'/'.$file.'.lock', '');
if ( copy($response->getStreamName(), $this->path.'/'.$file) ) {
// --- Remove lock
unlink($this->path.'/'.$file.'.lock');
return $file;
}
// --- Remove lock
unlink($this->path.'/'.$file.'.lock');
}
return false;
return null;
} catch (Zend_Http_Client_Exception $e) {
return false;
}
}
}
public function init()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$c = Zend_Registry::get('config');
$this->path = $c->profil->path->files;
require_once 'Scores/WsScores.php';
}
/**
* Télécharge la consommation client sous forme de fichier csv et affiche le lien
*/
@ -90,7 +101,7 @@ class TelechargementController extends Zend_Controller_Action
$start = $request->getParam('start', false);
//On souhaite récupérer l'url du fichier
if ($start==1) {
if ( $start == 1 ) {
$mois = $request->getParam('mois');
$detail = $request->getParam('detail', 0);
$idClient = $request->getParam('idClient', 0);
@ -107,7 +118,7 @@ class TelechargementController extends Zend_Controller_Action
$ws = new WsScores();
$reponse = $ws->getLogsClients($date, $detail, $idClient, $login, $all);
if (!empty($reponse->result->Url)) {
if ( !empty($reponse->result->Url) ) {
echo $reponse->result->Url;
} else {
echo 'FALSE';
@ -116,16 +127,19 @@ class TelechargementController extends Zend_Controller_Action
$url = $request->getParam('url', '');
$file = $this->getFile($url);
// Le fichier existe sur l'extranet
if ($file && file_exists($this->path.'/'.$file)) {
if (filesize($this->path.'/'.$file) > 0) {
echo '<u><a title="T&eacute;l&eacute;charger le fichier"'.
' target="_blank" href="/fichier/consommation/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger'.
' le fichier.</a></u>';
} else {
echo 'Aucune consommmation enregistr&eacute;e.';
}
// --- En attente
if ( $file === null ) {
echo '';
}
// --- Fichier en erreur
elseif ( $file === false ) {
echo 'Erreur lors du chargement du fichier.';
}
// --- Fichier disponible
elseif ( file_exists($this->path.'/'.$file) ) {
echo '<u><a title="T&eacute;l&eacute;charger le fichier"'.
' target="_blank" href="/fichier/consommation/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger le fichier.</a></u>';
}
}
}
@ -140,39 +154,42 @@ class TelechargementController extends Zend_Controller_Action
$request = $this->getRequest();
$start = $request->getParam('start', false);
if ($start==1) {
// --- Get File Url
if ( $start == 1) {
$source = $request->getParam('source', '');
$user = new Scores_Utilisateur();
$login = $user->getLogin();
$idClient = $user->getIdClient();
$ws = new WsScores();
$reponse = $ws->getListeSurveillancesCsv($source, $login, $idClient);
if (!empty($reponse->result->Url)) {
if ( !empty($reponse->result->Url) ) {
echo $reponse->result->Url;
exit;
} else {
echo 'FALSE';
}
echo 'FALSE';
exit;
} else {
}
// --- Get File
else {
$url = $request->getParam('url', '');
$file = $this->getFile($url);
// Le fichier existe sur l'extranet
if ($file && file_exists($this->path.'/'.$file)) {
if (filesize($this->path.'/'.$file) > 0) {
echo '<u><a title="T&eacute;l&eacute;charger le fichier"'.
' target="_blank" href="/fichier/surveillance/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger'.
' le fichier.</a></u>';
} else {
echo 'Aucune surveillance enregistr&eacute;e.';
}
}
exit;
// --- En attente
if ( $file === null ) {
echo '';
}
// --- Fichier en erreur
elseif ( $file === false ) {
echo 'Erreur lors du chargement du fichier.';
}
// --- Fichier disponible
elseif ( file_exists($this->path.'/'.$file) ) {
echo '<u><a title="T&eacute;l&eacute;charger le fichier"'.
' target="_blank" href="/fichier/surveillance/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger le fichier.</a></u>';
}
}
}
@ -194,30 +211,31 @@ class TelechargementController extends Zend_Controller_Action
$ws = new WsScores();
$reponse = $ws->getPortefeuilleCsv($login, $idClient);
if (!empty($reponse->result->Url)) {
echo $reponse->result->Url;
exit;
}
echo 'FALSE';
exit;
if ( !empty($reponse->result->Url) ) {
echo $reponse->result->Url;
} else {
echo 'FALSE';
}
} else {
$url = $request->getParam('url', '');
$file = $this->getFile($url);
// Le fichier existe sur l'extranet
if ($file && file_exists($this->path.'/'.$file)) {
if (filesize($this->path.'/'.$file) > 0) {
echo '<u><a title="T&eacute;l&eacute;charger le fichier"'.
' target="_blank" href="/fichier/portefeuille/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger'.
' le fichier.</a></u>';
} else {
echo 'Aucune surveillance enregistr&eacute;e.';
}
// --- En attente
if ( $file === null ) {
echo '';
}
// --- Fichier en erreur
elseif ( $file === false ) {
echo 'Erreur lors du chargement du fichier.';
}
// --- Fichier disponible
elseif ( file_exists($this->path.'/'.$file) ) {
echo '<u><a title="T&eacute;l&eacute;charger le fichier"'.
' target="_blank" href="/fichier/portefeuille/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger le fichier.</a></u>';
}
exit;
}
}
@ -241,13 +259,20 @@ class TelechargementController extends Zend_Controller_Action
$file = $this->getFile($url, uniqid('histo-').'.pdf');
// Le fichier existe sur l'extranet
if ($file && file_exists($this->path.'/'.$file)) {
// --- En attente
if ( $file === null ) {
echo '';
}
// --- Fichier en erreur
elseif ( $file === false ) {
echo 'Erreur lors du chargement du fichier.';
}
// --- Fichier disponible
elseif ( file_exists($this->path.'/'.$file) ) {
if (filesize($this->path.'/'.$file) > 0) {
echo '<u><a title="T&eacute;l&eacute;charger le fichier"'.
' target="_blank" href="/fichier/histopdf/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger'.
' le fichier.</a></u>';
'">Cliquez-ici pour t&eacute;l&eacute;charger le fichier.</a></u>';
} else {
echo "Erreur lors du téléchargement du fichier.";
}
@ -276,13 +301,20 @@ class TelechargementController extends Zend_Controller_Action
Zend_Registry::get('firebug')->info($url);
$file = $this->getFile($url);
Zend_Registry::get('firebug')->info('File:'.$this->path.'/'.$file);
// Le fichier existe sur l'extranet
if ($file && file_exists($this->path.'/'.$file)) {
// --- En attente
if ( $file === null ) {
echo '';
}
// --- Fichier en erreur
elseif ( $file === false ) {
echo 'Erreur lors du chargement du fichier.';
}
// --- Fichier disponible
elseif ( file_exists($this->path.'/'.$file) ) {
if (filesize($this->path.'/'.$file) > 0) {
echo '<br/><u><a title="T&eacute;l&eacute;charger le fichier"'.
' target="_blank" href="/fichier/bilan/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger'.
' le fichier.</a></u>';
'">Cliquez-ici pour t&eacute;l&eacute;charger le fichier.</a></u>';
} else {
echo "<br/>Erreur lors du téléchargement du fichier.";
}

View File

@ -1,6 +1,30 @@
<?php
class UserController extends Zend_Controller_Action
{
/**
* Return a ramdom password
* @param int $length
* Length of the string
* @param int $strength
* $strength = 1:- 0-9
* $strength = 2:- A-Z0-9
* $strength = 3:- A-Za-z0-9
* $strength = 4:- A-Za-z0-9 and # $ % &
* $strength = 5:- A-Za-z0-9 and # $ % & = > ? @
* @return string
*/
protected function randomPassword($length,$strength)
{
$char_sets=array('48-57','65-90','97-122','35-38','61-64');
$new_password='';
srand(microtime()*10000000);
for($i=0;$i<$length;$i++){
$random=rand(0,$strength-1);
list($start,$end)=explode('-',$char_sets[$random]);
$new_password.=chr(rand($start,$end));
}
return $new_password;
}
public function init()
{
@ -33,8 +57,6 @@ class UserController extends Zend_Controller_Action
$isPasswordUpdated = false;
$updateResult = false;
$ws = new WsScores();
$login = $request->getParam('login', '');
$op = $request->getParam('op');
@ -52,7 +74,7 @@ class UserController extends Zend_Controller_Action
//Enregistrement des données new & update
if (in_array($action, array('new','update'))) {
if ($options['changepwd']!=1) {
if ( $options['changepwd'] != 1 ) {
$options['password'] = '';
}
@ -64,7 +86,7 @@ class UserController extends Zend_Controller_Action
if( !isset($options['profil']) ) {
$options['profil'] = 'Utilisateur';
}
$ws = new WsScores();
$reponse = $ws->setInfosLogin($login, $action, $options);
$isProfilUpdated = true;
@ -77,24 +99,21 @@ class UserController extends Zend_Controller_Action
}
}
//Write change in session
// --- Write change in session
if ($identity->idClient == $options['idClient'] && $identity->username == $login) {
//Modification lors du changement de mot de passe
// --- Modification lors du changement de mot de passe
if ($options['changepwd']==1 && $updateResult) {
$identity->password = md5($login.'|'.$options['password']);
$auth->getStorage()->write($identity);
}
//Mise à jour du profil
// --- Mise à jour du profil
if ($isProfilUpdated && $updateResult) {
$ws = new WsScores();
$InfosLogin = $ws->getInfosLogin($identity->username, $_SERVER['REMOTE_ADDR']);
$identity = $user->updateProfil($InfosLogin);
$auth->getStorage()->write($identity);
}
//Gestion mode edition en SESSION
// --- Gestion mode edition en SESSION
if ($action=='update') {
$modeEdition = $request->getParam('modeEdition', false);
if ( $modeEdition ) {
@ -126,10 +145,11 @@ class UserController extends Zend_Controller_Action
if ($op=='new')
{
$idClient = $request->getParam('idClient', '');
$idClient = $request->getParam('idClient', '');
if ($idClient == '') {
$idClient = $identity->idClient;
}
$ws = new WsScores();
$reponse = $ws->getNextLogin($idClient);
$options->idClient = $idClient;
if ($identity->idClient!=1 && $identity->profil!='SuperAdministrateur') {
@ -137,6 +157,7 @@ class UserController extends Zend_Controller_Action
}
$this->view->assign('options', $options);
$this->view->assign('password', $this->randomPassword(10, 3));
$this->view->assign('loginNew', $reponse->result->racine);
$this->view->assign('droitsClients', explode(' ', strtolower($reponse->result->droitsClients)));
$this->view->assign('action', 'new');
@ -146,6 +167,7 @@ class UserController extends Zend_Controller_Action
{
if ( !empty($login) && $identity->username != $login ) {
Zend_Registry::get('firebug')->info('getInfosLogin');
$ws = new WsScores();
$reponse = $ws->getInfosLogin($login, $_SERVER['REMOTE_ADDR']);
$this->view->assign('options', $reponse->result);
$this->view->assign('loginVu', $reponse->result->login);
@ -162,6 +184,7 @@ class UserController extends Zend_Controller_Action
$this->view->assign('pref', explode(' ',$identity->pref));
}
$ws = new WsScores();
//Liste des catégories des accès
$reponse = $ws->getCategory();
$wscategory = $reponse->item;

View File

@ -0,0 +1,127 @@
<?php echo $this->doctype(); ?>
<html>
<head>
<?php echo $this->headMeta(); ?>
<?php echo $this->headTitle(); ?>
<?php echo $this->headStyle(); ?>
<?php echo $this->headLink(); ?>
<?php echo $this->headScript(); ?>
</head>
<body>
<div id="wrap">
<div class="container">
<div class="row">
<div class="col-md-6">
<p><img src="/themes/default/images/partner/<?=$this->logo?>"/></p>
<div class="panel panel-default">
<div class="panel-body">
<p class="text-primary">Spécialiste de l'information légales et financières sur les entreprises, Scores & Décisions vous permet par
confirmation des éléments ci-contre d'accéder à toute sa base de données.</p>
<ul class="list-group">
<li class="list-group-item">
Télécharger nos Conditions Générales de Services
<a href="<?=$this->baseUrl()?>/documents/inextenso_cgs.pdf" target="_blank">
<span class="glyphicon glyphicon-file pull-right" aria-hidden="true"></span></a>
</li>
<li class="list-group-item">
Télécharger nos Conditions Tarifaires
<a href="#" target="_blank">
<span class="glyphicon glyphicon-file pull-right" aria-hidden="true"></span></a>
</li>
<li class="list-group-item">
Télécharger les coordonnées de vos contacts
<a href="<?=$this->baseUrl()?>/documents/inextenso_contacts.pdf" target="_blank">
<span class="glyphicon glyphicon-file pull-right" aria-hidden="true"></span></a>
</li>
</ul>
<p class="text-danger">Ce service est actuellement en beta. La consultation vous est offerte durant cette période.</p>
</div>
</div>
</div>
<div class="col-md-6">
<form method="post" action="<?=$this->url(array('controller'=>'auth', 'action'=>'userssocreate'), 'default', true)?>">
<h2 class="form-signin-heading">Extranet <small>Scores &amp; Décisions</small></h2>
<?php
//Error
if ($this->Error) {?>
<div style="text-align:center;"><p class="text-danger"><span>Une erreur est survenue</span></p></div>
<?php
}
//Message
else if ($this->Message) {?>
<div style="text-align:center;"><p class="text-danger"><span><?=$this->Message?></span></p></div>
<?php
}
//NoUser
else if ($this->NoUser) {?>
<div><p class="text-warning"><span>
Votre compte n'existe pas encore. Compléter le formulaire puis valider pour créer votre compte.
</span></p>
</div>
<?php foreach ($this->Params as $item) {?>
<input type="hidden" name="P-<?=$item->label?>" value="<?=$item->value?>"/>
<?php }?>
<input type="hidden" name="partner" value="<?=$this->FormPartner?>"/>
<div class="form-group">
<label for="identifiant">Identifiant</label>
<input type="text" id="identifiant" value="<?=$this->FormIdentifiant?>" class="form-control" disabled>
<input type="hidden" name="login" value="<?=$this->FormIdentifiant?>">
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="text" class="form-control" value="<?=$this->FormCourriel?>" disabled>
<input type="hidden" name="email" value="<?=$this->FormCourriel?>">
</div>
<div class="form-group">
<label for="siret">SIRET</label>
<input type="text" class="form-control" name="siret" value="<?=$this->FormSiret?>">
</div>
<div class="form-group">
<label for="nom">Nom</label>
<input type="text" class="form-control" name="nom" value="<?=$this->FormNom?>">
</div>
<div class="form-group">
<label for="prenom">Prénom</label>
<input type="text" class="form-control" name="prenom" value="<?=$this->FormPrenom?>">
</div>
<div class="form-group">
<label for="tel">Téléphone</label>
<input type="text" class="form-control" name="tel" value="<?=$this->FormTel?>">
</div>
<button class="btn btn-lg btn-primary btn-block clearfix" type="submit">Valider</button>
<?php }?>
</form>
</div>
</div>
</div>
</div>
<div id="footer">
<div class="container">
<p class="text-muted credit"> &copy; <?=date('Y')?> <a href="http://www.scores-decisions.com">Scores & Décisions SAS</a>.</p>
</div>
</div>
<?php echo $this->inlineScript(); ?>
</body>
</html>

View File

@ -0,0 +1,58 @@
<?php echo $this->doctype(); ?>
<html>
<head>
<?php echo $this->headMeta(); ?>
<?php echo $this->headTitle(); ?>
<?php echo $this->headStyle(); ?>
<?php echo $this->headLink(); ?>
<?php echo $this->headScript(); ?>
</head>
<body>
<div id="wrap">
<div class="container">
<div class="row">
<div class="col-md-6"><img src="/themes/default/images/partner/<?=$this->logo?>"/></div>
<div class="col-md-6">
<h2 class="form-signin-heading">Extranet <small>Scores & Décisions</small></h2>
<?php
//Error
if ($this->Error) {?>
<div style="text-align:center;"><p class="text-danger"><span>Une erreur est survenue</span></p></div>
<?php
}
//Message
else if ($this->Message) {?>
<div style="text-align:center;"><p class="text-danger"><span><?=$this->Message?></span></p></div>
<?php
}
//OK
else if ($this->UserCreated) {?>
<div>
<p class="text-success">
<span>Votre compte a été crée avec succès.</span>
<a href="<?=$this->url(array_merge(array('controller'=> 'auth', 'action' => 'index'), $this->UrlArgs))?>">
Cliquez ici pour être rediriger vers la page d'accueil.</a>
</p>
</div>
<?php }?>
</div>
</div>
</div>
</div>
<div id="footer">
<div class="container">
<p class="text-muted credit"> &copy; <?=date('Y')?> <a href="http://www.scores-decisions.com">Scores & Décisions SAS</a>.</p>
</div>
</div>
<?php echo $this->inlineScript(); ?>
</body>
</html>

View File

@ -0,0 +1 @@
<?php

View File

@ -41,7 +41,7 @@
<table class="bilans">
<tr class="subhead">
<td colspan="2">&nbsp;</td>
<?php foreach ($this->dateCloture as $k=>$date) { ?>
<?php foreach ($this->dateCloture as $k => $date) { ?>
<td class="center" >
<?=substr($date,6,2).'/'.substr($date,4,2).'/'.substr($date,0,4)?><br/>
<?=$this->bilansInfos[$date]->duree?> mois</td>
@ -61,7 +61,7 @@ foreach ($this->dataTable as $ratio) {
<tr<?=$trClass?>>
<td><?=$ratio['op']?></td>
<td><?=$ratio['titre']?></td>
<?php foreach ($this->dateCloture as $k=>$date) { ?>
<?php foreach ($this->dateCloture as $k => $date) { ?>
<td class="right">
<?php if ( !empty($ratio['r']) ){ ?>
<?=$ratio['values'][$date]?>

View File

@ -13,50 +13,13 @@
<td width="350" class="StyleInfoData"><?=$this->raisonSociale?></td>
</tr>
<?php if ( $this->haveLiasse ) {?>
<form method="post" action="<?=$this->url(array('controller'=>'finance','action'=>'liasse','siret'=>$this->siret,'id'=>$this->id))?>">
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Valeurs exprimées en</td>
<td width="350" class="StyleInfoData">
<select name="unit">
<?php foreach ($this->unit as $id => $titre):?>
<option value="<?=$id?>"<?=($id==$this->unite)? ' selected': '';?>><?=$titre?></option>
<?php endforeach;?>
</select>
</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Millesime</td>
<td width="350" class="StyleInfoData">
<select name="date">
<?php foreach ($this->type as $champType => $name) {?>
<?php foreach ($this->liste[$champType] as $element) {?>
<option value="<?=$element.':'.$champType?>"<?=($this->date == $element && $champType == $this->champType)? ' selected': '';?>>
<?php $date = new Zend_Date($element, 'yyyyMMdd'); ?>
<?=$date->toString('dd/MM/yyyy').' '.$name;?>
</option>
<?php }?>
<?php }?>
</select>
<input type="submit" value="OK" />
</td>
</tr>
</form>
<?php }?>
<?php if ($this->edition) {?>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2">
<?php if ( $this->haveLiasse ) {?>
<?php if(!empty($this->dateCloture)) {?>
<a href="<?=$this->url(array('controller'=>'saisie', 'action'=>'liasse', 'siret'=>$this->siren, 'selection'=>$this->date.':'.$this->champType))?>">
Corriger le bilan sélectionné</a><br/> ou <?php }?>
Saisir une nouvelle liasse au format
<a href="<?=$this->url(array('controller'=>'saisie', 'action'=>'liasse', 'siret'=>$this->siren, 'selection'=>'NEW:N'))?>">Normal (2050)</a>,
<a href="<?=$this->url(array('controller'=>'saisie', 'action'=>'liasse', 'siret'=>$this->siren, 'selection'=>'NEW:C'))?>">Consolidé (2050)</a>,
<a href="<?=$this->url(array('controller'=>'saisie', 'action'=>'liasse', 'siret'=>$this->siren, 'selection'=>'NEW:S'))?>">Simplifié (2033)</a>
Corriger le bilan</a><br/><?php }?>
</td>
</tr>
<?php }?>
@ -76,58 +39,45 @@
</td>
</tr>
<?php }?>
<?php if ($this->saisiebilan) {?>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData">
<a id="bilanClient" href="<?=$this->url(array(
'controller'=>'finance',
'action'=>'saisiebilan',
'siren'=>$this->siren
), 'default', true)?>" title="Envoi du bilan">
Vous possèdez un bilan plus récent
</a>
</td>
</tr>
<?php }?>
<?php if ($this->surveillance) {?>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData">
<?=$this->action('infos','surveillance', null, array(
'source' => 'bilans',
'siret' => $this->siret
))?>
</td>
</tr>
<?php }?>
<?php if ( $this->champType == 'S' ) {?>
<tr>
<td colspan="3">
Ce bilan a été déposé au format réel simplifié mais vous est livré au
format réel normal pour des raisons de standardisation.
Ce bilan a été déposé au format réel simplifié mais vous est livré au format réel normal pour des raisons de
standardisation.
</td>
</tr>
<?php }?>
</table>
<?php if ( empty($this->AutrePage) && $this->haveLiasse) {?>
<div id="liasse-check-result" class="ui-state-highlight ui-corner-all" style="margin-top: 5px;">
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
<a title="Cliquez ici pour vérifier l'intégration des éléments financiers"
href="<?=$this->url(array('controller'=>'finance','action'=>'liasseinfos','siren'=>$this->siren), 'default', true)?>"
id="liasse-check">Vérifier la disponibilité des derniers états financiers au Greffe.</a></p>
</div>
<?php }?>
<?php
switch ($this->champType) {
case 'N' : $name = 'Réel Normal'; break;
case 'S' : $name = 'Simplifié'; break;
case 'C' : $name = 'Consolidé'; break;
case 'A' : $name = 'Assurance'; break;
case 'B' : $name = 'Banque'; break;
}
?>
<h2>Liasse <?=$name?> - Millésime <?=substr($this->dateCloture,0,4)?> </h2>
<div class="paragraph">
<form method="post" action="<?=$this->url(array('controller'=>'finance','action'=>'liasse','siret'=>$this->siret,'id'=>$this->id))?>">
Valeurs exprimées en
<select name="unit">
<?php foreach ($this->unit as $id => $titre):?>
<option value="<?=$id?>"<?=($id==$this->unite)? ' selected': '';?>><?=$titre?></option>
<?php endforeach;?>
</select>
<input type="submit" value="OK" />
</form>
</div>
<div class="paragraph">
<?php if(empty($this->date)) {?>
<?php if(empty($this->dateCloture)) {?>
<table>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" class="StyleInfoLib" width="200">Aucun bilan disponible.</td>
<td colspan="2" class="StyleInfoLib" width="200">Impossible d'afficher le bilan.</td>
</tr>
</table>
<?php } else {?>

View File

@ -16,7 +16,7 @@
<td><b><?=$this->dateCloturePre?></b><br/><?php if($this->dureesMoisPre!='') {?><b><?=$this->dureesMoisPre?> Mois</b><?php }?></td>
</tr>
<tr>
<td rowspan="19">A<br/>C<br/>T<br/>I<br/>F<br/></td>
<td rowspan="19" align="center">A<br/>C<br/>T<br/>I<br/>F<br/></td>
<td rowspan="7">Immobilisations incorporelles</td>
<td>Capital souscrit non appelé (I)</td>
<td align="center">AA</td>

View File

@ -1,11 +1,11 @@
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
<?php if ( $this->DateClotureIso ) { ?>
<?php if ( $this->BilanDateClotureIso ) { ?>
Le dernier millésime déposé au greffe est le <?=$this->DateCloture?>.
<?php if ( $this->SaisieDateIso && $this->SaisieCode == 0 ) {?>
Le dernier millésime déposé au greffe est le <?=$this->BilanDateCloture?>.
<?php if ( $this->SaisieDateIso != '' && $this->SaisieCode == '00' ) {?>
Le bilan a été saisie le <?=$this->SaisieDate?>.
<?php } else {?>
Le bilan n'a pas été saisie par la source officielle (<i><?=$this->SaisieLabel?>)</i>.
Le bilan n'a pas été saisie par la source officielle<?php if ($this->SaisieLabel!='') {?> (<i><?=$this->SaisieLabel?>)</i><?php }?>.
<br/>Contactez le support (support@scores-decisions.com) pour une demande de mise à jour.
(Soumis à facturation selon vos accords contractuels)
<?php }?>

View File

@ -0,0 +1,175 @@
<div id="center">
<h1>ELEMENTS FINANCIERS - LISTE DES BILANS</h1>
<div class="paragraph">
<table class="identite">
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Num&eacute;ro identifiant Siren</td>
<td width="350" class="StyleInfoData"><?=$this->SirenTexte($this->siren)?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Dénomination Sociale</td>
<td width="350" class="StyleInfoData"><?=$this->raisonSociale?></td>
</tr>
<?php if ($this->surveillance) {?>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550">
<?=$this->action('infos','surveillance', null, array('source' => 'bilans', 'siret' => $this->siret))?>
</td>
</tr>
<?php }?>
</table>
</div>
<h2>Dernier(s) bilan(s) disponible(s)</h2>
<?php if ($this->edition) {?>
<div class="paragraph">
Saisir une nouvelle liasse au format
<a href="<?=$this->url(array('controller'=>'saisie', 'action'=>'liasse', 'siret'=>$this->siren, 'selection'=>'NEW:N'))?>">Normal (2050)</a>,
<a href="<?=$this->url(array('controller'=>'saisie', 'action'=>'liasse', 'siret'=>$this->siren, 'selection'=>'NEW:C'))?>">Consolidé (2050)</a>,
<a href="<?=$this->url(array('controller'=>'saisie', 'action'=>'liasse', 'siret'=>$this->siren, 'selection'=>'NEW:S'))?>">Simplifié (2033)</a>
</div>
<?php }?>
<?php if ( empty($this->AutrePage) && $this->haveLiasse) {?>
<div class="paragraph">
<div id="liasse-check-result" class="ui-state-highlight ui-corner-all" style="margin-top:5px;">
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
<a title="Cliquez ici pour vérifier l'intégration des éléments financiers"
href="<?=$this->url(array('controller'=>'finance','action'=>'liasseinfos','siren'=>$this->siren), 'default', true)?>"
id="liasse-check">Vérifier la disponibilité des derniers états financiers au Greffe.</a></p>
</div>
</div>
<?php }?>
<?php if ($this->saisiebilan) {?>
<div class="paragraph">
<a id="bilanClient" href="<?=$this->url(array('controller'=>'finance', 'action'=>'saisiebilan',
'siren'=>$this->siren), 'default', true)?>" title="Envoi d'un bilan en saisi">
Vous possèdez un bilan plus récent</a>
</div>
<?php }?>
<?php if ( $this->haveLiasse ) {?>
<div class="paragraph">
<table class="liasse">
<thead>
<tr>
<th>Millésime</th>
<th>Date de cloture</th>
<th>Date de cloture N-1</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->BilanList as $type => $liste) {?>
<?php if (count($liste) > 0) {?>
<?php foreach ($liste as $element) {?>
<?php
switch ($type) {
case 'N' : $name = 'Réel Normal'; break;
case 'S' : $name = 'Simplifié'; break;
case 'C' : $name = 'Consolidé'; break;
case 'A' : $name = 'Assurance'; break;
case 'B' : $name = 'Banque'; break;
}
?>
<tr><td style="font-weight:bold;padding-left:20px;" colspan="4"><?=$name?></td></tr>
<tr>
<td align="center" style="font-weight:bold;">
<a href="<?=$this->url(array('controller'=>'finance','action'=>'liasse',
'siret'=>$this->siret,'id'=>$this->id, 'date'=> $element->dateExercice.':'.$type), 'default', true)?>">
<?=$element->millesime?></a>
</td>
<td align="center">
<?php $date = new Zend_Date($element->dateExercice, 'yyyyMMdd'); ?> <?=$date->toString('dd/MM/yyyy')?>
- <?=$element->dureeExercice?> Mois</td>
<td align="center"><?php $date = new Zend_Date($element->dateExercicePre, 'yyyyMMdd'); ?> <?=$date->toString('dd/MM/yyyy')?>
- <?=$element->dureeExercicePre?> Mois</td>
<td><a href="<?=$this->url(array('controller'=>'finance','action'=>'liasse',
'siret'=>$this->siret,'id'=>$this->id, 'date'=> $element->dateExercice.':'.$type), 'default', true)?>">
Visualiser</a>
</td>
</tr>
<?php break;?>
<?php }?>
<?php }?>
<?php }?>
</tbody>
</table>
<br/><br/>
</div>
<?php foreach ($this->BilanList as $type => $liste) {?>
<?php if (count($liste) > 0) {?>
<?php
switch ($type) {
case 'N' : $name = 'Réel Normal - Liasse 2050'; break;
case 'S' : $name = 'Simplifié - Liasse 2033'; break;
case 'C' : $name = 'Consolidé - Regroupement des états financier du groupe'; break;
case 'A' : $name = 'Assurance'; break;
case 'B' : $name = 'Banque'; break;
}
?>
<h2>Millésime(s) <?=$name?></h2>
<div class="paragraph">
<table class="liasse">
<thead>
<tr>
<th>Millésime</th>
<th>Date de cloture</th>
<th>Date de cloture N-1</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($liste as $element) {?>
<tr>
<td align="center" style="font-weight:bold;">
<a href="<?=$this->url(array('controller'=>'finance','action'=>'liasse',
'siret'=>$this->siret,'id'=>$this->id, 'date'=> $element->dateExercice.':'.$type), 'default', true)?>">
<?=$element->millesime?></a>
</td>
<td align="center">
<a href="<?=$this->url(array('controller'=>'finance','action'=>'liasse',
'siret'=>$this->siret,'id'=>$this->id, 'date'=> $element->dateExercice.':'.$champType), 'default', true)?>">
<?php $date = new Zend_Date($element->dateExercice, 'yyyyMMdd'); ?> <?=$date->toString('dd/MM/yyyy')?></a>
- <?=$element->dureeExercice?> Mois</td>
<td align="center">
<?php
if ( Zend_Date::isDate($element->dateExercicePre, 'yyyyMMdd') ) {
$date = new Zend_Date($element->dateExercicePre, 'yyyyMMdd');
echo $date->toString('dd/MM/yyyy');
}
?>
- <?php if ($element->dureeExercicePre > 0) {?><?=$element->dureeExercicePre?> Mois<?php } ?>
</td>
<td><a href="<?=$this->url(array('controller'=>'finance','action'=>'liasse',
'siret'=>$this->siret,'id'=>$this->id, 'date'=> $element->dateExercice.':'.$type), 'default', true)?>">
Visualiser</a>
</td>
</tr>
<?php }?>
</tbody>
</table>
</div>
<?php }?>
<?php }?>
<?php } else {?>
<div class="paragraph">
<table>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" class="StyleInfoLib" width="200">Aucun bilan disponible.</td>
</tr>
</table>
</div>
<?php }?>
<?php echo $this->render('cgu.phtml', $this->cgu);?>
</div>

View File

@ -3,5 +3,5 @@ Votre référence : BS<?=$this->ref?>
Merci d'envoyer votre courrier à l'adresse suivante :<br/>
Scores & Décisions,<br/>
Service Production, BS<?=$this->ref?><br/>
19 rue de Clairefontaine,<br/>
1 rue de Clairefontaine,<br/>
78120 Rambouillet

View File

@ -8,7 +8,8 @@
(JJ/MM/AAAA)
<br/><br/>
<label>Format : </label>
<input type="radio" name="format" value="N" checked> Réel normal ou simplifé
<input type="radio" name="format" value="N" checked> Réel normal (Liasse 2050)
<input type="radio" name="format" value="S" checked> Simplifié (Liasse 2033)
<input type="radio" name="format" value="C"> Consolidé
<br/><br/>
<label>Durée de l'exercice (en mois) : </label>
@ -30,7 +31,7 @@ Ce bilan n'est pas confidentiel (saisie gratuite)
<br/>
<input type="radio" name="confidentiel" value="1">
Ce bilan est confidentiel et ne doit être utilisé que pour les utilisateurs
de votre société (+5€ HT par bilan saisit)
de votre société (+5€ HT par bilan saisi)
<br/><br/>
<label>Mode d'envoi du bilan : </label><br/>
<input type="radio" name="method" value="fichier" checked>

View File

@ -6,8 +6,11 @@
<ul class="navigation">
<?php $i = 0; $activeMenudId = 0;?>
<?php foreach ($this->navigation()->getContainer() as $page) {?>
<?php if ( $this->navigation()->accept($page) ) {?>
<?php $class = ''; if ( $page->isActive(true) ) { $class = 'active'; $activeMenudId = $i; } $i++; ?>
<li<?php if ( !empty($class) ) { echo ' class="'.$class.'"'; } ?>>
@ -16,17 +19,25 @@
<?php if ( $page->hasPages() ) {?>
<ul>
<?php foreach ( $page->getPages() as $child ) {?>
<?php if ( $child->getHref() == '#') {?>
<li class="divider"></li>
<?php } else {?>
<li<?php if ( $child->isActive(true) ) { echo ' class="active"'; } ?>><a href="<?=$child->getHref()?>"><?=$child->label?></a></li>
<?php if ( $this->navigation()->accept($child) && $child->isVisible() ) {?>
<?php if ( $child->getHref() == '#') {?>
<li class="divider"></li>
<?php } else {?>
<li<?php if ( $child->isActive(true) ) { echo ' class="active"'; } ?>><a href="<?=$child->getHref()?>"><?=$child->label?></a></li>
<?php }?>
<?php }?>
<?php }?>
</ul>
<?php } ?>
</li>
<?php }?>
<?php }?>
</ul>

View File

@ -2,9 +2,11 @@
<div id="center">
<?php }?>
<?php if ( $this->error) {?>
<?php if ( $this->error ) {?>
<div class="paragraph">
Erreur
</div>
<?php } elseif ( $this->message ) {?>
@ -23,17 +25,9 @@ div.avisrncs-footer p { margin:0; padding:0; }
<div class="paragraph">
<div class="avisrncs-header">
<p>Avis de situtation RNCS édité le <?=$this->AvisDateTxt?></p>
<p>Département Système et Opérations</p>
<p>Société Scores & Décisions SAS</p>
<p>1 rue de Clairefontaine - 78120 Rambouillet</p>
</div>
</div>
<div class="paragraph" style="text-align:right;">
<a target="_blank" href="http://www.inpi.fr/fr/services-et-prestations/reutilisation-des-donnees-de-l-inpi/licences-rncs/liste-des-licencies.html">
Rediffuseur officiel du RNCS</a> - Service distinct
</div>
<div class="avisrncs-title">
<h2><?=$this->translate("AVIS DE SITUATION RNCS")?></h2>
<p><?=$this->translate("REGISTRE NATIONAL DU COMMERCES ET DES SOCIETES")?></p>
@ -44,86 +38,102 @@ Rediffuseur officiel du RNCS</a> - Service distinct
<div class="avisrncs-content">
<h3><?=$this->translate("IDENTIFICATION")?></h3>
<?php if ($this->RadiationDate) {?>
<p style="font:weight;">Cette entreprise est radiée au RNCS.</p>
<?php }?>
<p>Dénomination sociale : <?=$this->Nom?></p>
<p>Sigle : <?=$this->Sigle?></p>
<p>Enseigne : <?=$this->Enseigne?></p>
<p>Nom Commercial : <?=$this->NomComercial?></p>
<p>Numéro d'identification : <?=$this->SirenTexte($this->Siren)?> RCS <?=$this->Tribunal?></p>
<p>Numéro de gestion : <?=$this->NumGest?></p>
<p>Date d'immatriculation : <?=$this->ImmatDate?></p>
<h3><?=$this->translate("RENSEIGNEMENT RELATIF A L'IDENTITE")?></h3>
<p>Forme Juridique : <?=$this->FormeJuridique?></p>
<p>Au capital de : <?=$this->Capital?></p>
<p>Adresse du siège : <?=$this->SiegeAdresse?></p>
<p>Date darrêté des comptes : <?=$this->CompteArretDate?> </p>
<p>Constitution : <?=$this->ConstitutionActeDate?></p>
<p>Dépôt de l'acte constitutif: <?=$this->ConstitutionDepotDate?></p>
<h3><?=$this->translate("ADMINISTRATION")?></h3>
<?php foreach ( $this->Administration as $item ) {?>
<p><?=$item['Fct']?> : <?=$item['Txt']?></p>
<?php }?>
<h3><?=$this->translate("RENSEIGNEMENT RELATIFS A L'ACTIVITE")?></h3>
<p>Origine de la société : <?=$this->Origine?></p>
<p>Activité : <?=$this->Activite?></p>
<p>Commencement de l'activité : <?=$this->ActiviteDate?></p>
<p>Mode d'exploitation : <?=$this->Exploitation?></p>
<h3><?=$this->translate("JUGEMENTS RNCS")?></h3>
<p>&Eacute;vénements : </p>
<div style="margin-left:100px;">
<?php if (count($this->Evenements)>0) {?>
<table>
<?php foreach ( $this->Evenements as $item ) {?>
<tr><td><?=$item?></td></tr>
<?php }?>
</table>
<?php if ($this->RadiationDate) {?>
<p>Date de radiation : <?=$this->RadiationDate?></p>
<?php } else {?>
N&Eacute;ANT.
<?php }?>
</div>
<h3><?=$this->translate("DEPOT LEGAL")?></h3>
<p>Décisions :</p>
<div style="margin-left:100px;">
<?php if ( count($this->Depots)>0 ) {?>
<?php foreach ( $this->Depots as $item ) {?>
<table style="margin:10px 0;">
<tr>
<td>Acte n°<?=$item->ActeNum?> <?php if($item->ActeDate!='0000-00-00') {?>du <?=substr($item->ActeDate,8,2).'/'.substr($item->ActeDate,5,2).'/'.substr($item->ActeDate,0,4)?> <?php }?>
- Depot n°<?=$item->DepotNum?> du <?=substr($item->DepotDate,8,2).'/'.substr($item->DepotDate,5,2).'/'.substr($item->DepotDate,0,4)?></td>
</tr>
<tr>
<td><?=$item->ActeTypeLabel?></td>
</tr>
<?php foreach ($item->infos->item as $detail) {?>
<tr>
<td><?=$detail?></td>
</tr>
<?php }?>
</table>
<h3><?=$this->translate("RENSEIGNEMENT RELATIF A L'IDENTITE")?></h3>
<p>Forme Juridique : <?=$this->FormeJuridique?></p>
<p>Au capital de : <?=$this->Capital?></p>
<p>Adresse du siège : <?=$this->SiegeAdresse?></p>
<p>Date darrêté des comptes : <?=$this->CompteArretDate?> </p>
<p>Constitution : <?=$this->ConstitutionActeDate?></p>
<p>Dépôt de l'acte constitutif: <?=$this->ConstitutionDepotDate?></p>
<h3><?=$this->translate("ADMINISTRATION")?></h3>
<?php foreach ( $this->Administration as $item ) {?>
<p><?=$item['Fct']?> : <?=$item['Txt']?></p>
<?php }?>
<h3><?=$this->translate("RENSEIGNEMENT RELATIF A L'ACTIVITE")?></h3>
<p>Origine de la société : <?=$this->Origine?></p>
<p>Activité : <?=$this->Activite?></p>
<p>Activité déclarée au BODACC : <?=$this->BodaccActivite?></p>
<p>Commencement de l'activité : <?=$this->ActiviteDate?></p>
<p>Mode d'exploitation : <?=$this->Exploitation?></p>
<h3><?=$this->translate("JUGEMENTS RNCS")?></h3>
<p>&Eacute;vénements : </p>
<div style="margin-left:100px;">
<?php if (count($this->Evenements)>0) {?>
<table>
<?php foreach ( $this->Evenements as $item ) {?>
<tr><td><?=$item?></td></tr>
<?php }?>
</table>
<?php } else {?>
N&Eacute;ANT.
<?php }?>
</div>
<h3><?=$this->translate("DEPOT LEGAL")?></h3>
<p>Décisions :</p>
<div style="margin-left:100px;">
<?php if ( count($this->Depots)>0 ) {?>
<?php foreach ( $this->Depots as $item ) {?>
<table style="margin:10px 0;">
<tr>
<td>Acte n°<?=$item->ActeNum?> <?php if($item->ActeDate!='0000-00-00') {?>du <?=substr($item->ActeDate,8,2).'/'.substr($item->ActeDate,5,2).'/'.substr($item->ActeDate,0,4)?> <?php }?>
- Depot n°<?=$item->DepotNum?> du <?=substr($item->DepotDate,8,2).'/'.substr($item->DepotDate,5,2).'/'.substr($item->DepotDate,0,4)?></td>
</tr>
<tr>
<td><?=$item->ActeTypeLabel?></td>
</tr>
<?php foreach ($item->infos->item as $detail) {?>
<tr>
<td><?=$detail?></td>
</tr>
<?php }?>
</table>
<p>Liste non exhaustive.</p>
<?php }?>
<?php } else {?>
N&Eacute;ANT.
<?php }?>
</div>
<h3><?=$this->translate("AUTRES ETABLISSEMENTS")?></h3>
<p>Liste des établissements actifs :</p>
<div style="margin-left:100px;">
<table>
<?php foreach ( $this->Etablissements as $etab ) {?>
<tr><td><?=$etab?></td></tr>
<?php }?>
</table>
</div>
<?php }?>
<?php } else {?>
N&Eacute;ANT.
<?php }?>
</div>
<h3><?=$this->translate("AUTRES ETABLISSEMENTS")?></h3>
<p>Liste des établissements actifs :</p>
<div style="margin-left:100px;">
<table>
<?php foreach ( $this->Etablissements as $etab ) {?>
<tr><td><?=$etab?></td></tr>
<?php }?>
</table>
</div>
</div>
</div>
@ -131,17 +141,9 @@ N&Eacute;ANT.
<div class="avisrncs-footer">
<p>Fin de l'avis de situation</p>
<p>Avis de situation RNCS édité le <?=$this->AvisDateTxt?></p>
<p>Département Système et Opérations</p>
<p>Société Scores & Decisions SAS</p>
<p>1 rue de Clairefontaine - 78120 Rambouillet</p>
<p>support@scores-decisions.com</p>
</div>
</div>
<?php echo "<pre>"; ?>
<?php //print_r($this->exportObjet);?>
<?php echo "</pre>"; ?>
<?php if (empty($this->AutrePage)) {?>
<?=$this->render('cgu.phtml', $this->cgu)?>
<?php }?>

View File

@ -0,0 +1,23 @@
<?php if (empty($this->AutrePage)) {?>
<div id="center">
<?php }?>
<?php if ( $this->error ) {?>
<div class="paragraph">
Erreur
</div>
<?php } elseif ( $this->message ) {?>
<?=$this->message?>
<?php } else {?>
Erreur inconnu.
<?php }?>
<?php if (empty($this->AutrePage)) {?>
</div>
<?php }?>

View File

@ -32,10 +32,11 @@
<td width="200" class="StyleInfoLib"><?=$this->translate("Actif")?> / <?=$this->translate("Inactif")?></td>
<td width="350" class="StyleInfoData">
<form name="options" method="post" action="<?=$this->url(array(
'action' => 'etablissements',
'siret' => $this->siret,
'id' => $this->id,
), 'default', true);?>">
'controller' => 'identite',
'action' => 'etablissements',
'siret' => $this->siret,
'id' => $this->id,
), 'default', true);?>">
<select name="actif">
<option value="-1"<?=($this->actif==-1)? ' selected' : '';?>><?=$this->translate("Tous")?></option>
<option value="1"<?=($this->actif==1)? ' selected' : '';?>><?=$this->translate("Actif")?></option>

View File

@ -97,6 +97,7 @@ $('img.wcheck').each(function(){
<table>
<?php
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['RaisonSociale']);
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['Nom2']);
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['NomCommercial']);
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['EnseigneSigle']);
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['FormeJuridique']);

View File

@ -1,10 +1,12 @@
<style>.jstree-default a.jstree-search { color: red; }</style>
<div>Tête de groupe
<select name="isin">
<option value="1" <?php if($this->isin==1) { echo ' selected'; }?>>coté, détention minimum à 50%</option>
<option value="0" <?php if($this->isin==0) { echo ' selected'; }?>>détention minimum à 50%</option>
</select>
</div>
<div>
Filiales, détention minimum
<select name="pctMin">
@ -17,12 +19,13 @@ Filiales, détention minimum
</select>
<input id="filter" type="button" value="Filtrer" style="float:right;">
</div>
<div>
<div>
<input id="text" type="text" value="">
<input id="search" type="button" value="Rechercher">
<input id="clear_search" type="button" value="Initialiser">
</div>
<div id="groups" class="jstree jstree-default" style="overflow:auto;"></div>
<script src="/libs/jstree/jstree.min.js"></script>
<script>

View File

@ -39,8 +39,8 @@
<?php } else {?>
<?=$this->result->raisonSociale?>
<?php if (intval($this->result->siren)!=0) {?>(<?=$this->result->siren?>)<?php }?>
<?php if ($this->result->actif==0) {?>(inactif)<?php }?>
<?php if (intval($this->result->siren)!=0) {?> (<?=$this->result->siren?>)<?php }?>
<?php if ($this->result->actif==0) {?> (inactif)<?php }?>
<?php }?>
</div>

View File

@ -220,7 +220,7 @@ Cette entreprise est une personne physique exerçant son activité en nom propre
}
else '&nbsp;';
if ($lien->pays<>'France') echo '<b>'.$lien->pays.'</b>';
if ($lien->pays!='France') echo ' <b>'.$lien->pays.'</b>';
//@todo : Afficher les identifiants pays
?>

View File

@ -1 +1,17 @@
<?php
<div id="center">
<h1>A propos</h1>
<h2>Version & Nouveautés</h2>
<h2>Assistance</h2>
<h2>Mentions légales</h2>
<h2>Conditions d'utilisation</h2>
<h2>Politique de confidentialité</h2>
<h2>Utilisation des cookies</h2>
</div>

View File

@ -1 +1,20 @@
<?php
<div id="center">
<h1>Votre compte</h1>
<h2>Service</h2>
<h2>Votre administrateur</h2>
<div class="paragraph">
Nom Prénom Adresse Email Téléphone
</div>
+ support@scores-decisions.com (mailto)
<h2>Vos accès</h2>
</div>

View File

@ -1,13 +1,89 @@
<pre>
Paramètres
Général => Préférences, Dernières connexion
Compte => Les accès autorisés, l'appartenance au service, personne gerant les accès
A propos
Version & Nouveautés => Version de l'application
Assistance => Rappel des éléments de support
Mentions légales
Conditions d'utilisation
Politique de confidentialité
Utilisation des cookies
Déconnexion
</pre>
<div id="center">
<h1>Vos paramètres</h1>
<h2>Historique de connexion</h2>
<div class="paragraph">
<table class="table table-striped">
<thead>
<tr>
<th>Navigateur</th>
<th>Système</th>
<th>Adresse IP</th>
<th>Connexion</th>
<th>Horodatage</th>
</tr>
</thead>
<tbody>
<tr>
<td>Firefox</td>
<td>Windows 7</td>
<td>88.163.21.135</td>
<td>Echec</td>
<td>2014-08-18 12:00:00</td>
</tr>
</tbody>
</table>
</div>
<h2>Préférences</h2>
<div class="paragraph">
<div class="checkbox">
<label>
<input type="checkbox" value="">
Afficher les anciens NAF
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" value="">
Afficher les codes NACES
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" value="">
Afficher les news Google©
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" value="">
Afficher les façades d'immeubles
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" value="">
Afficher les cartes et les plans
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" value="">
Afficher les entités sous surveillances
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" value="">
Demande de référence par defaut
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" value="">
Afficher le formulaire de recherche par référence
</label>
</div>
</div>
</div>

View File

@ -1 +1,4 @@
<?php
<pre>
Support
</pre>

View File

@ -0,0 +1,57 @@
<?php if ( $this->form == 'display') {?>
<p>Commande de la saisie des chiffres du bilan <?=substr($this->date,8,2).'/'.substr($this->date,5,2).'/'.
substr($this->date,0,4)?> pour intégration et calcul dans les éléments financier.<p>
<?php if ( $this->isAuthorize ) {?>
<div id="output">
<small>Des frais supplémentaires peuvent s'appliquer suivant vos accords contractuels.</small>
<form method="post" name="cmd" action="<?=$this->url(array('controller'=>'pieces','action'=>'bilanenter'),'default',true)?>">
<input type="hidden" name="siren" value="<?=$this->siren?>"/>
<input type="hidden" name="date" value="<?=$this->date?>"/>
<input type="hidden" name="type" value="<?=$this->type?>"/>
</div>
</form>
<script>
$('#dialogcmd').dialog({ buttons: [
{ text: "Commander", click: function() {
var url = $('form[name=cmd]').attr('action');
var formdata = $('form[name=cmd]').serialize();
$('#dialogcmd > #output').html("Enregistrement en cours...");
$.post(url, formdata, function(data){
$('#dialogcmd > #output').html(data);
});
}
},
{ text: "Fermer", click: function() { $(this).dialog("close"); } }
] });
</script>
<?php } else {?>
<script>
$('#dialogcmd').dialog({ buttons: [
{ text: "Fermer", click: function() { $(this).dialog("close"); } }
] });
</script>
<?php }?>
<?php } else {?>
<?php if ( $this->err ) {?>
<?=$this->err?>
<?php } else {?>
Commande enregistré sous la référence <?=$this->msg?>
<?php }?>
<script>
$('#dialogcmd').dialog({ buttons: [
{ text: "Fermer", click: function() { $(this).dialog("close"); } }
] });
</script>
<?php }?>

View File

@ -60,20 +60,20 @@ Les éléments disponibles ci-dessous en téléchargement ou commande peuvent fa
<?php
switch( $bilan['mode'] ) {
case 'T':
?>
?>
<span class="fichier">
<a href="<?=$bilan['href']?>" title="<?=$bilan['title']?>">
<img alt="PDF" src="/themes/default/images/interfaces/icone_pdf.gif"/>
</a>
</span>
<?php
<?php
break;
case 'C':
?>
?>
<a class="dialogcmd" href="<?=$bilan['href']?>" title="<?=$bilan['title']?>">
<img alt="Courrier" src="/themes/default/images/interfaces/icone_courrier.png"/>
</a>
<?php
<?php
break;
}
?>
@ -88,6 +88,11 @@ Les éléments disponibles ci-dessous en téléchargement ou commande peuvent fa
<?php if ( $bilan['saisie'] ) {?>
<i><?=$bilan['saisie']?></i>
<?php }?>
<?php if ( $bilan['isEnter']==0 && $bilan['mode']=='T' ) {?>
<a class="dialogcmd" href="<?=$this->url(array('controller'=>'pieces', 'action'=>'bilanenter',
'siren'=>$this->siren, 'date'=>$bilan['dateIso'], 'type'=>$bilan['typeCode']), 'default', true)?>">
Demander la saisie du bilan</a>
<?php }?>
<?php if ( $this->ModeEdition ) {?>
<br/><a href="<?=$bilan['factice']?>" target="_blank">Créer une commande factice.</a>
<?php }?>

View File

@ -5,9 +5,9 @@
<?php } elseif ( $this->mode == 'C' ) {?>
<div id="output">
<form name="" action="" method="post">
<?php if( $this->emailValid ) {?>
<form name="commande" action="<?=$this->url(array('controller'=>'pieces', 'action'=>'kbis'))?>" method="post">
<div class="fieldgrp"><p>
<?=$this->translate("Commande de KBIS demandé pour la société");?> <strong><?=$this->raisonSociale?> (<?=$this->siren;?>)</strong><br/>
<?=$this->translate("Vous recevrez un email (sous 2 à 3 semaines) lorsque le document sera disponible.");?>
@ -45,6 +45,7 @@
<label><?=$this->translate("Votre Ville");?></label>
<div class="field"><input class="longfield" type="text" name="ville" value="<?=$this->ville?>"/></div>
</div>
</form>
<?php } else {?>
<div class="fieldgrp">
<div class="field" style="color:red;"><?=$this->translate("Commande impossible. L'email de votre compte est invalide");?></div>
@ -57,9 +58,6 @@
<?php }?>
</div>
</form>
</div>
<?php } elseif ( $this->mode == 'M' ) {?>
<div id="output">
@ -115,7 +113,6 @@
<input class="longfield" name="email" type="text" value="<?=$this->email?>" size="100"/>
</div>
</div>
</label>
</form>
</div>

View File

@ -3,8 +3,8 @@
'controller'=>'recherche', 'action'=>'refclientliste'), 'default', true)?>">
<input type="hidden" name="type" value="refclient" />
<div class="row">
<label style="font-size:1.1em;padding: 0.4em 5px 0.4em 0;">Référence client</label>
<input type="text" name="ref" value="" style="font-size:1.1em;padding: 0.4em 1em;" />
<label>Référence client</label>
<input type="text" name="ref" value=""/>
<input class="button" type="submit" name="submit" value="Rechercher" />
</div>
</form>

View File

@ -52,6 +52,8 @@ span.poste input { width:50px; }
?>
</div>
<div id="saveMsg" style="text-align:center;width:100%;height:30px;clear:both;"></div>
<input type="hidden" name="originalDateCloture" value="<?=$this->dateCloture?>"/>
<input type="hidden" name="originalTypeBilan" value="<?=$this->typeBilan?>"/>
<div style="text-align:center;">
<input type="submit" class="button" id=onlycheck name="onlycheck" value="Verifier" />
<input type="submit" class="button" id="normal" name="normal" value="Publier" />
@ -64,19 +66,25 @@ span.poste input { width:50px; }
<div id="debug"><span></span></div>
<?=$this->partial()->view->inlineScript();?>
<script>
<?php if ($this->typeBilan!='S') { ?>
$('span#typeBilan').editable(function(value, settings) { return value; }, {
data : {'C':'C', 'N':'N', 'selected':'<?=$this->typeBilan?>'},
type : 'select',
tooltip : 'Click to edit',
});
<?php } ?>
$(document).ready(function(){
$.datepicker.setDefaults( $.datepicker.regional['fr'] );
});
$('span.unit').editable(function(value, settings) {
return value;
}, {
$('span.unit').editable(function(value, settings) { return value; }, {
data : {'U':'&euro;','K':'K&euro;','M':'M&euro;', 'selected':'<?=$this->unite?>'},
type : 'select',
tooltip : 'Click to edit',
});
$('input.dateCloture').datepicker();
$('input.dateCloture').datepicker({ maxDate: 1 });
$('span.duree').editable(function(value, settings) {
if ( isFloat(value) && value.length<3 ) {
@ -155,14 +163,16 @@ span.poste input { width:50px; }
}
});
var sendValues = {
step: step,
unite: $('span#unit').html(),
dateCloture: $('input#dateCloture').val(),
dureeMois: $('span#dureeMois').html(),
dateCloturePre: $('input#dateCloturePre').val(),
dureeMoisPre: $('span#dureeMoisPre').html(),
typeBilan: $('span#typeBilan').html(),
postes: strPostes
step: step,
originalDateCloture: $('input[name=originalDateCloture]').val(),
originalTypeBilan: $('input[name=originalTypeBilan]').val(),
unite: $('span#unit').html(),
dateCloture: $('input#dateCloture').val(),
dureeMois: $('span#dureeMois').html(),
dateCloturePre: $('input#dateCloturePre').val(),
dureeMoisPre: $('span#dureeMoisPre').html(),
typeBilan: $('span#typeBilan').html(),
postes: strPostes
};
if (step=='debug') {
var debug = '';

View File

@ -1,7 +1,7 @@
<?php $ancres = array_keys($this->ancres); ?>
<div class="clearfix">
<label>Type de bilan</label>
<span id="typeBilan"><?=$this->typeBilan?></span>
<span id="typeBilan" class="editable"><?=$this->typeBilan?></span>
</div>
<div class="clearfix">
<label>Valeurs exprimées en </label>

View File

@ -4,4 +4,4 @@
'action' => 'portefeuille',
))?>" id="dl">Exporter votre portefeuille au format CSV</a>
</p>
<div id="dlMsg"></div>
<div class="paragraph" id="dlMsg"></div>

View File

@ -2,17 +2,11 @@
<label>Extraire uniquement les surveillances de type</label>
<select name="source">
<option value="">toutes</option>
<?php
foreach ($this->tabSource as $s) {
?>
<?php foreach ($this->tabSource as $s) { ?>
<option value="<?=$s['value']?>"<?=$s['select']?>><?=$s['name']?></option>
<?php
}
?>
<?php } ?>
</select>
<a href="<?=$this->url(array(
'controller' => 'telechargement',
'action' => 'surveillance',
))?>" id="dl">Ok</a>
<a href="<?=$this->url(array( 'controller' => 'telechargement', 'action' => 'surveillance'),
'default', true)?>" id="dl">Ok</a>
</p>
<div id="dlMsg"></div>
<div class="paragraph" id="dlMsg"></div>

View File

@ -17,11 +17,7 @@
<div class="infoTitle StyleInfoLib">Identifiant utilisateur</div>
<div class="infoData">
<?php
if ($this->action != 'new') {
echo $this->loginVu;
} else {
?>
<?php if ($this->action != 'new') { echo $this->loginVu; } else { ?>
<input type="text" size="20" maxlength="80" name="frmOptions[login]" value="<?=$this->loginNew?>"/>
<?php } ?>
</div>
@ -32,7 +28,7 @@ if ($this->action != 'new') {
<input type="text" size="20" maxlength="80" name="frmOptions[nom]" value="<?=$this->options->nom?>"/>
<input type="text" size="20" maxlength="80" name="frmOptions[prenom]" value="<?=$this->options->prenom?>"/>
<?php
} else { echo $this->options->nom.' '.$this->options->prenom ; } ?>
} else { echo $this->options->nom.' '.$this->options->prenom; } ?>
</div>
<div class="infoTitle StyleInfoLib">R&eacute;f. facturation (service, etc...)</div>
@ -54,12 +50,9 @@ if ($this->action != 'new') {
'controller' => 'user', 'action' => 'email',
'q' => $this->options->email,
))?>">Editer e-mail du compte</button>
<button id="user-emailsecondary" data-href="<?=$this->url(array(
'controller' => 'user', 'action' => 'emailsecondary',
'idClient' => $this->options->idClient,
'login' => $this->loginVu,
))?>">Voir ou associer des e-mails secondaires</button>
<button id="user-emailsecondary" data-href="<?=$this->url(array('controller' => 'user', 'action' => 'emailsecondary',
'idClient' => $this->options->idClient, 'login' => $this->loginVu,))?>">
Voir ou associer des e-mails secondaires</button>
<script>
$('button#user-emails').button({ icons: { primary: "ui-icon-pencil" }, text: false}).click(function(e) {
e.preventDefault();
@ -112,7 +105,6 @@ $('button#user-emailsecondary').button({icons: { primary: "ui-icon-plusthick" },
<input type="hidden" name="frmOptions[email]" value="<?=$this->options->email?>"/>
<div class="infoTitle StyleInfoLib">
Num&eacute;ros de t&eacute;l&eacute;phone<br/><i>(Fixe, Fax, Mobile)</i>
</div>
@ -127,7 +119,7 @@ Num&eacute;ros de t&eacute;l&eacute;phone<br/><i>(Fixe, Fax, Mobile)</i>
<div class="infoData last">
<?php
if ($this->action=='new') {
$typeChamp = 'password';
$typeChamp = 'text';
$changePassword = 1;
} else {
$typeChamp = 'hidden';
@ -137,18 +129,15 @@ if ($this->action=='new') {
<?php
}
?>
<input type="<?=$typeChamp?>" name="frmOptions[password]" value="password"/>
<input type="hidden" name="frmOptions[changepwd]" value="<?php echo $changePassword?>"/>
<input type="<?=$typeChamp?>" name="frmOptions[password]" value="<?=$this->password?>"/>
<input type="hidden" name="frmOptions[changepwd]" value="<?=$changePassword?>"/>
</div>
<div class="infoTitle StyleInfoLib">Relevé de consommation</div>
<?php
//Consomation
if ($this->isAdmin || $this->isSuperAdmin){
echo $this->action('conso', 'user', null, array(
'login' => $this->loginVu,
'idClient' => $this->options->idClient)
);
if ( $this->isAdmin || $this->isSuperAdmin ) {
echo $this->action('conso', 'user', null, array('login'=>$this->loginVu, 'idClient'=>$this->options->idClient));
}
?>

View File

@ -1,3 +1,81 @@
<div id="center">
<h1>ADMINISTRATION</h1>
<h2>Relevé de consommation complet</h2>
<div class="paragraph">
<?=$this->action('conso', 'user', null , array('login'=>$this->login, 'idClient'=>$this->idClient));?>
</div>
<h2>Liste des profils utilisateurs</h2>
<div class="paragraph">
<a href="<?=$this->url(array('controller' => 'user','action' => 'index','op' => 'new'), 'default', true)?>">
Créer un profil utilisateur</a>
</div>
<div class="paragraph">
<?php if (count($this->utilisateurs)>0) {?>
<table id="utilisateur" class="data">
<?php if (isset($message) && $message != '') {?>
<tr>
<td width="30">&nbsp;</td>
<td colspan="5" class="StyleInfoData" align="center">
<h3><?=$message?></h3>
</td>
</tr>
<?php } ?>
<tr class="titre">
<td class="StyleInfoLib">Login</td>
<td class="StyleInfoLib">Actions</td>
<td class="StyleInfoLib">Actif</td>
<td class="StyleInfoLib">Informations</td>
<td class="StyleInfoLib">Référence</td>
</tr>
<?php
foreach ($this->utilisateurs as $uti) {
$lienParams = ' login="'.$uti->login.'"';
?>
<tr>
<td class="StyleInfoData"><?=$uti->login;?></td>
<td align="center" valign="middle">
<a href="<?=$this->url(array(
'controller' => 'user',
'action' => 'edit',
'login' => $uti->login,
))?>" class="edit">
<img src="/themes/default/images/interfaces/edit0.gif" title="Editer le profil utilisateur" width="16" height="16"/>
</a>
<a href="<?=$this->url(array('controller' => 'user','action' => 'delete', 'login' => $uti->login,
'idUti' => $uti->idUti))?>" class="delete" title="Supprimer l'utilisateur <?=$uti->login?>">
<img src="/themes/default/images/interfaces/delete.gif" title="Supprimer le profil utilisateur" width="11" height="11"/>
</a>
</td>
<td class="StyleInfoData">
<?php if ($uti->actif == 1) { ?>
<a href="<?=$this->url(array('controller' => 'user', 'action' => 'disable', 'login' => $uti->login,
'idUti' => $uti->idUti))?>" class="disable" title="Désactiver le profil utilisateur <?=$uti->login?>">
<u><font color="green">Oui</font></u>
</a>
<?php } else { ?>
<a href="<?=$this->url(array('controller' => 'user', 'action' => 'enable', 'login' => $uti->login,
'idUti' => $uti->idUti ))?>" class="enable" title="Activer le profil utilisateur <?=$uti->login?>">
<u><font color="red">Non</font></u>
</a>
<?php } ?>
</td>
<td class="StyleInfoData">
<?php echo $uti->nom.' '.$uti->prenom?><br/>
<a href="mailto:<?php echo $uti->email?>">
<?php echo str_replace(array(';',','), array('<br/>', '<br/>'), $uti->email);?>
</a>
</td>
<td class="StyleInfoData"><?php echo $uti->reference?></td>
</tr>
<?php }?>
</table>
<?php }?>
</div>
</div>
<script>
$(document).ready(function(){
$('a.delete').on('click', function(e){
@ -25,107 +103,4 @@ $(document).ready(function(){
}
});
});
</script>
<div id="center">
<h1>ADMINISTRATION</h1>
<h2>Relevé de consommation complet</h2>
<div class="paragraph">
<?=$this->action('conso', 'user', null , array('login'=>$this->login, 'idClient'=>$this->idClient));?>
</div>
<h2>Liste des profils utilisateurs</h2>
<div class="paragraph">
<table id="utilisateur">
<?php if (isset($message) && $message != '') {?>
<tr>
<td width="30">&nbsp;</td>
<td colspan="5" class="StyleInfoData" align="center">
<h3><?=$message?></h3>
</td>
</tr>
<?php } ?>
<tr class="border titre">
<td class="StyleInfoLib">Login</td>
<td class="StyleInfoLib">Actions</td>
<td class="StyleInfoLib">Actif</td>
<td class="StyleInfoLib">Informations</td>
<td class="StyleInfoLib">Référence</td>
</tr>
<?php
if (count($this->utilisateurs)>0) {
foreach ($this->utilisateurs as $uti) {
$lienParams = ' login="'.$uti->login.'"';
?>
<tr class="border">
<td class="StyleInfoData"><?=$uti->login;?></td>
<td align="center" valign="middle">
<a href="<?=$this->url(array(
'controller' => 'user',
'action' => 'edit',
'login' => $uti->login,
))?>" class="edit">
<img src="/themes/default/images/interfaces/edit0.gif" title="Editer le profil utilisateur" width="16" height="16"/>
</a>
<a href="<?=$this->url(array(
'controller' => 'user',
'action' => 'delete',
'login' => $uti->login,
'idUti' => $uti->idUti,
))?>" class="delete" title="Supprimer l'utilisateur <?=$uti->login?>">
<img src="/themes/default/images/interfaces/delete.gif" title="Supprimer le profil utilisateur" width="11" height="11"/>
</a>
</td>
<td class="StyleInfoData">
<?php
if ($uti->actif == 1) {
?>
<a href="<?=$this->url(array(
'controller' => 'user',
'action' => 'disable',
'login' => $uti->login,
'idUti' => $uti->idUti,
))?>" class="disable" title="Désactiver le profil utilisateur <?=$uti->login?>">
<u><font color="green">Oui</font></u>
</a>
<?php
} else {
?>
<a href="<?=$this->url(array(
'controller' => 'user',
'action' => 'enable',
'login' => $uti->login,
'idUti' => $uti->idUti,
))?>" class="enable" title="Activer le profil utilisateur <?=$uti->login?>">
<u><font color="red">Non</font></u>
</a>
<?php
}
?>
</td>
<td class="StyleInfoData">
<?php echo $uti->nom.' '.$uti->prenom?><br/>
<a href="mailto:<?php echo $uti->email?>">
<?php echo str_replace(array(';',','), array('<br/>', '<br/>'), $uti->email);?>
</a>
</td>
<td class="StyleInfoData"><?php echo $uti->reference?></td>
</tr>
<?php
}
}
?>
<tr><td colspan="5">&nbsp;</td></tr>
<tr>
<td colspan="5" align="center">
<a href="<?=$this->url(array(
'controller' => 'user',
'action' => 'index',
'op' => 'new'
))?>">Créer un profil utilisateur</a>
</td>
</tr>
</table>
</div>
</div>
</script>

View File

@ -1,3 +1,3 @@
html { filter: expression(document.execCommand("BackgroundImageCache", false, true)); }
button { border:0; }
.pagination {border:1px solid #CDCDCD;border-radius:3px;width:231px;margin:0 auto;}

View File

@ -437,8 +437,8 @@ div.paragraph {margin:5px;padding:5px;}
a:link {color: #9c093a; text-decoration:none;}
a:visited {color: #0000CC; text-decoration:none;}
a:hover {color: #000066; text-decoration:none;}
.StyleInfoLib {font-family: Arial, Helvetica, sans-serif;font-size:11px;font-weight:bold;color:#535353; vertical-align:top;line-height:16px;}
.StyleInfoData {font-family: Arial, Helvetica, sans-serif;font-size:11px;color:#535353;line-height:16px;}
.StyleInfoLib {font-family: Arial, Helvetica, sans-serif;font-size:11px;font-weight:bold;color:#535353; vertical-align:top;line-height:18px;}
.StyleInfoData {font-family: Arial, Helvetica, sans-serif;font-size:11px;color:#535353;line-height:18px;}
.StyleInfoDataActif {font-family: Arial, Helvetica, sans-serif;font-size:11px;line-height:16px;}
table.identite {border-collapse:separate;border-spacing:4px;}
table.data {width:100%;}
@ -577,7 +577,7 @@ a.AncienSiege { background-color: #4D90FE; border: 1px solid #3079ED; color: #FF
#liasseForm td {color:#606060;}
#synthese {border-collapse: collapse;clear: both;font-size: 12px;padding: 2px;text-align: left;width: 100%;font-family: arial,sans-serif;font-size: 11px;}
#synthese .head {font-weight: bold;}
#synthese th {background: none repeat scroll 0 0 #B9C9FE;border: 1px solid #FFFFFF;color: #003399;font-size: 13px;font-weight: normal;padding: 4px;}
#synthese th {background-color:#B9C9FE; border:1px solid #FFFFFF; color:#003399; font-size:13px; font-weight:normal; padding:4px;}
#synthese td.right {text-align: right;}
#synthese td {background: none repeat scroll 0 0 #E8EDFF;border: 1px solid #FFFFFF;color: #666699;padding: 4px;}
#synthese tr:hover td {background: none repeat scroll 0 0 #D0DAFD;}

View File

@ -1,6 +0,0 @@
#dialog-password { display:none; }
#utilisateur { width:100%; border-collapse:collapse; margin:0;}
#utilisateur tr.titre td { background-color: #D9EEF1; font-weight:bold; }
#utilisateur tr.border td { border:1px dashed #939393; padding:5px; margin:0;}
fieldset { margin:0 0 10px 0; padding:5px; border:1px solid; }
fieldset legend { color: #535353; font-family: Arial,Helvetica,sans-serif; font-size: 11px; font-weight: bold; }

View File

@ -1,18 +1,18 @@
APACHE 2.2
==========
<VirtualHost *>
ServerName extranet.scores-decisions.com
AddDefaultCharset utf-8
DocumentRoot /var/www/extranet/public
<VirtualHost *:80>
ServerName extranet.scores-decisions.com
AddDefaultCharset utf-8
DocumentRoot /var/www/extranet/public
SetEnv APPLICATION_ENV "production"
SetEnv APPLICATION_ENV "production"
<Directory /var/www/extranet/public/>
<Directory /var/www/extranet/public/>
AllowOverride none
Order allow,deny
Allow from all
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteCond %{REQUEST_URI} ^/favicon.ico$ [OR]
@ -22,39 +22,38 @@ APACHE 2.2
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>
</Directory>
</Directory>
<IfModule mod_deflate.c>
<IfModule mod_deflate.c>
<Location />
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-http-php
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:ext|t?gz|zip|bz2|sit|tar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:pdf|avi|mov|mp3|mp4|rm)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</Location>
</IfModule>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-http-php
ExpiresActive On
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:ext|t?gz|zip|bz2|sit|tar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:pdf|avi|mov|mp3|mp4|rm)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</Location>
</IfModule>
ExpiresActive On
<FilesMatch "\.(ico|flv|jpg|jpeg|png|gif|swf)$">
<FilesMatch "\.(ico|flv|jpg|jpeg|png|gif|swf)$">
Header unset Cookie
Header unset Set-Cookie
#Header set Cache-Control "max-age=432000, public"
@ -62,9 +61,9 @@ APACHE 2.2
Header append vary "User-Agent"
ExpiresDefault "modification plus 5 days"
FileEtag None
</FilesMatch>
</FilesMatch>
<FilesMatch "\.(js|css)$">
<FilesMatch "\.(js|css)$">
Header unset Cookie
Header unset Set-Cookie
#Header set Cache-Control "max-age=432000, public"
@ -72,16 +71,43 @@ APACHE 2.2
Header append vary "User-Agent"
ExpiresDefault "modification plus 5 days"
FileEtag None
</FilesMatch>
</FilesMatch>
BrowserMatch "MSIE" force-no-vary
BrowserMatch "MSIE" force-no-vary
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel error
ErrorLog /var/log/apache2/extranet-error.log
CustomLog /var/log/apache2/extranet-access.log combined
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel error
ErrorLog /var/log/apache2/extranet-error.log
CustomLog /var/log/apache2/extranet-access.log combined
</VirtualHost>
APACHE 2.4
==========
==========
<VirtualHost *:80>
ServerName extranet.sd.dev
AddDefaultCharset utf-8
SetEnv APPLICATION_ENV "development"
DirectoryIndex index.php
DocumentRoot /home/vhosts/extranet/public
<Directory /home/vhosts/extranet/public/>
EnableSendfile Off
AllowOverride none
Require all granted
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteCond %{REQUEST_URI} ^/favicon.ico$ [OR]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>
</Directory>
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel debug
ErrorLog /home/vhosts/apachelog/extranet-error.log
CustomLog /home/vhosts/apachelog/extranet-access.log combined
</VirtualHost>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
<?php
class Application_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
//Authenticate ?
//Construct
$auth = Zend_Auth::getInstance();
if ( $auth->hasIdentity() ) {
// Standard resources
$acl = include APPLICATION_PATH . '/configs/acl.config.php';
// User details
$externalResources = $auth->getIdentity()->droits;
$userResources = array();
if ( !empty($externalResources) ) {
$userResources = explode(' ', $externalResources);
}
$scoresAcl = new Scores_Acl($acl);
// Profil - Role
$profil = $auth->getIdentity()->profil;
// Prepare resources allowed or denied
foreach ( $acl['resources'] as $r => $value) {
if ( in_array($r, $userResources) ) {
$scoresAcl->allow($profil, $r);
} else {
$scoresAcl->deny($profil, $r);
}
}
Zend_Registry::set('acl', $scoresAcl);
}
}
}

View File

@ -1,7 +1,7 @@
<?php
class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$checkAuth = true;
if ($request->getControllerName()=='user' && $request->getActionName()=='login') {
@ -12,6 +12,10 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
$checkAuth = false;
}
if ($request->getControllerName()=='auth') {
$checkAuth = false;
}
if ($request->getControllerName()=='fichier'
&& $request->getClientIp(false)=='78.31.45.206') {
$checkAuth = false;
@ -33,7 +37,7 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
$iponly = true;
}
//On vérifie le tout lors d'une connexion par url
// --- On vérifie le tout lors d'une connexion par url
if ( !empty($login) && !empty($hach) ) {
$authAdapter = new Scores_Auth_Adapter_Ws($login, $hach, $iponly);
@ -41,7 +45,7 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
if ( $result->isValid() ) {
//Store identity in sesssion
// --- Store identity in sesssion
$storage = new Zend_Auth_Storage_Session();
$session = new Zend_Session_Namespace($storage->getNamespace());
$auth->setStorage($storage);
@ -66,58 +70,60 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
->setParam('message', $messageF);
}
//Sinon on reste sur le standard
// --- Sinon on reste sur le standard
} else {
//Authentifié => on met à jour la session
if ( $auth->hasIdentity() && time() < $auth->getIdentity()->time ) {
$identity = $auth->getIdentity();
$identity->time = time() + $identity->timeout;
$auth->getStorage()->write($identity);
if (Zend_Session::namespaceIsset('login')){
Zend_Session::namespaceUnset('login');
}
//Check CGU
if ( $request->getControllerName()!='aide'
&& $request->getActionName()!='cgu'
&& $request->getControllerName()!='user'
&& $request->getActionName()!='logout') {
if ( empty($identity->acceptationCGU)
|| $identity->acceptationCGU=='0000-00-00 00:00:00' ) {
$request->setModuleName('default')
->setControllerName('aide')
->setActionName('cgu');
}
}
//Temps de connexion dépassé
} elseif ( $auth->hasIdentity() && time() > $auth->getIdentity()->time ) {
$auth->clearIdentity();
$storage = $auth->getStorage();
Zend_Session::namespaceUnset($storage->getNamespace());
if (!$request->isXmlHttpRequest()) {
$session = new Zend_Session_Namespace('login');
$session->url = $_SERVER['REQUEST_URI'];
// --- Authentifié
if ( $auth->hasIdentity() ) {
// --- Mise à jour du délai de connexion
if ( time() < $auth->getIdentity()->time ) {
$identity = $auth->getIdentity();
$identity->time = time() + $identity->timeout;
$auth->getStorage()->write($identity);
if (Zend_Session::namespaceIsset('login')){
Zend_Session::namespaceUnset('login');
}
// --- Check CGU
if ( $request->getControllerName()!='aide' && $request->getActionName()!='cgu'
|| $request->getControllerName()!='user' && $request->getActionName()!='logout') {
if ( empty($identity->acceptationCGU) || $identity->acceptationCGU=='0000-00-00 00:00:00' ) {
$request->setModuleName('default')
->setControllerName('aide')
->setActionName('cgu');
}
}
// --- Temps de connexion dépassé
} elseif ( time() > $auth->getIdentity()->time ) {
$auth->clearIdentity();
$storage = $auth->getStorage();
Zend_Session::namespaceUnset($storage->getNamespace());
if ( !$request->isXmlHttpRequest() ) {
$session = new Zend_Session_Namespace('login');
$session->url = $_SERVER['REQUEST_URI'];
}
if ( $request->getControllerName()=='index' && $request->getActionName()=='index' ) {
$request->setModuleName('default')
->setControllerName('user')
->setActionName('login');
} else {
$request->setModuleName('default')
->setControllerName('user')
->setActionName('logout')
->setParam('ajax', $request->isXmlHttpRequest());
}
}
if ( $request->getControllerName()=='index' && $request->getActionName()=='index' ) {
$request->setModuleName('default')
->setControllerName('user')
->setActionName('login');
} else {
$request->setModuleName('default')
->setControllerName('user')
->setActionName('logout')
->setParam('ajax', $request->isXmlHttpRequest());
}
//Pas Authentifié
} else {
}
// --- Pas Authentifié
else {
if ( $request->isXmlHttpRequest() ) {

View File

@ -35,19 +35,26 @@ class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
$config = include APPLICATION_PATH . '/configs/menu.config.php';
$container = new Zend_Navigation($config);
//Apply specific parameters, acl - visible
/*foreach ( $container->getPages() as $level1 ) {
//Apply specific parameters - needed to have an global id
//@todo : Vérifier que l'on a bien uniquement ces paramètres - session ?
$id = $request->getParam('id');
$siret = $request->getParam('siret');
foreach ( $container->getPages() as $level1 ) {
foreach ( $level1->getPages() as $page ) {
$page->setParams(array(
'siret' => $siret,
'id' => $id,
));
}
}*/
}
//Assign menu to the view
$view->navigation($container);
if ( Zend_Registry::isRegistered('acl') ) {
$acl = Zend_Registry::get('acl');
$view->navigation($container)->setAcl($acl)->setRole($user->getProfil());
} else {
$view->navigation($container);
}
//Gestion affichage Lien Print / PDF / XML
$page = new Scores_Export_Print($controller, $action);

View File

@ -4,23 +4,16 @@ class Application_Controller_Plugin_Theme extends Zend_Controller_Plugin_Abstrac
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
//Specify default theme
$theme = 'default'; //$theme = 'mobile';
$theme = 'bootstrap'; //$theme = 'mobile';
$auth = Zend_Auth::getInstance();
if ( $auth->hasIdentity() ) {
$theme = !empty($auth->getIdentity()->theme) ? $auth->getIdentity()->theme : $theme;
if ( $auth->hasIdentity() ) {
$theme = !empty($auth->getIdentity()->theme) ? $auth->getIdentity()->theme : 'default';
}
$controller = $request->getControllerName();
$action = $request->getActionName();
//Login or Logout page - add a special design
$UserLogin = false;
if ( $controller == 'user' && ( $action == 'login' || $action == 'logout' ) ) {
$UserLogin = true;
$theme = 'default';
}
//Sauvegarde des paramètres du themes pour gérer les scripts et styles à utiliser
$paramsTheme = new stdClass();
$paramsTheme->name = $theme;
@ -34,39 +27,32 @@ class Application_Controller_Plugin_Theme extends Zend_Controller_Plugin_Abstrac
$viewPath = APPLICATION_PATH . '/views/' . $theme;
//Load bootstrap
$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
//Get useragent and device informations
$userAgent = $bootstrap->getResource('useragent');
$device = $userAgent->getDevice();
//Detect IE
$isIE6 = false;
if ( $device->getFeature('browser_name')=='Internet Explorer'
&& $device->getFeature('browser_version')=='6.0' ) {
$isIE6 = true;
}
//Override path for view and layout
$view = $bootstrap->bootstrap('View')->getResource('View');
$view = $bootstrap->bootstrap('View')->getResource('View');
$view->setBasePath($viewPath);
$layout = $bootstrap->bootstrap('Layout')->getResource('Layout');
$layout->setLayout('layout');
$layout = $bootstrap->bootstrap('Layout')->getResource('Layout');
$layout->setLayout('layout');
$layout->setLayoutPath($layoutPath);
//Load default style and javascript files for the selected theme
switch ( $theme )
{
//Load default style and javascript files for the selected theme
switch ( $theme )
{
/**
* Default theme
*/
default:
case 'default':
$view->doctype('HTML5');
case 'default':
default:
$view->headMeta()
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
$view->doctype('HTML5');
$view->headMeta()
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
->appendHttpEquiv('Content-Language', 'fr-FR');
//Favicon - Touch icon for iOS 2.0+ and Android 2.1+
@ -79,7 +65,7 @@ class Application_Controller_Plugin_Theme extends Zend_Controller_Plugin_Abstrac
'rel' => 'icon',
'type' => 'image/png',
'href' => '/favicon-32.png'
));
));
$view->headLink()->headLink(array(
'rel' => 'shortcut icon',
'type' => 'image/x-icon',
@ -89,11 +75,12 @@ class Application_Controller_Plugin_Theme extends Zend_Controller_Plugin_Abstrac
/**
* ===> Standard Styles
*/
$view->headLink()->appendStylesheet('/libs/bootstrap-3.2.0/css/bootstrap.min.css', 'all');
if ( !$UserLogin ) {
if ( $UserLogin ) {
$view->headLink()
->appendStylesheet('/libs/pace/themes/pace-theme-flash.css', 'all')
->appendStylesheet($paramsTheme->pathStyle.'/main.css', 'all');
->appendStylesheet('/libs/bootstrap-3.3.1/css/bootstrap.min.css', 'all')
->appendStylesheet('/themes/default/styles/user-login.css', 'all');
} else {
$view->headLink()->appendStylesheet($paramsTheme->pathStyle.'/main.css', 'all');
}
if ($isIE6) {
@ -105,21 +92,23 @@ class Application_Controller_Plugin_Theme extends Zend_Controller_Plugin_Abstrac
$view->headLink()
->appendStylesheet('/libs/ui-1.10.4/themes/smoothness/jquery-ui.min.css', 'all');
}
$view->headLink()->appendStylesheet('/libs/qtip/jquery.qtip.css', 'all');
$view->headLink()->appendStylesheet('/libs/qtip/jquery.qtip.min.css', 'all');
/**
* ===> Standard Javascript
*/
if ( !$UserLogin ) {
$view->headScript()
->appendFile('/libs/pace/pace.min.js', 'text/javascript');
}
$view->headScript()
->appendFile('/libs/html5shiv.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
->appendFile('/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
->appendFile('/libs/jquery/jquery-1.11.1.min.js', 'text/javascript')
->appendFile('/libs/bootstrap-3.2.0/js/bootstrap.min.js', 'text/javascript');
*/
if ( $UserLogin ) {
$view->headScript()
->appendFile('/libs/html5shiv.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
->appendFile('/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
->appendFile('/libs/jquery/jquery-1.11.2.min.js', 'text/javascript')
->appendFile('/libs/jquery/jquery.placeholder.js', 'text/javascript')
->appendFile('/libs/bootstrap-3.3.1/js/bootstrap.min.js', 'text/javascript');
} else {
$view->headScript()
->appendFile('/libs/jquery/jquery-1.11.2.min.js', 'text/javascript');
}
if ($isIE6) {
//Old JQuery version for IE6
$view->headScript()
@ -133,7 +122,7 @@ class Application_Controller_Plugin_Theme extends Zend_Controller_Plugin_Abstrac
}
if ( !$UserLogin ) {
$view->headScript()
->appendFile('/libs/qtip/jquery.qtip.js', 'text/javascript')
->appendFile('/libs/qtip/jquery.qtip.min.js', 'text/javascript')
->appendFile($paramsTheme->pathScript.'/script.js', 'text/javascript');
}
@ -242,11 +231,11 @@ class Application_Controller_Plugin_Theme extends Zend_Controller_Plugin_Abstrac
/**
* ===> Standard Styles
*/
$view->headLink()->appendStylesheet('/libs/bootstrap-3.2.0/css/bootstrap.min.css', 'all');
$view->headLink()->appendStylesheet('/libs/bootstrap-3.3.1/css/bootstrap.min.css', 'all');
$view->headLink()->appendStylesheet('/libs/ui-1.10.4/themes/smoothness/jquery-ui.min.css', 'all');
if ( !$UserLogin ) {
$view->headLink()
->appendStylesheet('/libs/qtip/jquery.qtip.css', 'all')
->appendStylesheet('/libs/qtip/jquery.qtip.min.css', 'all')
->appendStylesheet($paramsTheme->pathStyle.'/default.css', 'all');
}
@ -256,21 +245,21 @@ class Application_Controller_Plugin_Theme extends Zend_Controller_Plugin_Abstrac
$view->headScript()
->appendFile('/libs/html5shiv.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
->appendFile('/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
->appendFile('/libs/jquery/jquery-1.11.1.min.js', 'text/javascript')
->appendFile('/libs/bootstrap-3.2.0/js/bootstrap.min.js', 'text/javascript')
->appendFile('/libs/jquery/jquery-1.11.2.min.js', 'text/javascript')
->appendFile('/libs/bootstrap-3.3.1/js/bootstrap.min.js', 'text/javascript')
->appendFile('/libs/ui-1.10.4/jquery-ui.min.js', 'text/javascript')
->appendFile('/libs/ui-1.10.4/jquery-ui-i18n.min.js', 'text/javascript');
if ( !$UserLogin ) {
$view->headScript()
->appendFile('/libs/qtip/jquery.qtip.js', 'text/javascript');
->appendFile('/libs/qtip/jquery.qtip.min.js', 'text/javascript');
}
break;
/**
* Mobile
*/
*/
case 'mobile': //@todo
$view->doctype('HTML5');
@ -297,17 +286,17 @@ class Application_Controller_Plugin_Theme extends Zend_Controller_Plugin_Abstrac
'href' => '/favicon.ico')
);
//Style
$view->headLink()
->appendStylesheet('/libs/mobile/1.4.2/jquery.mobile-1.4.2.min.css', 'all');
//JavaScript
//Style
$view->headLink()
->appendStylesheet('/libs/mobile/1.4.2/jquery.mobile-1.4.2.min.css', 'all');
//JavaScript
$view->headScript()
->appendFile('/libs/jquery/jquery-1.11.1.min.js', 'text/javascript')
->appendFile('/libs/mobile/1.4.2/jquery.mobile-1.4.2.min.js', 'text/javascript')
->appendFile($paramsTheme->pathScript.'/script.js', 'text/javascript');
break;
break;
}
}
}

View File

@ -112,7 +112,7 @@ class Application_Form_RechercheEntreprise extends Zend_Form
'required' => 'true',
'decorators' => $this->elementDecorators,
'attribs' => array(
'size' => 20,
'size' => 18,
'maxlength' => 100,
),
));

View File

@ -14,7 +14,7 @@ class Application_Model_BilanSaisie extends Zend_Db_Table_Abstract
* @param unknown_type $bilanDuree
*/
public function setInformations($cliendId, $utilisateurId, $utilisateurLogin, $email, $method, $confidentiel, $siren, $bilanCloture, $format, $bilanDuree)
{
{
$env = 'PRD';
$data = array(
'clientId' => $cliendId,
@ -30,15 +30,15 @@ class Application_Model_BilanSaisie extends Zend_Db_Table_Abstract
'format' => $format,
'bilanDuree' => $bilanDuree,
'dateInsert' => date('Y-m-d H:i:s'),
);
);
return $this->insert($data);
}
/**
* Retourne les informations
* Retourne les informations
* @param string $ref
*/
public function getInfosBilan($ref)
public function getInfosBilan($ref)
{
$sql = $this->select()->where(" ref='$ref'");
$result = $this->fetchAll($sql)->toArray();
@ -50,7 +50,7 @@ class Application_Model_BilanSaisie extends Zend_Db_Table_Abstract
* @param string $ref
* @param string $name
*/
public function setFilename($ref, $name)
public function setFilename($ref, $name)
{
$data = array( 'fichier' => $name );
$this->update($data, "ref='$ref'");
@ -59,10 +59,10 @@ class Application_Model_BilanSaisie extends Zend_Db_Table_Abstract
public function listBilans()
{
$sql = $this->select()
->from($this, array('ref','utilisateurId','confidentiel','siren','bilanCloture','bilanDuree','fichier','env'))
->where("dateEnvoi='0000-00-00 00:00:00' AND fichier!=''");
->from($this, array('ref','utilisateurId','confidentiel','siren','bilanCloture','format','bilanDuree','fichier','env'))
->where("dateEnvoi='0000-00-00 00:00:00' AND fichier!=''");
$result = $this->fetchAll($sql)->toArray();
return $result;
return $result;
}
public function setDateEnvoi($ref)

64
library/Scores/Acl.php Normal file
View File

@ -0,0 +1,64 @@
<?php
/**
* Construct ACL dynamically
* Create file application/configs/acl.config.php with array roles and ressources
* ACL Documentation : http://framework.zend.com/manual/1.12/fr/zend.acl.introduction.html
*/
class Scores_Acl extends Zend_Acl
{
public function __construct($config = array())
{
//Get roles
$this->_setRoles($config['roles']);
$this->_setRessources($config['resources']);
}
protected function _setRoles($roles)
{
foreach ($roles as $role => $parents) {
if ( empty($parents) ) {
$parents = null ;
} else {
$parents = explode(',', $parents) ;
}
$this->addRole(new Zend_Acl_Role($role), $parents);
}
return $this ;
}
protected function _setRessources($ressources)
{
foreach ($ressources as $ressource => $parents) {
if ( empty($parents )) {
$parents = null ;
} else {
$parents = explode(',', $parents) ;
}
$this->add(new Zend_Acl_Resource($ressource), $parents);
}
return $this ;
}
protected function _setPrivileges($role, $privileges)
{
foreach ($privileges as $do => $ressources) {
foreach ($ressources as $ressource => $actions) {
if (empty($actions)) {
$actions = null ;
} else {
$actions = explode(',', $actions) ;
}
$this->{$do}($role, $ressource, $actions);
}
}
return $this ;
}
}

View File

@ -71,6 +71,7 @@ class Scores_Auth_Adapter_Ws implements Zend_Auth_Adapter_Interface
$identity->dateFinCompte = $InfosLogin->result->dateFinCompte;
$identity->acceptationCGU = $InfosLogin->result->acceptationCGU;
$identity->ip = $adressIp;
$identity->version = $InfosLogin->result->version;
$identity->modeEdition = false;
$timeout = (!empty($InfosLogin->result->timeout)) ? $InfosLogin->result->timeout : $this->_timeout;
@ -105,7 +106,7 @@ class Scores_Auth_Adapter_Ws implements Zend_Auth_Adapter_Interface
}
// Renvoi
if ( is_string($InfosLogin) || $InfosLogin->error->errnum!=0){
if ( is_string($InfosLogin) || $InfosLogin->error->errnum != 0 ) {
$message = $InfosLogin;
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array($message));
} elseif ($this->_username == $InfosLogin->result->login) {

View File

@ -59,7 +59,8 @@ class Scores_Finance_Ratios_Data
* @param string $dateCloture
* @param string $id
*/
function dRatio($type, $dateCloture, $id){
public function dRatio($type, $dateCloture, $id)
{
$ratio = $this->ratiosEntrep[$type][$dateCloture][$id];
$return = '';
$formatRatio = TRUE;
@ -100,7 +101,8 @@ class Scores_Finance_Ratios_Data
* @param string $dateCloture
* @param string $id
*/
function dSecteur($dateCloture, $id){
public function dSecteur($dateCloture, $id)
{
$ratio = $this->ratiosSecteur[substr($dateCloture,0,4)][$id];
$return = '';
$formatRatio = TRUE;

View File

@ -358,8 +358,8 @@ class IdentiteEntreprise
{
$user = new Scores_Utilisateur();
$data = '';
if ( intval($this->identite->Siren)!=0 && $user->getIdClient()==1 /*$user->checkPerm('avisrncs')*/ ) {
$data ='<a title="Voir l\'avis de situation RNCS" target="_blank" href="/identite/avisrncs/siret/'.
if ( intval($this->identite->Siren)!=0 && $user->checkPerm('avisrncs') ) {
$data ='<a title="Voir l\'avis de situation RNCS" target="_blank" href="/identite/avisrncspdf/siret/'.
$this->identite->Siret.'">Situation au répertoire RNCS</a>';
}
@ -449,12 +449,11 @@ class IdentiteEntreprise
public function getRaisonSocialeLabel()
{
return 'Dénomination Sociale';
return 'Dénomination sociale';
}
public function getRaisonSocialeTexte()
{
$data = $this->identite->Nom;
if ($this->identite->Nom2!='') $data.= '<br/>'.$this->identite->Nom2;
return $data;
}
public function getRaisonSocialeTitre()
@ -469,6 +468,21 @@ class IdentiteEntreprise
return "Dénomination sociale / Nom de l'entreprise (format court avec abréviations)";
}
public function getNom2Label()
{
return 'Complément de raison sociale';
}
public function getNom2Texte()
{
if (empty($this->identite->Nom2))
return false;
return $this->identite->Nom2;
}
public function getNom2Aide()
{
return "Complément de Raison Sociale";
}
public function getNomCommercialLabel()
{
return 'Nom Commercial';
@ -558,7 +572,7 @@ class IdentiteEntreprise
$dateCreationEn = str_replace('-', '', $this->identite->DateCreaEn);
if ( $dateCreationEn!='' ) {
if (substr($dateCreationEn, -2) * 1 == 0) {
$date = new Zend_Date($dateCreationEn, 'yyyyMMdd');
$date = new Zend_Date($dateCreationEn, 'yyyyMM');
$data = $date->toString('MM/yyyy');
} else {
$date = new Zend_Date($dateCreationEn, 'yyyyMMdd');
@ -577,7 +591,7 @@ class IdentiteEntreprise
$dateCreationEt = str_replace('-', '', $this->identite->DateCreaEt);
if ($dateCreationEt * 1 <> 0) {
if (substr($dateCreationEt, -2) * 1 == 0) {
$date = new Zend_Date($dateCreationEt, 'yyyyMMdd');
$date = new Zend_Date($dateCreationEt, 'yyyyMM');
$data = $date->toString('MM/yyyy');
} else {
$date = new Zend_Date($dateCreationEt, 'yyyyMMdd');
@ -1084,23 +1098,19 @@ class IdentiteEntreprise
if($dir2LieuNaiss!='' && $dir2NaissText!='') $dir2NaissText.= ' à '.$dir2LieuNaiss;
elseif($dir2LieuNaiss!='' && $dir2NaissText=='') $dir2NaissText.= 'né(e) à '.$dir2LieuNaiss;
$dir_actif = false;
if ($this->identite->dir1Titre!=''){
$data = '<div class="txtAdresse">';
$data.= '<u><b>'.ucfirst($this->identite->dir1Titre).'</b></u><br/>'.$this->identite->dir1NomPrenom;
if($dir1NaissText!=''){ $data.=', '.$dir1NaissText; }
$data.= '</div>';
$dir_actif = $dir_actif || true;
}
if ($this->identite->dir2Titre!=''){
$data.= '<div class="txtAdresse">';
$data.= '<u><b>'.ucfirst($this->identite->dir2Titre).'</b>:</u><br/>'.$this->identite->dir2NomPrenom;
if($dir2NaissText!=''){ $data.=', '.$dir2NaissText; }
$data.= '</div>';
$dir_actif = $dir_actif || true;
}
if(!$dir_actif)
return false;
return $data;
}

View File

@ -184,7 +184,8 @@ class Scores_Menu
array(
'label' => 'ELEMENTS FINANCIERS',
'activateMenu' => array(
array('controller'=>'finance', 'action'=>'subvention'),
array('controller'=>'finance', 'action'=>'subvention'),
array('controller'=>'finance', 'action'=>'liasse'),
),
'pages' => array(
array(
@ -218,7 +219,7 @@ class Scores_Menu
array(
'label' => "Liasse fiscale",
'controller' => 'finance',
'action' => 'liasse',
'action' => 'liasselist',
'forceVisible' => true,
'permission' => 'LIASSE',
),

View File

@ -0,0 +1,30 @@
<?php
require_once 'Vendors/tcpdf/tcpdf.php';
require_once 'Vendors/fpdi/fpdi.php';
class Scores_Pdf_Fpdi extends FPDI
{
/**
* "Remembers" the template id of the imported page
*/
var $_tplIdx;
/**
* Draw an imported PDF logo on every page
* @param string $template
*/
function Header()
{
if (is_null($this->_tplIdx)) {
$this->setSourceFile($template);
$this->_tplIdx = $this->importPage(1);
}
$this->useTemplate($this->_tplIdx);
}
function Footer()
{
// emtpy method body
}
}

View File

@ -0,0 +1,65 @@
<?php
class Scores_Pdf_Page extends Zend_Pdf_Page
{
/**
* Cette fonction retourne la largeur typographique d'un string.
* @param string $text_line le texte à utiliser
* @return integer la largeur du texte
*/
protected function _getTextWidth($text_line)
{
$current_font = $this->getFont() ;
$font_size = $this->getFontSize() ;
// initialisation des tableaux
$glyph_array = $char_array = array();
$total_item_width = 0;
// on converti le texte en tableau et on récupère les codes ASCII
$text_array = str_split($text_line, 1);
foreach($text_array as $character) {
$char_array[] = ord($character);
}
// on récupère ensuite le numéro du glyphe d'après le code ASCII
$glyph_array = $current_font->glyphNumbersForCharacters($char_array) ;
// Zend_Pdf_Font nous permet de récupérer la largeur des glyphes
$text_width = $current_font->widthsForGlyphs($glyph_array);
// on additionne tous les caractères pour obtenir la largeur totale
foreach($text_width as $char_width) {
$total_item_width += $char_width;
}
// petite transformation pour obtenir notre taille en quelque chose d'utilisable
return ($total_item_width / 1000) * $font_size;
}
/**
* Dessine du texte aligné à droite de $x
*/
public function drawTextAlignRight($text, $x, $y)
{
$width = $this->_getTextWidth($text) ;
// on écrit le texte à la position donnée - la largeur du texte
$this->drawText($text, $x - $width, $y) ;
}
/**
* Dessine du texte centré sur $x
*/
public function drawTextAlignCenter($text, $x, $y)
{
$width = $this->_getTextWidth($text) ;
// on écrit le texte à la position donnée - la moitié de la largeur du texte
$this->drawText($text, $x - ($width / 2), $y) ;
}
/**
*
* @param number $bottom
*/
public function heightWithMargin($bottom = 0)
{
$current_font = $this->getFont();
return $current_font->getLineHeight() + $bottom;
}
}

View File

@ -0,0 +1,50 @@
<?php
require_once 'Vendors/tcpdf/tcpdf.php';
class Scores_Pdf_Tcpdf extends TCPDF
{
protected $bgimage = null;
public function SetBackgroundImage($file)
{
$this->bgimage = $file;
}
/**
* (non-PHPdoc)
* @see TCPDF::Header()
*/
public function Header()
{
if ($this->bgimage) {
// get the current page break margin
$bMargin = $this->getBreakMargin();
// get current auto-page-break mode
$auto_page_break = $this->AutoPageBreak;
// disable auto-page-break
$this->SetAutoPageBreak(false, 0);
// set bacground image
$this->Image($this->bgimage, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
// restore auto-page-break status
$this->SetAutoPageBreak($auto_page_break, 20);
// set the starting point for the page content
$this->setPageMark();
}
}
/**
* (non-PHPdoc)
* @see TCPDF::Footer()
*/
public function Footer()
{
// Position at 15 mm from bottom
$this->SetY(-15);
// Set font
$this->SetFont('helvetica', 'I', 8);
// Page number
$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
}

View File

@ -13,6 +13,8 @@ class Scores_Utilisateur
if ( $auth->hasIdentity() ) {
$this->identity = $auth->getIdentity();
}
return $this->identity;
}
/**
@ -51,6 +53,7 @@ class Scores_Utilisateur
$identity->dateDebutCompte = $InfosLogin->result->dateDebutCompte;
$identity->dateFinCompte = $InfosLogin->result->dateFinCompte;
$identity->ip = $_SERVER['REMOTE_ADDR'];
$identity->version = $InfosLogin->result->version;
$identity->timeout = (!empty($InfosLogin->result->timeout)) ?
$InfosLogin->result->timeout : 1800;
$identity->time = time() + $identity->timeout;

View File

@ -1,160 +0,0 @@
<?php
/**
* Load User Info
*/
require_once 'Scores/Utilisateur.php';
/**
* Distribute Scores Webservice
*/
class Scores_Ws
{
/**
* User login
* @var string
*/
protected $login = null;
/**
* Password
* @var string
*/
protected $password = null;
/**
* Enable/Disable Cache
* @var boolean
*/
protected $cache = true;
/**
* Enable/Disable cache writing
* Override the cache flag
* @var boolean
*/
protected $cacheWrite = true;
/**
* Number of response
* @var int
*/
protected $nbReponses = 20;
protected $obj = null;
/**
* Scores_Ws
* @param string $login
* @param string $password
*/
public function __construct($login = null, $password = null)
{
if ( !empty($login) && !empty($password) ){
$this->login = $login;
$this->password = $password;
} else {
$user = new Scores_Utilisateur();
$this->login = $user->getLogin();
$this->password = $user->getPassword();
$this->nbReponses = $user->getNbRep();
if ( $user->checkModeEdition() ) {
//Disable cache
$this->cache = false;
//Don't write cache
if ( APPLICATION_ENV == 'staging' ) {
$this->cacheWrite = false;
}
}
}
}
/**
* Distribute call on each separate class for each service
* Schema for $name is {Class}_{Method}
* @param string $name
* @param array $args
* @return mixed
*/
public function __call($name, $args)
{
$response = false;
$pos = strpos($name, '_');
$className = substr($name, 0, $pos);
$methodName = substr($name, $pos+1);
$objR = new ReflectionClass('Scores_Ws_'.$className);
$this->obj = $objR->newInstance($methodName);
$this->obj->setSoapClientOption('login', $this->login);
$this->obj->setSoapClientOption('password', $this->password);
//Check cache
if ($this->cacheWrite && $this->obj->getCache()) {
$filename = $this->obj->getFilename();
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
$response = $cache->getBlock();
}
}
//Execute the request
else {
call_user_func_array(array($this->obj, $methodName), $args);
if ( !$this->obj->isError() || !$this->obj->isMessage() ) {
$response = $obj->getSoapResponse();
//Put in cache the response
if ($this->cacheWrite && $obj->getCache()) {
$cache->deletefile();
$cache->setBlock($responses);
}
}
}
return $response;
}
/**
* Type du retour
* @return string
* ERR or MSG
*/
public function getResponseType()
{
if ( $this->obj->isError() ) {
return 'ERR';
} elseif ( $this->obj->isMessage() ) {
return 'MSG';
}
return null;
}
/**
* Message de retour pour affichage
* @return string
*/
public function getResponseMsg()
{
return $this->obj->getMessage();
}
/**
* Retourne les éléments pour debuggage
* @return object
*/
public function getError()
{
$error = new stdClass();
$error->service = $this->obj->getServiceName();
$error->method = $this->obj->getMethodName();
//Request Parameter
$error->args = $this->obj->getParams();
$error->faultCode = $this->obj->getFaultCode();
$error->faultMessage = $this->obj->getMessage();
return $error;
}
}

View File

@ -1,254 +0,0 @@
<?php
require_once 'Scores/Ws/Config.php';
/** @see Scores_Ws_Interface */
require_once 'Scores/Ws/Interface.php';
/**
* Abstract class for Scores_Ws.
*/
abstract class Scores_Ws_Abstract implements Scosres_Ws_Interface
{
/**
* Service name
* @var string
*/
protected $service = null;
/**
* Method Name
* @var string
*/
protected $method = null;
/**
* Params for soap call as stdClass
* @var stdClass
*/
protected $params = null;
/**
* Default max response
* @var int
*/
protected $nbReponses = 20;
/**
* Set to false to disable cache for one method
* @var boolean
*/
protected $cache = true;
/**
* WSDL URI
* @var string
*/
protected $wsdl = null;
/**
* Options for WSDL
* @var array
*/
protected $options = array();
/**
* Soap Response
* @var object
*/
protected $response = null;
/**
* 0 = no error
* 1 = error
* 2 = message
* @var int
*/
protected $error = 0;
/**
* Error / Message
* @var string
*/
protected $message = '';
/**
* Original soap fault code
* @var string
*/
protected $faultcode = null;
/**
*
*/
public function __construct()
{
$config = new Scores_Ws_Config();
$config->setLocation('local');
$serviceConfig = $config->getService($this->service);
$this->setSoapClientWsdl($serviceConfig['wsdl']);
foreach ( $serviceConfig['options'] as $name => $value ) {
$this->setSoapClientOption($name, $value);
}
$this->setSoapClientOption('features', SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS);
$this->setSoapClientOption('compression', SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE);
$this->setSoapClientOption('trace', true);
$this->setSoapClientOption('encoding', 'utf-8');
if (APPLICATION_ENV == 'development'){
$this->setSoapClientOption('cache_wsdl', WSDL_CACHE_NONE);
}
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::setService()
*/
public function setService($name)
{
$this->service = $name;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Interface::getServiceName()
*/
public function getServiceName()
{
return $this->service;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Interface::getMethodName()
*/
public function getMethodName()
{
return $this->method;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Interface::getParams()
*/
public function getParams()
{
return var_export($this->params, true);
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Interface::getFaultCode()
*/
public function getFaultCode()
{
return $this->faultcode;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::setNbReponses()
*/
public function setNbReponses($nb)
{
$this->nbReponses = $nb;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::setSoapClientWsdl()
*/
public function setSoapClientWsdl($wsdl = null)
{
$this->wsdl = $wsdl;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::setSoapClientOption()
*/
public function setSoapClientOption($name = null , $value = null)
{
$this->options[$name] = $value;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::getSoapClient()
*/
public function getSoapClient()
{
$client = false;
try {
$client = new SoapClient($this->wsdl, $this->options);
} catch (Exception $e) {
throw new Exception('Application Error');
}
return $client;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::isError()
*/
public function isError()
{
if ( $this->error == 1 ) {
return true;
}
return false;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::isMessage()
*/
public function isMessage()
{
if ( $this->error == 2 ) {
return true;
}
return false;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::getSoapResponse()
*/
public function getSoapResponse()
{
return $this->response;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::getMessage()
*/
public function getMessage()
{
return $this->message;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::getFilename()
*/
public function getFilename($method, $args)
{
$filename = $this->service . '-' . $method . '-' . implode('-', $args);
return $filename;
}
public function getCache()
{
return $this->cache;
}
public function setCache($enable = true)
{
$this->cache = $enable;
}
}

View File

@ -1,183 +0,0 @@
<?php
require_once 'Scores/Ws/Abstract.php';
/**
*
*/
class Scores_Ws_Catalog extends Scores_Ws_Abstract
{
public function __construct()
{
$this->setService('catalog');
$this->cache = false;
parent::__construct();
}
/**
* Get the filename for a mathod
* @param string $method
* @param array $args
*/
public function getFilename($method, $args){}
/**
*
* @param unknown $id
* @param unknown $columns
*/
public function getEvent($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns = $columns;
$client = $this->getSoapClient();
try {
$response = $client->getEvent($params);
$this->response = $response->getEventResult;
} catch (SoapFault $fault) {
$this->message = $fault->faultstring;
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
public function getCatalogCurrency()
{
$filename = 'catalog-currency';
$cache = new Cache($filename);
if ( $cache->exist() ){
return $cache->getBlock();
}
$params = new stdClass();
$params->id = null;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getCurrency($params);
$cache->deletefile();
$cache->setBlock($reponse->getCurrencyResult);
return $reponse->getCurrencyResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function getCatalogCountry()
{
$filename = 'catalog-country';
$cache = new Cache($filename);
if ( $cache->exist() ){
return $cache->getBlock();
}
$params = new stdClass();
$params->id = null;
$params->columns = array(
'codPays3',
'libPays',
'devise',
'indTel',
);
$client = $this->loadClient('catalog');
try {
$reponse = $client->getCountry($params);
$cache->deletefile();
$cache->setBlock($reponse->getCountryResult);
return $reponse->getCountryResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function getCatalogEvent($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns = $columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getEvent($params);
return $reponse->getEventResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getCatalogNaf5($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns =$columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getNaf5($params);
return $reponse->getNaf5Result;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getCatalogFctDir($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns =$columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getDirFonction($params);
return $reponse->getDirFonctionResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getCatalogLegalForm($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns =$columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getLegalForm($params);
return $reponse->getLegalFormResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
}

View File

@ -0,0 +1,224 @@
<?php
/**
* Configuration
* URL : http://wse.scores-decisions.com
* ServiceName : entreprise
* ServiceVersion : 0.8
*
* SoapClient wsdl = URL + ServiceName + ServiceVersion + ?wsdl
*
* Configuration des paramètres de l'appel
* Appel Soap
* Gestion des erreurs
* Mise en cache
*
* Client ( name, version ) extends Zend_Soap_Client
*
*
* Client/Entreprise08
* Client/Gestion03
* Client/Gestion04
*
* Config ServiceName-Version
* methode
* parametres
* cache
* log => firebug, file, email
* error [
* code error => return (message, false), stop (true, false)
* ]
* arguments
* name => null, defaultvalue
*
*
* Interface qui déclare les méthodes d'appel
*
* Méthodes protégés pour les opérations webservice
* Paramètres de l'opération
* Paramètres spécifique - Mise en cache
* Gestion des erreurs
*/
class Scores_Ws_Client extends Zend_Soap_Client
{
/**
* Configuration des méthodes du service
* @var array
*/
protected $config;
/**
* WebService Url - Add a configuration key in application.ini
* @var string
*/
protected $url = null;
protected $cache;
/**
* Créer l'environnement nécessaire pour le chargement du webservice
* @param string $name
* Nom du service
* @param string $version
* Représente la version du service
* @param string $user
* @throws Exception
*/
public function __construct($name, $version, $user = null)
{
//Configuration de l'application
if (Zend_Registry::isRegistered('config')) {
$c = Zend_Registry::get('config');
$this->url = $c->profil->webservice->url;
} else {
$c = new Zend_Config_Ini(APPLICATION_PATH.'/configs/application.ini');
$this->url = $c->profil->webservice->url;
}
//Configuration du service
$config = include __DIR__ . '/Client/' . ucfirst($name) . '.php';
if ($config === false) {
throw new Exception('Impossible de charger la configuration du service');
}
if (!array_key_exists($version, $config)) {
throw new Exception('Version du service inexistante');
}
$this->config = $config[$version];
// Create WSDL url
$wsdl = $this->url . '/' . $name . '/v' . $version;
if (APPLICATION_ENV == 'development') {
$wsdl.= '?wsdl-auto';
$this->setWsdlCache(WSDL_CACHE_NONE);
} else {
$wsdl.= '?wsdl';
}
$this->setWsdl($wsdl);
if (PHP_SAPI != 'cli' && $user === null) {
$user = new Scores_Utilisateur();
Zend_Registry::get('firebug')->info($user->getPassword());
}
if ($user !== null) {
$this->setHttpLogin($user->getLogin());
$this->setHttpPassword($user->getPassword());
}
//Add default options
$options = array(
'features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS,
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE,
//'trace' => true,
'encoding' => 'utf-8',
);
$this->setOptions($options);
// Create Cache
$frontend = array(
'lifetime' => 28800,
'automatic_seralization' => true
);
$backend = array(
'cache_dir' => APPLICATION_PATH . '/../data/cache',
);
$this->cache = Zend_Cache::factory('Core', 'File', $frontend, $backend);
}
/**
* (non-PHPdoc)
* @see Zend_Soap_Client::__call()
*/
public function __call($name, $arguments)
{
if ( !array_key_exists($name, $this->config) ) {
throw new Exception("Method $name not exist");
}
//@todo : gestion des paramètres envoyés sous forme d'array
if( is_array($arguments) ) {
}
$methodConfig = $this->config[$name];
//Cache
$cacheEnable = false;
if ( array_key_exists('cache', $methodConfig) ) {
if ( $methodConfig['cache'] === true ) {
$cacheEnable = true;
$cacheId = $name;
if ( count($arguments) > 0 ){
foreach ($arguments as $item) {
$cacheId.= $item;
}
}
}
}
//Cache
if ( $cacheEnable === true ) {
$response = $this->cache->load($cacheId);
if ( $response !== false ) {
return $response;
}
}
//Debug
if ( array_key_exists('debug', $methodConfig) ) {
Zend_Registry::get('firebug')->info(__CLASS__.'->'.$name);
Zend_Registry::get('firebug')->info($arguments);
}
try {
$response = parent::__call($name, $arguments);
//Debug
if ( array_key_exists('debug', $methodConfig) ) {
Zend_Registry::get('firebug')->info($response);
}
//Cache
if ( $cacheEnable === true ) {
$this->cache->save($response->{$name.'Result'}, $cacheId);
}
return $response->{$name.'Result'};
} catch ( SoapFault $fault ) {
//Debug
if ( array_key_exists('debug', $methodConfig) ) {
Zend_Registry::get('firebug')->info($fault->faultcode.' - '.$fault->faultstring);
}
//Gestion des SOAP fault
if ( array_key_exists('errorMsg', $methodConfig) ) {
if ( in_array($fault->faultcode, $methodConfig['errorMsg']) ) {
//throw new Exception($fault->faultstring, 'MSG');
throw new Exception($fault->faultstring);
}
}
//Logging
if ( array_key_exists('log', $methodConfig) ) {
}
return false;
}
}
/**
*
* @param unknown $url
*/
protected function setUrl($url)
{
$this->url = $url;
}
}

View File

@ -0,0 +1,62 @@
<?php
return array(
'0.3' => array(
'getCategory' => null,
'getClientTarif' => null,
'getClientTarifs' => null,
'getEmail' => null,
'getInfosLogin' => array(
'debug' => true,
),
'getListeClients' => null,
'getListeDroits' => null,
'getListePrefs' => null,
'getListeUtilisateurs' => null,
'getLogs' => null,
'getLogsClients' => null,
'getNextLogin' => null,
'getPrestation' => null,
'getPrestations' => null,
'getService' => null,
'getServiceUsers' => null,
'getServices' => null,
'getUser' => null,
'searchLogin' => null,
'setCGU' => null,
'setClient' => null,
'setClientTarif' => null,
'setEmail' => null,
'setInfosLogin' => null,
'setParam' => null,
'setPrestation' => null,
'setService' => null,
'setSurveillancesMail' => null,
'setUserService' => null,
),
'0.4' => array(
'getCategory' => null,
'getClient' => null,
'getClientServices' => null,
'getClients' => null,
'getService' => null,
'getServices' => null,
'getUser' => null,
'getUserEmail' => null,
'getUsers' => null,
'loginAuthenticate' => null,
'setCGU' => null,
'setService' => null,
'setServiceParam' => null,
'setUser' => null,
'setUserEmail' => null,
'setUserPassword' => null,
'setUserSSO' => array(
'debug' => true,
'errorMsg' => array('SSO'),
),
'ssoAuthenticate' => array(
'debug' => true,
'errorMsg' => array('SSO'),
),
),
);

View File

@ -1,229 +0,0 @@
<?php
/**
* WebService Configuration
*/
class Scores_Ws_Config
{
protected $location = null;
protected $services = array(
//Local
'local' => array(
'interne' => array(
'wsdl' => "http://webservice-2.4.sd.dev/interne/v0.6?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'entreprise' => array(
'wsdl' => "http://webservice-2.4.sd.dev/entreprise/v0.8?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'gestion' => array(
'wsdl' => "http://webservice-2.4.sd.dev/gestion/v0.3?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'saisie' => array(
'wsdl' => "http://webservice-2.4.sd.dev/saisie/v0.2?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'pieces' => array(
'wsdl' => "http://webservice-2.4.sd.dev/pieces/v0.1?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'catalog' => array(
'wsdl' => "http://webservice-2.4.sd.dev/catalog/v0.1?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
),
//Development
'development' => array(
'interne' => array(
'wsdl' => "http://webservice-2.4.sd.lan/interne/v0.6?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'entreprise' => array(
'wsdl' => "http://webservice-2.4.sd.lan/entreprise/v0.8?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'gestion' => array(
'wsdl' => "http://webservice-2.4.sd.lan/gestion/v0.3?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'saisie' => array(
'wsdl' => "http://webservice-2.4.sd.lan/saisie/v0.2?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'pieces' => array(
'wsdl' => "http://webservice-2.4.sd.lan/pieces/v0.1?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'catalog' => array(
'wsdl' => "http://webservice-2.4.sd.lan/catalog/v0.1?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
),
//sd-25137
'sd-25137' => array(
'interne' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'entreprise' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/entreprise/v0.8?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'gestion' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/gestion/v0.3?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'saisie' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/saisie/v0.2?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'pieces' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/pieces/v0.1?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'catalog' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/catalog/v0.1?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
),
//Celeste
'celeste' => array(
'interne' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'entreprise' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/entreprise/v0.8?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'gestion' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/gestion/v0.3?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'saisie' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/saisie/v0.2?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'pieces' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/pieces/v0.1?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'catalog' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/catalog/v0.1?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
),
//Celeste Staging
'celeste-staging' => array(
'interne' => array(
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'entreprise' => array(
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'gestion' => array(
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'saisie' => array(
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'pieces' => array(
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'catalog' => array(
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
),
);
/**
*
*/
public function setLocation($name)
{
$this->location = $name;
}
/**
* Return service parameters
* @param string $name
* @return array
*/
public function getService($name)
{
return $this->services[$this->location][$name];
}
}

View File

@ -1,952 +0,0 @@
<?php
require_once 'Scores/Ws/Abstract.php';
class Scores_Ws_Entreprise extends Scores_Ws_Abstract
{
public function __construct($method = null)
{
//Set service to use
$this->setService('entreprise');
//Prepare method configuration
if(null !== $method && method_exists($this, $method)) {
$this->{$method.'Params'}();
}
parent::__construct();
}
/**
* getAnnonces
* @param string $siren
* @param integer $filtre
* @param string $idAnn
* @param integer $position
* @param integer $nbRep
* @void
*/
public function getAnnonces($siren, $filtre=0, $idAnn='', $position=0, $nbRep=100)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->filtre = $filtre;
$this->params->idAnn = $idAnn;
$client = $this->getSoapClient();
try {
$response = $client->getAnnonces($this->params);
$this->response = $response->getAnnoncesResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getAnnoncesAsso
* @param string $siren
* @param string $idAnn
* @param string $filtre
* @param number $position
* @param number $nbRep
*/
public function getAnnoncesAsso($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->idAnn = $idAnn;
$this->params->filtre = $filtre;
$this->params->position = $position;
$this->params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->getAnnoncesAsso($this->params);
$this->response = $response->getAnnoncesAssoResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getAnnoncesBalo
* @param string $siren
* @param string $idAnn
* @param string $filtre
* @param number $position
* @param number $nbRep
* @void
*/
public function getAnnoncesBalo($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->idAnn = $idAnn;
$this->params->filtre = $filtre;
$this->params->position = $position;
$this->params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->getAnnoncesBalo($this->params);
$this->response = $response->getAnnoncesBaloResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getAnnoncesBoamp
* @param string $siren
* @param string $idAnn
* @param string $filtre
* @param number $position
* @param number $nbRep
* @void
*/
public function getAnnoncesBoamp($siren, $idAnn=null, $filtre = null, $position=0, $nbRep=20)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->idAnn = $idAnn;
$this->params->filtre = null;
if (!empty($filtre) && in_array($filtre,array('A','M'))) {
$filtreStruct = new stdClass();
$filtreStruct->key = 'type';
$filtreStruct->value = $filtre;
$this->params->filtre[] = $filtreStruct;
}
$this->params->position = $position;
$this->params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->getAnnoncesBoamp($this->params);
$this->response = $response->getAnnoncesBoampResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getAnnoncesLegales
* @param string $siren
* @param string $idAnn
* @param string $filtre
* @param number $position
* @param number $nbRep
* @void
*/
public function getAnnoncesLegales($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->idAnn = $idAnn;
$this->params->filtre = $filtre;
$this->params->position = $position;
$this->params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->getAnnoncesLegales($this->params);
$this->response = $response->getAnnoncesLegalesResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getAnnoncesNum
* @param string $siren
* @void
*/
public function getAnnoncesNum($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->getAnnoncesNum($this->params);
$this->response = $response->getAnnoncesNumResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getBanques
* @param string $siren
* @void
*/
public function getBanques($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->getBanques($this->params);
$this->response = $response->getBanquesResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getBilan
* @param string $siren
* @param string $millesime
* @param string $typeBilan
* @param string $ref
* @void
*/
public function getBilan($siren, $millesime, $typeBilan, $ref)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->millesime = $millesime;
$this->params->typeBilan = $typeBilan;
$this->params->ref = $ref;
$client = $this->getSoapClient();
try {
$response = $client->getBilan($this->params);
$this->response = $response->getBilanResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getIdentiteParams
* @void
*/
public function getIdentiteParams()
{
$this->setCache(false);
}
/**
* getIdentite
* @param string $siret
* @param int $id
* @void
*/
public function getIdentite($siret, $id = 0)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siret = $siret;
$this->params->id = $id;
$client = $this->getSoapClient();
try {
$response = $client->getIdentite($this->params);
$this->response = $response->getIdentiteResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('1020')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getIdentiteProcol
* @param string $siret
* @param int $id
* @void
*/
public function getIdentiteProcol($siret, $id = 0)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siret = $siret;
$this->params->id = $id;
$client = $this->getSoapClient();
try {
$response = $client->getIdentiteProcol($this->params);
$this->response = $response->getIdentiteProcolResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getIndiScore
* @param string $siren
* @param string $nic
* @param integer $niveau
* @param boolean $plus
* @param string $ref
* @param integer $encours
* @param string $email
*/
public function getIndiScore($siren, $nic=0, $niveau=2, $plus=false, $ref='', $encours=0, $email='')
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->nic = $nic;
$this->params->niveau = $niveau;
$this->params->plus = $plus;
$this->params->ref = $ref;
$this->params->encours = $encours;
$this->params->email = $email;
$client = $this->getSoapClient();
try {
$response = $client->getIndiScore($this->params);
$this->response = $response->getIndiScoreResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('1020')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getInfosBourse
* @param string $siren
* @void
*/
public function getInfosBourse($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->getInfosBourse($this->params);
$this->response = $response->getInfosBourseResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('1030')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getInfosReg
* @param string $siren
* @param mixed $id
* @void
*/
public function getInfosReg($siren, $id = false)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->id = $id;
$client = $this->getSoapClient();
try {
$response = $client->getInfosReg($this->params);
$this->response = $response->getInfosRegResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('1030')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getDirigeants
* @param string $siren
* @param boolean $histo
* @void
*/
public function getDirigeants($siren, $histo=false)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->histo = $histo;
$client = $this->getSoapClient();
try {
$response = $client->getDirigeants($this->params);
$this->response = $response->getDirigeantsResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getLienRef
* @param string $id
* @void
*/
public function getLienRef($id)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->id = $id;
$client = $this->getSoapClient();
try {
$response = $client->getLienRef($this->params);
$this->response = $response->getLienRefResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('ERR','MSG')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getLiens
* @param string $siren
* @void
*/
public function getLiens($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->getLiens($this->params);
$this->response = $response->getLiensResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('MSG')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getLiensById
* @param int $id
* @void
*/
public function getLiensById($id)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->id = $id;
$client = $this->getSoapClient();
try {
$response = $client->getLiensById($this->params);
$this->response = $response->getLiensByIdResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('MSG')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getListeBilans
* @param string $siren
*/
public function getListeBilans($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->getListeBilans($this->params);
$this->response = $response-getListeBilansResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getListeCompetences
* @param string $siret
* @param string $type
* @param string $codeInsee
*/
public function getListeCompetences($siret, $type, $codeInsee)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siret = $siret;
$this->params->type = $type;
$this->params->codeInsee = $codeInsee;
$client = $this->getSoapClient();
try {
$response = $client->getListeCompetences($this->params);
$this->response = $response->getListeCompetencesResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getListeEtablissements
* @param string $siren
* @void
*/
public function getListeEtablissements($siren, $actif = -1, $position = 0)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$params->siren = $siren;
$params->actif = $actif;
$params->position = $position;
$client = $this->getSoapClient();
try {
$response = $client->getListeEtablissements($this->params);
$this->response = $response->getListeEtablissementsResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getListeEvenements
* @param string $siren
* @param string $nic
* @param integer $position
* @param integer $nbRep
* @void
*/
public function getListeEvenements($siren, $nic=0, $position=0, $nbRep=200)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$params->siren = $siren;
$params->nic = $nic;
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->getListeEvenements($this->params);
$this->response = $response->getListeEvenementsResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getRapport
* @param string $siren
* @param integer $niveau
* @param integer $id
* @param boolean $plus
* @param string $ref
* @param integer $encours
* @param string $email
* @void
*/
public function getRapport($siren, $niveau=3, $id=0, $plus=false, $ref='', $encours=0, $email='')
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->niveau = $niveau;
$this->params->d = $id;
$this->params->plus = $plus;
$this->params->ref = $ref;
$this->params->encours = $encours;
$this->params->email = $email;
$client = $this->getSoapClient();
try {
$response = $client->getRapport($this->params);
$this->response = $response->getRapportResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getRatios
* @param string $siren
* @param string $page
*/
public function getRatios($siren, $page = 'ratios')
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->page = $page;
$client = $this->getSoapClient();
try {
$response = $client->getRapport($this->params);
$this->response = $response->getRapportResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getSurveillancesParams
*/
public function getSurveillancesParams()
{
$this->setCache(false);
}
/**
* getSurveillances
* @param object $filtre
* @param integer $deb
* @param integer $nbRep
* @param string $tri
*/
public function getSurveillances($filtre, $deb=0, $nbRep=100)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->filtre = $filtre;
$this->params->position = $deb;
$this->params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->getSurveillances($this->params);
$this->response = $response->getSurveillancesResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getValo
* @param string $siren
* @void
*/
public function getValo($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->getValo($this->params);
$this->response = $response->getValoResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('1020')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* isSirenExistant
* @param string $siren
*/
public function isSirenExistant($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->isSirenExistant($this->params);
$this->response = $response->isSirenExistantResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* rechercheAnnonceParams
* @void
*/
public function rechercheAnnonceParams()
{
$this->setCache(false);
}
/**
* Recherche Annonce
* @param string $source
* @param string $dateAnnee
* @param integer $numParution
* @param integer $numAnnonce
*/
public function rechercheAnnonce($source, $dateAnnee, $numParution, $numAnnonce)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->source = $source;
$this->params->dateAnnee = $dateAnnee;
$this->params->numParution = $numParution;
$this->params->numAnnonce = $numAnnonce;
$client = $this->getSoapClient();
try {
$response = $client->rechercheAnnonce($this->params);
$this->response = $response->rechercheAnnonceResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* searchEntrepriseParams
* @void
*/
public function searchEntrepriseParams()
{
$this->setCache(false);
}
/**
* searchEntreprise
* @param array $criteres
* @param int $position
* @param int $nbRep
* @param int $actif
*/
public function searchEntreprise($criteres, $position = 0, $nbRep = null)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->criteres = new StdClass;
$this->params->criteres->identifiant = $criteres['identifiant'];
$this->params->criteres->raisonSociale = $criteres['raisonSociale'];
$this->params->criteres->adresse = $criteres['adresse'];
$this->params->criteres->codePostal = $criteres['codePostal'];
$this->params->criteres->ville = $criteres['ville'];
$this->params->criteres->telFax = $criteres['telFax'];
$this->params->criteres->naf = $criteres['naf'];
$this->params->criteres->siege = false;
$this->params->criteres->actif = in_array($criteres['actif'], array(0,1,2)) ? $criteres['actif'] : 2;
$this->params->criteres->fj = $criteres['fj'];
$this->params->position = $position;
$this->params->nbRep = empty($nbRep) ? $this->nbReponses : $nbRep ;
$client = $this->getSoapClient();
try {
$response = $client->searchEntreprise($this->params);
$this->response = $response->searchEntrepriseeResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* searchDirParams
* @void
*/
public function searchDirParams()
{
$this->setCache(false);
}
/**
* Recherche par dirigeants
* @param array $criteres
* @param integer $deb
* @param integer $nbRep
* @param integer $maxRep
*/
public function searchDir($criteres, $deb=0, $nbRep=20, $maxRep=200)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->criteres->nom = $criteres['dirNom'];
$this->params->criteres->prenom = $criteres['dirPrenom'];
$this->params->criteres->dateNaiss = $criteres['dirDateNaiss'];
$this->params->criteres->lieuNaiss = $criteres['lieuNaiss'];
$this->params->criteres->pertinence = ($criteres['pertinence']===true) ? true : false ;
$this->params->deb = $deb;
$this->params->nbRep = $nbRep;
$this->params->maxRep = $maxRep;
$client = $this->getSoapClient();
try {
$response = $client->searchDir($this->params);
$this->response = $response->searchDirResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* searchRefClientParams
* @void
*/
public function searchRefClientParams()
{
$this->setCache(false);
}
/**
* Recherche par référence client
* @param string $search
* @param integer $position
* @param integer $nbRep
*/
public function searchRefClient($search, $position=0, $nbRep=20)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->search = $search;
$this->params->position = $position;
$this->params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->searchRefClient($this->params);
$this->response = $response->searchRefClientResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* setSurveillance
* @param string $siret
* @param string $email
* @param string $ref
* @param string $source
* @param boolean $delete
* @param integer $encoursClient
* @void
*/
public function setSurveillance($siret, $email, $ref = '', $source='annonces', $delete=false, $encoursClient=0)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siret = $siret;
$this->params->email = $email;
$this->params->ref = $ref;
$this->params->source = $source;
$this->params->delete = $delete;
$this->params->encoursClient = $encoursClient;
$client = $this->getSoapClient();
try {
$response = $client->setSurveillance($this->params);
$this->response = $response->setSurveillanceResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
}

View File

@ -1,459 +0,0 @@
<?php
class Scores_Ws_Gestion extends Scores_Ws_Abstract
{
/**
* getCategory
*/
public function getCategory()
{
$filename = 'category';
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock('category');
}
try {
$client = $this->loadClient('gestion');
$reponse = $client->getCategory();
$cache->deletefile();
$cache->setBlock($reponse->getCategoryResult);
return $reponse->getCategoryResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
//Placer exception pour affichage message
return false;
}
}
/**
* getListeDroits
*/
public function getListeDroits()
{
$filename = 'droits';
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock('droits');
}
try {
$client = $this->loadClient('gestion');
$reponse = $client->getListeDroits();
$cache->deletefile();
$cache->setBlock($reponse->getListeDroitsResult);
return $reponse->getListeDroitsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
//Placer exception pour affichage message
return false;
}
}
/**
* getNextLogin
* @param int $idClient
*/
public function getNextLogin($idClient)
{
$params = new stdClass();
$params->idClient = $idClient;
try {
$client = $this->loadClient('gestion');
$reponse = $client->getNextLogin($params);
Zend_Registry::get('firebug')->info($reponse);
return $reponse->getNextLoginResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
Zend_Registry::get('firebug')->info($fault);
//Placer exception pour affichage message
return false;
}
}
/**
* getLogs
*/
public function getLogs()
{
$filename = 'logs';
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock('logs');
}
try {
$client = $this->loadClient('gestion');
$reponse = $client->getLogs();
$cache->deletefile();
$cache->setBlock($reponse->getLogsResult);
return $reponse->getLogsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
//Placer exception pour affichage message
return false;
}
}
/**
* getListePrefs
*/
public function getListePrefs()
{
$filename = 'prefs';
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock('prefs');
}
try {
$client = $this->loadClient('gestion');
$reponse = $client->getListePrefs();
$cache->deletefile();
$cache->setBlock($reponse->getListePrefsResult);
return $reponse->getListePrefsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
//Placer exception pour affichage message
return false;
}
}
/**
* Enregistre ou modifie un client
* @param unknown_type $infos
* @return boolean
*/
public function setClient($infos)
{
$params = new stdClass();
$params->infos = json_encode($infos);
try {
$client = $this->loadClient('gestion');
$reponse = $client->setClient($params);
return $reponse->setClientResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
Zend_Registry::get('firebug')->info($fault);
//Placer exception pour affichage message
return false;
}
}
/**
* setInfosLogin
* @param string $login
* @param string $action
* @param array $infos
*/
public function setInfosLogin($login, $action, $infos = null)
{
$params = new stdClass();
$params->login = $login;
$params->action = $action;
if ($infos !== null ) {
$params->infos = json_encode($infos);
}
try {
$client = $this->loadClient('gestion');
$reponse = $client->setInfosLogin($params);
return $reponse->setInfosLoginResult;
} catch (SoapFault $fault) {
if (in_array($fault->getCode(),array('MSG','ERR'))) {
return $fault->getMessage();
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
Zend_Registry::get('firebug')->info($fault);
//Placer exception pour affichage message
return false;
}
}
}
/**
* getInfosLogin
* @param string $login
* @param string $ipUtilisateur
*/
public function getInfosLogin($login, $ipUtilisateur = '')
{
$params = new stdClass();
$params->login = $login;
$params->ipUtilisateur = $ipUtilisateur;
try {
$client = $this->loadClient('gestion');
$reponse = $client->getInfosLogin($params);
return $reponse->getInfosLoginResult;
} catch (SoapFault $fault) {
if (substr($fault->faultcode,0,1)=='0'){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
* getListeUtilisateurs
* Enter description here ...
* @param string $login
* @param integer $idClient
*/
public function getListeUtilisateurs($login, $idClient = -1)
{
$params = new stdClass();
$params->login = $login;
$params->idClient = $idClient;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getListeUtilisateurs($params);
return $reponse->getListeUtilisateursResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getListeClients
* @param unknown_type $idClient
*/
public function getListeClients($idClient=false)
{
$params = new stdClass();
$params->idClient = $idClient;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getListeClients($params);
return $reponse->getListeClientsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getLogsClients
* @param unknown_type $mois
* @param unknown_type $detail
* @param unknown_type $idClient
* @param unknown_type $login
* @param unknown_type $all
*/
public function getLogsClients($mois, $detail=0, $idClient=0, $login='', $all=0)
{
$params = new stdClass();
$params->mois = $mois;
$params->detail = $detail;
$params->idClient = $idClient;
$params->login = $login;
$params->all = $all;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getLogsClients($params);
return $reponse->getLogsClientsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function setCGU()
{
$params = new stdClass();
$params->application ='';
$client = $this->loadClient('gestion');
try {
$reponse = $client->setCGU($params);
Zend_Registry::get('firebug')->info($reponse);
return $reponse->setCGUResult;
} catch(SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Get all infos for a user (Admin)
* @param string $login
*/
public function getUser($login)
{
$params = new stdClass();
$params->login = $login;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getUser($params);
return $reponse->getUserResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function getServiceUsers($idClient, $service)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->serviceCode = $service;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getServiceUsers($params);
Zend_Registry::get('firebug')->info($reponse);
return $reponse->getServiceUsersResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getServices($idClient)
{
$params = new stdClass();
$params->idClient = $idClient;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getServices($params);
return $reponse->getServicesResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setClientTarif($idClient, $log, $service, $type, $priceUnit, $limit, $date, $duree, $doublon)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->tarif->log = $log;
$params->tarif->service = $service;
$params->tarif->type = $type;
$params->tarif->priceUnit = $priceUnit;
$params->tarif->limit = $limit;
$params->tarif->date = $date;
$params->tarif->duree = $duree;
$params->tarif->doublon = $doublon;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setClientTarif($params);
return $reponse->setClientTarifResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getClientTarifs($idClient, $service = null)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->service = $service;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getClientTarifs($params);
return $reponse->getClientTarifsResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setService($idClient, $infos)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->infos = $infos;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setService($params);
return $reponse->setServiceResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function searchLogin($idClient, $query)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->query = $query;
$client = $this->loadClient('gestion');
try {
$reponse = $client->searchLogin($params);
return $reponse->searchLoginResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function setSurveillancesMail($login, $email)
{
$params = new stdClass();
$params->login = $login;
$params->email = $email;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setSurveillancesMail($params);
return $reponse->setSurveillancesMailResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setUserService($login, $code)
{
$params = new stdClass();
$params->login = $login;
$params->code = $code;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setUserService($params);
return $reponse->setUserServiceResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
}

View File

@ -1,88 +0,0 @@
<?php
/**
* Interface class for Scores_Ws
*/
interface Scores_Ws_Interface
{
/**
* Define service name
* @param string $name
*/
public function setService($name);
/**
* Get the service name
* @void
*/
public function getServiceName();
/**
* Get Method name
* @void
*/
public function getMethodName();
/**
* Get Params
* @void
*/
public function getParams();
/**
* Get fault code
* @void
*/
public function getFaultCode();
/**
* Set the default for max responses
* @param int $nb
*/
public function setNbReponses($nb);
/**
* Define WSDL URI
* @param string $wsdl
*/
public function setSoapClientWsdl($wsdl = null);
/**
* Define options for SoapClient
* @param string $name
* @param string $value
*/
public function setSoapClientOption($name = null , $value = null);
/**
* Instantiate Soap Client
*/
public function getSoapClient();
/**
* Get Soap Response
*/
public function getSoapResponse();
/**
* True if the response is an error
*/
public function isError();
/**
* True if the response is a message
*/
public function isMessage();
/**
* Return message (error)
*/
public function getMessage();
/**
* Get the filename for a mathod
* @param string $method
* @param array $args
*/
public function getFilename($method, $args);
}

View File

@ -1,654 +0,0 @@
<?php
class Scores_Ws_Interne extends Scores_Ws_Abstract
{
/**
* setCmdAsso
* @param unknown_type $infosCommande
* @param unknown_type $infosDemandeur
* @return boolean
*/
public function setCmdAsso($infosCommande, $infosDemandeur)
{
$params = new stdClass();
$params->infosCommande = $infosCommande;
$params->infosDemandeur = $infosDemandeur;
try {
$client = $this->loadClient('interne');
$reponse = $client->setCmdAsso($params);
return $reponse->setCmdAssoResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
Zend_Registry::get('firebug')->info($fault);
//Placer exception pour affichage message
return false;
}
}
/**
* getIdentiteLight
* @param string $siret
* @param int $id
* @return mixed
*/
public function getIdentiteLight($siret, $id = 0)
{
$filename = 'identitelight-'.$siret.'-'.$id;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new StdClass();
$params->siret = $siret;
$params->id = $id;
$client = $this->loadClient('interne');
try {
$reponse = $client->getIdentiteLight($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getIdentiteLightResult);
}
return $reponse->getIdentiteLightResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getDirigeantsOp
* @param string $siren
*/
public function getDirigeantsOp($siren)
{
$filename = 'dirigeantsop-'.$siren;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new StdClass();
$params->siren = $siren;
$client = $this->loadClient('interne');
try {
$reponse = $client->getDirigeantsOp($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getDirigeantsOpResult);
}
return $reponse->getDirigeantsOpResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getPortefeuille
* @param object $filtre
* @param integer $position
* @param integer $nbAffichage
*/
public function getPortefeuille($filtre, $position = 0, $nbAffichage = 100)
{
$params = new StdClass;
$params->filtre = $filtre;
$params->deb = $position;
$params->nbRep = $nbAffichage;
$client = $this->loadClient('interne');
try {
$reponse = $client->getPortefeuille($params);
return $reponse->getPortefeuilleResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getListeConventions
* Enter description here ...
* @param string $siren
*/
public function getListeConventions($siren)
{
$filename = 'conventions-'.$siren;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('interne');
try {
$reponse = $client->getListeConventions($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getListeConventionsResult);
}
return $reponse->getListeConventionsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getMarques
* Enter description here ...
* @param string $siren
* @param integer $idDepot
*/
public function getMarques($siren, $idDepot = 0)
{
$filename = 'marques-'.$siren.'-'.$idDepot;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new stdClass();
$params->siren = $siren;
$params->idDepot = $idDepot;
$client = $this->loadClient('interne');
try {
$reponse = $client->getMarques($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getMarquesResult);
}
return $reponse->getMarquesResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getPrivilegesDetail
* Enter description here ...
* @param unknown_type $siren
* @param unknown_type $tabTypes
*/
public function getPrivilegesDetail($siren, $tabTypes = array() )
{
$params = new stdClass();
$params->siren = $siren;
$params->tabTypes = $tabTypes;
$client = $this->loadClient('interne');
try {
$reponse = $client->getPrivilegesDetail($params);
return $reponse->getPrivilegesDetailResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getDevises
* Enter description here ...
* @param unknown_type $codeIsoDevise
*/
public function getDevises($codeIsoDevise = '')
{
$params = new stdClass();
$params->codeIsoDevise = $codeIsoDevise;
$client = $this->loadClient('interne');
try {
$reponse = $client->getDevises($params);
return $reponse->getDevisesResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getPrivilegesCumul
* Enter description here ...
* @param unknown_type $siren
* @param unknown_type $tabTypes
*/
public function getPrivilegesCumul($siren, $tabTypes = array() )
{
$params = new stdClass();
$params->siren = $siren;
$params->tabTypes = $tabTypes;
$client = $this->loadClient('interne');
try {
$reponse = $client->getPrivilegesCumul($params);
return $reponse->getPrivilegesCumulResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getTribunaux
* Enter description here ...
* @param unknown_type $tabTypes
*/
public function getTribunaux($tabTypes = array())
{
$params = new stdClass();
$params->tabTypes = $tabTypes;
$client = $this->loadClient('interne');
try {
$reponse = $client->getTribunaux($params);
return $reponse->getTribunauxResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getListeJalCollecte
* Enter description here ...
*/
public function getListeJalCollecte()
{
$filename = 'listejalcollecte';
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
$params = new stdClass();
$client = $this->loadClient('interne');
try {
$reponse = $client->getListeJalCollecte();
$cache->deletefile();
$cache->setBlock($reponse->getListeJalCollecteResult);
return $reponse->getListeJalCollecteResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Recherche Actionnaire
* @param unknown_type $nom
* @param unknown_type $cpVille
* @param unknown_type $siren
* @param unknown_type $pays
* @param unknown_type $pctMin
* @param unknown_type $pctMax
* @param unknown_type $deb
* @param unknown_type $nbRep
* @param unknown_type $maxRep
* @param unknown_type $pertinence
*/
public function searchAct($nom, $cpVille='', $siren='', $pays='', $pctMin=0, $pctMax=100, $deb=0)
{
$params = new stdClass();
$params->nom = $nom;
$params->cpVille = $cpVille;
$params->siren = $siren;
$params->pays = $pays;
$params->pctMin = $pctMin;
$params->pctMax= $pctMax;
$params->pertinence = false;
$params->deb = $deb;
$params->nbRep = $this->nbReponses;
//$params->maxRep = $maxRep;
$client = $this->loadClient('interne');
try {
$reponse = $client->searchAct($params);
return $reponse->searchActResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Recherche Historique
* @param string $recherche
* @param string $annee
* @param string $typeBod
* @param integer $deb
*/
public function rechercheHisto($recherche, $annee, $typeBod, $deb = 0)
{
$params = new stdClass();
$params->recherche = $recherche;
$params->annee = $annee;
$params->typeBod = $typeBod;
$params->deb = $deb;
$params->nbRep = $this->nbReponses;
$client = $this->loadClient('interne');
try {
$reponse = $client->rechercheHisto($params);
return $reponse->rechercheHistoResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* searchMandataires
* @param unknown_type $nom
* @param unknown_type $type
* @param unknown_type $cpDep
*/
public function searchMandataires($nom, $type=array(), $cpDep=0)
{
$params = new stdClass();
$params->nom = $nom;
$params->type = $type;
$params->cpDep = $cpDep;
$client = $this->loadClient('interne');
try {
$reponse = $client->searchMandataires($params);
return $reponse->searchMandatairesResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* setMandataire
* Enter description here ...
* @param unknown_type $infos
*/
public function setMandataire($infos)
{
$params = new stdClass();
$params->infos->id = $infos['id'];
$params->infos->sirenGrp = $infos['sirenGrp'];
$params->infos->sirenMand = $infos['sirenMand'];
$params->infos->Nom = $infos['Nom'];
$params->infos->Prenom = $infos['Prenom'];
$params->infos->type = $infos['type'];
$params->infos->stagiaire = $infos['stagiaire'];
$params->infos->coursAppel = $infos['coursAppel'];
$params->infos->coursAppel2 = $infos['coursAppel2'];
$params->infos->tribunal = $infos['tribunal'];
$params->infos->Statut = $infos['Statut'];
$params->infos->adresse = $infos['adresse'];
$params->infos->adresseComp = $infos['adresseComp'];
$params->infos->cp = $infos['cp'];
$params->infos->ville = $infos['ville'];
$params->infos->tel = $infos['tel'];
$params->infos->fax = $infos['fax'];
$params->infos->email = $infos['email'];
$params->infos->web = $infos['web'];
$params->infos->contact = $infos['contact'];
$client = $this->loadClient('interne');
try {
$reponse = $client->setMandataire($params);
return $reponse->setMandataireResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getIdCourAppel
* @param string $codeTribunal
*/
public function getIdCoursAppel($codeTribunal)
{
$params = new stdClass();
$params->codeTribunal = $codeTribunal;
$client = $this->loadClient('interne');
try {
$reponse = $client->getIdCoursAppel($params);
return $reponse->getIdCoursAppelResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* setLog
* @param string $page
* @param string $siret
* @param string $id
* @param string $ref
*/
public function setLog ($page, $siret, $id=0, $ref = '')
{
$params = new stdClass();
$params->page = $page;
$params->siret = $siret;
$params->id = $id;
$params->ref = $ref;
$client = $this->loadClient('interne');
try {
$reponse = $client->setLog($params);
return true;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getListeSurveillanceCsv
* @param unknown_type $source
* @param unknown_type $login
* @param unknown_type $idClient
*/
public function getListeSurveillancesCsv($source='', $login='', $idClient=0)
{
$params = new stdClass();
$params->source = $source;
$params->login = $login;
$params->idClient = $idClient;
$client = $this->loadClient('interne');
try {
$reponse = $client->getListeSurveillancesCsv($params);
return $reponse->getListeSurveillancesCsvResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getPortefeuilleCsv
* @param unknown_type $login
* @param unknown_type $idClient
*/
public function getPortefeuilleCsv($login='', $idClient=0)
{
$params = new stdClass();
$params->login = $login;
$params->idClient = $idClient;
//@todo : Seulement pour aider Altysis
$c = Zend_Registry::get('config');
$location = $c->profil->webservice->location;
$cWS = new Zend_Config_Ini(realpath(dirname(__FILE__)) . '/webservices.ini');
$config = $cWS->toArray();
$this->webservices = $config[$location]['webservices'];
//@todo
$client = $this->loadClient('interne');
try {
$reponse = $client->getPortefeuilleCsv($params);
return $reponse->getPortefeuilleCsvResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Enter description here ...
* @param string $idAnn
* @param string $siret
*/
public function getAnnonceCollecte($idAnn, $siret)
{
$params = new stdClass();
$params->idAnn= $idAnn;
$params->siret = $siret;
$client = $this->loadClient('interne');
try {
$reponse = $client->getAnnonceCollecte($params);
return $reponse->getAnnonceCollecteResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Enter description here ...
* @param unknown_type $siren
* @return Ambigous <boolean, mixed>|boolean
*/
public function getListeDepots($siren)
{
$filename = 'listedepots-'.$siren;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('interne');
try {
$reponse = $client->getListeDepots($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getListeDepotsResult);
}
return $reponse->getListeDepotsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Commande d'une enquete intersud
* @param string $siren
* @param array $infoEnq
* @param array $infoUser
*/
public function commandeEnquete($siren, $infoEnq, $infoUser)
{
$params = new stdClass();
$params->siren = $siren;
$params->infoEnq = json_encode($infoEnq);
$params->infoDemande = json_encode($infoUser);
$client = $this->loadClient('interne');
try {
$reponse = $client->commandeEnquete($params);
return $reponse->commandeEnqueteResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Retourne l'arborescence d'un groupe
* @param string $siren
* @param int pctMin
* @param int $nbNiveaux
*/
public function getGroupesArbo($siren, $pctMin=33, $nbNiveaux=10)
{
$filename = 'groupesarbo-'.$siren.'-'.$pctMin;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new StdClass;
$params->siren = $siren;
$params->pctMin = $pctMin;
$params->nbNiveaux = $nbNiveaux;
$client = $this->loadClient('interne');
try {
$reponse = $client->getGroupesArbo($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getGroupesArboResult);
}
return $reponse->getGroupesArboResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Retourne les infos du groupe
* @param string $siren
*/
public function getGroupeInfos($siren)
{
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('interne');
try {
$reponse = $client->getGroupeInfos($params);
return $reponse->getGroupeInfosResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('Error')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getCountryId($code)
{
$params = new stdClass();
$params->codeCountry = $code;
$client = $this->loadClient('interne');
try {
$reponse = $client->getCountryId($params);
return $reponse->getCountryIdResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
}

View File

@ -1,75 +0,0 @@
<?php
class Scores_Ws_Pieces extends Scores_Ws_Abstract
{
/**
* Récupération des kbis
*/
public function getKbis($siren, $diffusion, $reference='')
{
$params = new StdClass;
$params->siren = $siren;
$params->diffusion = $diffusion;
$params->reference = $reference;
$client = $this->loadClient('pieces');
try {
$reponse = $client->getKbis($params);
return $reponse->getKbisResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('0000', 'MSG')) ){
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
* Liste des bilans
* @param string $siren
* @todo : Cache
*/
public function getPiecesBilans($siren)
{
$params = new stdClass();
$params->identifiant = $siren;
$client = $this->loadClient('pieces');
try {
$reponse = $client->getBilans($params);
return $reponse->getBilansResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Bilan URL
* @param string $siren
* @param string $diffusion
* @param string $dateCloture
* @param string $reference
*/
public function getPiecesBilan($siren, $diffusion, $dateCloture, $reference)
{
$params = new stdClass();
$params->identifiant = $siren;
$params->diffusion = $diffusion;
$params->dateCloture = $dateCloture;
$params->reference = $reference;
$client = $this->loadClient('pieces');
try {
$reponse = $client->getBilan($params);
Zend_Registry::get('firebug')->info($reponse);
return $reponse->getBilanResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}

View File

@ -1,511 +0,0 @@
<?php
class Scores_Ws_Saisie extends Scores_Ws_Abstract
{
/**
* getMandataire
* @param string $idMand
*/
public function getMandataire($idMand)
{
$params = new stdClass();
$params->id = $idMand;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getMandataire($params);
return $reponse->getMandataireResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* dupliqueAnnonce
* @param integer $source
* @param string $idAnn
* @param string $siretIn
* @param string $siretOut
* @return boolean
*/
public function dupliqueAnnonce($source, $idAnn, $siretIn = '', $siretOut = '')
{
$params = new stdClass();
$params->source= $source;
$params->idAnn= $idAnn;
$params->siretIn = $siretIn;
$params->siretOut = $siretOut;
$client = $this->loadClient('saisie');
try {
$reponse = $client->dupliqueAnnonce($params);
return $reponse->dupliqueAnnonceResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Enter description here ...
* @param string $siret
* @param integer $id
* @param array $infos
* @return boolean
*/
public function setInfosEntrep($siret, $id, $infos)
{
$params = new stdClass();
$params->siret = $siret;
$params->idEntreprise = $siret;
$params->infos = json_encode($infos);
$client = $this->loadClient('saisie');
try {
$reponse = $client->setInfosEntrep($params);
return $reponse->setInfosEntrepResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Enter description here ...
* @param unknown_type $idAnn
* @param unknown_type $siret
*/
public function supprAnnonceCollecte($idAnn, $siret = '')
{
$params = new stdClass();
$params->idAnn= $idAnn;
$params->siret= $siret;
$client = $this->loadClient('saisie');
try {
$reponse = $client->supprAnnonceCollecte($params);
return $reponse->supprAnnonceCollecteResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* supprAnnonce
* @param integer $source
* @param string $idAnn
* @param string $siret
*/
public function supprAnnonce($source, $idAnn, $siret = '')
{
$params = new stdClass();
$params->source= $source;
$params->idAnn= $idAnn;
$params->siret = $siret;
$client = $this->loadClient('saisie');
try {
$reponse = $client->supprAnnonce($params);
return $reponse->supprAnnonceResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Enter description here ...
* @param unknown_type $siren
* @param unknown_type $id
* @param unknown_type $codeEven
*/
public function setAnnonceEven($siren, $id, $codeEven)
{
$params = new stdClass();
$params->siren = $siren;
$params->id = $id;
$params->codeEven = $codeEven;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setAnnonceEven($params);
return $reponse->setAnnonceEvenResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function setActeAsso($siren, $waldec, $type, $libelle, $date)
{
$params = new stdClass();
$params->siren = $siren;
$params->waldec = $waldec;
$params->type = $type;
$params->libelle = $libelle;
$params->date = $date;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setActeAsso($params);
return $reponse->setActeAssoResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setBilan($siren, $unite, $dateCloture, $dureeMois, $dateCloturePre, $dureeMoisPre, $typeBilan, $postes, $step = 'normal')
{
$params = new stdClass();
$params->siren = $siren;
$params->data->unite = $unite;
$params->data->dateCloture = $dateCloture;
$params->data->dureeMois = $dureeMois;
$params->data->dateCloturePre = $dateCloturePre;
$params->data->dureeMoisPre = $dureeMoisPre;
$params->data->typeBilan = $typeBilan;
$params->data->postes = $postes;
$params->step = $step;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setBilan($params);
return $reponse->setBilanResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setLienRef($infos, $id = null)
{
$params = new stdClass();
$params->infos = $infos;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setLienRef($params);
return $reponse->setLienRefResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function searchLienRef($query, $type = null)
{
$params = new stdClass();
$params->query = $query;
$params->type = $type;
$client = $this->loadClient('saisie');
try {
$reponse = $client->searchLienRef($params);
return $reponse->searchLienRefResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setLienDoc($infos, $id = null)
{
$params = new stdClass();
$params->infos = $infos;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setLienDoc($params);
return $reponse->setLienDocResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function setLien($infos, $id = null)
{
$params = new stdClass();
$params->infos = $infos;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setLien($params);
return $reponse->setLienResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getSaisieLienRef($id)
{
$params = new stdClass();
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getLienRef($params);
return $reponse->getLienRefResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getSaisieLien($id)
{
$params = new stdClass();
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getLien($params);
return $reponse->getLienResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setBourse($isin, $infos)
{
$params = new stdClass();
$params->isin = $isin;
$params->infos = $infos;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setBourse($params);
return $reponse->setBourseResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getSaisieBourse($isin)
{
$params = new stdClass();
$params->isin = $isin;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getBourse($params);
return $reponse->getBourseResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
* Get Score Cut Off
* @param string $siren
* @return Cutoff values or False
*/
public function getScoreCutoff($siren)
{
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getScoreCutoff($params);
return $reponse->getScoreCutoffResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
/**
* Delete Score Cut Off
* @param string $siren
* @return boolean
*/
public function delScoreCutoff($siren)
{
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('saisie');
try {
$reponse = $client->delScoreCutoff($params); //change name when webservice is ready
return $reponse->delScoreCutoffResult; //change name when webservice is ready
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
public function setLienChange($action, $idLien, $id)
{
$params = new stdClass();
$params->action = $action;
$params->idLien = $idLien;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setLienChange($params);
return $reponse->setLienChangeResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
* Set Score Cut Off
* @param string $siren
* @param int $encours
* @param int $scoreSolv
* @param int $scoreDir
* @param int $scoreConf
* @param string $remarque
* @param boolean delete
* @return boolean
*/
public function setScoreCutoff($siren, $encours, $scoreSolv, $scoreDir, $scoreConf, $remarque, $delete)
{
$infos = array(
'siren' => $siren,
'encours' => $encours,
'scoreSolv' => $scoreSolv,
'scoreDir' => $scoreDir,
'scoreConf' => $scoreConf,
'remarque' => $remarque,
);
$params = new stdClass();
$params->infos = json_encode($infos);
$params->delete = $delete;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setScoreCutoff($params);
return $reponse->setScoreCutoffResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
public function getLienDoc($id, $type = null, $groupe = false)
{
$params = new stdClass();
$params->id = $id;
$params->type = $type;
$params->groupe = $groupes;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getLienDoc($params);
return $reponse->getLienDocResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getDirigeantsOp
* @param string $siren
*/
public function getDirigeantsOp($siren, $id = null)
{
$filename = 'dirigeantsop-'.$siren.'-'.intval($id);
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new StdClass();
$params->siren = $siren;
$params->id = $id;
$client = $this->loadClient('interne');
try {
$reponse = $client->getDirigeantsOp($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getDirigeantsOpResult);
}
return $reponse->getDirigeantsOpResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* setDirigeantsOp
* @param array $infos
*/
public function setDirigeantsOp($infos, $mode, $id)
{
$params = new stdClass();
$params->infos = $infos;
$params->mode = $mode;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setDirigeantsOp($params);
return $reponse->setDirigeantsOpResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
}

View File

@ -101,6 +101,25 @@ class WsScores
return $client;
}
public function setPiecesBilanEnterCmd($siren, $date, $type, $source, $private)
{
$params = new stdClass();
$params->siren = $siren;
$params->date = $date;
$params->type = $type;
$params->source = $source;
$params->private = $private;
$client = $this->loadClient('pieces');
try {
$reponse = $client->setBilanEnterCmd($params);
return $reponse->setBilanEnterCmdResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function getEntrepriseLiasseInfos($siren)
{
$params = new stdClass();
@ -918,10 +937,12 @@ class WsScores
}
}
public function setBilan($siren, $unite, $dateCloture, $dureeMois, $dateCloturePre, $dureeMoisPre, $typeBilan, $postes, $step = 'normal')
public function setBilan($siren, $originalDateCloture, $originalTypeBilan, $unite, $dateCloture, $dureeMois, $dateCloturePre, $dureeMoisPre, $typeBilan, $postes, $step = 'normal')
{
$params = new stdClass();
$params = new stdClass();
$params->siren = $siren;
$params->cloture = $originalDateCloture;
$params->type = $originalTypeBilan;
$params->data->unite = $unite;
$params->data->dateCloture = $dateCloture;
$params->data->dureeMois = $dureeMois;
@ -929,11 +950,11 @@ class WsScores
$params->data->dureeMoisPre = $dureeMoisPre;
$params->data->typeBilan = $typeBilan;
$params->data->postes = $postes;
$params->step = $step;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setBilan($params);
return $reponse->setBilanResult;
$params->step = $step;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setBilan($params);
return $reponse->setBilanResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
@ -941,10 +962,11 @@ class WsScores
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
}
/**
* Liste des bilans
* @param string $identifiant

View File

@ -1,29 +1,29 @@
[local]
webservices.interne.wsdl = "http://webservice-2.7.sd.dev/interne/v0.6?wsdl-auto"
webservices.interne.wsdl = "http://webservice-2.8.sd.dev/interne/v0.6?wsdl-auto"
webservices.interne.options.soap_version = SOAP_1_2
webservices.entreprise.wsdl = "http://webservice-2.7.sd.dev/entreprise/v0.8?wsdl-auto"
webservices.entreprise.wsdl = "http://webservice-2.8.sd.dev/entreprise/v0.8?wsdl-auto"
webservices.entreprise.options.soap_version = SOAP_1_2
webservices.gestion.wsdl = "http://webservice-2.7.sd.dev/gestion/v0.3?wsdl-auto"
webservices.gestion.wsdl = "http://webservice-2.8.sd.dev/gestion/v0.3?wsdl-auto"
webservices.gestion.options.soap_version = SOAP_1_2
webservices.saisie.wsdl = "http://webservice-2.7.sd.dev/saisie/v0.2?wsdl-auto"
webservices.saisie.wsdl = "http://webservice-2.8.sd.dev/saisie/v0.2?wsdl-auto"
webservices.saisie.options.soap_version = SOAP_1_2
webservices.pieces.wsdl = "http://webservice-2.7.sd.dev/pieces/v0.1?wsdl-auto"
webservices.pieces.wsdl = "http://webservice-2.8.sd.dev/pieces/v0.1?wsdl-auto"
webservices.pieces.options.soap_version = SOAP_1_2
webservices.catalog.wsdl = "http://webservice-2.7.sd.dev/catalog/v0.1?wsdl-auto"
webservices.catalog.wsdl = "http://webservice-2.8.sd.dev/catalog/v0.1?wsdl-auto"
webservices.catalog.options.soap_version = SOAP_1_2
[sdsrvdev01]
webservices.interne.wsdl = "http://webservice-2.7.sd.lan/interne/v0.6?wsdl-auto"
webservices.interne.wsdl = "http://webservice-2.8.sd.lan/interne/v0.6?wsdl-auto"
webservices.interne.options.soap_version = SOAP_1_2
webservices.entreprise.wsdl = "http://webservice-2.7.sd.lan/entreprise/v0.8?wsdl-auto"
webservices.entreprise.wsdl = "http://webservice-2.8.sd.lan/entreprise/v0.8?wsdl-auto"
webservices.entreprise.options.soap_version = SOAP_1_2
webservices.gestion.wsdl = "http://webservice-2.6.sd.lan/gestion/v0.3?wsdl-auto"
webservices.gestion.options.soap_version = SOAP_1_2
webservices.saisie.wsdl = "http://webservice-2.7.sd.lan/saisie/v0.2?wsdl-auto"
webservices.saisie.wsdl = "http://webservice-2.8.sd.lan/saisie/v0.2?wsdl-auto"
webservices.saisie.options.soap_version = SOAP_1_2
webservices.pieces.wsdl = "http://webservice-2.7.sd.lan/pieces/v0.1?wsdl-auto"
webservices.pieces.wsdl = "http://webservice-2.8.sd.lan/pieces/v0.1?wsdl-auto"
webservices.pieces.options.soap_version = SOAP_1_2
webservices.catalog.wsdl = "http://webservice-2.7.sd.lan/catalog/v0.1?wsdl-auto"
webservices.catalog.wsdl = "http://webservice-2.8.sd.lan/catalog/v0.1?wsdl-auto"
webservices.catalog.options.soap_version = SOAP_1_2
[sd-25137]

File diff suppressed because it is too large Load Diff

View File

@ -126,7 +126,11 @@ if (!extension_loaded("ChartDirector PHP API"))
$ver = explode('.', phpversion());
$ver = $ver[0] * 10000 + $ver[1] * 100 + $ver[2];
if ($ver >= 50400)
if ($ver >= 50600)
$ext = "phpchartdir560.dll";
else if ($ver >= 50500)
$ext = "phpchartdir550.dll";
else if ($ver >= 50400)
$ext = "phpchartdir540.dll";
else if ($ver >= 50300)
$ext = "phpchartdir530.dll";
@ -2235,7 +2239,7 @@ class StepLineLayer extends LineLayer {
$this->ptr = $ptr;
}
function setAlignment($a) {
return callmethod("StepLineLayer.getLine", $this->ptr, $a);
return callmethod("StepLineLayer.setAlignment", $this->ptr, $a);
}
}

View File

@ -1,12 +1,12 @@
<?php
/**
* Copyright 2011 Craig Campbell
* Copyright 2010-2013 Craig Campbell
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -26,38 +26,18 @@ class ChromePhp
/**
* @var string
*/
const COOKIE_NAME = 'chromephp_log';
const VERSION = '4.1.0';
/**
* @var string
*/
const VERSION = '2.2.3';
/**
* @var string
*/
const LOG_PATH = 'log_path';
/**
* @var string
*/
const URL_PATH = 'url_path';
/**
* @var string
*/
const STORE_LOGS = 'store_logs';
const HEADER_NAME = 'X-ChromeLogger-Data';
/**
* @var string
*/
const BACKTRACE_LEVEL = 'backtrace_level';
/**
* @var string
*/
const MAX_TRANSFER = 'max_transfer';
/**
* @var string
*/
@ -96,7 +76,7 @@ class ChromePhp
/**
* @var string
*/
const COOKIE_SIZE_WARNING = 'cookie size of 4kb exceeded! try ChromePhp::useFile() to pull the log data from disk';
const TABLE = 'table';
/**
* @var string
@ -113,7 +93,7 @@ class ChromePhp
*/
protected $_json = array(
'version' => self::VERSION,
'columns' => array('label', 'log', 'backtrace', 'type'),
'columns' => array('log', 'backtrace', 'type'),
'rows' => array()
);
@ -131,11 +111,7 @@ class ChromePhp
* @var array
*/
protected $_settings = array(
self::LOG_PATH => null,
self::URL_PATH=> null,
self::STORE_LOGS => false,
self::BACKTRACE_LEVEL => 1,
self::MAX_TRANSFER => 3000
self::BACKTRACE_LEVEL => 1
);
/**
@ -155,7 +131,6 @@ class ChromePhp
*/
private function __construct()
{
$this->_deleteCookie();
$this->_php_version = phpversion();
$this->_timestamp = $this->_php_version >= 5.1 ? $_SERVER['REQUEST_TIME'] : time();
$this->_json['request_uri'] = $_SERVER['REQUEST_URI'];
@ -169,7 +144,7 @@ class ChromePhp
public static function getInstance()
{
if (self::$_instance === null) {
self::$_instance = new ChromePhp();
self::$_instance = new self();
}
return self::$_instance;
}
@ -177,46 +152,37 @@ class ChromePhp
/**
* logs a variable to the console
*
* @param string label
* @param mixed value
* @param string severity ChromePhp::LOG || ChromePhp::WARN || ChromePhp::ERROR
* @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
* @return void
*/
public static function log()
{
$args = func_get_args();
$severity = count($args) == 3 ? array_pop($args) : '';
// save precious bytes in the cookie
if ($severity == self::LOG) {
$severity = '';
}
return self::_log($args + array('type' => $severity));
return self::_log('', $args);
}
/**
* logs a warning to the console
*
* @param string label
* @param mixed value
* @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
* @return void
*/
public static function warn()
{
return self::_log(func_get_args() + array('type' => self::WARN));
$args = func_get_args();
return self::_log(self::WARN, $args);
}
/**
* logs an error to the console
*
* @param string label
* @param mixed value
* @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
* @return void
*/
public static function error()
{
return self::_log(func_get_args() + array('type' => self::ERROR));
$args = func_get_args();
return self::_log(self::ERROR, $args);
}
/**
@ -226,17 +192,20 @@ class ChromePhp
*/
public static function group()
{
return self::_log(func_get_args() + array('type' => self::GROUP));
$args = func_get_args();
return self::_log(self::GROUP, $args);
}
/**
* sends an info log
*
* @param string value
* @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
* @return void
*/
public static function info()
{
return self::_log(func_get_args() + array('type' => self::INFO));
$args = func_get_args();
return self::_log(self::INFO, $args);
}
/**
@ -246,7 +215,8 @@ class ChromePhp
*/
public static function groupCollapsed()
{
return self::_log(func_get_args() + array('type' => self::GROUP_COLLAPSED));
$args = func_get_args();
return self::_log(self::GROUP_COLLAPSED, $args);
}
/**
@ -256,7 +226,19 @@ class ChromePhp
*/
public static function groupEnd()
{
return self::_log(func_get_args() + array('type' => self::GROUP_END));
$args = func_get_args();
return self::_log(self::GROUP_END, $args);
}
/**
* sends a table log
*
* @param string value
*/
public static function table()
{
$args = func_get_args();
return self::_log(self::TABLE, $args);
}
/**
@ -265,34 +247,21 @@ class ChromePhp
* @param string $type
* @return void
*/
protected static function _log(array $args)
protected static function _log($type, array $args)
{
$type = $args['type'];
unset($args['type']);
// nothing passed in, don't do anything
if (count($args) == 0 && $type != self::GROUP_END) {
return;
}
// default to single
$label = null;
$value = isset($args[0]) ? $args[0] : '';
$logger = self::getInstance();
if ($logger->_error_triggered) {
return;
}
// if there are two values passed in then the first one is the label
if (count($args) == 2) {
$label = $args[0];
$value = $args[1];
}
$logger->_processed = array();
$value = $logger->_convert($value);
$logs = array();
foreach ($args as $arg) {
$logs[] = $logger->_convert($arg);
}
$backtrace = debug_backtrace(false);
$level = $logger->getSetting(self::BACKTRACE_LEVEL);
@ -302,7 +271,7 @@ class ChromePhp
$backtrace_message = $backtrace[$level]['file'] . ' : ' . $backtrace[$level]['line'];
}
$logger->_addRow($label, $value, $backtrace_message, $type);
$logger->_addRow($logs, $backtrace_message, $type);
}
/**
@ -325,7 +294,7 @@ class ChromePhp
$object_as_array = array();
// first add the class name
$object_as_array['class'] = get_class($object);
$object_as_array['___class_name'] = get_class($object);
// loop through object vars
$object_vars = get_object_vars($object);
@ -392,110 +361,37 @@ class ChromePhp
}
/**
* adds a value to the cookie
* adds a value to the data array
*
* @var mixed
* @return void
*/
protected function _addRow($label, $log, $backtrace, $type)
protected function _addRow(array $logs, $backtrace, $type)
{
// if this is logged on the same line for example in a loop, set it to null to save space
if (in_array($backtrace, $this->_backtraces)) {
$backtrace = null;
}
// for group, groupEnd, and groupCollapsed
// take out the backtrace since it is not useful
if ($type == self::GROUP || $type == self::GROUP_END || $type == self::GROUP_COLLAPSED) {
$backtrace = null;
}
if ($backtrace !== null) {
$this->_backtraces[] = $backtrace;
}
$this->_clearRows();
$row = array($label, $log, $backtrace, $type);
// if we are in cookie mode and the row won't fit then don't add it
if ($this->getSetting(self::LOG_PATH) === null && !$this->_willFit($row)) {
return $this->_cookieMonster();
}
$row = array($logs, $backtrace, $type);
$this->_json['rows'][] = $row;
$this->_writeCookie();
$this->_writeHeader($this->_json);
}
/**
* clears existing rows in special cases
*
* for ajax requests chrome will be listening for cookie changes
* this means we can send the cookie data one row at a time as it comes in
*
* @return void
*/
protected function _clearRows()
protected function _writeHeader($data)
{
// if we are in file mode we want the file to have all the log data
if ($this->getSetting(self::LOG_PATH) !== null) {
return;
}
// X-Requested-With header not present or not equal to XMLHttpRequest
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
return;
}
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
return;
}
$this->_json['rows'] = array();
}
/**
* determines if this row will fit in the cookie
*
* @param array $row
* @return bool
*/
protected function _willFit($row)
{
$json = $this->_json;
$json['rows'][] = $row;
// if we don't have multibyte string length available just use regular string length
// this doesn't have to be perfect, just want to prevent sending more data
// than chrome or apache can handle in a cookie
$encoded_string = $this->_encode($json);
$size = function_exists('mb_strlen') ? mb_strlen($encoded_string) : strlen($encoded_string);
// if the size is greater than the max transfer size
if ($size > $this->getSetting(self::MAX_TRANSFER)) {
return false;
}
return true;
}
/**
* writes the cookie
*
* @return bool
*/
protected function _writeCookie()
{
// if we are going to use a file then use that
// here we only want to json_encode
if ($this->getSetting(self::LOG_PATH) !== null) {
return $this->_writeToFile(json_encode($this->_json));
}
return $this->_setCookie($this->_json);
}
/**
* deletes the main cookie
*
* @return bool
*/
protected function _deleteCookie()
{
return setcookie(self::COOKIE_NAME, null, 1);
header(self::HEADER_NAME . ': ' . $this->_encode($data));
}
/**
@ -509,17 +405,6 @@ class ChromePhp
return base64_encode(utf8_encode(json_encode($data)));
}
/**
* sets the main cookie
*
* @param array
* @return bool
*/
protected function _setCookie($data)
{
return setcookie(self::COOKIE_NAME, $this->_encode($data), time() + 30);
}
/**
* adds a setting
*
@ -558,65 +443,4 @@ class ChromePhp
}
return $this->_settings[$key];
}
/**
* this will allow you to specify a path on disk and a uri to access a static file that can store json
*
* this allows you to log data that is more than 4k
*
* @param string path to directory on disk to keep log files
* @param string url path to url to access the files
*/
public static function useFile($path, $url)
{
$logger = self::getInstance();
$logger->addSetting(self::LOG_PATH, rtrim($path, '/'));
$logger->addSetting(self::URL_PATH, rtrim($url, '/'));
}
/**
* handles cases when there is too much data
*
* @param string
* @return void
*/
protected function _cookieMonster()
{
$this->_error_triggered = true;
$this->_json['rows'][] = array(null, self::COOKIE_SIZE_WARNING, 'ChromePhp', self::WARN);
return $this->_writeCookie();
}
/**
* writes data to a file
*
* @param string
* @return void
*/
protected function _writeToFile($json)
{
// if the log path is not setup then create it
if (!is_dir($this->getSetting(self::LOG_PATH))) {
mkdir($this->getSetting(self::LOG_PATH));
}
$file_name = 'last_run.json';
if ($this->getSetting(self::STORE_LOGS)) {
$file_name = 'run_' . $this->_timestamp . '.json';
}
file_put_contents($this->getSetting(self::LOG_PATH) . '/' . $file_name, $json);
$data = array(
'uri' => $this->getSetting(self::URL_PATH) . '/' . $file_name,
'request_uri' => $_SERVER['REQUEST_URI'],
'time' => $this->_timestamp,
'version' => self::VERSION
);
return $this->_setCookie($data);
}
}
?>

View File

@ -0,0 +1,23 @@
## Overview
ChromePhp is a PHP library for the Chrome Logger Google Chrome extension.
This library allows you to log variables to the Chrome console.
## Requirements
- PHP 5 or later
## Installation
1. Install the Chrome extension from: https://chrome.google.com/extensions/detail/noaneddfkdjfnfdakjjmocngnfkfehhd
2. Click the extension icon in the browser to enable it for the current tab's domain
3. Put ChromePhp.php somewhere in your PHP include path
4. Log some data
```php
include 'ChromePhp.php';
ChromePhp::log('Hello console!');
ChromePhp::log($_SERVER);
ChromePhp::warn('something went wrong!');
```
More information can be found here:
http://www.chromelogger.com

View File

@ -0,0 +1,24 @@
{
"name": "ccampbell/chromephp",
"type": "library",
"description": "Log variables to the Chrome console (via Chrome Logger Google Chrome extension).",
"keywords": ["log","logging"],
"homepage": "http://github.com/ccampbell/chromephp",
"license": "Apache-2.0",
"authors": [
{
"name": "Craig Campbell",
"email": "iamcraigcampbell@gmail.com",
"homepage": "http://craig.is",
"role": "Developer"
}
],
"require": {
"php": ">=5.0.0"
},
"autoload": {
"psr-0": {
"ChromePhp": ""
}
}
}

View File

@ -1,8 +1,8 @@
<?php
//
// FPDI - Version 1.3.2
// FPDI - Version 1.5.2
//
// Copyright 2004-2010 Setasign - Jan Slabon
// Copyright 2004-2014 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -17,88 +17,98 @@
// limitations under the License.
//
if (!defined('ORD_z'))
define('ORD_z',ord('z'));
if (!defined('ORD_exclmark'))
define('ORD_exclmark', ord('!'));
if (!defined('ORD_u'))
define('ORD_u', ord('u'));
if (!defined('ORD_tilde'))
define('ORD_tilde', ord('~'));
/**
* Class FilterASCII85
*/
class FilterASCII85
{
/**
* Decode ASCII85 encoded string
*
* @param string $in
* @return string
* @throws Exception
*/
public function decode($in)
{
$ord = array(
'~' => ord('~'),
'z' => ord('z'),
'u' => ord('u'),
'z' => ord('z'),
'!' => ord('!')
);
$__tmp = version_compare(phpversion(), "5") == -1 ? array('FilterASCII85') : array('FilterASCII85', false);
if (!call_user_func_array('class_exists', $__tmp)) {
$out = '';
$state = 0;
$chn = null;
class FilterASCII85 {
function error($msg) {
die($msg);
}
function decode($in) {
$out = '';
$state = 0;
$chn = null;
$l = strlen($in);
for ($k = 0; $k < $l; ++$k) {
$ch = ord($in[$k]) & 0xff;
if ($ch == ORD_tilde) {
break;
}
if (preg_match('/^\s$/',chr($ch))) {
continue;
}
if ($ch == ORD_z && $state == 0) {
$out .= chr(0).chr(0).chr(0).chr(0);
continue;
}
if ($ch < ORD_exclmark || $ch > ORD_u) {
return $this->error('Illegal character in ASCII85Decode.');
}
$chn[$state++] = $ch - ORD_exclmark;
if ($state == 5) {
$state = 0;
$r = 0;
for ($j = 0; $j < 5; ++$j)
$r = $r * 85 + $chn[$j];
$out .= chr($r >> 24);
$out .= chr($r >> 16);
$out .= chr($r >> 8);
$out .= chr($r);
}
$l = strlen($in);
for ($k = 0; $k < $l; ++$k) {
$ch = ord($in[$k]) & 0xff;
if ($ch == $ord['~']) {
break;
}
$r = 0;
if ($state == 1)
return $this->error('Illegal length in ASCII85Decode.');
if ($state == 2) {
$r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1]+1) * 85 * 85 * 85;
$out .= chr($r >> 24);
if (preg_match('/^\s$/',chr($ch))) {
continue;
}
else if ($state == 3) {
$r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + ($chn[2]+1) * 85 * 85;
$out .= chr($r >> 24);
$out .= chr($r >> 16);
if ($ch == $ord['z'] && $state == 0) {
$out .= chr(0) . chr(0) . chr(0) . chr(0);
continue;
}
else if ($state == 4) {
$r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + $chn[2] * 85 * 85 + ($chn[3]+1) * 85 ;
if ($ch < $ord['!'] || $ch > $ord['u']) {
throw new Exception('Illegal character in ASCII85Decode.');
}
$chn[$state++] = $ch - $ord['!'];
if ($state == 5) {
$state = 0;
$r = 0;
for ($j = 0; $j < 5; ++$j)
$r = $r * 85 + $chn[$j];
$out .= chr($r >> 24);
$out .= chr($r >> 16);
$out .= chr($r >> 8);
$out .= chr($r);
}
return $out;
}
function encode($in) {
return $this->error("ASCII85 encoding not implemented.");
}
}
}
$r = 0;
unset($__tmp);
if ($state == 1) {
throw new Exception('Illegal length in ASCII85Decode.');
}
if ($state == 2) {
$r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1]+1) * 85 * 85 * 85;
$out .= chr($r >> 24);
} else if ($state == 3) {
$r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + ($chn[2]+1) * 85 * 85;
$out .= chr($r >> 24);
$out .= chr($r >> 16);
} else if ($state == 4) {
$r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + $chn[2] * 85 * 85 + ($chn[3]+1) * 85 ;
$out .= chr($r >> 24);
$out .= chr($r >> 16);
$out .= chr($r >> 8);
}
return $out;
}
/**
* NOT IMPLEMENTED
*
* @param string $in
* @return string
* @throws LogicException
*/
public function encode($in)
{
throw new LogicException("ASCII85 encoding not implemented.");
}
}

View File

@ -1,33 +0,0 @@
<?php
//
// FPDI - Version 1.3.2
//
// Copyright 2004-2010 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
require_once('FilterASCII85.php');
class FilterASCII85_FPDI extends FilterASCII85 {
var $fpdi;
function FPDI_FilterASCII85(&$fpdi) {
$this->fpdi =& $fpdi;
}
function error($msg) {
$this->fpdi->error($msg);
}
}

View File

@ -0,0 +1,52 @@
<?php
//
// FPDI - Version 1.5.2
//
// Copyright 2004-2014 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/**
* Class FilterASCIIHexDecode
*/
class FilterASCIIHexDecode
{
/**
* Converts an ASCII hexadecimal encoded string into it's binary representation.
*
* @param string $data The input string
* @return string
*/
public function decode($data)
{
$data = preg_replace('/[^0-9A-Fa-f]/', '', rtrim($data, '>'));
if ((strlen($data) % 2) == 1) {
$data .= '0';
}
return pack('H*', $data);
}
/**
* Converts a string into ASCII hexadecimal representation.
*
* @param string $data The input string
* @param boolean $leaveEOD
* @return string
*/
public function encode($data, $leaveEOD = false)
{
return current(unpack('H*', $data)) . ($leaveEOD ? '' : '>');
}
}

View File

@ -1,8 +1,8 @@
<?php
//
// FPDI - Version 1.3.2
// FPDI - Version 1.5.2
//
// Copyright 2004-2010 Setasign - Jan Slabon
// Copyright 2004-2014 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -17,144 +17,157 @@
// limitations under the License.
//
$__tmp = version_compare(phpversion(), "5") == -1 ? array('FilterLZW') : array('FilterLZW', false);
if (!call_user_func_array('class_exists', $__tmp)) {
/**
* Class FilterLZW
*/
class FilterLZW
{
protected $_sTable = array();
protected $_data = null;
protected $_dataLength = 0;
protected $_tIdx;
protected $_bitsToGet = 9;
protected $_bytePointer;
protected $_bitPointer;
protected $_nextData = 0;
protected $_nextBits = 0;
protected $_andTable = array(511, 1023, 2047, 4095);
class FilterLZW {
var $sTable = array();
var $data = null;
var $dataLength = 0;
var $tIdx;
var $bitsToGet = 9;
var $bytePointer;
var $bitPointer;
var $nextData = 0;
var $nextBits = 0;
var $andTable = array(511, 1023, 2047, 4095);
function error($msg) {
die($msg);
/**
* Decodes LZW compressed data.
*
* @param string $data The compressed data.
* @throws Exception
* @return string
*/
public function decode($data)
{
if ($data[0] == 0x00 && $data[1] == 0x01) {
throw new Exception('LZW flavour not supported.');
}
/**
* Method to decode LZW compressed data.
*
* @param string data The compressed data.
*/
function decode($data) {
if($data[0] == 0x00 && $data[1] == 0x01) {
$this->error('LZW flavour not supported.');
}
$this->initsTable();
$this->data = $data;
$this->dataLength = strlen($data);
// Initialize pointers
$this->bytePointer = 0;
$this->bitPointer = 0;
$this->nextData = 0;
$this->nextBits = 0;
$oldCode = 0;
$string = '';
$uncompData = '';
while (($code = $this->getNextCode()) != 257) {
if ($code == 256) {
$this->initsTable();
$code = $this->getNextCode();
if ($code == 257) {
break;
}
$uncompData .= $this->sTable[$code];
$this->_initsTable();
$this->_data = $data;
$this->_dataLength = strlen($data);
// Initialize pointers
$this->_bytePointer = 0;
$this->_bitPointer = 0;
$this->_nextData = 0;
$this->_nextBits = 0;
$oldCode = 0;
$unCompData = '';
while (($code = $this->_getNextCode()) != 257) {
if ($code == 256) {
$this->_initsTable();
$code = $this->_getNextCode();
if ($code == 257) {
break;
}
if (!isset($this->_sTable[$code])) {
throw new Exception('Error while decompression LZW compressed data.');
}
$unCompData .= $this->_sTable[$code];
$oldCode = $code;
} else {
if ($code < $this->_tIdx) {
$string = $this->_sTable[$code];
$unCompData .= $string;
$this->_addStringToTable($this->_sTable[$oldCode], $string[0]);
$oldCode = $code;
} else {
if ($code < $this->tIdx) {
$string = $this->sTable[$code];
$uncompData .= $string;
$this->addStringToTable($this->sTable[$oldCode], $string[0]);
$oldCode = $code;
} else {
$string = $this->sTable[$oldCode];
$string = $string.$string[0];
$uncompData .= $string;
$this->addStringToTable($string);
$oldCode = $code;
}
$string = $this->_sTable[$oldCode];
$string = $string . $string[0];
$unCompData .= $string;
$this->_addStringToTable($string);
$oldCode = $code;
}
}
return $uncompData;
}
/**
* Initialize the string table.
*/
function initsTable() {
$this->sTable = array();
for ($i = 0; $i < 256; $i++)
$this->sTable[$i] = chr($i);
$this->tIdx = 258;
$this->bitsToGet = 9;
}
/**
* Add a new string to the string table.
*/
function addStringToTable ($oldString, $newString='') {
$string = $oldString.$newString;
// Add this new String to the table
$this->sTable[$this->tIdx++] = $string;
if ($this->tIdx == 511) {
$this->bitsToGet = 10;
} else if ($this->tIdx == 1023) {
$this->bitsToGet = 11;
} else if ($this->tIdx == 2047) {
$this->bitsToGet = 12;
}
}
// Returns the next 9, 10, 11 or 12 bits
function getNextCode() {
if ($this->bytePointer == $this->dataLength) {
return 257;
}
$this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff);
$this->nextBits += 8;
if ($this->nextBits < $this->bitsToGet) {
$this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff);
$this->nextBits += 8;
}
$code = ($this->nextData >> ($this->nextBits - $this->bitsToGet)) & $this->andTable[$this->bitsToGet-9];
$this->nextBits -= $this->bitsToGet;
return $code;
}
function encode($in) {
$this->error("LZW encoding not implemented.");
return $unCompData;
}
/**
* Initialize the string table.
*/
protected function _initsTable()
{
$this->_sTable = array();
for ($i = 0; $i < 256; $i++)
$this->_sTable[$i] = chr($i);
$this->_tIdx = 258;
$this->_bitsToGet = 9;
}
/**
* Add a new string to the string table.
*/
protected function _addStringToTable($oldString, $newString = '')
{
$string = $oldString . $newString;
// Add this new String to the table
$this->_sTable[$this->_tIdx++] = $string;
if ($this->_tIdx == 511) {
$this->_bitsToGet = 10;
} else if ($this->_tIdx == 1023) {
$this->_bitsToGet = 11;
} else if ($this->_tIdx == 2047) {
$this->_bitsToGet = 12;
}
}
}
unset($__tmp);
/**
* Returns the next 9, 10, 11 or 12 bits
*
* @return int
*/
protected function _getNextCode()
{
if ($this->_bytePointer == $this->_dataLength) {
return 257;
}
$this->_nextData = ($this->_nextData << 8) | (ord($this->_data[$this->_bytePointer++]) & 0xff);
$this->_nextBits += 8;
if ($this->_nextBits < $this->_bitsToGet) {
$this->_nextData = ($this->_nextData << 8) | (ord($this->_data[$this->_bytePointer++]) & 0xff);
$this->_nextBits += 8;
}
$code = ($this->_nextData >> ($this->_nextBits - $this->_bitsToGet)) & $this->_andTable[$this->_bitsToGet-9];
$this->_nextBits -= $this->_bitsToGet;
return $code;
}
/**
* NOT IMPLEMENTED
*
* @param string $in
* @return string
* @throws LogicException
*/
public function encode($in)
{
throw new LogicException("LZW encoding not implemented.");
}
}

View File

@ -1,33 +0,0 @@
<?php
//
// FPDI - Version 1.3.2
//
// Copyright 2004-2010 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
require_once('FilterLZW.php');
class FilterLZW_FPDI extends FilterLZW {
var $fpdi;
function FilterLZW_FPDI(&$fpdi) {
$this->fpdi =& $fpdi;
}
function error($msg) {
$this->fpdi->error($msg);
}
}

View File

@ -1,409 +1,555 @@
<?php
//
// FPDF_TPL - Version 1.1.4
//
// Copyright 2004-2010 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
class FPDF_TPL extends FPDF {
/**
* Array of Tpl-Data
* @var array
*/
var $tpls = array();
/**
* Current Template-ID
* @var int
*/
var $tpl = 0;
/**
* "In Template"-Flag
* @var boolean
*/
var $_intpl = false;
/**
* Nameprefix of Templates used in Resources-Dictonary
* @var string A String defining the Prefix used as Template-Object-Names. Have to beginn with an /
*/
var $tplprefix = "/TPL";
/**
* Resources used By Templates and Pages
* @var array
*/
var $_res = array();
/**
* Last used Template data
*
* @var array
*/
var $lastUsedTemplateData = array();
/**
* Start a Template
*
* This method starts a template. You can give own coordinates to build an own sized
* Template. Pay attention, that the margins are adapted to the new templatesize.
* If you want to write outside the template, for example to build a clipped Template,
* you have to set the Margins and "Cursor"-Position manual after beginTemplate-Call.
*
* If no parameter is given, the template uses the current page-size.
* The Method returns an ID of the current Template. This ID is used later for using this template.
* Warning: A created Template is used in PDF at all events. Still if you don't use it after creation!
*
* @param int $x The x-coordinate given in user-unit
* @param int $y The y-coordinate given in user-unit
* @param int $w The width given in user-unit
* @param int $h The height given in user-unit
* @return int The ID of new created Template
*/
function beginTemplate($x=null, $y=null, $w=null, $h=null) {
if ($this->page <= 0)
$this->error("You have to add a page to fpdf first!");
if ($x == null)
$x = 0;
if ($y == null)
$y = 0;
if ($w == null)
$w = $this->w;
if ($h == null)
$h = $this->h;
// Save settings
$this->tpl++;
$tpl =& $this->tpls[$this->tpl];
$tpl = array(
'o_x' => $this->x,
'o_y' => $this->y,
'o_AutoPageBreak' => $this->AutoPageBreak,
'o_bMargin' => $this->bMargin,
'o_tMargin' => $this->tMargin,
'o_lMargin' => $this->lMargin,
'o_rMargin' => $this->rMargin,
'o_h' => $this->h,
'o_w' => $this->w,
'buffer' => '',
'x' => $x,
'y' => $y,
'w' => $w,
'h' => $h
);
$this->SetAutoPageBreak(false);
// Define own high and width to calculate possitions correct
$this->h = $h;
$this->w = $w;
$this->_intpl = true;
$this->SetXY($x+$this->lMargin, $y+$this->tMargin);
$this->SetRightMargin($this->w-$w+$this->rMargin);
return $this->tpl;
}
/**
* End Template
*
* This method ends a template and reset initiated variables on beginTemplate.
*
* @return mixed If a template is opened, the ID is returned. If not a false is returned.
*/
function endTemplate() {
if ($this->_intpl) {
$this->_intpl = false;
$tpl =& $this->tpls[$this->tpl];
$this->SetXY($tpl['o_x'], $tpl['o_y']);
$this->tMargin = $tpl['o_tMargin'];
$this->lMargin = $tpl['o_lMargin'];
$this->rMargin = $tpl['o_rMargin'];
$this->h = $tpl['o_h'];
$this->w = $tpl['o_w'];
$this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']);
return $this->tpl;
} else {
return false;
}
}
/**
* Use a Template in current Page or other Template
*
* You can use a template in a page or in another template.
* You can give the used template a new size like you use the Image()-method.
* All parameters are optional. The width or height is calculated automaticaly
* if one is given. If no parameter is given the origin size as defined in
* beginTemplate() is used.
* The calculated or used width and height are returned as an array.
*
* @param int $tplidx A valid template-Id
* @param int $_x The x-position
* @param int $_y The y-position
* @param int $_w The new width of the template
* @param int $_h The new height of the template
* @retrun array The height and width of the template
*/
function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) {
if ($this->page <= 0)
$this->error("You have to add a page to fpdf first!");
if (!isset($this->tpls[$tplidx]))
$this->error("Template does not exist!");
if ($this->_intpl) {
$this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx];
}
$tpl =& $this->tpls[$tplidx];
$w = $tpl['w'];
$h = $tpl['h'];
if ($_x == null)
$_x = 0;
if ($_y == null)
$_y = 0;
$_x += $tpl['x'];
$_y += $tpl['y'];
$wh = $this->getTemplateSize($tplidx, $_w, $_h);
$_w = $wh['w'];
$_h = $wh['h'];
$tData = array(
'x' => $this->x,
'y' => $this->y,
'w' => $_w,
'h' => $_h,
'scaleX' => ($_w/$w),
'scaleY' => ($_h/$h),
'tx' => $_x,
'ty' => ($this->h-$_y-$_h),
'lty' => ($this->h-$_y-$_h) - ($this->h-$h) * ($_h/$h)
);
$this->_out(sprintf("q %.4F 0 0 %.4F %.4F %.4F cm", $tData['scaleX'], $tData['scaleY'], $tData['tx']*$this->k, $tData['ty']*$this->k)); // Translate
$this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx));
$this->lastUsedTemplateData = $tData;
return array("w" => $_w, "h" => $_h);
}
/**
* Get The calculated Size of a Template
*
* If one size is given, this method calculates the other one.
*
* @param int $tplidx A valid template-Id
* @param int $_w The width of the template
* @param int $_h The height of the template
* @return array The height and width of the template
*/
function getTemplateSize($tplidx, $_w=0, $_h=0) {
if (!$this->tpls[$tplidx])
return false;
$tpl =& $this->tpls[$tplidx];
$w = $tpl['w'];
$h = $tpl['h'];
if ($_w == 0 and $_h == 0) {
$_w = $w;
$_h = $h;
}
if($_w==0)
$_w = $_h*$w/$h;
if($_h==0)
$_h = $_w*$h/$w;
return array("w" => $_w, "h" => $_h);
}
/**
* See FPDF/TCPDF-Documentation ;-)
*/
function SetFont($family, $style='', $size=0, $fontfile='') {
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 3) {
$this->Error('More than 3 arguments for the SetFont method are only available in TCPDF.');
}
/**
* force the resetting of font changes in a template
*/
if ($this->_intpl)
$this->FontFamily = '';
parent::SetFont($family, $style, $size, $fontfile);
$fontkey = $this->FontFamily.$this->FontStyle;
if ($this->_intpl) {
$this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
} else {
$this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey];
}
}
/**
* See FPDF/TCPDF-Documentation ;-)
*/
function Image($file, $x, $y, $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox = false, $hidden = false) {
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 7) {
$this->Error('More than 7 arguments for the Image method are only available in TCPDF.');
}
parent::Image($file, $x, $y, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $ismask, $imgmask, $border, $fitbox, $hidden);
if ($this->_intpl) {
$this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
} else {
$this->_res['page'][$this->page]['images'][$file] =& $this->images[$file];
}
}
/**
* See FPDF-Documentation ;-)
*
* AddPage is not available when you're "in" a template.
*/
function AddPage($orientation='', $format='') {
if ($this->_intpl)
$this->Error('Adding pages in templates isn\'t possible!');
parent::AddPage($orientation, $format);
}
/**
* Preserve adding Links in Templates ...won't work
*/
function Link($x, $y, $w, $h, $link, $spaces=0) {
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 5) {
$this->Error('More than 5 arguments for the Image method are only available in TCPDF.');
}
if ($this->_intpl)
$this->Error('Using links in templates aren\'t possible!');
parent::Link($x, $y, $w, $h, $link, $spaces);
}
function AddLink() {
if ($this->_intpl)
$this->Error('Adding links in templates aren\'t possible!');
return parent::AddLink();
}
function SetLink($link, $y=0, $page=-1) {
if ($this->_intpl)
$this->Error('Setting links in templates aren\'t possible!');
parent::SetLink($link, $y, $page);
}
/**
* Private Method that writes the form xobjects
*/
function _putformxobjects() {
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->tpls);
foreach($this->tpls AS $tplidx => $tpl) {
$p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
$this->_newobj();
$this->tpls[$tplidx]['n'] = $this->n;
$this->_out('<<'.$filter.'/Type /XObject');
$this->_out('/Subtype /Form');
$this->_out('/FormType 1');
$this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
// llx
$tpl['x']*$this->k,
// lly
-$tpl['y']*$this->k,
// urx
($tpl['w']+$tpl['x'])*$this->k,
// ury
($tpl['h']-$tpl['y'])*$this->k
));
if ($tpl['x'] != 0 || $tpl['y'] != 0) {
$this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]',
-$tpl['x']*$this->k*2, $tpl['y']*$this->k*2
));
}
$this->_out('/Resources ');
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
$this->_out('/Font <<');
foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
$this->_out('>>');
}
if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) ||
isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
{
$this->_out('/XObject <<');
if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
foreach($this->_res['tpl'][$tplidx]['images'] as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
}
if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
$this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R');
}
$this->_out('>>');
}
$this->_out('>>');
$this->_out('/Length '.strlen($p).' >>');
$this->_putstream($p);
$this->_out('endobj');
}
}
/**
* Overwritten to add _putformxobjects() after _putimages()
*
*/
function _putimages() {
parent::_putimages();
$this->_putformxobjects();
}
function _putxobjectdict() {
parent::_putxobjectdict();
if (count($this->tpls)) {
foreach($this->tpls as $tplidx => $tpl) {
$this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n']));
}
}
}
/**
* Private Method
*/
function _out($s) {
if ($this->state==2 && $this->_intpl) {
$this->tpls[$this->tpl]['buffer'] .= $s."\n";
} else {
parent::_out($s);
}
}
}
<?php
//
// FPDI - Version 1.5.2
//
// Copyright 2004-2014 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
require_once('fpdi_bridge.php');
/**
* Class FPDF_TPL
*/
class FPDF_TPL extends fpdi_bridge
{
/**
* Array of template data
*
* @var array
*/
protected $_tpls = array();
/**
* Current Template-Id
*
* @var int
*/
public $tpl = 0;
/**
* "In Template"-Flag
*
* @var boolean
*/
protected $_inTpl = false;
/**
* Name prefix of templates used in Resources dictionary
*
* @var string A String defining the Prefix used as Template-Object-Names. Have to begin with an /
*/
public $tplPrefix = "/TPL";
/**
* Resources used by templates and pages
*
* @var array
*/
protected $_res = array();
/**
* Last used template data
*
* @var array
*/
public $lastUsedTemplateData = array();
/**
* Start a template.
*
* This method starts a template. You can give own coordinates to build an own sized
* template. Pay attention, that the margins are adapted to the new template size.
* If you want to write outside the template, for example to build a clipped template,
* you have to set the margins and "cursor"-position manual after beginTemplate()-call.
*
* If no parameter is given, the template uses the current page-size.
* The method returns an id of the current template. This id is used later for using this template.
* Warning: A created template is saved in the resulting PDF at all events. Also if you don't use it after creation!
*
* @param int $x The x-coordinate given in user-unit
* @param int $y The y-coordinate given in user-unit
* @param int $w The width given in user-unit
* @param int $h The height given in user-unit
* @return int The id of new created template
* @throws LogicException
*/
public function beginTemplate($x = null, $y = null, $w = null, $h = null)
{
if (is_subclass_of($this, 'TCPDF')) {
throw new LogicException('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.');
}
if ($this->page <= 0) {
throw new LogicException("You have to add at least a page first!");
}
if ($x == null)
$x = 0;
if ($y == null)
$y = 0;
if ($w == null)
$w = $this->w;
if ($h == null)
$h = $this->h;
// Save settings
$this->tpl++;
$tpl =& $this->_tpls[$this->tpl];
$tpl = array(
'o_x' => $this->x,
'o_y' => $this->y,
'o_AutoPageBreak' => $this->AutoPageBreak,
'o_bMargin' => $this->bMargin,
'o_tMargin' => $this->tMargin,
'o_lMargin' => $this->lMargin,
'o_rMargin' => $this->rMargin,
'o_h' => $this->h,
'o_w' => $this->w,
'o_FontFamily' => $this->FontFamily,
'o_FontStyle' => $this->FontStyle,
'o_FontSizePt' => $this->FontSizePt,
'o_FontSize' => $this->FontSize,
'buffer' => '',
'x' => $x,
'y' => $y,
'w' => $w,
'h' => $h
);
$this->SetAutoPageBreak(false);
// Define own high and width to calculate correct positions
$this->h = $h;
$this->w = $w;
$this->_inTpl = true;
$this->SetXY($x + $this->lMargin, $y + $this->tMargin);
$this->SetRightMargin($this->w - $w + $this->rMargin);
if ($this->CurrentFont) {
$fontKey = $this->FontFamily . $this->FontStyle;
if ($fontKey) {
$this->_res['tpl'][$this->tpl]['fonts'][$fontKey] =& $this->fonts[$fontKey];
$this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
}
}
return $this->tpl;
}
/**
* End template.
*
* This method ends a template and reset initiated variables collected in {@link beginTemplate()}.
*
* @return int|boolean If a template is opened, the id is returned. If not a false is returned.
*/
public function endTemplate()
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::endTemplate'), $args);
}
if ($this->_inTpl) {
$this->_inTpl = false;
$tpl = $this->_tpls[$this->tpl];
$this->SetXY($tpl['o_x'], $tpl['o_y']);
$this->tMargin = $tpl['o_tMargin'];
$this->lMargin = $tpl['o_lMargin'];
$this->rMargin = $tpl['o_rMargin'];
$this->h = $tpl['o_h'];
$this->w = $tpl['o_w'];
$this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']);
$this->FontFamily = $tpl['o_FontFamily'];
$this->FontStyle = $tpl['o_FontStyle'];
$this->FontSizePt = $tpl['o_FontSizePt'];
$this->FontSize = $tpl['o_FontSize'];
$fontKey = $this->FontFamily . $this->FontStyle;
if ($fontKey)
$this->CurrentFont =& $this->fonts[$fontKey];
return $this->tpl;
} else {
return false;
}
}
/**
* Use a template in current page or other template.
*
* You can use a template in a page or in another template.
* You can give the used template a new size.
* All parameters are optional. The width or height is calculated automatically
* if one is given. If no parameter is given the origin size as defined in
* {@link beginTemplate()} method is used.
*
* The calculated or used width and height are returned as an array.
*
* @param int $tplIdx A valid template-id
* @param int $x The x-position
* @param int $y The y-position
* @param int $w The new width of the template
* @param int $h The new height of the template
* @return array The height and width of the template (array('w' => ..., 'h' => ...))
* @throws LogicException|InvalidArgumentException
*/
public function useTemplate($tplIdx, $x = null, $y = null, $w = 0, $h = 0)
{
if ($this->page <= 0) {
throw new LogicException('You have to add at least a page first!');
}
if (!isset($this->_tpls[$tplIdx])) {
throw new InvalidArgumentException('Template does not exist!');
}
if ($this->_inTpl) {
$this->_res['tpl'][$this->tpl]['tpls'][$tplIdx] =& $this->_tpls[$tplIdx];
}
$tpl = $this->_tpls[$tplIdx];
$_w = $tpl['w'];
$_h = $tpl['h'];
if ($x == null) {
$x = 0;
}
if ($y == null) {
$y = 0;
}
$x += $tpl['x'];
$y += $tpl['y'];
$wh = $this->getTemplateSize($tplIdx, $w, $h);
$w = $wh['w'];
$h = $wh['h'];
$tplData = array(
'x' => $this->x,
'y' => $this->y,
'w' => $w,
'h' => $h,
'scaleX' => ($w / $_w),
'scaleY' => ($h / $_h),
'tx' => $x,
'ty' => ($this->h - $y - $h),
'lty' => ($this->h - $y - $h) - ($this->h - $_h) * ($h / $_h)
);
$this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm',
$tplData['scaleX'], $tplData['scaleY'], $tplData['tx'] * $this->k, $tplData['ty'] * $this->k)
); // Translate
$this->_out(sprintf('%s%d Do Q', $this->tplPrefix, $tplIdx));
$this->lastUsedTemplateData = $tplData;
return array('w' => $w, 'h' => $h);
}
/**
* Get the calculated size of a template.
*
* If one size is given, this method calculates the other one.
*
* @param int $tplIdx A valid template-id
* @param int $w The width of the template
* @param int $h The height of the template
* @return array The height and width of the template (array('w' => ..., 'h' => ...))
*/
public function getTemplateSize($tplIdx, $w = 0, $h = 0)
{
if (!isset($this->_tpls[$tplIdx]))
return false;
$tpl = $this->_tpls[$tplIdx];
$_w = $tpl['w'];
$_h = $tpl['h'];
if ($w == 0 && $h == 0) {
$w = $_w;
$h = $_h;
}
if ($w == 0)
$w = $h * $_w / $_h;
if($h == 0)
$h = $w * $_h / $_w;
return array("w" => $w, "h" => $h);
}
/**
* Sets the font used to print character strings.
*
* See FPDF/TCPDF documentation.
*
* @see http://fpdf.org/en/doc/setfont.htm
* @see http://www.tcpdf.org/doc/code/classTCPDF.html#afd56e360c43553830d543323e81bc045
*/
public function SetFont($family, $style = '', $size = null, $fontfile = '', $subset = 'default', $out = true)
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::SetFont'), $args);
}
parent::SetFont($family, $style, $size);
$fontkey = $this->FontFamily . $this->FontStyle;
if ($this->_inTpl) {
$this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
} else {
$this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey];
}
}
/**
* Puts an image.
*
* See FPDF/TCPDF documentation.
*
* @see http://fpdf.org/en/doc/image.htm
* @see http://www.tcpdf.org/doc/code/classTCPDF.html#a714c2bee7d6b39d4d6d304540c761352
*/
public function Image(
$file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false,
$dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false,
$hidden = false, $fitonpage = false, $alt = false, $altimgs = array()
)
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::Image'), $args);
}
$ret = parent::Image($file, $x, $y, $w, $h, $type, $link);
if ($this->_inTpl) {
$this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
} else {
$this->_res['page'][$this->page]['images'][$file] =& $this->images[$file];
}
return $ret;
}
/**
* Adds a new page to the document.
*
* See FPDF/TCPDF documentation.
*
* This method cannot be used if you'd started a template.
*
* @see http://fpdf.org/en/doc/addpage.htm
* @see http://www.tcpdf.org/doc/code/classTCPDF.html#a5171e20b366b74523709d84c349c1ced
*/
public function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false)
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::AddPage'), $args);
}
if ($this->_inTpl) {
throw new LogicException('Adding pages in templates is not possible!');
}
parent::AddPage($orientation, $format);
}
/**
* Puts a link on a rectangular area of the page.
*
* Overwritten because adding links in a template will not work.
*
* @see http://fpdf.org/en/doc/link.htm
* @see http://www.tcpdf.org/doc/code/classTCPDF.html#ab87bf1826384fbfe30eb499d42f1d994
*/
public function Link($x, $y, $w, $h, $link, $spaces = 0)
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::Link'), $args);
}
if ($this->_inTpl) {
throw new LogicException('Using links in templates is not posible!');
}
parent::Link($x, $y, $w, $h, $link);
}
/**
* Creates a new internal link and returns its identifier.
*
* Overwritten because adding links in a template will not work.
*
* @see http://fpdf.org/en/doc/addlink.htm
* @see http://www.tcpdf.org/doc/code/classTCPDF.html#a749522038ed7786c3e1701435dcb891e
*/
public function AddLink()
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::AddLink'), $args);
}
if ($this->_inTpl) {
throw new LogicException('Adding links in templates is not possible!');
}
return parent::AddLink();
}
/**
* Defines the page and position a link points to.
*
* Overwritten because adding links in a template will not work.
*
* @see http://fpdf.org/en/doc/setlink.htm
* @see http://www.tcpdf.org/doc/code/classTCPDF.html#ace5be60e7857953ea5e2b89cb90df0ae
*/
public function SetLink($link, $y = 0, $page = -1)
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::SetLink'), $args);
}
if ($this->_inTpl) {
throw new LogicException('Setting links in templates is not possible!');
}
parent::SetLink($link, $y, $page);
}
/**
* Writes the form XObjects to the PDF document.
*/
protected function _putformxobjects()
{
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->_tpls);
foreach($this->_tpls AS $tplIdx => $tpl) {
$this->_newobj();
$this->_tpls[$tplIdx]['n'] = $this->n;
$this->_out('<<'.$filter.'/Type /XObject');
$this->_out('/Subtype /Form');
$this->_out('/FormType 1');
$this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
// llx
$tpl['x'] * $this->k,
// lly
-$tpl['y'] * $this->k,
// urx
($tpl['w'] + $tpl['x']) * $this->k,
// ury
($tpl['h'] - $tpl['y']) * $this->k
));
if ($tpl['x'] != 0 || $tpl['y'] != 0) {
$this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]',
-$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2
));
}
$this->_out('/Resources ');
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
if (isset($this->_res['tpl'][$tplIdx])) {
$res = $this->_res['tpl'][$tplIdx];
if (isset($res['fonts']) && count($res['fonts'])) {
$this->_out('/Font <<');
foreach($res['fonts'] as $font) {
$this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
}
$this->_out('>>');
}
if(isset($res['images']) || isset($res['tpls'])) {
$this->_out('/XObject <<');
if (isset($res['images'])) {
foreach($res['images'] as $image)
$this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
}
if (isset($res['tpls'])) {
foreach($res['tpls'] as $i => $_tpl)
$this->_out($this->tplPrefix . $i . ' ' . $_tpl['n'] . ' 0 R');
}
$this->_out('>>');
}
}
$this->_out('>>');
$buffer = ($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
$this->_out('/Length ' . strlen($buffer) . ' >>');
$this->_putstream($buffer);
$this->_out('endobj');
}
}
/**
* Output images.
*
* Overwritten to add {@link _putformxobjects()} after _putimages().
*/
public function _putimages()
{
parent::_putimages();
$this->_putformxobjects();
}
/**
* Writes the references of XObject resources to the document.
*
* Overwritten to add the the templates to the XObject resource dictionary.
*/
public function _putxobjectdict()
{
parent::_putxobjectdict();
foreach($this->_tpls as $tplIdx => $tpl) {
$this->_out(sprintf('%s%d %d 0 R', $this->tplPrefix, $tplIdx, $tpl['n']));
}
}
/**
* Writes bytes to the resulting document.
*
* Overwritten to delegate the data to the template buffer.
*
* @param string $s
*/
public function _out($s)
{
if ($this->state == 2 && $this->_inTpl) {
$this->_tpls[$this->tpl]['buffer'] .= $s . "\n";
} else {
parent::_out($s);
}
}
}

View File

@ -1,8 +1,8 @@
<?php
//
// FPDI - Version 1.3.2
// FPDI - Version 1.5.2
//
// Copyright 2004-2010 Setasign - Jan Slabon
// Copyright 2004-2014 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -17,106 +17,185 @@
// limitations under the License.
//
define('FPDI_VERSION','1.3.2');
// Check for TCPDF and remap TCPDF to FPDF
$__tmp = version_compare(phpversion(), "5") == -1 ? array('TCPDF') : array('TCPDF', false);
if (call_user_func_array('class_exists', $__tmp)) {
require_once('fpdi2tcpdf_bridge.php');
}
unset($__tmp);
require_once('fpdf_tpl.php');
require_once('fpdi_pdf_parser.php');
/**
* Class FPDI
*/
class FPDI extends FPDF_TPL
{
/**
* FPDI version
*
* @string
*/
const VERSION = '1.5.2';
class FPDI extends FPDF_TPL {
/**
* Actual filename
*
* @var string
*/
var $current_filename;
public $currentFilename;
/**
* Parser-Objects
* @var array
*
* @var fpdi_pdf_parser[]
*/
var $parsers;
public $parsers = array();
/**
* Current parser
* @var object
*
* @var fpdi_pdf_parser
*/
var $current_parser;
public $currentParser;
/**
* object stack
* The name of the last imported page box
*
* @var string
*/
public $lastUsedPageBox;
/**
* Object stack
*
* @var array
*/
var $_obj_stack;
protected $_objStack;
/**
* done object stack
* Done object stack
*
* @var array
*/
var $_don_obj_stack;
protected $_doneObjStack;
/**
* Current Object Id.
*
* @var integer
*/
var $_current_obj_id;
protected $_currentObjId;
/**
* The name of the last imported page box
* @var string
*/
var $lastUsedPageBox;
var $_importedPages = array();
/**
* Set a source-file
* Cache for imported pages/template ids
*
* @param string $filename a valid filename
* @return int number of available pages
* @var array
*/
function setSourceFile($filename) {
$this->current_filename = $filename;
$fn =& $this->current_filename;
protected $_importedPages = array();
/**
* Set a source-file.
*
* Depending on the PDF version of the used document the PDF version of the resulting document will
* be adjusted to the higher version.
*
* @param string $filename A valid path to the PDF document from which pages should be imported from
* @return int The number of pages in the document
*/
public function setSourceFile($filename)
{
$_filename = realpath($filename);
if (false !== $_filename)
$filename = $_filename;
if (!isset($this->parsers[$fn]))
$this->parsers[$fn] = new fpdi_pdf_parser($fn, $this);
$this->current_parser =& $this->parsers[$fn];
$this->currentFilename = $filename;
return $this->parsers[$fn]->getPageCount();
if (!isset($this->parsers[$filename])) {
$this->parsers[$filename] = $this->_getPdfParser($filename);
$this->setPdfVersion(
max($this->getPdfVersion(), $this->parsers[$filename]->getPdfVersion())
);
}
$this->currentParser =& $this->parsers[$filename];
return $this->parsers[$filename]->getPageCount();
}
/**
* Import a page
* Returns a PDF parser object
*
* @param int $pageno pagenumber
* @return int Index of imported page - to use with fpdf_tpl::useTemplate()
* @param string $filename
* @return fpdi_pdf_parser
*/
function importPage($pageno, $boxName='/CropBox') {
if ($this->_intpl) {
return $this->error('Please import the desired pages before creating a new template.');
protected function _getPdfParser($filename)
{
require_once('fpdi_pdf_parser.php');
return new fpdi_pdf_parser($filename);
}
/**
* Get the current PDF version.
*
* @return string
*/
public function getPdfVersion()
{
return $this->PDFVersion;
}
/**
* Set the PDF version.
*
* @param string $version
*/
public function setPdfVersion($version = '1.3')
{
$this->PDFVersion = sprintf('%.1F', $version);
}
/**
* Import a page.
*
* The second parameter defines the bounding box that should be used to transform the page into a
* form XObject.
*
* Following values are available: MediaBox, CropBox, BleedBox, TrimBox, ArtBox.
* If a box is not especially defined its default box will be used:
*
* <ul>
* <li>CropBox: Default -> MediaBox</li>
* <li>BleedBox: Default -> CropBox</li>
* <li>TrimBox: Default -> CropBox</li>
* <li>ArtBox: Default -> CropBox</li>
* </ul>
*
* It is possible to get the used page box by the {@link getLastUsedPageBox()} method.
*
* @param int $pageNo The page number
* @param string $boxName The boundary box to use when transforming the page into a form XObject
* @param boolean $groupXObject Define the form XObject as a group XObject to support transparency (if used)
* @return int An id of the imported page/template to use with e.g. fpdf_tpl::useTemplate()
* @throws LogicException|InvalidArgumentException
* @see getLastUsedPageBox()
*/
public function importPage($pageNo, $boxName = 'CropBox', $groupXObject = true)
{
if ($this->_inTpl) {
throw new LogicException('Please import the desired pages before creating a new template.');
}
$fn =& $this->current_filename;
// check if page already imported
$pageKey = $fn.((int)$pageno).$boxName;
if (isset($this->_importedPages[$pageKey]))
return $this->_importedPages[$pageKey];
$parser =& $this->parsers[$fn];
$parser->setPageno($pageno);
$fn = $this->currentFilename;
$boxName = '/' . ltrim($boxName, '/');
if (!in_array($boxName, $parser->availableBoxes))
return $this->Error(sprintf('Unknown box: %s', $boxName));
$pageboxes = $parser->getPageBoxes($pageno);
// check if page already imported
$pageKey = $fn . '-' . ((int)$pageNo) . $boxName;
if (isset($this->_importedPages[$pageKey])) {
return $this->_importedPages[$pageKey];
}
$parser = $this->parsers[$fn];
$parser->setPageNo($pageNo);
if (!in_array($boxName, $parser->availableBoxes)) {
throw new InvalidArgumentException(sprintf('Unknown box: %s', $boxName));
}
$pageBoxes = $parser->getPageBoxes($pageNo, $this->k);
/**
* MediaBox
@ -125,44 +204,52 @@ class FPDI extends FPDF_TPL {
* TrimBox: Default -> CropBox
* ArtBox: Default -> CropBox
*/
if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox'))
if (!isset($pageBoxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox'))
$boxName = '/CropBox';
if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox')
if (!isset($pageBoxes[$boxName]) && $boxName == '/CropBox')
$boxName = '/MediaBox';
if (!isset($pageboxes[$boxName]))
if (!isset($pageBoxes[$boxName]))
return false;
$this->lastUsedPageBox = $boxName;
$box = $pageboxes[$boxName];
$box = $pageBoxes[$boxName];
$this->tpl++;
$this->tpls[$this->tpl] = array();
$tpl =& $this->tpls[$this->tpl];
$tpl['parser'] =& $parser;
$this->_tpls[$this->tpl] = array();
$tpl =& $this->_tpls[$this->tpl];
$tpl['parser'] = $parser;
$tpl['resources'] = $parser->getPageResources();
$tpl['buffer'] = $parser->getContent();
$tpl['box'] = $box;
$tpl['groupXObject'] = $groupXObject;
if ($groupXObject) {
$this->setPdfVersion(max($this->getPdfVersion(), 1.4));
}
// To build an array that can be used by PDF_TPL::useTemplate()
$this->tpls[$this->tpl] = array_merge($this->tpls[$this->tpl], $box);
$this->_tpls[$this->tpl] = array_merge($this->_tpls[$this->tpl], $box);
// An imported page will start at 0,0 everytime. Translation will be set in _putformxobjects()
// An imported page will start at 0,0 all the time. Translation will be set in _putformxobjects()
$tpl['x'] = 0;
$tpl['y'] = 0;
// handle rotated pages
$rotation = $parser->getPageRotation($pageno);
$rotation = $parser->getPageRotation($pageNo);
$tpl['_rotationAngle'] = 0;
if (isset($rotation[1]) && ($angle = $rotation[1] % 360) != 0) {
$steps = $angle / 90;
$steps = $angle / 90;
$_w = $tpl['w'];
$_h = $tpl['h'];
$tpl['w'] = $steps % 2 == 0 ? $_w : $_h;
$tpl['h'] = $steps % 2 == 0 ? $_h : $_w;
$tpl['_rotationAngle'] = $angle*-1;
if ($angle < 0)
$angle += 360;
$tpl['_rotationAngle'] = $angle * -1;
}
$this->_importedPages[$pageKey] = $this->tpl;
@ -170,82 +257,133 @@ class FPDI extends FPDF_TPL {
return $this->tpl;
}
function getLastUsedPageBox() {
/**
* Returns the last used page boundary box.
*
* @return string The used boundary box: MediaBox, CropBox, BleedBox, TrimBox or ArtBox
*/
public function getLastUsedPageBox()
{
return $this->lastUsedPageBox;
}
function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0, $adjustPageSize=false) {
if ($adjustPageSize == true && is_null($_x) && is_null($_y)) {
$size = $this->getTemplateSize($tplidx, $_w, $_h);
$format = array($size['w'], $size['h']);
if ($format[0]!=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1]) {
$this->w=$format[0];
$this->h=$format[1];
$this->wPt=$this->w*$this->k;
$this->hPt=$this->h*$this->k;
$this->PageBreakTrigger=$this->h-$this->bMargin;
$this->CurPageFormat=$format;
$this->PageSizes[$this->page]=array($this->wPt, $this->hPt);
}
/**
* Use a template or imported page in current page or other template.
*
* You can use a template in a page or in another template.
* You can give the used template a new size. All parameters are optional.
* The width or height is calculated automatically if one is given. If no
* parameter is given the origin size as defined in beginTemplate() or of
* the imported page is used.
*
* The calculated or used width and height are returned as an array.
*
* @param int $tplIdx A valid template-id
* @param int $x The x-position
* @param int $y The y-position
* @param int $w The new width of the template
* @param int $h The new height of the template
* @param boolean $adjustPageSize If set to true the current page will be resized to fit the dimensions
* of the template
*
* @return array The height and width of the template (array('w' => ..., 'h' => ...))
* @throws LogicException|InvalidArgumentException
*/
public function useTemplate($tplIdx, $x = null, $y = null, $w = 0, $h = 0, $adjustPageSize = false)
{
if ($adjustPageSize == true && is_null($x) && is_null($y)) {
$size = $this->getTemplateSize($tplIdx, $w, $h);
$orientation = $size['w'] > $size['h'] ? 'L' : 'P';
$size = array($size['w'], $size['h']);
if (is_subclass_of($this, 'TCPDF')) {
$this->setPageFormat($size, $orientation);
} else {
$size = $this->_getpagesize($size);
if($orientation != $this->CurOrientation ||
$size[0] != $this->CurPageSize[0] ||
$size[1] != $this->CurPageSize[1]
) {
// New size or orientation
if ($orientation=='P') {
$this->w = $size[0];
$this->h = $size[1];
} else {
$this->w = $size[1];
$this->h = $size[0];
}
$this->wPt = $this->w * $this->k;
$this->hPt = $this->h * $this->k;
$this->PageBreakTrigger = $this->h - $this->bMargin;
$this->CurOrientation = $orientation;
$this->CurPageSize = $size;
$this->PageSizes[$this->page] = array($this->wPt, $this->hPt);
}
}
}
$this->_out('q 0 J 1 w 0 j 0 G 0 g'); // reset standard values
$s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h);
$size = parent::useTemplate($tplIdx, $x, $y, $w, $h);
$this->_out('Q');
return $s;
return $size;
}
/**
* Private method, that rebuilds all needed objects of source files
* Copy all imported objects to the resulting document.
*/
function _putimportedobjects() {
if (is_array($this->parsers) && count($this->parsers) > 0) {
foreach($this->parsers AS $filename => $p) {
$this->current_parser =& $this->parsers[$filename];
if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) {
while(($n = key($this->_obj_stack[$filename])) !== null) {
$nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c,$this->_obj_stack[$filename][$n][1]);
$this->_newobj($this->_obj_stack[$filename][$n][0]);
if ($nObj[0] == PDF_TYPE_STREAM) {
$this->pdf_write_value ($nObj);
} else {
$this->pdf_write_value ($nObj[1]);
}
$this->_out('endobj');
$this->_obj_stack[$filename][$n] = null; // free memory
unset($this->_obj_stack[$filename][$n]);
reset($this->_obj_stack[$filename]);
}
protected function _putimportedobjects()
{
foreach($this->parsers AS $filename => $p) {
$this->currentParser =& $p;
if (!isset($this->_objStack[$filename]) || !is_array($this->_objStack[$filename])) {
continue;
}
while(($n = key($this->_objStack[$filename])) !== null) {
try {
$nObj = $this->currentParser->resolveObject($this->_objStack[$filename][$n][1]);
} catch (Exception $e) {
$nObj = array(pdf_parser::TYPE_OBJECT, pdf_parser::TYPE_NULL);
}
$this->_newobj($this->_objStack[$filename][$n][0]);
if ($nObj[0] == pdf_parser::TYPE_STREAM) {
$this->_writeValue($nObj);
} else {
$this->_writeValue($nObj[1]);
}
$this->_out("\nendobj");
$this->_objStack[$filename][$n] = null; // free memory
unset($this->_objStack[$filename][$n]);
reset($this->_objStack[$filename]);
}
}
}
/**
* Private Method that writes the form xobjects
* Writes the form XObjects to the PDF document.
*/
function _putformxobjects() {
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->tpls);
foreach($this->tpls AS $tplidx => $tpl) {
$p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
$this->_newobj();
$cN = $this->n; // TCPDF/Protection: rem current "n"
protected function _putformxobjects()
{
$filter = ($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->_tpls);
foreach($this->_tpls AS $tplIdx => $tpl) {
$this->_newobj();
$currentN = $this->n; // TCPDF/Protection: rem current "n"
$this->tpls[$tplidx]['n'] = $this->n;
$this->_out('<<'.$filter.'/Type /XObject');
$this->_tpls[$tplIdx]['n'] = $this->n;
$this->_out('<<' . $filter . '/Type /XObject');
$this->_out('/Subtype /Form');
$this->_out('/FormType 1');
$this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
(isset($tpl['box']['llx']) ? $tpl['box']['llx'] : $tpl['x'])*$this->k,
(isset($tpl['box']['lly']) ? $tpl['box']['lly'] : -$tpl['y'])*$this->k,
(isset($tpl['box']['urx']) ? $tpl['box']['urx'] : $tpl['w'] + $tpl['x'])*$this->k,
(isset($tpl['box']['ury']) ? $tpl['box']['ury'] : $tpl['h']-$tpl['y'])*$this->k
(isset($tpl['box']['llx']) ? $tpl['box']['llx'] : $tpl['x']) * $this->k,
(isset($tpl['box']['lly']) ? $tpl['box']['lly'] : -$tpl['y']) * $this->k,
(isset($tpl['box']['urx']) ? $tpl['box']['urx'] : $tpl['w'] + $tpl['x']) * $this->k,
(isset($tpl['box']['ury']) ? $tpl['box']['ury'] : $tpl['h'] - $tpl['y']) * $this->k
));
$c = 1;
@ -259,8 +397,8 @@ class FPDI extends FPDF_TPL {
if ($tpl['_rotationAngle'] <> 0) {
$angle = $tpl['_rotationAngle'] * M_PI/180;
$c=cos($angle);
$s=sin($angle);
$c = cos($angle);
$s = sin($angle);
switch($tpl['_rotationAngle']) {
case -90:
@ -272,14 +410,14 @@ class FPDI extends FPDF_TPL {
$ty = $tpl['box']['ury'];
break;
case -270:
$tx = $tpl['box']['ury'];
$tx = $tpl['box']['ury'];
$ty = -$tpl['box']['llx'];
break;
}
}
} else if ($tpl['x'] != 0 || $tpl['y'] != 0) {
$tx = -$tpl['x']*2;
$ty = $tpl['y']*2;
$tx = -$tpl['x'] * 2;
$ty = $tpl['y'] * 2;
}
$tx *= $this->k;
@ -294,101 +432,128 @@ class FPDI extends FPDF_TPL {
$this->_out('/Resources ');
if (isset($tpl['resources'])) {
$this->current_parser =& $tpl['parser'];
$this->pdf_write_value($tpl['resources']); // "n" will be changed
$this->currentParser = $tpl['parser'];
$this->_writeValue($tpl['resources']); // "n" will be changed
} else {
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
$this->_out('/Font <<');
foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
$this->_out('>>');
}
if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) ||
isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
{
$this->_out('/XObject <<');
if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
foreach($this->_res['tpl'][$tplidx]['images'] as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
if (isset($this->_res['tpl'][$tplIdx])) {
$res = $this->_res['tpl'][$tplIdx];
if (isset($res['fonts']) && count($res['fonts'])) {
$this->_out('/Font <<');
foreach ($res['fonts'] as $font)
$this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
$this->_out('>>');
}
if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
$this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R');
if (isset($res['images']) && count($res['images']) ||
isset($res['tpls']) && count($res['tpls']))
{
$this->_out('/XObject <<');
if (isset($res['images'])) {
foreach ($res['images'] as $image)
$this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
}
if (isset($res['tpls'])) {
foreach ($res['tpls'] as $i => $_tpl)
$this->_out($this->tplPrefix . $i . ' ' . $_tpl['n'] . ' 0 R');
}
$this->_out('>>');
}
$this->_out('>>');
}
$this->_out('>>');
}
}
$nN = $this->n; // TCPDF: rem new "n"
$this->n = $cN; // TCPDF: reset to current "n"
$this->_out('/Length '.strlen($p).' >>');
$this->_putstream($p);
if (isset($tpl['groupXObject']) && $tpl['groupXObject']) {
$this->_out('/Group <</Type/Group/S/Transparency>>');
}
$newN = $this->n; // TCPDF: rem new "n"
$this->n = $currentN; // TCPDF: reset to current "n"
$buffer = ($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
if (is_subclass_of($this, 'TCPDF')) {
$buffer = $this->_getrawstream($buffer);
$this->_out('/Length ' . strlen($buffer) . ' >>');
$this->_out("stream\n" . $buffer . "\nendstream");
} else {
$this->_out('/Length ' . strlen($buffer) . ' >>');
$this->_putstream($buffer);
}
$this->_out('endobj');
$this->n = $nN; // TCPDF: reset to new "n"
$this->n = $newN; // TCPDF: reset to new "n"
}
$this->_putimportedobjects();
}
/**
* Creates and optionally write the object definition to the document.
*
* Rewritten to handle existing own defined objects
*
* @param bool $objId
* @param bool $onlyNewObj
* @return bool|int
*/
function _newobj($obj_id=false,$onlynewobj=false) {
if (!$obj_id) {
$obj_id = ++$this->n;
public function _newobj($objId = false, $onlyNewObj = false)
{
if (!$objId) {
$objId = ++$this->n;
}
//Begin a new object
if (!$onlynewobj) {
$this->offsets[$obj_id] = is_subclass_of($this, 'TCPDF') ? $this->bufferlen : strlen($this->buffer);
$this->_out($obj_id.' 0 obj');
$this->_current_obj_id = $obj_id; // for later use with encryption
if (!$onlyNewObj) {
$this->offsets[$objId] = is_subclass_of($this, 'TCPDF') ? $this->bufferlen : strlen($this->buffer);
$this->_out($objId . ' 0 obj');
$this->_currentObjId = $objId; // for later use with encryption
}
return $obj_id;
return $objId;
}
/**
* Writes a value
* Writes a PDF value to the resulting document.
*
* Needed to rebuild the source document
*
* @param mixed $value A PDF-Value. Structure of values see cases in this method
*/
function pdf_write_value(&$value)
protected function _writeValue(&$value)
{
if (is_subclass_of($this, 'TCPDF')) {
parent::pdf_write_value($value);
parent::_prepareValue($value);
}
switch ($value[0]) {
case PDF_TYPE_TOKEN :
case pdf_parser::TYPE_TOKEN:
$this->_straightOut($value[1] . ' ');
break;
case PDF_TYPE_NUMERIC :
case PDF_TYPE_REAL :
case pdf_parser::TYPE_NUMERIC:
case pdf_parser::TYPE_REAL:
if (is_float($value[1]) && $value[1] != 0) {
$this->_straightOut(rtrim(rtrim(sprintf('%F', $value[1]), '0'), '.') .' ');
$this->_straightOut(rtrim(rtrim(sprintf('%F', $value[1]), '0'), '.') . ' ');
} else {
$this->_straightOut($value[1] . ' ');
}
break;
case PDF_TYPE_ARRAY :
case pdf_parser::TYPE_ARRAY:
// An array. Output the proper
// structure and move on.
$this->_straightOut('[');
for ($i = 0; $i < count($value[1]); $i++) {
$this->pdf_write_value($value[1][$i]);
$this->_writeValue($value[1][$i]);
}
$this->_out(']');
break;
case PDF_TYPE_DICTIONARY :
case pdf_parser::TYPE_DICTIONARY:
// A dictionary.
$this->_straightOut('<<');
@ -397,54 +562,54 @@ class FPDI extends FPDF_TPL {
while (list($k, $v) = each($value[1])) {
$this->_straightOut($k . ' ');
$this->pdf_write_value($v);
$this->_writeValue($v);
}
$this->_straightOut('>>');
break;
case PDF_TYPE_OBJREF :
case pdf_parser::TYPE_OBJREF:
// An indirect object reference
// Fill the object stack if needed
$cpfn =& $this->current_parser->filename;
if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) {
$this->_newobj(false,true);
$this->_obj_stack[$cpfn][$value[1]] = array($this->n, $value);
$this->_don_obj_stack[$cpfn][$value[1]] = array($this->n, $value); // Value is maybee obsolete!!!
$cpfn =& $this->currentParser->filename;
if (!isset($this->_doneObjStack[$cpfn][$value[1]])) {
$this->_newobj(false, true);
$this->_objStack[$cpfn][$value[1]] = array($this->n, $value);
$this->_doneObjStack[$cpfn][$value[1]] = array($this->n, $value);
}
$objid = $this->_don_obj_stack[$cpfn][$value[1]][0];
$objId = $this->_doneObjStack[$cpfn][$value[1]][0];
$this->_out($objid.' 0 R');
$this->_out($objId . ' 0 R');
break;
case PDF_TYPE_STRING :
case pdf_parser::TYPE_STRING:
// A string.
$this->_straightOut('('.$value[1].')');
$this->_straightOut('(' . $value[1] . ')');
break;
case PDF_TYPE_STREAM :
case pdf_parser::TYPE_STREAM:
// A stream. First, output the
// stream dictionary, then the
// stream data itself.
$this->pdf_write_value($value[1]);
$this->_writeValue($value[1]);
$this->_out('stream');
$this->_out($value[2][1]);
$this->_out('endstream');
$this->_straightOut("endstream");
break;
case PDF_TYPE_HEX :
$this->_straightOut('<'.$value[1].'>');
case pdf_parser::TYPE_HEX:
$this->_straightOut('<' . $value[1] . '>');
break;
case PDF_TYPE_BOOLEAN :
case pdf_parser::TYPE_BOOLEAN:
$this->_straightOut($value[1] ? 'true ' : 'false ');
break;
case PDF_TYPE_NULL :
case pdf_parser::TYPE_NULL:
// The null object.
$this->_straightOut('null ');
@ -454,51 +619,77 @@ class FPDI extends FPDF_TPL {
/**
* Modified so not each call will add a newline to the output.
* Modified _out() method so not each call will add a newline to the output.
*/
function _straightOut($s) {
protected function _straightOut($s)
{
if (!is_subclass_of($this, 'TCPDF')) {
if($this->state==2)
if ($this->state == 2) {
$this->pages[$this->page] .= $s;
else
} else {
$this->buffer .= $s;
}
} else {
if ($this->state == 2) {
if (isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) {
if ($this->inxobj) {
// we are inside an XObject template
$this->xobjects[$this->xobjid]['outdata'] .= $s;
} else if ((!$this->InFooter) AND isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) {
// puts data before page footer
$page = substr($this->getPageBuffer($this->page), 0, -$this->footerlen[$this->page]);
$footer = substr($this->getPageBuffer($this->page), -$this->footerlen[$this->page]);
$this->setPageBuffer($this->page, $page.' '.$s."\n".$footer);
$pagebuff = $this->getPageBuffer($this->page);
$page = substr($pagebuff, 0, -$this->footerlen[$this->page]);
$footer = substr($pagebuff, -$this->footerlen[$this->page]);
$this->setPageBuffer($this->page, $page . $s . $footer);
// update footer position
$this->footerpos[$this->page] += strlen($s);
} else {
// set page data
$this->setPageBuffer($this->page, $s, true);
}
} else {
} else if ($this->state > 0) {
// set general data
$this->setBuffer($s);
}
}
}
/**
* rewritten to close opened parsers
* Ends the document
*
* Overwritten to close opened parsers
*/
function _enddoc() {
public function _enddoc()
{
parent::_enddoc();
$this->_closeParsers();
}
/**
* close all files opened by parsers
* Close all files opened by parsers.
*
* @return boolean
*/
function _closeParsers() {
if ($this->state > 2 && count($this->parsers) > 0) {
foreach ($this->parsers as $k => $_){
$this->parsers[$k]->closeFile();
$this->parsers[$k] = null;
unset($this->parsers[$k]);
}
protected function _closeParsers()
{
if ($this->state > 2) {
$this->cleanUp();
return true;
}
return false;
}
/**
* Removes cycled references and closes the file handles of the parser objects.
*/
public function cleanUp()
{
while (($parser = array_pop($this->parsers)) !== null) {
/**
* @var fpdi_pdf_parser $parser
*/
$parser->closeFile();
}
}
}

View File

@ -1,171 +0,0 @@
<?php
//
// FPDI - Version 1.3.2
//
// Copyright 2004-2010 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/**
* This class is used as a bridge between TCPDF and FPDI
* and will create the possibility to use both FPDF and TCPDF
* via one FPDI version.
*
* We'll simply remap TCPDF to FPDF again.
*
* It'll be loaded and extended by FPDF_TPL.
*/
class FPDF extends TCPDF {
function __get($name) {
switch ($name) {
case 'PDFVersion':
return $this->PDFVersion;
case 'k':
return $this->k;
default:
// Error handling
$this->Error('Cannot access protected property '.get_class($this).':$'.$name.' / Undefined property: '.get_class($this).'::$'.$name);
}
}
function __set($name, $value) {
switch ($name) {
case 'PDFVersion':
$this->PDFVersion = $value;
break;
default:
// Error handling
$this->Error('Cannot access protected property '.get_class($this).':$'.$name.' / Undefined property: '.get_class($this).'::$'.$name);
}
}
/**
* Encryption of imported data by FPDI
*
* @param array $value
*/
function pdf_write_value(&$value) {
switch ($value[0]) {
case PDF_TYPE_STRING :
if ($this->encrypted) {
$value[1] = $this->_unescape($value[1]);
$value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]);
$value[1] = $this->_escape($value[1]);
}
break;
case PDF_TYPE_STREAM :
if ($this->encrypted) {
$value[2][1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[2][1]);
}
break;
case PDF_TYPE_HEX :
if ($this->encrypted) {
$value[1] = $this->hex2str($value[1]);
$value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]);
// remake hexstring of encrypted string
$value[1] = $this->str2hex($value[1]);
}
break;
}
}
/**
* Unescapes a PDF string
*
* @param string $s
* @return string
*/
function _unescape($s) {
$out = '';
for ($count = 0, $n = strlen($s); $count < $n; $count++) {
if ($s[$count] != '\\' || $count == $n-1) {
$out .= $s[$count];
} else {
switch ($s[++$count]) {
case ')':
case '(':
case '\\':
$out .= $s[$count];
break;
case 'f':
$out .= chr(0x0C);
break;
case 'b':
$out .= chr(0x08);
break;
case 't':
$out .= chr(0x09);
break;
case 'r':
$out .= chr(0x0D);
break;
case 'n':
$out .= chr(0x0A);
break;
case "\r":
if ($count != $n-1 && $s[$count+1] == "\n")
$count++;
break;
case "\n":
break;
default:
// Octal-Values
if (ord($s[$count]) >= ord('0') &&
ord($s[$count]) <= ord('9')) {
$oct = ''. $s[$count];
if (ord($s[$count+1]) >= ord('0') &&
ord($s[$count+1]) <= ord('9')) {
$oct .= $s[++$count];
if (ord($s[$count+1]) >= ord('0') &&
ord($s[$count+1]) <= ord('9')) {
$oct .= $s[++$count];
}
}
$out .= chr(octdec($oct));
} else {
$out .= $s[$count];
}
}
}
}
return $out;
}
/**
* Hexadecimal to string
*
* @param string $hex
* @return string
*/
function hex2str($hex) {
return pack('H*', str_replace(array("\r", "\n", ' '), '', $hex));
}
/**
* String to hexadecimal
*
* @param string $str
* @return string
*/
function str2hex($str) {
return current(unpack('H*', $str));
}
}

View File

@ -0,0 +1,215 @@
<?php
//
// FPDI - Version 1.5.2
//
// Copyright 2004-2014 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/**
* This file is used as a bridge between TCPDF or FPDF
* It will dynamically create the class extending the available
* class FPDF or TCPDF.
*
* This way it is possible to use FPDI for both FPDF and TCPDF with one FPDI version.
*/
if (!class_exists('TCPDF', false)) {
/**
* Class fpdi_bridge
*/
class fpdi_bridge extends FPDF
{
// empty body
}
} else {
/**
* Class fpdi_bridge
*/
class fpdi_bridge extends TCPDF
{
/**
* Array of Tpl-Data
*
* @var array
*/
protected $_tpls = array();
/**
* Name-prefix of Templates used in Resources-Dictionary
*
* @var string A String defining the Prefix used as Template-Object-Names. Have to begin with an /
*/
public $tplPrefix = "/TPL";
/**
* Current Object Id.
*
* @var integer
*/
protected $_currentObjId;
/**
* Return XObjects Dictionary.
*
* Overwritten to add additional XObjects to the resources dictionary of TCPDF
*
* @return string
*/
protected function _getxobjectdict()
{
$out = parent::_getxobjectdict();
foreach ($this->_tpls as $tplIdx => $tpl) {
$out .= sprintf('%s%d %d 0 R', $this->tplPrefix, $tplIdx, $tpl['n']);
}
return $out;
}
/**
* Writes a PDF value to the resulting document.
*
* Prepares the value for encryption of imported data by FPDI
*
* @param array $value
*/
protected function _prepareValue(&$value)
{
switch ($value[0]) {
case pdf_parser::TYPE_STRING:
if ($this->encrypted) {
$value[1] = $this->_unescape($value[1]);
$value[1] = $this->_encrypt_data($this->_currentObjId, $value[1]);
$value[1] = TCPDF_STATIC::_escape($value[1]);
}
break;
case pdf_parser::TYPE_STREAM:
if ($this->encrypted) {
$value[2][1] = $this->_encrypt_data($this->_currentObjId, $value[2][1]);
$value[1][1]['/Length'] = array(
pdf_parser::TYPE_NUMERIC,
strlen($value[2][1])
);
}
break;
case pdf_parser::TYPE_HEX:
if ($this->encrypted) {
$value[1] = $this->hex2str($value[1]);
$value[1] = $this->_encrypt_data($this->_currentObjId, $value[1]);
// remake hexstring of encrypted string
$value[1] = $this->str2hex($value[1]);
}
break;
}
}
/**
* Un-escapes a PDF string
*
* @param string $s
* @return string
*/
protected function _unescape($s)
{
$out = '';
for ($count = 0, $n = strlen($s); $count < $n; $count++) {
if ($s[$count] != '\\' || $count == $n-1) {
$out .= $s[$count];
} else {
switch ($s[++$count]) {
case ')':
case '(':
case '\\':
$out .= $s[$count];
break;
case 'f':
$out .= chr(0x0C);
break;
case 'b':
$out .= chr(0x08);
break;
case 't':
$out .= chr(0x09);
break;
case 'r':
$out .= chr(0x0D);
break;
case 'n':
$out .= chr(0x0A);
break;
case "\r":
if ($count != $n-1 && $s[$count+1] == "\n")
$count++;
break;
case "\n":
break;
default:
// Octal-Values
if (ord($s[$count]) >= ord('0') &&
ord($s[$count]) <= ord('9')) {
$oct = ''. $s[$count];
if (ord($s[$count+1]) >= ord('0') &&
ord($s[$count+1]) <= ord('9')) {
$oct .= $s[++$count];
if (ord($s[$count+1]) >= ord('0') &&
ord($s[$count+1]) <= ord('9')) {
$oct .= $s[++$count];
}
}
$out .= chr(octdec($oct));
} else {
$out .= $s[$count];
}
}
}
}
return $out;
}
/**
* Hexadecimal to string
*
* @param string $data
* @return string
*/
public function hex2str($data)
{
$data = preg_replace('/[^0-9A-Fa-f]/', '', rtrim($data, '>'));
if ((strlen($data) % 2) == 1) {
$data .= '0';
}
return pack('H*', $data);
}
/**
* String to hexadecimal
*
* @param string $str
* @return string
*/
public function str2hex($str)
{
return current(unpack('H*', $str));
}
}
}

Some files were not shown because too many files have changed in this diff Show More