Merge 2.4
This commit is contained in:
parent
e3faf6cf8f
commit
5b1d26febf
@ -1,15 +1,12 @@
|
||||
<?php
|
||||
class wkhtmltopdf
|
||||
class Scores_Wkhtml_Pdf
|
||||
{
|
||||
protected $pathWkhtml;
|
||||
protected $pathIn = '';
|
||||
protected $pathOut = '';
|
||||
protected $options = array();
|
||||
protected $wkhtml;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$c = Zend_Registry::get('config');
|
||||
$this->pathWkhtml = $c->profil->wkhtmltopdf->path.'/';
|
||||
$c = Zend_Registry::get('config');
|
||||
$this->wkhtml = $c->profil->wkhtmltopdf->path;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,24 +42,11 @@ class wkhtmltopdf
|
||||
foreach ( $this->options as $name => $value )
|
||||
{
|
||||
$options.= ' --'.$name;
|
||||
if ($value!= '') $options.= ' '.$value;
|
||||
if ($value!= '') $options.= ' "'.$value.'"';
|
||||
}
|
||||
}
|
||||
|
||||
if (stristr(PHP_OS, 'WIN'))
|
||||
{
|
||||
$wkhtmltopdf = 'wkhtmltopdf.exe';
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(WKHTMLTOPDF_ARCH)
|
||||
{
|
||||
default:
|
||||
case 'amd64': $wkhtmltopdf = 'wkhtmltopdf-amd64'; break;
|
||||
case 'i386': $wkhtmltopdf = 'wkhtmltopdf-i386'; break;
|
||||
}
|
||||
}
|
||||
$cmd = $this->pathWkhtml.$wkhtmltopdf.' '.$options.' "'.$fileIn.'" "'.$fileOut.'"';
|
||||
$cmd = $this->wkhtml.' '.$options.' "'.$fileIn.'" "'.$fileOut.'"';
|
||||
exec( $cmd );
|
||||
return $fileOut;
|
||||
}
|
@ -4011,61 +4011,58 @@ class Entreprise extends WsScore
|
||||
//Initialisation
|
||||
$iDb = new WDB('sdv1');
|
||||
$tabRet = array();
|
||||
debugLog('I',"Liste des banques demandée pour siren $siren",
|
||||
__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
debugLog('I',"Liste des banques demandée pour siren $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
if (intval($siren)<=1000) {
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
$res=$iDb->select('banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$tmp=$iDb->select('fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", false, MYSQL_ASSOC);
|
||||
$res=$iDb->select('banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", true, MYSQL_ASSOC);
|
||||
$tmp=$iDb->select('fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", true, MYSQL_ASSOC);
|
||||
$res=array_merge($res, $tmp);
|
||||
foreach ($res as $tabBanque){
|
||||
$dateSource=$tabBanque['dateSource'];
|
||||
$codBanque=$tabBanque['codeBanque'];
|
||||
$codGuichet=$tabBanque['codeGuichet'];
|
||||
$libBanque=trim($tabBanque['libBanqueGuichet']);
|
||||
$found=false;
|
||||
foreach ($res as $tabBanque)
|
||||
{
|
||||
$dateSource = $tabBanque['dateSource'];
|
||||
$codBanque = $tabBanque['codeBanque'];
|
||||
$codGuichet = $tabBanque['codeGuichet'];
|
||||
$libBanque = trim($tabBanque['libBanqueGuichet']);
|
||||
$found = false;
|
||||
$adrBanque1=$adrBanque2=$adrBanqueCP=$adrBanqueVille='';
|
||||
|
||||
if ($codBanque>0 && $codGuichet>0 &&
|
||||
$dateSource>(date('Y')-4)*10000+101 &&
|
||||
$dateSource<date('Ymd')){
|
||||
$tmp = $iDb->select('insee.BDF_Etabs b, insee.BDF_Guichets g',
|
||||
'g.bdfFibCodeEtab AS banque, g.bdfFibCodeGuichet AS guichet, b.bdfFibDenom40 AS nomBanque, b.bdfFibDenom10 AS sigleBanque, g.bdfFibDenom20 AS nomGuichet, g.bdfFibAdresse1 AS adresse1, g.bdfFibAdresse2 AS adresse2, g.bdfFibAdresse3 AS adresse3, g.CP, g.Ville', "g.bdfFibCodeEtab=$codBanque AND g.bdfFibCodeGuichet=$codGuichet AND b.bdfFibCodeEtab=g.bdfFibCodeEtab",
|
||||
false, MYSQL_ASSOC);
|
||||
if (isset($tmp[0])){
|
||||
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
|
||||
$adrBanque1=$tmp[0]['adresse1'];
|
||||
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
|
||||
$adrBanqueCP=$tmp[0]['CP'];
|
||||
$adrBanqueVille=$tmp[0]['Ville'];
|
||||
$found=true;
|
||||
};
|
||||
}
|
||||
if (!$found && $codBanque>0 &&
|
||||
$dateSource>(date('Y')-4)*10000+101 &&
|
||||
$dateSource<date('Ymd')){
|
||||
$tmp = $iDb->select('insee.BDF_Etabs', "bdfFibCodeEtab AS banque, '' AS guichet, bdfFibDenom40 AS nomBanque, '' AS nomGuichet, '' AS adresse1, '' AS adresse2, '' AS adresse3, '' AS CP, '' AS Ville", "bdfFibCodeEtab=$codBanque", false, MYSQL_ASSOC);
|
||||
if (isset($tmp[0])){
|
||||
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
|
||||
$adrBanque1=$tmp[0]['adresse1'];
|
||||
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
|
||||
$adrBanqueCP=$tmp[0]['CP'];
|
||||
$adrBanqueVille=$tmp[0]['Ville'];
|
||||
} else continue;
|
||||
} else continue;
|
||||
if ( $codBanque>0 && $codGuichet>0 ) {
|
||||
$tmp = $iDb->select('insee.BDF_Etabs b, insee.BDF_Guichets g',
|
||||
'g.bdfFibCodeEtab AS banque, g.bdfFibCodeGuichet AS guichet, b.bdfFibDenom40 AS nomBanque, b.bdfFibDenom10 AS sigleBanque, g.bdfFibDenom20 AS nomGuichet, g.bdfFibAdresse1 AS adresse1, g.bdfFibAdresse2 AS adresse2, g.bdfFibAdresse3 AS adresse3, g.CP, g.Ville', "g.bdfFibCodeEtab=$codBanque AND g.bdfFibCodeGuichet=$codGuichet AND b.bdfFibCodeEtab=g.bdfFibCodeEtab",
|
||||
true, MYSQL_ASSOC);
|
||||
if (count($tmp)>0) {
|
||||
$found = true;
|
||||
|
||||
$banque = new Banque();
|
||||
$banque->codeBanque = $codBanque;
|
||||
$banque->codeGuichet = $codGuichet;
|
||||
$banque->libBanque = trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
|
||||
$banque->adresse1 = $tmp[0]['adresse1'];
|
||||
$banque->adresse2 = trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
|
||||
$banque->cp = $tmp[0]['CP'];
|
||||
$banque->ville = $tmp[0]['Ville'];
|
||||
$tabRet[] = $banque;
|
||||
}
|
||||
}
|
||||
|
||||
if ($found===false && $codBanque>0 ) {
|
||||
$tmp = $iDb->select('insee.BDF_Etabs', "bdfFibCodeEtab AS banque, '' AS guichet, bdfFibDenom40 AS nomBanque, '' AS nomGuichet, '' AS adresse1, '' AS adresse2, '' AS adresse3, '' AS CP, '' AS Ville", "bdfFibCodeEtab=$codBanque", true, MYSQL_ASSOC);
|
||||
if (count($tmp)>0) {
|
||||
$banque = new Banque();
|
||||
$banque->codeBanque = $codBanque;
|
||||
$banque->codeGuichet = $codGuichet;
|
||||
$banque->libBanque = trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
|
||||
$banque->adresse1 = $tmp[0]['adresse1'];
|
||||
$banque->adresse2 = trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
|
||||
$banque->cp = $tmp[0]['CP'];
|
||||
$banque->ville = $tmp[0]['Ville'];
|
||||
$tabRet[] = $banque;
|
||||
}
|
||||
}
|
||||
|
||||
$banque = new Banque();
|
||||
$banque->codeBanque = $codBanque;
|
||||
$banque->codeGuichet = $codGuichet;
|
||||
$banque->libBanque = $libBanque;
|
||||
$banque->adresse1 = $adrBanque1;
|
||||
$banque->adresse2 = $adrBanque2;
|
||||
$banque->cp = $adrBanqueCP;
|
||||
$banque->ville = $adrBanqueVille;
|
||||
$tabRet[] = $banque;
|
||||
}
|
||||
debugLog('I',"Liste des banques pour siren $siren : ".count($tabRet).' banques',__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
|
@ -78,8 +78,7 @@ class Pieces extends WsScore
|
||||
}
|
||||
|
||||
//Génération du PDF
|
||||
require_once 'wkhtmltopdf/wkhtmltopdf.php';
|
||||
$pdf = new wkhtmltopdf();
|
||||
$pdf = new Scores_Wkhtml_Pdf();
|
||||
$fileOut = $pdf->exec($file, $filepdf);
|
||||
|
||||
if ( !file_exists($filepdf) ) {
|
||||
|
Loading…
Reference in New Issue
Block a user