diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php index 5ac8b47df2b..733e5af3a07 100644 --- a/htdocs/admin/fournisseur.php +++ b/htdocs/admin/fournisseur.php @@ -42,6 +42,9 @@ $langs->load("orders"); if (!$user->admin) accessforbidden(); +$specimenthirdparty=new Societe($db); +$specimenthirdparty->initAsSpecimen(); + /* * Actions @@ -54,12 +57,13 @@ if ($_POST["action"] == 'updateMask') if ($maskconstorder) dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity); } -if ($_GET["action"] == 'specimen') +if ($_GET["action"] == 'specimen') // For orders { $modele=$_GET["module"]; $commande = new CommandeFournisseur($db); $commande->initAsSpecimen(); + $commande->thirdparty=$specimenthirdparty; // Charge le modele $dir = DOL_DOCUMENT_ROOT . "/includes/modules/supplier_order/pdf/"; @@ -69,7 +73,7 @@ if ($_GET["action"] == 'specimen') $classname = "pdf_".$modele; require_once($dir.$file); - $obj = new $classname($db); + $obj = new $classname($db,$commande); if ($obj->write_file($commande,$langs) > 0) { @@ -89,12 +93,13 @@ if ($_GET["action"] == 'specimen') } } -if ($_GET["action"] == 'specimenfacture') +if ($_GET["action"] == 'specimenfacture') // For invoices { $modele=$_GET["module"]; $facture = new FactureFournisseur($db); $facture->initAsSpecimen(); + $facture->thirdparty=$specimenthirdparty; // Charge le modele $dir = DOL_DOCUMENT_ROOT . "/includes/modules/supplier_invoice/pdf/"; @@ -104,7 +109,7 @@ if ($_GET["action"] == 'specimenfacture') $classname = "pdf_".$modele; require_once($dir.$file); - $obj = new $classname($db); + $obj = new $classname($db,$facture); if ($obj->write_file($facture,$langs) > 0) { @@ -301,6 +306,8 @@ if ($handle) print '
'; + + /* * Modeles documents for supplier orders */ @@ -360,7 +367,7 @@ while (($file = readdir($handle))!==false) print "\n $name"; print "\n \n"; require_once($dir.$file); - $module = new $classname($db); + $module = new $classname($db,$specimenthirdparty); print $module->description; print "\n"; @@ -480,7 +487,7 @@ while (($file = readdir($handle)) !== false) print "\n $name"; print "\n \n"; require_once($dir.$file); - $module = new $classname($db); + $module = new $classname($db,$specimenthirdparty); print $module->description; print "\n"; diff --git a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 9fc936e7c5e..87be68bc5ab 100755 --- a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -73,7 +73,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->franchise=!$mysoc->tva_assuj; // Get source company - $object->fetch_thirdparty(); + if (! is_object($object->thirdparty)) $object->fetch_thirdparty(); $this->emetteur=$object->thirdparty; if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default, if was not defined diff --git a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php index a812f3ab153..0bb6552d89d 100644 --- a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -334,6 +334,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders /* * Mode de reglement */ + /* Not for supplier orders if ((! defined("FACTURE_CHQ_NUMBER") || ! FACTURE_CHQ_NUMBER) && (! defined("FACTURE_RIB_NUMBER") || ! FACTURE_RIB_NUMBER)) { $pdf->SetXY ($this->marge_gauche, 228); @@ -343,6 +344,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorCreateBankAccount"),0,'L',0); $pdf->SetTextColor(0,0,0); } + */ /* * Pied de page diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 54f62d466f6..b4fabb589df 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1311,7 +1311,7 @@ class Societe extends CommonObject { $lien = ''; $lienfin=''; @@ -2139,7 +2139,7 @@ class Societe extends CommonObject // Initialize parameters $this->id=0; - $this->nom = 'SPECIMEN'.'-'.dol_print_date($now,'dayhourlog'); + $this->nom = 'THIRDPARTY SPECIMEN '.dol_print_date($now,'dayhourlog'); $this->specimen=1; $this->cp='99999'; $this->ville='MyTown'; @@ -2154,6 +2154,8 @@ class Societe extends CommonObject $this->client=1; $this->prospect=1; $this->fournisseur=1; + $this->tva_assuj=1; + $this->tva_intra='EU1234567'; $this->note_public='This is a comment (public)'; $this->note='This is a comment (private)'; }