New: Gestion du FAC_PDF_LOGO dans le modle de facture crabe.

New: Ajout du capital, SIREN et RCS sur la page de config de la socit/association.
New: Multilangue sur la page accueil index.php
This commit is contained in:
Laurent Destailleur 2004-07-25 15:31:16 +00:00
parent d6b11b2848
commit 4188598b10
7 changed files with 163 additions and 53 deletions

View File

@ -87,9 +87,9 @@ print_titre("Module de num
print '<table class="noborder" cellpadding="2" cellspacing="0" width=\"100%\">';
print '<tr class="liste_titre">';
print '<td>Nom</td>';
print '<td>Description</td>';
print '<td align="center" width="60">Activé</td>';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
@ -123,7 +123,7 @@ while (($file = readdir($handle))!==false)
{
print '&nbsp;';
print '</td><td align="center">';
print '<a href="facture.php?action=set&value='.$file.'">Activer</a>';
print '<a href="facture.php?action=set&value='.$file.'">'.$langs->trans("Activate").'</a>';
}
print "</td></tr>\n";
}
@ -140,9 +140,9 @@ print_titre("Mod
print '<table class="noborder" cellpadding="2" cellspacing="0" width=\"100%\">';
print '<tr class="liste_titre">';
print '<td>Nom</td>';
print '<td>Description</td>';
print '<td align="center" width="60">Activé</td>';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
@ -179,7 +179,7 @@ while (($file = readdir($handle))!==false)
{
print '&nbsp;';
print '</td><td align="center">';
print '<a href="facture.php?action=setpdf&value='.$name.'">Activer</a>';
print '<a href="facture.php?action=setpdf&value='.$name.'">'.$langs->trans("Activate").'</a>';
}
print "</td></tr>\n";
@ -204,7 +204,7 @@ print '<form action="facture.php" method="post">';
print '<input type="hidden" name="action" value="setribchq">';
print '<tr class="liste_titre">';
print '<td>Mode règlement à proposer</td>';
print '<td align="right"><input type="submit" value="Modifier"></td>';
print '<td align="right"><input type="submit" value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
$var=!$var;
print '<tr '.$bc[$var].'>';
@ -289,7 +289,7 @@ print '<form action="facture.php" method="post">';
print '<input type="hidden" name="action" value="settvaoption">';
print '<tr class="liste_titre">';
print '<td>Option</td><td>Description</td>';
print '<td align="right"><input type="submit" value="Modifier"></td>';
print '<td align="right"><input type="submit" value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
$var=True;
$var=!$var;
@ -310,11 +310,11 @@ print_titre("Autres constantes relatives aux factures");
print '<table class="noborder" cellpadding="2" cellspacing="0" width="100%">';
print '<tr class="liste_titre">';
print '<td>Nom</td>';
print '<td>Valeur</td>';
print '<td>Type</td>';
print '<td>Note</td>';
print "<td>Action</td>";
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Note").'</td>';
print '<td>'.$langs->trans("Actiion").'</td>';
print "</tr>\n";
@ -371,8 +371,8 @@ if ($result)
print '<input type="text" size="15" name="constnote" value="'.stripslashes(nl2br($obj->note)).'">';
print '</td><td>';
print '<input type="Submit" value="Update" name="Button"> &nbsp; ';
print '<a href="const.php?rowid='.$obj->rowid.'&action=delete">'.img_delete().'</a>';
print '<input type="Submit" value="'.$langs->trans("Modify").'" name="Button"> &nbsp; ';
// print '<a href="facture.php?rowid='.$obj->rowid.'&action=delete">'.img_delete().'</a>';
print "</td></tr>\n";
print '</form>';

View File

@ -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 '</td></tr>';
print '<tr class="impair"><td width="50%">Numéro de tva intracommunautaire</td><td>';
print '<tr class="impair"><td width="50%">Numéro de TVA intracommunautaire</td><td>';
print '<input name="tva" size="20" value="' . MAIN_INFO_TVAINTRA . '"></td></tr>';
print '<tr class="pair"><td colspan="2" align="center">';
print '<tr class="pair"><td width="50%">Capital</td><td>';
print '<input name="capital" size="20" value="' . MAIN_INFO_CAPITAL . '"></td></tr>';
print '<tr class="impair"><td width="50%">Identifiant professionnel (SIREN,...)</td><td>';
print '<input name="siren" size="20" value="' . MAIN_INFO_SIREN . '"></td></tr>';
print '<tr class="pair"><td width="50%">RCS</td><td>';
print '<input name="rcs" size="20" value="' . MAIN_INFO_RCS . '"></td></tr>';
print '<tr><td colspan="2" align="center">';
print '<input type="submit" value="Enregistrer"></td></tr>';
print '</table></form>';
}
@ -75,13 +88,23 @@ else
print $form->pays_name(MAIN_INFO_SOCIETE_PAYS);
print '</td></tr>';
print '<tr class="impair"><td>Numéro de tva intracommunautaire</td><td>' . MAIN_INFO_TVAINTRA . '</td></tr>';
print '<tr class="impair"><td>Numéro de TVA intracommunautaire</td><td>' . MAIN_INFO_TVAINTRA . '</td></tr>';
print '<tr class="pair"><td width="50%">Capital</td><td>';
print MAIN_INFO_CAPITAL . '</td></tr>';
print '<tr class="impair"><td width="50%">Identifiant professionnel (SIREN,...)</td><td>';
print MAIN_INFO_SIREN . '</td></tr>';
print '<tr class="pair"><td width="50%">RCS</td><td>';
print MAIN_INFO_RCS . '</td></tr>';
print '</table><br>';
// Boutons d'action
print '<div class="tabsAction">';
print '<a class="tabAction" href="index.php?action=edit">Editer</a>';
print '</div>';

View File

@ -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');
}
}
?>

View File

@ -24,7 +24,9 @@ require("./pre.inc.php");
llxHeader();
print_fiche_titre("<font class=\"body\">Nous sommes le</font> ".dolibarr_print_date(mktime(),"%A %d %B %Y").'<font class="body">, vous êtes connecté en tant que</font> ' . $user->prenom . ' ' . $user->nom .' ['.$user->code.']', '<a href="about.php">A propos</a>');
$userstring=$user->prenom . ' ' . $user->nom .' ['.$user->code.']';
print_fiche_titre($langs->trans("WelcomeString",dolibarr_print_date(mktime(),"%A %d %B %Y"),$userstring), '<a href="about.php">'.$langs->trans("About").'</a>');
print "<br>\n";
/*

View File

@ -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=<font class="body">We are </font>%s<font class="body">, and you are connected with name</font> %s

View File

@ -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=<font class="body">Nous sommes le</font> %s<font class="body">, et vous êtes connectés sous le user</font> %s

View File

@ -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]<br>";
$tab=split('=',$ligne,2);
//print "Ligne=$ligne<br>Found a string for $tab[0] with value $tab[1]<br>";
$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;
}