43 |
*/ |
*/ |
44 |
function pdf_crabe($db) |
function pdf_crabe($db) |
45 |
{ |
{ |
46 |
global $langs; |
global $conf,$langs; |
47 |
|
|
48 |
$this->db = $db; |
$this->db = $db; |
49 |
$this->name = "crabe"; |
$this->name = "crabe"; |
59 |
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') |
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') |
60 |
$this->franchise=1; |
$this->franchise=1; |
61 |
|
|
62 |
// Recupere code pays |
// Recupere code pays de l'emmetteur |
63 |
$this->code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation |
$this->emetteur->code_pays=substr($langs->defaultlang,-2); // Par defaut, si on trouve pas |
64 |
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; |
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; |
65 |
$sql .= " WHERE rowid = ".MAIN_INFO_SOCIETE_PAYS; |
$sql .= " WHERE rowid = '".$conf->global->MAIN_INFO_SOCIETE_PAYS."'"; |
66 |
$result=$this->db->query($sql); |
$result=$this->db->query($sql); |
67 |
if ($result) { |
if ($result) { |
68 |
$obj = $this->db->fetch_object($result); |
$obj = $this->db->fetch_object($result); |
69 |
if ($obj->code) $this->code_pays=$obj->code; |
if ($obj->code) $this->emetteur->code_pays=$obj->code; |
70 |
} |
} |
71 |
else { |
else { |
72 |
dolibarr_print_error($this->db); |
dolibarr_print_error($this->db); |
645 |
// Logo |
// Logo |
646 |
if (defined("FAC_PDF_LOGO") && FAC_PDF_LOGO) |
if (defined("FAC_PDF_LOGO") && FAC_PDF_LOGO) |
647 |
{ |
{ |
648 |
if (file_exists(FAC_PDF_LOGO)) { |
if (file_exists(FAC_PDF_LOGO)) |
649 |
|
{ |
650 |
$pdf->Image(FAC_PDF_LOGO, 10, 5, 0, 24); |
$pdf->Image(FAC_PDF_LOGO, 10, 5, 0, 24); |
651 |
} |
} |
652 |
else { |
else |
653 |
|
{ |
654 |
$pdf->SetTextColor(200,0,0); |
$pdf->SetTextColor(200,0,0); |
655 |
$pdf->SetFont('Arial','B',8); |
$pdf->SetFont('Arial','B',8); |
656 |
$pdf->MultiCell(80, 3, $langs->trans("ErrorLogoFileNotFound",FAC_PDF_LOGO), 0, 'L'); |
$pdf->MultiCell(80, 3, $langs->trans("ErrorLogoFileNotFound",FAC_PDF_LOGO), 0, 'L'); |
788 |
} |
} |
789 |
if ($conf->global->MAIN_INFO_SIRET) |
if ($conf->global->MAIN_INFO_SIRET) |
790 |
{ |
{ |
791 |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId2",$this->code_pays).": ".$conf->global->MAIN_INFO_SIRET; |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId2",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIRET; |
792 |
} |
} |
793 |
elseif ($conf->global->MAIN_INFO_SIREN) |
if ($conf->global->MAIN_INFO_SIREN && (! $conf->global->MAIN_INFO_SIRET || $this->emetteur->code_pays != 'FR')) |
794 |
{ |
{ |
795 |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId1",$this->code_pays).": ".$conf->global->MAIN_INFO_SIREN; |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId1",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIREN; |
796 |
} |
} |
797 |
if ($conf->global->MAIN_INFO_APE) |
if ($conf->global->MAIN_INFO_APE) |
798 |
{ |
{ |
799 |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId3",$this->code_pays).": ".MAIN_INFO_APE; |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId3",$this->emetteur->code_pays).": ".MAIN_INFO_APE; |
800 |
} |
} |
801 |
|
|
802 |
if ($ligne) |
if ($ligne) |
809 |
$ligne=""; |
$ligne=""; |
810 |
if ($conf->global->MAIN_INFO_RCS) |
if ($conf->global->MAIN_INFO_RCS) |
811 |
{ |
{ |
812 |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId4",$this->code_pays).": ".$conf->global->MAIN_INFO_RCS; |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId4",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_RCS; |
813 |
} |
} |
814 |
if ($conf->global->MAIN_INFO_TVAINTRA != '') |
if ($conf->global->MAIN_INFO_TVAINTRA != '') |
815 |
{ |
{ |