From 4188598b10f83e10f24e4ee3bdd9cc41c09abb49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Jul 2004 15:31:16 +0000 Subject: [PATCH] =?UTF-8?q?New:=20Gestion=20du=20FAC=5FPDF=5FLOGO=20dans?= =?UTF-8?q?=20le=20mod=E8le=20de=20facture=20crabe.=20New:=20Ajout=20du=20?= =?UTF-8?q?capital,=20SIREN=20et=20RCS=20sur=20la=20page=20de=20config=20d?= =?UTF-8?q?e=20la=20soci=E9t=E9/association.=20New:=20Multilangue=20sur=20?= =?UTF-8?q?la=20page=20accueil=20index.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/facture.php | 34 +++--- htdocs/admin/index.php | 33 +++++- .../modules/facture/pdf_crabe.modules.php | 100 ++++++++++++++---- htdocs/index.php | 4 +- htdocs/langs/en_US/main.lang | 23 ++-- htdocs/langs/fr_FR/main.lang | 13 ++- htdocs/translate.class.php | 9 +- 7 files changed, 163 insertions(+), 53 deletions(-) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 700427e3249..159d2f7e296 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -87,9 +87,9 @@ print_titre("Module de num print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; print "\n"; @@ -123,7 +123,7 @@ while (($file = readdir($handle))!==false) { print ' '; print '\n"; } @@ -140,9 +140,9 @@ print_titre("Mod print '
NomDescriptionActivé'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Activated").' 
'; - print 'Activer'; + print ''.$langs->trans("Activate").''; } print "
'; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; print "\n"; @@ -179,7 +179,7 @@ while (($file = readdir($handle))!==false) { print ' '; print '\n"; @@ -204,7 +204,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; $var=!$var; print ''; @@ -289,7 +289,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; $var=True; $var=!$var; @@ -310,11 +310,11 @@ print_titre("Autres constantes relatives aux factures"); print '
NomDescriptionActivé'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Activated").' 
'; - print 'Activer'; + print ''.$langs->trans("Activate").''; } print "
Mode règlement à proposer
OptionDescription
'; print ''; -print ''; -print ''; -print ''; -print ''; -print ""; +print ''; +print ''; +print ''; +print ''; +print ''; print "\n"; @@ -371,8 +371,8 @@ if ($result) print ''; print '\n"; print ''; diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index fbce18e773c..8c9a75de3e1 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -30,6 +30,10 @@ if ($_POST["action"] == 'update') dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"]); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS",$_POST["pays_id"]); dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"]); + dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"]); + dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"]); + dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"]); + dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"]); Header("Location: index.php"); } @@ -57,10 +61,19 @@ if ($_GET["action"] == 'edit') print $form->select_pays(MAIN_INFO_SOCIETE_PAYS); print ''; - print ''; - print ''; + + print ''; + + print ''; + + print ''; print '
NomValeurTypeNoteAction'.$langs->trans("Name").''.$langs->trans("Value").''.$langs->trans("Type").''.$langs->trans("Note").''.$langs->trans("Actiion").'
'; - print '   '; - print ''.img_delete().''; + print '   '; +// print ''.img_delete().''; print "
Numéro de tva intracommunautaire'; + print '
Numéro de TVA intracommunautaire'; print '
'; + print '
Capital'; + print '
Identifiant professionnel (SIREN,...)'; + print '
RCS'; + print '
'; print '
'; } @@ -75,13 +88,23 @@ else print $form->pays_name(MAIN_INFO_SOCIETE_PAYS); print ''; - print 'Numéro de tva intracommunautaire' . MAIN_INFO_TVAINTRA . ''; + print 'Numéro de TVA intracommunautaire' . MAIN_INFO_TVAINTRA . ''; + + print 'Capital'; + print MAIN_INFO_CAPITAL . ''; + + print 'Identifiant professionnel (SIREN,...)'; + print MAIN_INFO_SIREN . ''; + + print 'RCS'; + print MAIN_INFO_RCS . ''; + + print '
'; + // Boutons d'action print '
'; - print 'Editer'; - print '
'; diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index 615b69ed3ec..367fef16279 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -21,6 +21,7 @@ * */ +require_once(DOL_DOCUMENT_ROOT."/product.class.php"); /*! \file pdf_crabe.modules.php \brief Classe permettant de générer lune facture au modèle Crabe @@ -38,7 +39,13 @@ Class pdf_crabe { Function pdf_crabe($db=0) { $this->db = $db; - $this->description = "Modèle de facture classique (Gère l'option fiscale de facturation TVA et le choix du mode de règlement à afficher)"; + $this->description = "Modèle de facture complet (Gère l'option fiscale de facturation TVA, le choix du mode de règlement à afficher, logo...)"; + $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION + $this->option_modereg = 1; // Gere choix mode règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER + $this->option_codeproduitservice = 1; // Affiche code produit-service FACTURE_CODEPRODUITSERVICE + $this->option_tvaintra = 1; // Affiche tva intra MAIN_INFO_TVAINTRA + $this->option_capital = 1; // Affiche capital MAIN_INFO_CAPITAL } @@ -56,10 +63,20 @@ Class pdf_crabe { \param facid id de la facture à générer \remarks Variables utilisées \remarks FAC_OUTPUTDIR + \remarks FAC_PDF_LOGO \remarks FACTURE_CODEPRODUITSERVICE \remarks FACTURE_CHQ_NUMBER \remarks FACTURE_RIB_NUMBER \remarks FAC_OUTPUTDIR + \remarks FAC_PDF_INTITULE + \remarks FAC_PDF_INTITULE2 + \remarks FAC_PDF_SIREN + \remarks FAC_PDF_SIRET + \remarks FAC_PDF_TEL + \remarks FAC_PDF_ADRESSE + \remarks MAIN_INFO_RCS + \remarks MAIN_INFO_CAPITAL + \remarks MAIN_INFO_TVAINTRA \return 1=ok, 0=ko */ Function write_pdf_file($facid) @@ -96,10 +113,20 @@ Class pdf_crabe { $pdf->SetSubject("Facture"); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($user->fullname); + //$pdf->Keywords("Facture"); + + $pdf->SetMargins(10, 10, 10); + $pdf->SetAutoPageBreak(1,0); $tab_top = 96; $tab_height = 110; + if (defined("FAC_PDF_LOGO")) + { + $pdf->SetXY(10,5); + $pdf->Image(FAC_PDF_LOGO, 10, 5, 0, 24, 'PNG'); + } + $pdf->SetFillColor(220,220,220); $pdf->SetFont('Arial','', 9); $pdf->SetXY (10, $tab_top + 10 ); @@ -119,7 +146,11 @@ Class pdf_crabe { $pdf->SetXY (11, $curY ); if (defined("FACTURE_CODEPRODUITSERVICE") && FACTURE_CODEPRODUITSERVICE) { // Affiche code produit si ligne associée à un code produit - $codeproduitservice=" (Code produit ".$fac->lignes[$i]->produit_id.")"; + + $prodser = new Product($this->db); + + $prodser->fetch($fac->lignes[$i]->produit_id); + $codeproduitservice=" (Code produit ".$prodser->ref.")"; } if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end) { // Affichage durée si il y en a une @@ -231,7 +262,7 @@ Class pdf_crabe { /* * Conditions de règlements */ - $pdf->SetFont('Arial','U',10); + $pdf->SetFont('Arial','B',10); $pdf->SetXY(10, 217); $titre = "Conditions de réglement:"; $pdf->MultiCell(80, 5, $titre, 0, 'L'); @@ -239,6 +270,13 @@ Class pdf_crabe { $pdf->SetXY(54, 217); $pdf->MultiCell(80, 5, $fac->cond_reglement_facture,0,'L'); + + /* + * Pied de page + */ + $this->_pagefoot($pdf, $fac); + $pdf->AliasNbPages(); + $pdf->Close(); $pdf->Output($file); @@ -335,6 +373,7 @@ Class pdf_crabe { $pdf->MultiCell(20, 4, $row[3], 0, 'L', 0); $pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 ); + $i++; } } @@ -359,19 +398,6 @@ Class pdf_crabe { if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') { $pdf->MultiCell(100, $tab2_hl, "* TVA non applicable art-293B du CGI", 0, 'L', 0); } - // Affiche le numéro de TVA intracommunautaire - if (defined("MAIN_INFO_TVAINTRA")) { - if (MAIN_INFO_TVAINTRA == 'MAIN_INFO_TVAINTRA') { - $pdf->SetTextColor(200,0,0); - $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(90, 3, "Numéro de TVA intracommunautaire pas encore configuré.",0,'L',0); - $pdf->MultiCell(90, 3, "Aller dans la Configuration générale pour le définir ou l'effacer.",0,'L',0); - $pdf->SetTextColor(0,0,0); - } - elseif (MAIN_INFO_TVAINTRA != '') { - $pdf->MultiCell(190, 5, "Numéro de TVA intracommunautaire : ".MAIN_INFO_TVAINTRA, 0, 'L'); - } - } // Tableau total $col1x=120; $col2x=174; @@ -516,10 +542,15 @@ Class pdf_crabe { $pdf->SetFont('Arial','',10); $pdf->MultiCell(40, 4, "Tél : ".FAC_PDF_TEL); } - if (defined("FAC_PDF_SIREN")) + if (defined("FAC_PDF_SIRET")) { $pdf->SetFont('Arial','',10); - $pdf->MultiCell(40, 4, "SIREN : ".FAC_PDF_SIREN); + $pdf->MultiCell(60, 4, "SIRET : ".FAC_PDF_SIRET); + } + elseif (defined("FAC_PDF_SIREN")) + { + $pdf->SetFont('Arial','',10); + $pdf->MultiCell(60, 4, "SIREN : ".FAC_PDF_SIREN); } @@ -552,6 +583,39 @@ Class pdf_crabe { } + /* + * + * + */ + function _pagefoot(&$pdf, $fac) + { + $footy=13; + $pdf->SetFont('Arial','',8); + + if (MAIN_INFO_CAPITAL) { + $pdf->SetY(-$footy); + $pdf->MultiCell(190, 3,"SARL au Capital de " . MAIN_INFO_CAPITAL." ".MAIN_MONNAIE." - " . MAIN_INFO_RCS." - Identifiant professionnel: " . MAIN_INFO_SIREN , 0, 'C'); + $footy-=3; + } + + // Affiche le numéro de TVA intracommunautaire + if (MAIN_INFO_TVAINTRA == 'MAIN_INFO_TVAINTRA') { + $pdf->SetY(-$footy); + $pdf->SetTextColor(200,0,0); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(190, 3, "Numéro de TVA intracommunautaire pas encore configuré.",0,'L',0); + $pdf->MultiCell(190, 3, "Aller dans la Configuration générale pour le définir ou l'effacer.",0,'L',0); + $pdf->SetTextColor(0,0,0); + } + elseif (MAIN_INFO_TVAINTRA != '') { + $pdf->SetY(-$footy); + $pdf->MultiCell(190, 3, "Numéro de TVA intracommunautaire : ".MAIN_INFO_TVAINTRA, 0, 'C'); + } + + $pdf->SetXY(-10,-10); + $pdf->MultiCell(10, 3, $pdf->PageNo().'/{nb}', 0, 'R'); + } + } ?> diff --git a/htdocs/index.php b/htdocs/index.php index 3cc28360578..c6689a3ad94 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -24,7 +24,9 @@ require("./pre.inc.php"); llxHeader(); -print_fiche_titre("Nous sommes le ".dolibarr_print_date(mktime(),"%A %d %B %Y").', vous êtes connecté en tant que ' . $user->prenom . ' ' . $user->nom .' ['.$user->code.']', 'A propos'); +$userstring=$user->prenom . ' ' . $user->nom .' ['.$user->code.']'; +print_fiche_titre($langs->trans("WelcomeString",dolibarr_print_date(mktime(),"%A %d %B %Y"),$userstring), ''.$langs->trans("About").''); + print "
\n"; /* diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 8f08fe81178..95fddbb1e6b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1,10 +1,21 @@ -# Dolibarr language file - fr_FR - main +# Dolibarr language file - en_US - main charset="iso-8859-1" -Add=Ajouter -Delete=Supprimer -Cancel=Annuler -Modify=Modifier -Edit=Editer +Activate=Activate +Activated=Activated +Add=Add +Delete=Delete +Cancel=Cancel +Modify=Modify +Edit=Edit +Search=Search ChooseLangage=Please choose your language User=User Group=Group +Name=Name +Value=Value +Type=Type +Note=Note +Action=Action +About=About +WelcomeString=We are %s, and you are connected with name %s + diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 974ffaef2e1..b61be6e30ce 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -1,10 +1,21 @@ # Dolibarr language file - fr_FR - main charset="iso-8859-1" +Activate=Activer +Activated=Activé Add=Ajouter Delete=Supprimer Cancel=Annuler Modify=Modifier Edit=Editer -ChooseLangage=Please choose your language +Search=Rechercher +ChooseLangage=Choisissez votre langue User=Utilisateur Group=Groupe +Name=Nom +Value=Valeur +Type=Type +Note=Note +Action=Action +About=A propos +WelcomeString=Nous sommes le %s, et vous êtes connectés sous le user %s + diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php index c8ba6377527..090bd92bde6 100644 --- a/htdocs/translate.class.php +++ b/htdocs/translate.class.php @@ -53,8 +53,8 @@ Class Translate { $finded = 0; while (($ligne = fgets($fp,4096)) && ($finded == 0)){ if ($ligne[0] != "\n" && $ligne[0] != " " && $ligne[0] != "#") { - $tab=split('=',$ligne); - //print "Found a string for $tab[0] with value $tab[1]
"; + $tab=split('=',$ligne,2); + //print "Ligne=$ligne
Found a string for $tab[0] with value $tab[1]
"; $this->tab_translate[$tab[0]]=$tab[1]; } } @@ -77,11 +77,10 @@ Class Translate { * @param string $str original string to translate * @param int $mark bolean, 1 or nothing: add [vo] if this translation does not exists, 0 don't add [vo] tags */ - function trans($str) { + function trans($str, $param1='', $param2='', $param3='') { if ($this->tab_translate[$str]) { // Si la traduction est disponible - - return $this->tab_translate[$str]; + return sprintf($this->tab_translate[$str],$param1,$param2,$param2); } return $str; }