Application du patch de Nicolas

This commit is contained in:
Regis Houssin 2007-09-23 10:08:41 +00:00
parent 049438e6f2
commit ef839035bd
3 changed files with 44 additions and 43 deletions

View File

@ -347,15 +347,15 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$commande = new CommandeFournisseur($db, 0, $_REQUEST['id']); $commande = new CommandeFournisseur($db, 0, $_REQUEST['id']);
$commande->fetch($_REQUEST['id']); $commande->fetch($_REQUEST['id']);
if ($_REQUEST['model']) if ($_REQUEST['model'])
{ {
$commande->set_pdf_model($user, $_REQUEST['model']); $commande->set_pdf_model($user, $_REQUEST['model']);
} }
if ($_REQUEST['lang_id']) if ($_REQUEST['lang_id'])
{ {
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
$result=supplier_order_pdf_create($db, $commande->id,$commande->modelpdf,$outputlangs); $result=supplier_order_pdf_create($db, $commande->id,$commande->modelpdf,$outputlangs);
if ($result <= 0) if ($result <= 0)
{ {

View File

@ -51,7 +51,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
{ {
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$this->db = $db; $this->db = $db;
@ -702,7 +702,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY($this->marge_gauche,$posy-5); $pdf->SetXY($this->marge_gauche,$posy-5);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillTo").":"); $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":");
$pdf->SetXY($this->marge_gauche,$posy); $pdf->SetXY($this->marge_gauche,$posy);
@ -747,8 +747,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$posy=42; $posy=42;
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY(102,$posy-5); $pdf->SetXY(100,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("BillFrom").":"); $pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":");
// //
$client = new Societe($this->db); $client = new Societe($this->db);
$client->fetch($com->socid); $client->fetch($com->socid);
@ -782,40 +782,42 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
{ {
global $conf; global $conf;
$outputlangs->load("dict");
$html=new Form($this->db); $html=new Form($this->db);
// Premiere ligne d'info réglementaires // Premiere ligne d'info réglementaires
$ligne1=""; $ligne1="";
if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE) if ($this->emetteur->forme_juridique_code)
{ {
$ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); $ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($this->emetteur->forme_juridique_code);
} }
if ($conf->global->MAIN_INFO_CAPITAL) if ($this->emetteur->capital)
{ {
$ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$conf->global->MAIN_INFO_CAPITAL)." ".$outputlangs->transnoentities("Currency".$conf->monnaie); $ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$this->emetteur->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
} }
if ($conf->global->MAIN_INFO_SIRET) if ($this->emetteur->profid2)
{ {
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId2",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIRET; $ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId2",$this->emetteur->pays_code).": ".$this->emetteur->profid2;
} }
if ($conf->global->MAIN_INFO_SIREN && (! $conf->global->MAIN_INFO_SIRET || $this->emetteur->code_pays != 'FR')) if ($this->emetteur->profid1 && (! $this->emetteur->profid2 || $this->emetteur->pays_code != 'FR'))
{ {
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId1",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIREN; $ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId1",$this->emetteur->pays_code).": ".$this->emetteur->profid1;
}
if ($conf->global->MAIN_INFO_APE)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId3",$this->emetteur->code_pays).": ".MAIN_INFO_APE;
} }
// Deuxieme ligne d'info réglementaires // Deuxieme ligne d'info réglementaires
$ligne2=""; $ligne2="";
if ($conf->global->MAIN_INFO_RCS) if ($this->emetteur->profid3)
{ {
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountry("ProfId4",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_RCS; $ligne2.=($ligne2?" - ":"").$outputlangs->transcountry("ProfId3",$this->emetteur->pays_code).": ".$this->emetteur->profid3;
} }
if ($conf->global->MAIN_INFO_TVAINTRA != '') if ($this->emetteur->profid4)
{ {
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$conf->global->MAIN_INFO_TVAINTRA; $ligne2.=($ligne2?" - ":"").$outputlangs->transcountry("ProfId4",$this->emetteur->pays_code).": ".$this->emetteur->profid4;
}
if ($this->emetteur->tva_intra != '')
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$this->emetteur->tva_intra;
} }
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);

View File

@ -963,22 +963,21 @@ class CommandeFournisseur extends Commande
function set_pdf_model($user, $modelpdf) function set_pdf_model($user, $modelpdf)
{ {
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET model_pdf = '".$modelpdf."'";
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET model_pdf = '$modelpdf'"; $sql .= " WHERE rowid = ".$this->id." AND fk_statut = 0 ;";
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
if ($this->db->query($sql) )
if ($this->db->query($sql) ) {
{ $this->modelpdf=$modelpdf;
$this->modelpdf=$modelpdf; return 1;
return 1; }
} else
else {
{ dolibarr_print_error($this->db);
dolibarr_print_error($this->db); return 0;
return 0; }
} }
}
} }
/** /**
* *