try to fix : cannot display numbering models

This commit is contained in:
Grand Philippe 2013-03-16 16:58:45 +01:00
parent 2da3fb68a0
commit 86dff79b73
3 changed files with 20 additions and 12 deletions

View File

@ -20,11 +20,11 @@
/** /**
* \file htdocs/core/modules/supplier_order/mod_facture_fournisseur_cactus.php * \file htdocs/core/modules/supplier_order/mod_facture_fournisseur_cactus.php
* \ingroup commande * \ingroup supplier invoice
* \brief File containing the Cactus Class of numbering models of suppliers invoices references * \brief File containing the Cactus Class of numbering models of suppliers invoices references
*/ */
require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_order/modules_facturefournisseur.php'; require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_invoice/modules_facturefournisseur.php';
/** /**
@ -123,7 +123,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
//$date=time(); //$date=time();
$date=$object->datec; // Not always defined $date=$object->datec; // Not always defined
if (empty($date)) $date=$object->date; // Creation date is order date for suppliers orders if (empty($date)) $date=$object->date; // Creation date is invoice date for suppliers invoices
$yymm = strftime("%y%m",$date); $yymm = strftime("%y%m",$date);
$num = sprintf("%04s",$max+1); $num = sprintf("%04s",$max+1);

View File

@ -123,7 +123,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
return 0; return 0;
} }
$numFinal=get_next_value($db,$mask,'facture_fournisseur','ref','',$objsoc->code_fournisseur,$object->date_commande); $numFinal=get_next_value($db,$mask,'facture_fournisseur','ref','',$objsoc->code_fournisseur,$object->datec);
return $numFinal; return $numFinal;
} }

View File

@ -22,6 +22,7 @@
* \file htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php * \file htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php
* \ingroup facture fournisseur * \ingroup facture fournisseur
* \brief File that contains parent class for supplier invoices models * \brief File that contains parent class for supplier invoices models
* and parent class for supplier invoices numbering models
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requis car utilise par les classes qui heritent require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requis car utilise par les classes qui heritent
@ -36,7 +37,7 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
/** /**
* Return list of active generation modules * Return list of active generation models
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $maxfilenamelength Max length of value to show * @param string $maxfilenamelength Max length of value to show
@ -131,7 +132,7 @@ abstract class ModeleNumRefSuppliersInvoices
} }
/** /**
* Create a document onto disk according to template module. * Create a document onto disk according to template model.
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param Object $object Object supplier invoice * @param Object $object Object supplier invoice
@ -158,7 +159,7 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided
$srctemplatepath=''; $srctemplatepath='';
// Positionne le modele sur le nom du modele a utiliser // Set the model on the model name to use
if (! dol_strlen($modele)) if (! dol_strlen($modele))
{ {
if (! empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)) if (! empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF))
@ -189,7 +190,7 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided
{ {
$file = $prefix."_".$modele.".modules.php"; $file = $prefix."_".$modele.".modules.php";
// On verifie l'emplacement du modele // We checked the location of the model
$file=dol_buildpath($reldir."core/modules/supplier_invoice/pdf/".$file,0); $file=dol_buildpath($reldir."core/modules/supplier_invoice/pdf/".$file,0);
if (file_exists($file)) if (file_exists($file))
{ {
@ -201,7 +202,7 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided
if ($filefound) break; if ($filefound) break;
} }
// Charge le modele // Load the model
if ($filefound) if ($filefound)
{ {
require_once $file; require_once $file;
@ -219,12 +220,12 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_delete_preview($object); dol_delete_preview($object);
// Appel des triggers // Calls triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('BILL_INVOICE_BUILDDOC',$object,$user,$langs,$conf); $result=$interface->run_triggers('BILL_INVOICE_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // End calls triggers
return 1; return 1;
} }
@ -238,7 +239,14 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided
} }
else else
{ {
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); if (! $conf->global->INVOICE_SUPPLIER_ADDON_PDF)
{
print $langs->trans("Error")." ".$langs->trans("Error_INVOICE_SUPPLIER_ADDON_PDF_NotDefined");
}
else
{
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
}
return 0; return 0;
} }
} }