Fix: Task 8618

This commit is contained in:
Laurent Destailleur 2010-11-11 01:26:41 +00:00
parent d018d4be8b
commit 3d1d607158
4 changed files with 20 additions and 9 deletions

View File

@ -42,6 +42,9 @@ $langs->load("orders");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$specimenthirdparty=new Societe($db);
$specimenthirdparty->initAsSpecimen();
/* /*
* Actions * Actions
@ -54,12 +57,13 @@ if ($_POST["action"] == 'updateMask')
if ($maskconstorder) dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity); 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"]; $modele=$_GET["module"];
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->initAsSpecimen(); $commande->initAsSpecimen();
$commande->thirdparty=$specimenthirdparty;
// Charge le modele // Charge le modele
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/supplier_order/pdf/"; $dir = DOL_DOCUMENT_ROOT . "/includes/modules/supplier_order/pdf/";
@ -69,7 +73,7 @@ if ($_GET["action"] == 'specimen')
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db,$commande);
if ($obj->write_file($commande,$langs) > 0) 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"]; $modele=$_GET["module"];
$facture = new FactureFournisseur($db); $facture = new FactureFournisseur($db);
$facture->initAsSpecimen(); $facture->initAsSpecimen();
$facture->thirdparty=$specimenthirdparty;
// Charge le modele // Charge le modele
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/supplier_invoice/pdf/"; $dir = DOL_DOCUMENT_ROOT . "/includes/modules/supplier_invoice/pdf/";
@ -104,7 +109,7 @@ if ($_GET["action"] == 'specimenfacture')
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db,$facture);
if ($obj->write_file($facture,$langs) > 0) if ($obj->write_file($facture,$langs) > 0)
{ {
@ -301,6 +306,8 @@ if ($handle)
print '</table><br>'; print '</table><br>';
/* /*
* Modeles documents for supplier orders * Modeles documents for supplier orders
*/ */
@ -360,7 +367,7 @@ while (($file = readdir($handle))!==false)
print "<tr ".$bc[$var].">\n <td>$name"; print "<tr ".$bc[$var].">\n <td>$name";
print "</td>\n <td>\n"; print "</td>\n <td>\n";
require_once($dir.$file); require_once($dir.$file);
$module = new $classname($db); $module = new $classname($db,$specimenthirdparty);
print $module->description; print $module->description;
print "</td>\n"; print "</td>\n";
@ -480,7 +487,7 @@ while (($file = readdir($handle)) !== false)
print "<tr ".$bc[$var].">\n <td>$name"; print "<tr ".$bc[$var].">\n <td>$name";
print "</td>\n <td>\n"; print "</td>\n <td>\n";
require_once($dir.$file); require_once($dir.$file);
$module = new $classname($db); $module = new $classname($db,$specimenthirdparty);
print $module->description; print $module->description;
print "</td>\n"; print "</td>\n";

View File

@ -73,7 +73,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->franchise=!$mysoc->tva_assuj; $this->franchise=!$mysoc->tva_assuj;
// Get source company // Get source company
$object->fetch_thirdparty(); if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
$this->emetteur=$object->thirdparty; $this->emetteur=$object->thirdparty;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default, if was not defined if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default, if was not defined

View File

@ -334,6 +334,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
/* /*
* Mode de reglement * Mode de reglement
*/ */
/* Not for supplier orders
if ((! defined("FACTURE_CHQ_NUMBER") || ! FACTURE_CHQ_NUMBER) && (! defined("FACTURE_RIB_NUMBER") || ! FACTURE_RIB_NUMBER)) if ((! defined("FACTURE_CHQ_NUMBER") || ! FACTURE_CHQ_NUMBER) && (! defined("FACTURE_RIB_NUMBER") || ! FACTURE_RIB_NUMBER))
{ {
$pdf->SetXY ($this->marge_gauche, 228); $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->MultiCell(90, 3, $outputlangs->transnoentities("ErrorCreateBankAccount"),0,'L',0);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
} }
*/
/* /*
* Pied de page * Pied de page

View File

@ -2139,7 +2139,7 @@ class Societe extends CommonObject
// Initialize parameters // Initialize parameters
$this->id=0; $this->id=0;
$this->nom = 'SPECIMEN'.'-'.dol_print_date($now,'dayhourlog'); $this->nom = 'THIRDPARTY SPECIMEN '.dol_print_date($now,'dayhourlog');
$this->specimen=1; $this->specimen=1;
$this->cp='99999'; $this->cp='99999';
$this->ville='MyTown'; $this->ville='MyTown';
@ -2154,6 +2154,8 @@ class Societe extends CommonObject
$this->client=1; $this->client=1;
$this->prospect=1; $this->prospect=1;
$this->fournisseur=1; $this->fournisseur=1;
$this->tva_assuj=1;
$this->tva_intra='EU1234567';
$this->note_public='This is a comment (public)'; $this->note_public='This is a comment (public)';
$this->note='This is a comment (private)'; $this->note='This is a comment (private)';
} }