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 gnr 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:
parent
c477dcad2c
commit
f191dfc7e6
@ -230,7 +230,7 @@ if ($_GET["action"] == 'create')
|
||||
print '<td colspan="2">';
|
||||
$model=new ModelePDFPropales();
|
||||
$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>";
|
||||
|
||||
// Projet
|
||||
|
||||
@ -184,7 +184,7 @@ if ($_POST['action'] == 'add')
|
||||
$propal->socidp = $_POST['socidp'];
|
||||
$propal->contactid = $_POST['contactidp'];
|
||||
$propal->projetidp = $_POST['projetidp'];
|
||||
$propal->modelpdf = $_POST['modelpdf'];
|
||||
$propal->modelpdf = $_POST['model'];
|
||||
$propal->author = $user->id;
|
||||
$propal->note = $_POST['note'];
|
||||
$propal->ref = $_POST['ref'];
|
||||
@ -208,7 +208,7 @@ if ($_POST['action'] == 'add')
|
||||
|
||||
$propal->contactid = $_POST['contactidp'];
|
||||
$propal->projetidp = $_POST['projetidp'];
|
||||
$propal->modelpdf = $_POST['modelpdf'];
|
||||
$propal->modelpdf = $_POST['model'];
|
||||
$propal->author = $user->id;
|
||||
$propal->note = $_POST['note'];
|
||||
$propal->ref_client = $_POST['ref_client'];
|
||||
@ -258,7 +258,7 @@ if ($_POST['action'] == 'add')
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$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);
|
||||
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$id);
|
||||
exit;
|
||||
@ -540,9 +540,9 @@ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$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'])
|
||||
@ -1498,7 +1498,7 @@ if ($_GET['propalid'] > 0)
|
||||
|
||||
$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);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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_percent = $_POST['remise_percent'];
|
||||
$commande->ref_client = $_POST['ref_client'];
|
||||
$commande->modelpdf = $_POST['modelpdf'];
|
||||
$commande->modelpdf = $_POST['model'];
|
||||
$commande->cond_reglement_id = $_POST['cond_reglement_id'];
|
||||
$commande->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$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
|
||||
$commande = new Commande($db, 0, $_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'])
|
||||
@ -774,13 +774,13 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
||||
print '<tr><td>'.$langs->trans('Source').'</td><td>';
|
||||
$html->selectSourcesCommande('','source_id',1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Model").'</td>';
|
||||
print '<tr><td>'.$langs->trans('Model').'</td>';
|
||||
print '<td>';
|
||||
// pdf
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/commande/modules_commande.php');
|
||||
$model=new ModelePDFCommandes();
|
||||
$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>";
|
||||
|
||||
if ($propalid > 0)
|
||||
@ -1646,7 +1646,7 @@ else
|
||||
$genallowed=$user->rights->commande->creer;
|
||||
$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
|
||||
@ -1809,7 +1809,7 @@ else
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$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)
|
||||
{
|
||||
dolibarr_print_error($db,$result);
|
||||
|
||||
@ -553,7 +553,7 @@ if ($_GET["id"] > 0)
|
||||
$genallowed=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
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -31,6 +30,7 @@
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/don.class.php");
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("donations");
|
||||
|
||||
$sortorder=$_GET["sortorder"];
|
||||
|
||||
@ -195,7 +195,7 @@ if ($_POST['action'] == 'add')
|
||||
$facture->note_public = $_POST['note_public'];
|
||||
$facture->note = $_POST['note'];
|
||||
$facture->ref_client = $_POST['ref_client'];
|
||||
$facture->modelpdf = $_POST['modelpdf'];
|
||||
$facture->modelpdf = $_POST['model'];
|
||||
|
||||
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->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'])
|
||||
@ -914,13 +914,13 @@ if ($_GET['action'] == 'create')
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("Model").'</td>';
|
||||
print '<td>';
|
||||
print '<tr><td>'.$langs->trans('Model').'</td>';
|
||||
print '<td>';
|
||||
// pdf
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php');
|
||||
$model=new ModelePDFFactures();
|
||||
$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>";
|
||||
|
||||
// Note publique
|
||||
@ -2334,7 +2334,7 @@ else
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$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)
|
||||
{
|
||||
dolibarr_print_error($db,$result);
|
||||
@ -2389,7 +2389,7 @@ else
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$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)
|
||||
{
|
||||
dolibarr_print_error($db,$result);
|
||||
|
||||
@ -70,9 +70,12 @@ class Don
|
||||
$this->modepaiementid = 0;
|
||||
|
||||
$langs->load("donations");
|
||||
$this->labelstatut[0]=$langs->trans("DonationStatusPromessNotValidated");
|
||||
$this->labelstatut[1]=$langs->trans("DonationStatusPromessValidated");
|
||||
$this->labelstatut[0]=$langs->trans("DonationStatusPromiseNotValidated");
|
||||
$this->labelstatut[1]=$langs->trans("DonationStatusPromiseValidated");
|
||||
$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)
|
||||
{
|
||||
$prefix='';
|
||||
return $this->labelstatut[$statut];
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
$prefix='Short';
|
||||
return $this->labelstatut[$statut];
|
||||
return $this->labelstatutshort[$statut];
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
$prefix='Short';
|
||||
if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatut[$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->labelstatut[$statut];
|
||||
if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatutshort[$statut];
|
||||
if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatutshort[$statut];
|
||||
if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatutshort[$statut];
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
@ -129,9 +129,9 @@ class Don
|
||||
if ($mode == 5)
|
||||
{
|
||||
$prefix='Short';
|
||||
if ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0');
|
||||
if ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1');
|
||||
if ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6');
|
||||
if ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0');
|
||||
if ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1');
|
||||
if ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -583,7 +583,7 @@ else
|
||||
//$genallowed=1;
|
||||
//$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
|
||||
|
||||
@ -22,14 +22,34 @@
|
||||
* $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";
|
||||
|
||||
|
||||
/**
|
||||
\class pdf_expedition_dorade
|
||||
\brief Classe permettant de générer les borderaux envoi au modèle Dorade
|
||||
*/
|
||||
|
||||
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)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "dorade";
|
||||
$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->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='')
|
||||
{
|
||||
global $user,$conf,$langs,$mysoc;
|
||||
global $user,$conf,$langs;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$outputlangs->load("main");
|
||||
@ -98,70 +122,92 @@ Class pdf_expedition_dorade extends ModelePdfExpedition
|
||||
|
||||
$outputlangs->setPhpLang();
|
||||
|
||||
$this->expe = $objExpe;
|
||||
|
||||
$this->expe->fetch_commande();
|
||||
|
||||
// Définition de $dir et $file
|
||||
if ($this->expe->specimen)
|
||||
if ($conf->expedition->dir_output)
|
||||
{
|
||||
$dir = $conf->propal->dir_output;
|
||||
$file = $dir . "/SPECIMEN.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
$expref = sanitize_string($this->expe->ref);
|
||||
$dir = $conf->expedition->dir_output . "/" . $expref;
|
||||
$file = $dir . "/" . $expref . ".pdf";
|
||||
}
|
||||
$this->expe = $objExpe;
|
||||
$this->expe->fetch_commande();
|
||||
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
if (create_exdir($dir) < 0)
|
||||
// Définition de $dir et $file
|
||||
if ($this->expe->specimen)
|
||||
{
|
||||
$this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir);
|
||||
return 0;
|
||||
$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";
|
||||
}
|
||||
}
|
||||
|
||||
$filename=$file;
|
||||
|
||||
$this->pdf = new ModelePdfExpedition();
|
||||
$this->pdf->expe = &$this->expe;
|
||||
|
||||
$this->pdf->Open();
|
||||
$this->pdf->AliasNbPages();
|
||||
$this->pdf->AddPage();
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
if (create_exdir($dir) < 0)
|
||||
{
|
||||
$this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
$this->pdf->SetTitle($objExpe->ref);
|
||||
$this->pdf->SetSubject("Bordereau d'expedition");
|
||||
$this->pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
||||
//$this->pdf->SetAuthor($user->fullname);
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
$this->pdf->SetTextColor(0,0,0);
|
||||
$this->pdf->SetFont('Arial','', 16);
|
||||
|
||||
$this->expe->fetch_lignes();
|
||||
|
||||
for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++)
|
||||
{
|
||||
$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);
|
||||
if (file_exists($dir))
|
||||
{
|
||||
$filename=$file;
|
||||
|
||||
$this->pdf = new ModelePdfExpedition();
|
||||
$this->pdf->expe = &$this->expe;
|
||||
|
||||
$this->pdf->Open();
|
||||
$this->pdf->AliasNbPages();
|
||||
$this->pdf->AddPage();
|
||||
|
||||
$this->pdf->SetTitle($objExpe->ref);
|
||||
$this->pdf->SetSubject("Bordereau d'expedition");
|
||||
$this->pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
||||
//$this->pdf->SetAuthor($user->fullname);
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
$this->pdf->SetTextColor(0,0,0);
|
||||
$this->pdf->SetFont('Arial','', 16);
|
||||
|
||||
$this->expe->fetch_lignes();
|
||||
|
||||
for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* 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
|
||||
@ -22,14 +22,34 @@
|
||||
* $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."/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
|
||||
{
|
||||
var $emetteur; // Objet societe qui emet
|
||||
|
||||
|
||||
/**
|
||||
\brief Constructeur
|
||||
\param db Handler accès base de donnée
|
||||
*/
|
||||
function pdf_expedition_merou($db=0)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "Merou";
|
||||
$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->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
|
||||
//Initialisation des données
|
||||
//*****************************
|
||||
function generate(&$objExpe, $file, $outputlangs='')
|
||||
{
|
||||
global $user,$conf,$langs,$mysoc;
|
||||
global $user,$conf,$langs;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$outputlangs->load("main");
|
||||
@ -65,51 +90,54 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
|
||||
$outputlangs->setPhpLang();
|
||||
|
||||
//Initialisation des langues
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("products");
|
||||
//Generation de la fiche
|
||||
$this->expe = $objExpe;
|
||||
$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
|
||||
if ($conf->expedition->dir_output)
|
||||
{
|
||||
$expeditionref = sanitize_string($this->expe->ref);
|
||||
$dir = $conf->expedition->dir_output . "/" . $expeditionref;
|
||||
$file = $dir . "/" . $expeditionref . ".pdf";
|
||||
//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();
|
||||
|
||||
|
||||
//Si le dossier n existe pas
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
umask(0);
|
||||
|
||||
//On tente de le creer
|
||||
if (! mkdir($dir, 0755))
|
||||
{
|
||||
$pdf->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
//Si le dossier existe
|
||||
if (file_exists($dir))
|
||||
{
|
||||
@ -179,16 +207,34 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
$pdf->SetFont('Arial','', 7);
|
||||
}
|
||||
}
|
||||
//Insertio ndu pied de page
|
||||
$this->_pagefoot($pdf);
|
||||
$pdf->AliasNbPages();
|
||||
//Cloture du pdf
|
||||
$pdf->Close();
|
||||
//Ecriture du pdf
|
||||
$pdf->Output($file);
|
||||
return 1;
|
||||
//Insertion du pied de page
|
||||
$this->_pagefoot($pdf);
|
||||
$pdf->AliasNbPages();
|
||||
//Cloture du pdf
|
||||
$pdf->Close();
|
||||
//Ecriture du pdf
|
||||
$pdf->Output($file);
|
||||
|
||||
$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)
|
||||
{
|
||||
global $conf, $langs, $mysoc;
|
||||
global $conf, $langs;
|
||||
|
||||
$tab4_top = 60;
|
||||
$tab4_hl = 6;
|
||||
@ -247,8 +293,8 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
$ligne = 2;
|
||||
|
||||
//*********************LOGO****************************
|
||||
$logo=$conf->societe->dir_logos.'/'.$mysoc->logo;
|
||||
if ($mysoc->logo)
|
||||
$logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
{
|
||||
|
||||
@ -21,14 +21,34 @@
|
||||
* $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";
|
||||
|
||||
|
||||
/**
|
||||
\class pdf_expedition_dorade
|
||||
\brief Classe permettant de générer les borderaux envoi au modèle Rouget
|
||||
*/
|
||||
|
||||
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)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "rouget";
|
||||
$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->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()
|
||||
@ -68,7 +92,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
||||
|
||||
function generate(&$objExpe, $filename, $outputlangs='')
|
||||
{
|
||||
global $user,$conf,$langs,$mysoc;
|
||||
global $user,$conf,$langs;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$outputlangs->load("main");
|
||||
@ -79,43 +103,87 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
||||
|
||||
$outputlangs->setPhpLang();
|
||||
|
||||
$this->expe = $objExpe;
|
||||
|
||||
$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++)
|
||||
if ($conf->expedition->dir_output)
|
||||
{
|
||||
$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);
|
||||
$this->expe = $objExpe;
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ if ($step == 1 || $action == 'cleanselect')
|
||||
if ($action == 'builddoc')
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
$mesg='<div class="error">'.$objexport->error.'</div>';
|
||||
|
||||
@ -126,7 +126,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
||||
|
||||
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("Date")."</td><td>";
|
||||
$sel->select_date(time(),"p",'','','','fichinter');
|
||||
$html->select_date(time(),"p",'','','','fichinter');
|
||||
print "</td></tr>";
|
||||
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
|
||||
@ -265,7 +265,7 @@ if ($_GET["action"] == 'edit')
|
||||
|
||||
// Date
|
||||
print "<tr><td>".$langs->trans("Date")."</td><td>";
|
||||
$sel->select_date($fichinter->date,'','','','','update');
|
||||
$html->select_date($fichinter->date,'','','','','update');
|
||||
print "</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é
|
||||
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>';
|
||||
}
|
||||
|
||||
@ -397,7 +397,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
|
||||
$var=true;
|
||||
|
||||
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>";
|
||||
|
||||
@ -615,8 +615,7 @@ if ($_GET["id"] > 0)
|
||||
print '<br>';
|
||||
}
|
||||
*/
|
||||
//$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);
|
||||
$html->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$commande->statut>0?1:0,$delallowed,$commande->modelpdf);
|
||||
$somethingshown=$html->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$commande->statut>0?1:0,$delallowed,$commande->modelpdf);
|
||||
|
||||
|
||||
print '</td><td width="50%" valign="top">';
|
||||
|
||||
@ -2468,7 +2468,7 @@ class Form
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans('Model').'</td>';
|
||||
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');
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
|
||||
@ -13,8 +13,11 @@ DonationsReceived=Donations received
|
||||
PublicDonation=Public donation
|
||||
DonationsNumber=Donation number
|
||||
DonationsArea=Donations area
|
||||
DonationStatusPromessNotValidated=Draft promess
|
||||
DonationStatusPromessValidated=Validated promess
|
||||
DonationStatusPromiseNotValidated=Draft promise
|
||||
DonationStatusPromiseValidated=Validated promise
|
||||
DonationStatusPayed=Donation received
|
||||
ValidPromess=Validate promess
|
||||
DonationStatusPromiseNotValidatedShort=Draft
|
||||
DonationStatusPromiseValidatedShort=Validated
|
||||
DonationStatusPayedShort=Received
|
||||
ValidPromise=Validate promise
|
||||
BuildDonationReceipt=Build receipt
|
||||
|
||||
@ -13,8 +13,11 @@ DonationsReceived=Dons encaiss
|
||||
PublicDonation=Don public
|
||||
DonationsNumber=Nombre de dons
|
||||
DonationsArea=Espace Dons
|
||||
DonationStatusPromessNotValidated=Promesse non validée
|
||||
DonationStatusPromessValidated=Promesse validée
|
||||
DonationStatusPromiseNotValidated=Promesse non validée
|
||||
DonationStatusPromiseValidated=Promesse validée
|
||||
DonationStatusPayed=Don payé
|
||||
DonationStatusPromiseNotValidatedShort=Non validée
|
||||
DonationStatusPromiseValidatedShort=Validée
|
||||
DonationStatusPayedShort=Payé
|
||||
ValidPromess=Valider promesse
|
||||
BuildDonationReceipt=Créer reçu
|
||||
@ -557,7 +557,7 @@ else
|
||||
//$genallowed=1;
|
||||
//$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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user