Skip to content
Snippets Groups Projects
Commit 6afa1cb2 authored by Philippe Grand's avatar Philippe Grand
Browse files

normalize

parent ca96bd64
Branches
Tags
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
/** /**
* \file htdocs/core/modules/expedition/modules_expedition.php * \file htdocs/core/modules/expedition/modules_expedition.php
* \ingroup expedition * \ingroup expedition
* \brief File of class to manage expedition numbering * \brief File that contains parent class for sending receipts models
* and parent class for sending receipts numbering models
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
...@@ -60,15 +61,15 @@ abstract class ModelePdfExpedition extends CommonDocGenerator ...@@ -60,15 +61,15 @@ abstract class ModelePdfExpedition extends CommonDocGenerator
/** /**
* Classe mere des modeles de numerotation des references d expedition * Parent Class of numbering models of sending receipts references
*/ */
abstract class ModelNumRefExpedition abstract class ModelNumRefExpedition
{ {
var $error=''; var $error='';
/** Return if a module can be used or not /** Return if a model can be used or not
* *
* @return boolean true if module can be used * @return boolean true if model can be used
*/ */
function isEnabled() function isEnabled()
{ {
...@@ -88,7 +89,7 @@ abstract class ModelNumRefExpedition ...@@ -88,7 +89,7 @@ abstract class ModelNumRefExpedition
} }
/** /**
* Return numbering example * Returns numbering example
* *
* @return string Example * @return string Example
*/ */
...@@ -110,7 +111,7 @@ abstract class ModelNumRefExpedition ...@@ -110,7 +111,7 @@ abstract class ModelNumRefExpedition
} }
/** /**
* Return next value * Returns next value assigned
* *
* @param Societe $objsoc Third party object * @param Societe $objsoc Third party object
* @param Object $shipment Shipment object * @param Object $shipment Shipment object
...@@ -123,7 +124,7 @@ abstract class ModelNumRefExpedition ...@@ -123,7 +124,7 @@ abstract class ModelNumRefExpedition
} }
/** /**
* Return numbering version module * Returns version of the numbering model
* *
* @return string Value * @return string Value
*/ */
...@@ -158,7 +159,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs) ...@@ -158,7 +159,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
$srctemplatepath=''; $srctemplatepath='';
// Positionne le modele sur le nom du modele a utiliser // Sets the model on the model name to use
if (! dol_strlen($modele)) if (! dol_strlen($modele))
{ {
if (! empty($conf->global->EXPEDITION_ADDON_PDF)) if (! empty($conf->global->EXPEDITION_ADDON_PDF))
...@@ -171,7 +172,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs) ...@@ -171,7 +172,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
} }
} }
// If selected modele is a filename template (then $modele="modelname:filename") // If selected model is a filename template (then $modele="modelname:filename")
$tmp=explode(':',$modele,2); $tmp=explode(':',$modele,2);
if (! empty($tmp[1])) if (! empty($tmp[1]))
{ {
...@@ -189,7 +190,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs) ...@@ -189,7 +190,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
{ {
$file = $prefix."_expedition_".$modele.".modules.php"; $file = $prefix."_expedition_".$modele.".modules.php";
// On verifie l'emplacement du modele // We check the model location
$file=dol_buildpath($reldir."core/modules/expedition/doc/".$file,0); $file=dol_buildpath($reldir."core/modules/expedition/doc/".$file,0);
if (file_exists($file)) if (file_exists($file))
{ {
...@@ -201,7 +202,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs) ...@@ -201,7 +202,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
if ($filefound) break; if ($filefound) break;
} }
// Charge le modele // Load the model
if ($filefound) if ($filefound)
{ {
require_once $file; require_once $file;
...@@ -221,14 +222,14 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs) ...@@ -221,14 +222,14 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
//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('SHIPPING_BUILDDOC',$object,$user,$langs,$conf); $result=$interface->run_triggers('SHIPPING_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { if ($result < 0) {
$error++; $this->errors=$interface->errors; $error++; $this->errors=$interface->errors;
} }
// Fin appel triggers // End calls triggers
return 1; return 1;
} }
...@@ -242,8 +243,15 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs) ...@@ -242,8 +243,15 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
} }
else else
{ {
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file)); if (! $conf->global->EXPEDITION_ADDON_PDF)
return -1; {
print $langs->trans("Error")." ".$langs->trans("Error_EXPEDITION_ADDON_PDF_NotDefined");
}
else
{
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
}
return 0;
} }
} }
?> ?>
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
/** /**
* \file htdocs/core/modules/supplier_order/modules_commandefournisseur.php * \file htdocs/core/modules/supplier_order/modules_commandefournisseur.php
* \ingroup commande fournisseur * \ingroup commande fournisseur
* \brief File that contain parent class for supplier orders models * \brief File that contains parent class for supplier orders models
* and parent class for supplier orders numbering models * and parent class for supplier orders numbering models
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
...@@ -44,13 +44,13 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator ...@@ -44,13 +44,13 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator
* *
* @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
* @return array List of numbers * @return array List of templates
*/ */
static function liste_modeles($db,$maxfilenamelength=0) static function liste_modeles($db,$maxfilenamelength=0)
{ {
global $conf; global $conf;
$type='order_supplier'; $type='supplier_order';
$liste=array(); $liste=array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
...@@ -79,7 +79,7 @@ abstract class ModeleNumRefSuppliersOrders ...@@ -79,7 +79,7 @@ abstract class ModeleNumRefSuppliersOrders
return true; return true;
} }
/** Returns the default description of the model numbering /** Returns default description of numbering model
* *
* @return string Description Text * @return string Description Text
*/ */
...@@ -101,7 +101,7 @@ abstract class ModeleNumRefSuppliersOrders ...@@ -101,7 +101,7 @@ abstract class ModeleNumRefSuppliersOrders
return $langs->trans("NoExample"); return $langs->trans("NoExample");
} }
/** Tests if the numbers already in force in the database do not cause conflicts that would prevent this numbering. /** Tests if existing numbers make problems with numbering
* *
* @return boolean false if conflict, true if ok * @return boolean false if conflict, true if ok
*/ */
...@@ -120,7 +120,7 @@ abstract class ModeleNumRefSuppliersOrders ...@@ -120,7 +120,7 @@ abstract class ModeleNumRefSuppliersOrders
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");
} }
/** Returns version of the model numbering /** Returns version of the numbering model
* *
* @return string Value * @return string Value
*/ */
...@@ -138,7 +138,7 @@ abstract class ModeleNumRefSuppliersOrders ...@@ -138,7 +138,7 @@ abstract class ModeleNumRefSuppliersOrders
/** /**
* 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 order * @param Object $object Object supplier order
...@@ -164,7 +164,7 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet ...@@ -164,7 +164,7 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet
$srctemplatepath=''; $srctemplatepath='';
// Set the model on the model name to use // Sets the model on the model name to use
if (! dol_strlen($modele)) if (! dol_strlen($modele))
{ {
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF))
...@@ -195,7 +195,7 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet ...@@ -195,7 +195,7 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet
{ {
$file = $prefix."_".$modele.".modules.php"; $file = $prefix."_".$modele.".modules.php";
// We checked the location of the model // We check the model location
$file=dol_buildpath($reldir."core/modules/supplier_order/pdf/".$file,0); $file=dol_buildpath($reldir."core/modules/supplier_order/pdf/".$file,0);
if (file_exists($file)) if (file_exists($file))
{ {
...@@ -229,7 +229,9 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet ...@@ -229,7 +229,9 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet
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('ORDER_SUPPLIER_BUILDDOC',$object,$user,$langs,$conf); $result=$interface->run_triggers('ORDER_SUPPLIER_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// End calls triggers // End calls triggers
return 1; return 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment