Fix: Le composant show_document renvoi le model sous le nom 'model' partout (certaines parties de code utilisaient 'model', d'autre 'modelpdf').

On prendre 'model' car l'architecture Dolibarr peut tres bien généré des documents non pdf, tout depend uniquement du module de generation (exemple les dons generent des modeles html).
Trad: Traduction etat promesses de dons
This commit is contained in:
Laurent Destailleur 2006-07-02 13:45:06 +00:00
parent c477dcad2c
commit f191dfc7e6
18 changed files with 363 additions and 198 deletions

View File

@ -230,7 +230,7 @@ if ($_GET["action"] == 'create')
print '<td colspan="2">'; print '<td colspan="2">';
$model=new ModelePDFPropales(); $model=new ModelePDFPropales();
$liste=$model->liste_modeles($db); $liste=$model->liste_modeles($db);
$html->select_array("modelpdf",$liste,$conf->global->PROPALE_ADDON_PDF); $html->select_array('model',$liste,$conf->global->PROPALE_ADDON_PDF);
print "</td></tr>"; print "</td></tr>";
// Projet // Projet

View File

@ -184,7 +184,7 @@ if ($_POST['action'] == 'add')
$propal->socidp = $_POST['socidp']; $propal->socidp = $_POST['socidp'];
$propal->contactid = $_POST['contactidp']; $propal->contactid = $_POST['contactidp'];
$propal->projetidp = $_POST['projetidp']; $propal->projetidp = $_POST['projetidp'];
$propal->modelpdf = $_POST['modelpdf']; $propal->modelpdf = $_POST['model'];
$propal->author = $user->id; $propal->author = $user->id;
$propal->note = $_POST['note']; $propal->note = $_POST['note'];
$propal->ref = $_POST['ref']; $propal->ref = $_POST['ref'];
@ -208,7 +208,7 @@ if ($_POST['action'] == 'add')
$propal->contactid = $_POST['contactidp']; $propal->contactid = $_POST['contactidp'];
$propal->projetidp = $_POST['projetidp']; $propal->projetidp = $_POST['projetidp'];
$propal->modelpdf = $_POST['modelpdf']; $propal->modelpdf = $_POST['model'];
$propal->author = $user->id; $propal->author = $user->id;
$propal->note = $_POST['note']; $propal->note = $_POST['note'];
$propal->ref_client = $_POST['ref_client']; $propal->ref_client = $_POST['ref_client'];
@ -258,7 +258,7 @@ if ($_POST['action'] == 'add')
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
propale_pdf_create($db, $id, $_POST['modelpdf'], $outputlangs); propale_pdf_create($db, $id, $_REQUEST['model'], $outputlangs);
dolibarr_syslog('Redirect to '.$_SERVER["PHP_SELF"].'?propalid='.$id); dolibarr_syslog('Redirect to '.$_SERVER["PHP_SELF"].'?propalid='.$id);
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$id); Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$id);
exit; exit;
@ -540,9 +540,9 @@ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer)
{ {
$propal = new Propal($db); $propal = new Propal($db);
$propal->fetch($_GET['propalid']); $propal->fetch($_GET['propalid']);
if ($_POST['modelpdf']) if ($_REQUEST['model'])
{ {
$propal->set_pdf_model($user, $_POST['modelpdf']); $propal->set_pdf_model($user, $_REQUEST['model']);
} }
if ($_REQUEST['lang_id']) if ($_REQUEST['lang_id'])
@ -1498,7 +1498,7 @@ if ($_GET['propalid'] > 0)
$var=true; $var=true;
$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); $somethingshown=$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);
/* /*

View File

@ -97,7 +97,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
//$commande->remise_absolue = $_POST['remise_absolue']; //la remise était appliquée sur les lignes et sur le total //$commande->remise_absolue = $_POST['remise_absolue']; //la remise était appliquée sur les lignes et sur le total
//$commande->remise_percent = $_POST['remise_percent']; //$commande->remise_percent = $_POST['remise_percent'];
$commande->ref_client = $_POST['ref_client']; $commande->ref_client = $_POST['ref_client'];
$commande->modelpdf = $_POST['modelpdf']; $commande->modelpdf = $_POST['model'];
$commande->cond_reglement_id = $_POST['cond_reglement_id']; $commande->cond_reglement_id = $_POST['cond_reglement_id'];
$commande->mode_reglement_id = $_POST['mode_reglement_id']; $commande->mode_reglement_id = $_POST['mode_reglement_id'];
$commande->date_livraison = $datelivraison; $commande->date_livraison = $datelivraison;
@ -449,9 +449,9 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
// Sauvegarde le dernier modèle choisi pour générer un document // Sauvegarde le dernier modèle choisi pour générer un document
$commande = new Commande($db, 0, $_REQUEST['id']); $commande = new Commande($db, 0, $_REQUEST['id']);
$commande->fetch($_REQUEST['id']); $commande->fetch($_REQUEST['id']);
if ($_REQUEST['modelpdf']) if ($_REQUEST['model'])
{ {
$commande->set_pdf_model($user, $_REQUEST['modelpdf']); $commande->set_pdf_model($user, $_REQUEST['model']);
} }
if ($_REQUEST['lang_id']) if ($_REQUEST['lang_id'])
@ -774,13 +774,13 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
print '<tr><td>'.$langs->trans('Source').'</td><td>'; print '<tr><td>'.$langs->trans('Source').'</td><td>';
$html->selectSourcesCommande('','source_id',1); $html->selectSourcesCommande('','source_id',1);
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("Model").'</td>'; print '<tr><td>'.$langs->trans('Model').'</td>';
print '<td>'; print '<td>';
// pdf // pdf
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/commande/modules_commande.php'); include_once(DOL_DOCUMENT_ROOT.'/includes/modules/commande/modules_commande.php');
$model=new ModelePDFCommandes(); $model=new ModelePDFCommandes();
$liste=$model->liste_modeles($db); $liste=$model->liste_modeles($db);
$html->select_array("modelpdf",$liste,$conf->global->COMMANDE_ADDON_PDF); $html->select_array('model',$liste,$conf->global->COMMANDE_ADDON_PDF);
print "</td></tr>"; print "</td></tr>";
if ($propalid > 0) if ($propalid > 0)
@ -1646,7 +1646,7 @@ else
$genallowed=$user->rights->commande->creer; $genallowed=$user->rights->commande->creer;
$delallowed=$user->rights->commande->supprimer; $delallowed=$user->rights->commande->supprimer;
$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); $somethingshown=$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
/* /*
* Liste des factures * Liste des factures
@ -1809,7 +1809,7 @@ else
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
$result=commande_pdf_create($db, $_REQUEST['id'], '', $_REQUEST['modelpdf'], $outputlangs); $result=commande_pdf_create($db, $_REQUEST['id'], '', $_REQUEST['model'], $outputlangs);
if ($result <= 0) if ($result <= 0)
{ {
dolibarr_print_error($db,$result); dolibarr_print_error($db,$result);

View File

@ -553,7 +553,7 @@ if ($_GET["id"] > 0)
$genallowed=0; $genallowed=0;
$delallowed=0; $delallowed=0;
$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); $somethingshown=$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
/* /*
* Liste des factures * Liste des factures

View File

@ -18,7 +18,6 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
/** /**
@ -31,6 +30,7 @@
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT ."/don.class.php"); require_once(DOL_DOCUMENT_ROOT ."/don.class.php");
$langs->load("companies");
$langs->load("donations"); $langs->load("donations");
$sortorder=$_GET["sortorder"]; $sortorder=$_GET["sortorder"];

View File

@ -195,7 +195,7 @@ if ($_POST['action'] == 'add')
$facture->note_public = $_POST['note_public']; $facture->note_public = $_POST['note_public'];
$facture->note = $_POST['note']; $facture->note = $_POST['note'];
$facture->ref_client = $_POST['ref_client']; $facture->ref_client = $_POST['ref_client'];
$facture->modelpdf = $_POST['modelpdf']; $facture->modelpdf = $_POST['model'];
if ($_POST['fac_rec'] > 0) if ($_POST['fac_rec'] > 0)
{ {
@ -701,9 +701,9 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$facture = new Facture($db, 0, $_GET['facid']); $facture = new Facture($db, 0, $_GET['facid']);
$facture->fetch($_GET['facid']); $facture->fetch($_GET['facid']);
if ($_REQUEST['modelpdf']) if ($_REQUEST['model'])
{ {
$facture->set_pdf_model($user, $_REQUEST['modelpdf']); $facture->set_pdf_model($user, $_REQUEST['model']);
} }
if ($_REQUEST['lang_id']) if ($_REQUEST['lang_id'])
@ -914,13 +914,13 @@ if ($_GET['action'] == 'create')
print '</td></tr>'; print '</td></tr>';
} }
print '<tr><td>'.$langs->trans("Model").'</td>'; print '<tr><td>'.$langs->trans('Model').'</td>';
print '<td>'; print '<td>';
// pdf // pdf
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php'); include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php');
$model=new ModelePDFFactures(); $model=new ModelePDFFactures();
$liste=$model->liste_modeles($db); $liste=$model->liste_modeles($db);
$html->select_array("modelpdf",$liste,$conf->global->FACTURE_ADDON_PDF); $html->select_array('model',$liste,$conf->global->FACTURE_ADDON_PDF);
print "</td></tr>"; print "</td></tr>";
// Note publique // Note publique
@ -2334,7 +2334,7 @@ else
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
$result=facture_pdf_create($db, $fac->id, '', $_REQUEST['modelpdf'], $outputlangs); $result=facture_pdf_create($db, $fac->id, '', $_REQUEST['model'], $outputlangs);
if ($result <= 0) if ($result <= 0)
{ {
dolibarr_print_error($db,$result); dolibarr_print_error($db,$result);
@ -2389,7 +2389,7 @@ else
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
$result=facture_pdf_create($db, $fac->id, '', $_REQUEST['modelpdf'], $outputlangs); $result=facture_pdf_create($db, $fac->id, '', $_REQUEST['model'], $outputlangs);
if ($result <= 0) if ($result <= 0)
{ {
dolibarr_print_error($db,$result); dolibarr_print_error($db,$result);

View File

@ -70,9 +70,12 @@ class Don
$this->modepaiementid = 0; $this->modepaiementid = 0;
$langs->load("donations"); $langs->load("donations");
$this->labelstatut[0]=$langs->trans("DonationStatusPromessNotValidated"); $this->labelstatut[0]=$langs->trans("DonationStatusPromiseNotValidated");
$this->labelstatut[1]=$langs->trans("DonationStatusPromessValidated"); $this->labelstatut[1]=$langs->trans("DonationStatusPromiseValidated");
$this->labelstatut[2]=$langs->trans("DonationStatusPayed"); $this->labelstatut[2]=$langs->trans("DonationStatusPayed");
$this->labelstatutshort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort");
$this->labelstatutshort[1]=$langs->trans("DonationStatusPromiseValidatedShort");
$this->labelstatutshort[2]=$langs->trans("DonationStatusPayedShort");
} }
@ -98,20 +101,17 @@ class Don
if ($mode == 0) if ($mode == 0)
{ {
$prefix='';
return $this->labelstatut[$statut]; return $this->labelstatut[$statut];
} }
if ($mode == 1) if ($mode == 1)
{ {
$prefix='Short'; return $this->labelstatutshort[$statut];
return $this->labelstatut[$statut];
} }
if ($mode == 2) if ($mode == 2)
{ {
$prefix='Short'; if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatutshort[$statut];
if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatut[$statut]; if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatutshort[$statut];
if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatutshort[$statut];
if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut];
} }
if ($mode == 3) if ($mode == 3)
{ {
@ -129,9 +129,9 @@ class Don
if ($mode == 5) if ($mode == 5)
{ {
$prefix='Short'; $prefix='Short';
if ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); if ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0');
if ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); if ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1');
if ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); if ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6');
} }
} }

View File

@ -583,7 +583,7 @@ else
//$genallowed=1; //$genallowed=1;
//$delallowed=0; //$delallowed=0;
$result=$html->show_documents('expedition',$expeditionref,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf); $somethingshown=$html->show_documents('expedition',$expeditionref,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf);
/* /*
* Déjà livre * Déjà livre

View File

@ -22,14 +22,34 @@
* $Source$ * $Source$
*/ */
/**
\file htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php
\ingroup expedition
\brief Fichier de la classe permettant de générer les bordereaux envoi au modèle Dorade
\version $Revision$
*/
require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php"; require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php";
/**
\class pdf_expedition_dorade
\brief Classe permettant de générer les borderaux envoi au modèle Dorade
*/
Class pdf_expedition_dorade extends ModelePdfExpedition Class pdf_expedition_dorade extends ModelePdfExpedition
{ {
var $emetteur; // Objet societe qui emet
/**
\brief Constructeur
\param db Handler accès base de donnée
*/
function pdf_expedition_dorade($db=0) function pdf_expedition_dorade($db=0)
{ {
global $conf,$langs,$mysoc;
$this->db = $db; $this->db = $db;
$this->name = "dorade"; $this->name = "dorade";
$this->description = "Modèle identique au rouget utilisé pour debug uniquement."; $this->description = "Modèle identique au rouget utilisé pour debug uniquement.";
@ -40,6 +60,10 @@ Class pdf_expedition_dorade extends ModelePdfExpedition
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
$this->option_logo = 0; $this->option_logo = 0;
// Recupere emmetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
} }
@ -87,7 +111,7 @@ Class pdf_expedition_dorade extends ModelePdfExpedition
function generate(&$objExpe, $filename, $outputlangs='') function generate(&$objExpe, $filename, $outputlangs='')
{ {
global $user,$conf,$langs,$mysoc; global $user,$conf,$langs;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
$outputlangs->load("main"); $outputlangs->load("main");
@ -98,70 +122,92 @@ Class pdf_expedition_dorade extends ModelePdfExpedition
$outputlangs->setPhpLang(); $outputlangs->setPhpLang();
$this->expe = $objExpe; if ($conf->expedition->dir_output)
$this->expe->fetch_commande();
// Définition de $dir et $file
if ($this->expe->specimen)
{ {
$dir = $conf->propal->dir_output; $this->expe = $objExpe;
$file = $dir . "/SPECIMEN.pdf"; $this->expe->fetch_commande();
}
else
{
$expref = sanitize_string($this->expe->ref);
$dir = $conf->expedition->dir_output . "/" . $expref;
$file = $dir . "/" . $expref . ".pdf";
}
if (! file_exists($dir)) // Définition de $dir et $file
{ if ($this->expe->specimen)
if (create_exdir($dir) < 0)
{ {
$this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir); $dir = $conf->expedition->dir_output;
return 0; $file = $dir . "/SPECIMEN.pdf";
}
else
{
$expref = sanitize_string($this->expe->ref);
$dir = $conf->expedition->dir_output . "/" . $expref;
$file = $dir . "/" . $expref . ".pdf";
} }
}
$filename=$file;
$this->pdf = new ModelePdfExpedition();
$this->pdf->expe = &$this->expe;
$this->pdf->Open(); if (! file_exists($dir))
$this->pdf->AliasNbPages(); {
$this->pdf->AddPage(); if (create_exdir($dir) < 0)
{
$this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir);
return 0;
}
}
$this->pdf->SetTitle($objExpe->ref); if (file_exists($dir))
$this->pdf->SetSubject("Bordereau d'expedition"); {
$this->pdf->SetCreator("Dolibarr ".DOL_VERSION); $filename=$file;
//$this->pdf->SetAuthor($user->fullname);
$this->pdf = new ModelePdfExpedition();
/* $this->pdf->expe = &$this->expe;
*
*/ $this->pdf->Open();
$this->pdf->SetTextColor(0,0,0); $this->pdf->AliasNbPages();
$this->pdf->SetFont('Arial','', 16); $this->pdf->AddPage();
$this->expe->fetch_lignes(); $this->pdf->SetTitle($objExpe->ref);
$this->pdf->SetSubject("Bordereau d'expedition");
for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++) $this->pdf->SetCreator("Dolibarr ".DOL_VERSION);
{ //$this->pdf->SetAuthor($user->fullname);
$a = $this->pdf->tableau_top + 14 + ($i * 16);
/*
$this->pdf->i25(8, ($a - 2), "000000".$this->expe->lignes[$i]->fk_product, 1, 8); *
*/
$this->pdf->Text(40, $a, $this->expe->lignes[$i]->description); $this->pdf->SetTextColor(0,0,0);
$this->pdf->SetFont('Arial','', 16);
$this->pdf->Text(170, $a, $this->expe->lignes[$i]->qty_commande);
$this->expe->fetch_lignes();
$this->pdf->Text(194, $a, $this->expe->lignes[$i]->qty_expedition);
} for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++)
{
$this->pdf->Output($filename); $a = $this->pdf->tableau_top + 14 + ($i * 16);
$this->pdf->i25(8, ($a - 2), "000000".$this->expe->lignes[$i]->fk_product, 1, 8);
$this->pdf->Text(40, $a, $this->expe->lignes[$i]->description);
$this->pdf->Text(170, $a, $this->expe->lignes[$i]->qty_commande);
$this->pdf->Text(194, $a, $this->expe->lignes[$i]->qty_expedition);
}
$this->pdf->Output($filename);
$langs->setPhpLang(); // On restaure langue session
return 1;
}
else
{
$this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir);
$langs->setPhpLang(); // On restaure langue session
return 0;
}
}
else
{
$this->error=$outputlangs->trans("ErrorConstantNotDefined","EXP_OUTPUTDIR");
$langs->setPhpLang(); // On restaure langue session
return 0;
}
$this->error=$outputlangs->trans("ErrorUnknown");
$langs->setPhpLang(); // On restaure langue session
return 0; // Erreur par defaut
return 1;
} }
} }
?> ?>

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com> * Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,14 +22,34 @@
* $Source$ * $Source$
*/ */
/**
\file htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php
\ingroup expedition
\brief Fichier de la classe permettant de générer les bordereaux envoi au modèle Merou
\version $Revision$
*/
require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php"; require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php";
require_once DOL_DOCUMENT_ROOT."/contact.class.php"; require_once DOL_DOCUMENT_ROOT."/contact.class.php";
/**
\class pdf_expedition_dorade
\brief Classe permettant de générer les borderaux envoi au modèle Merou
*/
Class pdf_expedition_merou extends ModelePdfExpedition Class pdf_expedition_merou extends ModelePdfExpedition
{ {
var $emetteur; // Objet societe qui emet
/**
\brief Constructeur
\param db Handler accès base de donnée
*/
function pdf_expedition_merou($db=0) function pdf_expedition_merou($db=0)
{ {
global $conf,$langs,$mysoc;
$this->db = $db; $this->db = $db;
$this->name = "Merou"; $this->name = "Merou";
$this->description = "Modele Merou 2xA5 \n $this->description = "Modele Merou 2xA5 \n
@ -46,15 +66,20 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
$this->option_logo = 1; // Affiche logo $this->option_logo = 1; // Affiche logo
// Recupere emmetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
} }
//***************************** //*****************************
//Creation du Document //Creation du Document
//Initialisation des données //Initialisation des données
//***************************** //*****************************
function generate(&$objExpe, $file, $outputlangs='') function generate(&$objExpe, $file, $outputlangs='')
{ {
global $user,$conf,$langs,$mysoc; global $user,$conf,$langs;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
$outputlangs->load("main"); $outputlangs->load("main");
@ -65,51 +90,54 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$outputlangs->setPhpLang(); $outputlangs->setPhpLang();
//Initialisation des langues
$langs->load("main");
$langs->load("bills");
$langs->load("products");
//Generation de la fiche //Generation de la fiche
$this->expe = $objExpe; $this->expe = $objExpe;
$this->expe->fetch_commande(); $this->expe->fetch_commande();
//Creation du Client
$soc = new Societe($this->db);
$soc->fetch($this->expe->commande->socidp);
//Creation de l expediteur
$this->expediteur = $soc;
//Creation du destinataire
$this->destinataire = new Contact($this->db);
// $pdf->expe->commande->fetch($pdf->commande->id);
//print_r($pdf->expe);
$idcontact = $this->expe->commande->getIdContact('external','DESTINATAIRE');
$this->destinataire->fetch($idcontact[0]);
//Creation du livreur
$idcontact = $this->expe->commande->getIdContact('internal','LIVREUR');
$this->livreur = new User($this->db,$idcontact[0]);
if ($idcontact[0]) $this->livreur->fetch();
//Verification de la configuration //Verification de la configuration
if ($conf->expedition->dir_output) if ($conf->expedition->dir_output)
{ {
$expeditionref = sanitize_string($this->expe->ref); //Creation du Client
$dir = $conf->expedition->dir_output . "/" . $expeditionref; $soc = new Societe($this->db);
$file = $dir . "/" . $expeditionref . ".pdf"; $soc->fetch($this->expe->commande->socidp);
//Creation de l expediteur
$this->expediteur = $soc;
//Creation du destinataire
$this->destinataire = new Contact($this->db);
// $pdf->expe->commande->fetch($pdf->commande->id);
//print_r($pdf->expe);
$idcontact = $this->expe->commande->getIdContact('external','DESTINATAIRE');
$this->destinataire->fetch($idcontact[0]);
//Creation du livreur
$idcontact = $this->expe->commande->getIdContact('internal','LIVREUR');
$this->livreur = new User($this->db,$idcontact[0]);
if ($idcontact[0]) $this->livreur->fetch();
//Si le dossier n existe pas // Définition de $dir et $file
if (! file_exists($dir)) if ($this->expe->specimen)
{ {
umask(0); $dir = $conf->expedition->dir_output;
$file = $dir . "/SPECIMEN.pdf";
//On tente de le creer }
if (! mkdir($dir, 0755)) else
{ {
$pdf->error=$langs->trans("ErrorCanNotCreateDir",$dir); $expref = sanitize_string($this->expe->ref);
return 0; $dir = $conf->expedition->dir_output . "/" . $expref;
} $file = $dir . "/" . $expref . ".pdf";
} }
if (! file_exists($dir))
{
if (create_exdir($dir) < 0)
{
$this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir);
return 0;
}
}
//Si le dossier existe //Si le dossier existe
if (file_exists($dir)) if (file_exists($dir))
{ {
@ -179,16 +207,34 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetFont('Arial','', 7); $pdf->SetFont('Arial','', 7);
} }
} }
//Insertio ndu pied de page //Insertion du pied de page
$this->_pagefoot($pdf); $this->_pagefoot($pdf);
$pdf->AliasNbPages(); $pdf->AliasNbPages();
//Cloture du pdf //Cloture du pdf
$pdf->Close(); $pdf->Close();
//Ecriture du pdf //Ecriture du pdf
$pdf->Output($file); $pdf->Output($file);
return 1;
$langs->setPhpLang(); // On restaure langue session
return 1;
} }
else
{
$this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir);
$langs->setPhpLang(); // On restaure langue session
return 0;
}
} }
else
{
$this->error=$outputlangs->trans("ErrorConstantNotDefined","EXP_OUTPUTDIR");
$langs->setPhpLang(); // On restaure langue session
return 0;
}
$this->error=$outputlangs->trans("ErrorUnknown");
$langs->setPhpLang(); // On restaure langue session
return 0; // Erreur par defaut
} }
//******************************** //********************************
@ -239,7 +285,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
//******************************** //********************************
function _pagehead(&$pdf, $exp) function _pagehead(&$pdf, $exp)
{ {
global $conf, $langs, $mysoc; global $conf, $langs;
$tab4_top = 60; $tab4_top = 60;
$tab4_hl = 6; $tab4_hl = 6;
@ -247,8 +293,8 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$ligne = 2; $ligne = 2;
//*********************LOGO**************************** //*********************LOGO****************************
$logo=$conf->societe->dir_logos.'/'.$mysoc->logo; $logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo;
if ($mysoc->logo) if ($this->emetteur->logo)
{ {
if (is_readable($logo)) if (is_readable($logo))
{ {

View File

@ -21,14 +21,34 @@
* $Source$ * $Source$
*/ */
/**
\file htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php
\ingroup expedition
\brief Fichier de la classe permettant de générer les bordereaux envoi au modèle Rouget
\version $Revision$
*/
require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php"; require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php";
/**
\class pdf_expedition_dorade
\brief Classe permettant de générer les borderaux envoi au modèle Rouget
*/
Class pdf_expedition_rouget extends ModelePdfExpedition Class pdf_expedition_rouget extends ModelePdfExpedition
{ {
var $emetteur; // Objet societe qui emet
/**
\brief Constructeur
\param db Handler accès base de donnée
*/
function pdf_expedition_rouget($db=0) function pdf_expedition_rouget($db=0)
{ {
global $conf,$langs,$mysoc;
$this->db = $db; $this->db = $db;
$this->name = "rouget"; $this->name = "rouget";
$this->description = "Modèle simple."; $this->description = "Modèle simple.";
@ -39,6 +59,10 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
$this->option_logo = 0; $this->option_logo = 0;
// Recupere emmetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
} }
function Header() function Header()
@ -68,7 +92,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
function generate(&$objExpe, $filename, $outputlangs='') function generate(&$objExpe, $filename, $outputlangs='')
{ {
global $user,$conf,$langs,$mysoc; global $user,$conf,$langs;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
$outputlangs->load("main"); $outputlangs->load("main");
@ -79,43 +103,87 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$outputlangs->setPhpLang(); $outputlangs->setPhpLang();
$this->expe = $objExpe; if ($conf->expedition->dir_output)
$this->pdf = new FPDF();
$this->pdf->expe = &$this->expe;
$this->pdf->Open();
$this->pdf->AliasNbPages();
$this->pdf->AddPage();
$this->pdf->SetTitle($objExpe->ref);
$this->pdf->SetSubject($langs->trans("Sending"));
$this->pdf->SetCreator("Dolibarr ".DOL_VERSION);
//$this->pdf->SetAuthor($user->fullname);
/*
*
*/
$this->pdf->SetTextColor(0,0,0);
$this->pdf->SetFont('Arial','', 14);
$this->expe->fetch_lignes();
for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++)
{ {
$a = $this->pdf->tableau_top + 14 + ($i * 7); $this->expe = $objExpe;
$this->pdf->Text(8, $a, $this->expe->lignes[$i]->description);
$this->pdf->Text(170, $a, $this->expe->lignes[$i]->qty_commande);
$this->pdf->Text(194, $a, $this->expe->lignes[$i]->qty_expedition);
}
$this->pdf->Output($filename);
return 1; // Définition de $dir et $file
if ($this->expe->specimen)
{
$dir = $conf->expedition->dir_output;
$file = $dir . "/SPECIMEN.pdf";
}
else
{
$expref = sanitize_string($this->expe->ref);
$dir = $conf->expedition->dir_output . "/" . $expref;
$file = $dir . "/" . $expref . ".pdf";
}
if (! file_exists($dir))
{
if (create_exdir($dir) < 0)
{
$this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir);
return 0;
}
}
if (file_exists($dir))
{
$this->pdf = new FPDF();
$this->pdf->expe = &$this->expe;
$this->pdf->Open();
$this->pdf->AliasNbPages();
$this->pdf->AddPage();
$this->pdf->SetTitle($objExpe->ref);
$this->pdf->SetSubject($langs->trans("Sending"));
$this->pdf->SetCreator("Dolibarr ".DOL_VERSION);
//$this->pdf->SetAuthor($user->fullname);
/*
*
*/
$this->pdf->SetTextColor(0,0,0);
$this->pdf->SetFont('Arial','', 14);
$this->expe->fetch_lignes();
for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++)
{
$a = $this->pdf->tableau_top + 14 + ($i * 7);
$this->pdf->Text(8, $a, $this->expe->lignes[$i]->description);
$this->pdf->Text(170, $a, $this->expe->lignes[$i]->qty_commande);
$this->pdf->Text(194, $a, $this->expe->lignes[$i]->qty_expedition);
}
$this->pdf->Output($filename);
$langs->setPhpLang(); // On restaure langue session
return 1;
}
else
{
$this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir);
$langs->setPhpLang(); // On restaure langue session
return 0;
}
}
else
{
$this->error=$outputlangs->trans("ErrorConstantNotDefined","EXP_OUTPUTDIR");
$langs->setPhpLang(); // On restaure langue session
return 0;
}
$this->error=$outputlangs->trans("ErrorUnknown");
$langs->setPhpLang(); // On restaure langue session
return 0; // Erreur par defaut
} }
} }

View File

@ -117,7 +117,7 @@ if ($step == 1 || $action == 'cleanselect')
if ($action == 'builddoc') if ($action == 'builddoc')
{ {
// Genère le fichier // Genère le fichier
$result=$objexport->build_file($user, $_POST["model"], $datatoexport, $array_selected); $result=$objexport->build_file($user, $_POST['model'], $datatoexport, $array_selected);
if ($result < 0) if ($result < 0)
{ {
$mesg='<div class="error">'.$objexport->error.'</div>'; $mesg='<div class="error">'.$objexport->error.'</div>';

View File

@ -126,7 +126,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
llxHeader(); llxHeader();
$sel = new Form($db); $html = new Form($db);
/* /*
* *
@ -176,7 +176,7 @@ if ($_GET["action"] == 'create')
print "<tr><td>".$langs->trans("Company")."</td><td>".$societe->getNomUrl(1)."</td></tr>"; print "<tr><td>".$langs->trans("Company")."</td><td>".$societe->getNomUrl(1)."</td></tr>";
print "<tr><td>".$langs->trans("Date")."</td><td>"; print "<tr><td>".$langs->trans("Date")."</td><td>";
$sel->select_date(time(),"p",'','','','fichinter'); $html->select_date(time(),"p",'','','','fichinter');
print "</td></tr>"; print "</td></tr>";
print "<input type=\"hidden\" name=\"action\" value=\"add\">"; print "<input type=\"hidden\" name=\"action\" value=\"add\">";
@ -265,7 +265,7 @@ if ($_GET["action"] == 'edit')
// Date // Date
print "<tr><td>".$langs->trans("Date")."</td><td>"; print "<tr><td>".$langs->trans("Date")."</td><td>";
$sel->select_date($fichinter->date,'','','','','update'); $html->select_date($fichinter->date,'','','','','update');
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'.$langs->trans("Duration")." (".$langs->trans("days").')</td><td><input name="duree" value="'.$fichinter->duree.'"></td></tr>'; print '<tr><td>'.$langs->trans("Duration")." (".$langs->trans("days").')</td><td><input name="duree" value="'.$fichinter->duree.'"></td></tr>';
@ -274,7 +274,7 @@ if ($_GET["action"] == 'edit')
{ {
// Projet associé // Projet associé
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>';
$sel->select_projects($fichinter->societe_id,$fichinter->projet_id,"projetidp"); $html->select_projects($fichinter->societe_id,$fichinter->projet_id,"projetidp");
print '</td></tr>'; print '</td></tr>';
} }
@ -397,7 +397,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
$var=true; $var=true;
print "<br>\n"; print "<br>\n";
$sel->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$ficheinter->modelpdf); $somethingshown=$html->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$ficheinter->modelpdf);
print "</td><td>"; print "</td><td>";

View File

@ -615,8 +615,7 @@ if ($_GET["id"] > 0)
print '<br>'; print '<br>';
} }
*/ */
//$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); $somethingshown=$html->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$commande->statut>0?1:0,$delallowed,$commande->modelpdf);
$html->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$commande->statut>0?1:0,$delallowed,$commande->modelpdf);
print '</td><td width="50%" valign="top">'; print '</td><td width="50%" valign="top">';

View File

@ -2468,7 +2468,7 @@ class Form
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans('Model').'</td>'; print '<td>'.$langs->trans('Model').'</td>';
print '<td align="center">'; print '<td align="center">';
$this->select_array('modelpdf',$modellist,$modelselected,0,0,1); $this->select_array('model',$modellist,$modelselected,0,0,1);
$texte=$langs->trans('Generate'); $texte=$langs->trans('Generate');
print '</td>'; print '</td>';
print '<td align="center">'; print '<td align="center">';

View File

@ -13,8 +13,11 @@ DonationsReceived=Donations received
PublicDonation=Public donation PublicDonation=Public donation
DonationsNumber=Donation number DonationsNumber=Donation number
DonationsArea=Donations area DonationsArea=Donations area
DonationStatusPromessNotValidated=Draft promess DonationStatusPromiseNotValidated=Draft promise
DonationStatusPromessValidated=Validated promess DonationStatusPromiseValidated=Validated promise
DonationStatusPayed=Donation received DonationStatusPayed=Donation received
ValidPromess=Validate promess DonationStatusPromiseNotValidatedShort=Draft
DonationStatusPromiseValidatedShort=Validated
DonationStatusPayedShort=Received
ValidPromise=Validate promise
BuildDonationReceipt=Build receipt BuildDonationReceipt=Build receipt

View File

@ -13,8 +13,11 @@ DonationsReceived=Dons encaiss
PublicDonation=Don public PublicDonation=Don public
DonationsNumber=Nombre de dons DonationsNumber=Nombre de dons
DonationsArea=Espace Dons DonationsArea=Espace Dons
DonationStatusPromessNotValidated=Promesse non validée DonationStatusPromiseNotValidated=Promesse non validée
DonationStatusPromessValidated=Promesse validée DonationStatusPromiseValidated=Promesse validée
DonationStatusPayed=Don payé DonationStatusPayed=Don payé
DonationStatusPromiseNotValidatedShort=Non validée
DonationStatusPromiseValidatedShort=Validée
DonationStatusPayedShort=Payé
ValidPromess=Valider promesse ValidPromess=Valider promesse
BuildDonationReceipt=Créer reçu BuildDonationReceipt=Créer reçu

View File

@ -557,7 +557,7 @@ else
//$genallowed=1; //$genallowed=1;
//$delallowed=0; //$delallowed=0;
$result=$html->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf); $somethingshown=$html->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf);
/* /*
* Déjà livre * Déjà livre