Fix: Le constructeur des propales accepte le handler d'accès base.
This commit is contained in:
parent
838b5ddb09
commit
dd296d8c95
@ -130,6 +130,7 @@ $dir = "../includes/modules/propale/";
|
|||||||
$handle = opendir($dir);
|
$handle = opendir($dir);
|
||||||
if ($handle)
|
if ($handle)
|
||||||
{
|
{
|
||||||
|
$var=false;
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (substr($file, 0, 12) == 'mod_propale_' && substr($file, strlen($file)-3, 3) == 'php')
|
if (substr($file, 0, 12) == 'mod_propale_' && substr($file, strlen($file)-3, 3) == 'php')
|
||||||
@ -140,11 +141,8 @@ if ($handle)
|
|||||||
|
|
||||||
$modPropale = new $file;
|
$modPropale = new $file;
|
||||||
|
|
||||||
if($pair == "pair")
|
$var=!$var;
|
||||||
$pair = "impair";
|
print "<tr ".$bc[$var].">\n <td width=\"140\">".$file."</td>";
|
||||||
else
|
|
||||||
$pair = "pair";
|
|
||||||
print "<tr class=\"$pair\">\n <td width=\"140\">".$file."</td>";
|
|
||||||
print "\n <td>".$modPropale->info()."</td>\n";
|
print "\n <td>".$modPropale->info()."</td>\n";
|
||||||
print "\n <td>".$modPropale->getExample()."</td>\n";
|
print "\n <td>".$modPropale->getExample()."</td>\n";
|
||||||
|
|
||||||
@ -206,6 +204,7 @@ clearstatcache();
|
|||||||
|
|
||||||
$handle=opendir($dir);
|
$handle=opendir($dir);
|
||||||
|
|
||||||
|
$var=false;
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_')
|
if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_')
|
||||||
@ -213,15 +212,12 @@ while (($file = readdir($handle))!==false)
|
|||||||
$name = substr($file, 12, strlen($file) - 24);
|
$name = substr($file, 12, strlen($file) - 24);
|
||||||
$classname = substr($file, 0, strlen($file) -12);
|
$classname = substr($file, 0, strlen($file) -12);
|
||||||
|
|
||||||
if($pair == "pair")
|
$var=!$var;
|
||||||
$pair = "impair";
|
print "<tr ".$bc[$var].">\n <td>";
|
||||||
else
|
|
||||||
$pair = "pair";
|
|
||||||
print "<tr class=\"$pair\">\n <td>";
|
|
||||||
print "$name";
|
print "$name";
|
||||||
print "</td>\n <td>\n";
|
print "</td>\n <td>\n";
|
||||||
require_once($dir.$file);
|
require_once($dir.$file);
|
||||||
$obj = new $classname();
|
$obj = new $classname($db);
|
||||||
|
|
||||||
print $obj->description;
|
print $obj->description;
|
||||||
|
|
||||||
|
|||||||
@ -337,14 +337,6 @@ class pdf_propale_adytek extends ModelePDFPropales
|
|||||||
}
|
}
|
||||||
$pdf->SetTextColor(70,70,170);
|
$pdf->SetTextColor(70,70,170);
|
||||||
|
|
||||||
if (defined("FAC_PDF_INTITULE2"))
|
|
||||||
{
|
|
||||||
$pdf->SetXY(10,30);
|
|
||||||
$pdf->SetFont('Arial','',7);
|
|
||||||
$pdf->SetTextColor(0,0,200);
|
|
||||||
$pdf->MultiCell(45, 5, FAC_PDF_INTITULE2, '' , 'C');
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Definition du document
|
* Definition du document
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -38,12 +38,14 @@
|
|||||||
class pdf_propale_azur extends ModelePDFPropales
|
class pdf_propale_azur extends ModelePDFPropales
|
||||||
{
|
{
|
||||||
|
|
||||||
/** \brief Constructeur
|
/**
|
||||||
|
\brief Constructeur
|
||||||
\param db handler accès base de donnée
|
\param db handler accès base de donnée
|
||||||
*/
|
*/
|
||||||
function pdf_propale_azur($db=0)
|
function pdf_propale_azur($db=0)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
$this->name = "azur";
|
||||||
$this->description = "Modèle de propositions commerciales complet (logo...)";
|
$this->description = "Modèle de propositions commerciales complet (logo...)";
|
||||||
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
|
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
|
||||||
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
|
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
|
||||||
@ -51,6 +53,22 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
$this->option_codeproduitservice = 1; // Affiche code produit-service FACTURE_CODEPRODUITSERVICE
|
$this->option_codeproduitservice = 1; // Affiche code produit-service FACTURE_CODEPRODUITSERVICE
|
||||||
$this->option_tvaintra = 1; // Affiche tva intra MAIN_INFO_TVAINTRA
|
$this->option_tvaintra = 1; // Affiche tva intra MAIN_INFO_TVAINTRA
|
||||||
$this->option_capital = 1; // Affiche capital MAIN_INFO_CAPITAL
|
$this->option_capital = 1; // Affiche capital MAIN_INFO_CAPITAL
|
||||||
|
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
|
||||||
|
$this->franchise=1;
|
||||||
|
|
||||||
|
// Recupere code pays
|
||||||
|
$this->code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation
|
||||||
|
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays";
|
||||||
|
$sql .= " WHERE rowid = ".MAIN_INFO_SOCIETE_PAYS;
|
||||||
|
$result=$this->db->query($sql);
|
||||||
|
if ($result) {
|
||||||
|
$obj = $this->db->fetch_object($result);
|
||||||
|
if ($obj->code) $this->code_pays=$obj->code;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
|
}
|
||||||
|
$this->db->free($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -67,18 +85,19 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
\param facid id de la propale à générer
|
\param facid id de la propale à générer
|
||||||
\return int 1=ok, 0=ko
|
\return int 1=ok, 0=ko
|
||||||
\remarks Variables utilisées
|
\remarks Variables utilisées
|
||||||
|
\remarks MAIN_INFO_SOCIETE_NOM
|
||||||
|
\remarks MAIN_INFO_SIRET
|
||||||
|
\remarks MAIN_INFO_SIREN
|
||||||
|
\remarks MAIN_INFO_RCS
|
||||||
|
\remarks MAIN_INFO_CAPITAL
|
||||||
|
\remarks MAIN_INFO_TVAINTRA
|
||||||
\remarks FAC_PDF_LOGO
|
\remarks FAC_PDF_LOGO
|
||||||
\remarks FACTURE_CODEPRODUITSERVICE
|
\remarks FACTURE_CODEPRODUITSERVICE
|
||||||
\remarks FACTURE_CHQ_NUMBER
|
\remarks FACTURE_CHQ_NUMBER
|
||||||
\remarks FACTURE_RIB_NUMBER
|
\remarks FACTURE_RIB_NUMBER
|
||||||
\remarks FAC_PDF_INTITULE
|
\remarks FAC_PDF_INTITULE
|
||||||
\remarks FAC_PDF_INTITULE2
|
|
||||||
\remarks FAC_PDF_TEL
|
\remarks FAC_PDF_TEL
|
||||||
\remarks FAC_PDF_ADRESSE
|
\remarks FAC_PDF_ADRESSE
|
||||||
\remarks MAIN_INFO_SIRET
|
|
||||||
\remarks MAIN_INFO_SIREN
|
|
||||||
\remarks MAIN_INFO_CAPITAL
|
|
||||||
\remarks MAIN_INFO_TVAINTRA
|
|
||||||
*/
|
*/
|
||||||
function write_pdf_file($id)
|
function write_pdf_file($id)
|
||||||
{
|
{
|
||||||
@ -350,7 +369,8 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
|
|
||||||
// Affiche la mention TVA non applicable selon option
|
// Affiche la mention TVA non applicable selon option
|
||||||
$pdf->SetXY (10, $tab2_top + 0);
|
$pdf->SetXY (10, $tab2_top + 0);
|
||||||
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') {
|
if ($this->franchise==1)
|
||||||
|
{
|
||||||
$pdf->MultiCell(100, $tab2_hl, "* TVA non applicable art-293B du CGI", 0, 'L', 0);
|
$pdf->MultiCell(100, $tab2_hl, "* TVA non applicable art-293B du CGI", 0, 'L', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,12 +484,15 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("main");
|
$langs->load("main");
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
$langs->load("propal");
|
||||||
|
$langs->load("companies");
|
||||||
|
|
||||||
$pdf->SetTextColor(0,0,60);
|
$pdf->SetTextColor(0,0,60);
|
||||||
$pdf->SetFont('Arial','B',13);
|
$pdf->SetFont('Arial','B',13);
|
||||||
|
|
||||||
$pdf->SetXY(10,6);
|
$pdf->SetXY(10,6);
|
||||||
|
|
||||||
|
// Logo
|
||||||
if (defined("FAC_PDF_LOGO") && FAC_PDF_LOGO)
|
if (defined("FAC_PDF_LOGO") && FAC_PDF_LOGO)
|
||||||
{
|
{
|
||||||
if (file_exists(FAC_PDF_LOGO)) {
|
if (file_exists(FAC_PDF_LOGO)) {
|
||||||
@ -513,32 +536,48 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
|
|
||||||
$pdf->SetXY(10,$posy+4);
|
$pdf->SetXY(10,$posy+4);
|
||||||
|
|
||||||
if (defined("FAC_PDF_INTITULE2"))
|
// Nom emetteur
|
||||||
|
$pdf->SetTextColor(0,0,60);
|
||||||
|
$pdf->SetFont('Arial','B',11);
|
||||||
|
if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) // Prioritaire sur MAIN_INFO_SOCIETE_NOM
|
||||||
{
|
{
|
||||||
$pdf->SetTextColor(0,0,60);
|
$pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L');
|
||||||
$pdf->SetFont('Arial','B',10);
|
}
|
||||||
$pdf->MultiCell(70, 4, FAC_PDF_INTITULE2, 0, 'L');
|
else // Par defaut
|
||||||
|
{
|
||||||
|
$pdf->MultiCell(80, 4, MAIN_INFO_SOCIETE_NOM, 0, 'L');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Caractéristiques emetteur
|
||||||
|
$pdf->SetFont('Arial','',9);
|
||||||
if (defined("FAC_PDF_ADRESSE"))
|
if (defined("FAC_PDF_ADRESSE"))
|
||||||
{
|
{
|
||||||
$pdf->SetFont('Arial','',10);
|
|
||||||
$pdf->MultiCell(80, 4, FAC_PDF_ADRESSE);
|
$pdf->MultiCell(80, 4, FAC_PDF_ADRESSE);
|
||||||
}
|
}
|
||||||
if (defined("FAC_PDF_TEL"))
|
if (defined("FAC_PDF_TEL"))
|
||||||
{
|
{
|
||||||
$pdf->SetFont('Arial','',10);
|
$pdf->MultiCell(80, 4, $langs->trans("Phone").": ".FAC_PDF_TEL);
|
||||||
$pdf->MultiCell(40, 4, "Tél : ".FAC_PDF_TEL);
|
}
|
||||||
|
if (defined("FAC_PDF_FAX"))
|
||||||
|
{
|
||||||
|
$pdf->MultiCell(80, 4, $langs->trans("Fax").": ".FAC_PDF_FAX);
|
||||||
|
}
|
||||||
|
if (defined("FAC_PDF_MEL"))
|
||||||
|
{
|
||||||
|
$pdf->MultiCell(80, 4, $langs->trans("Email").": ".FAC_PDF_MEL);
|
||||||
|
}
|
||||||
|
if (defined("FAC_PDF_WWW"))
|
||||||
|
{
|
||||||
|
$pdf->MultiCell(80, 4, $langs->trans("Web").": ".FAC_PDF_WWW);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined("MAIN_INFO_SIREN"))
|
if (defined("MAIN_INFO_SIREN") && MAIN_INFO_SIREN)
|
||||||
{
|
{
|
||||||
$pdf->SetFont('Arial','',10);
|
$pdf->MultiCell(80, 4, $langs->transcountry("ProfId1",$this->code_pays).": ".MAIN_INFO_SIREN);
|
||||||
$pdf->MultiCell(60, 4, "SIREN : ".MAIN_INFO_SIREN);
|
|
||||||
}
|
}
|
||||||
elseif (defined("MAIN_INFO_SIRET"))
|
elseif (defined("MAIN_INFO_SIRET") && MAIN_INFO_SIRET)
|
||||||
{
|
{
|
||||||
$pdf->SetFont('Arial','',10);
|
$pdf->MultiCell(80, 4, $langs->transcountry("ProfId2",$this->code_pays).": ".MAIN_INFO_SIRET);
|
||||||
$pdf->MultiCell(60, 4, "SIRET : ".MAIN_INFO_SIRET);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -550,11 +589,14 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
$pdf->SetFont('Arial','',8);
|
$pdf->SetFont('Arial','',8);
|
||||||
$pdf->SetXY(102,$posy-5);
|
$pdf->SetXY(102,$posy-5);
|
||||||
$pdf->MultiCell(80,5, $langs->trans("BillTo").":");
|
$pdf->MultiCell(80,5, $langs->trans("BillTo").":");
|
||||||
$pdf->SetFont('Arial','B',11);
|
$prop->fetch_client();
|
||||||
$prop->fetch_client();
|
// Nom client
|
||||||
$pdf->SetXY(102,$posy+4);
|
$pdf->SetXY(102,$posy+4);
|
||||||
|
$pdf->SetFont('Arial','B',11);
|
||||||
$pdf->MultiCell(86,4, $prop->client->nom, 0, 'L');
|
$pdf->MultiCell(86,4, $prop->client->nom, 0, 'L');
|
||||||
$pdf->SetFont('Arial','B',10);
|
|
||||||
|
// Caractéristiques client
|
||||||
|
$pdf->SetFont('Arial','B',9);
|
||||||
$pdf->SetXY(102,$posy+12);
|
$pdf->SetXY(102,$posy+12);
|
||||||
$pdf->MultiCell(86,4, $prop->client->adresse . "\n" . $prop->client->cp . " " . $prop->client->ville);
|
$pdf->MultiCell(86,4, $prop->client->adresse . "\n" . $prop->client->cp . " " . $prop->client->ville);
|
||||||
$pdf->rect(100, $posy, 100, 34);
|
$pdf->rect(100, $posy, 100, 34);
|
||||||
@ -586,9 +628,16 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
$footy=13;
|
$footy=13;
|
||||||
$pdf->SetFont('Arial','',8);
|
$pdf->SetFont('Arial','',8);
|
||||||
|
|
||||||
if (MAIN_INFO_CAPITAL) {
|
if (defined(MAIN_INFO_CAPITAL)) {
|
||||||
$pdf->SetY(-$footy);
|
$pdf->SetY(-$footy);
|
||||||
$pdf->MultiCell(190, 3,"SARL au Capital de " . MAIN_INFO_CAPITAL." ".$conf->monnaie." - " . MAIN_INFO_RCS." - Identifiant professionnel: " . MAIN_INFO_SIREN , 0, 'C');
|
$ligne="SARL au Capital de " . MAIN_INFO_CAPITAL." ".$conf->monnaie;
|
||||||
|
if (defined(MAIN_INFO_SIREN) && MAIN_INFO_SIREN) {
|
||||||
|
$ligne.=" - ".$langs->transcountry("ProfId2",$this->code_pays).": ".MAIN_INFO_SIREN;
|
||||||
|
}
|
||||||
|
if (defined(MAIN_INFO_RCS) && MAIN_INFO_RCS) {
|
||||||
|
$ligne.=" - ".$langs->transcountry("ProfId3",$this->code_pays).": ".MAIN_INFO_RCS;
|
||||||
|
}
|
||||||
|
$pdf->MultiCell(190, 3, $ligne, 0, 'C');
|
||||||
$footy-=3;
|
$footy-=3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class pdf_propale_jaune extends ModelePDFPropales
|
|||||||
function pdf_propale_jaune($db=0)
|
function pdf_propale_jaune($db=0)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->name = "Jaune";
|
$this->name = "jaune";
|
||||||
$this->description = "Modèle de proposition Jaune";
|
$this->description = "Modèle de proposition Jaune";
|
||||||
$this->error = "";
|
$this->error = "";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user