Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2012-04-04 21:45:07 +02:00

View File

@@ -6,6 +6,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
*
* 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
@@ -55,28 +56,36 @@ if ($action == 'specimen')
$exp = new Expedition($db);
$exp->initAsSpecimen();
//$exp->fetch_commande();
// Charge le modele
$dir = "/core/modules/expedition/doc/";
$file = "pdf_expedition_".$modele.".modules.php";
$file = dol_buildpath($dir.$file);
if (file_exists($file))
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/expedition/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
$classname = "pdf_expedition_".$modele;
require_once($file);
$obj = new $classname($db);
$module = new $classname($db);
if ($obj->write_file($exp,$langs) > 0)
if ($module->write_file($exp,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expedition&file=SPECIMEN.pdf");
return;
}
else
{
$mesg='<font class="error">'.$obj->error.'</font>';
dol_syslog($obj->error, LOG_ERR);
$mesg='<font class="error">'.$module->error.'</font>';
dol_syslog($module->error, LOG_ERR);
}
}
else
@@ -298,8 +307,9 @@ if ($action == 'set_SHIPPING_FREE_TEXT')
* View
*/
$form=new Form($db);
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
$form=new Form($db);
llxHeader("","");
@@ -349,9 +359,9 @@ print "</tr>\n";
clearstatcache();
foreach ($conf->file->dol_document_root as $dirroot)
foreach ($dirmodels as $reldir)
{
$dir = $dirroot . "/core/modules/expedition/";
$dir = dol_buildpath($reldir."core/modules/expedition/");
if (is_dir($dir))
{
@@ -362,9 +372,10 @@ foreach ($conf->file->dol_document_root as $dirroot)
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 15) == 'mod_expedition_' && substr($file, dol_strlen($file)-3, 3) == 'php')
if (preg_match('/^(mod_.*)\.php$/i',$file,$reg))
{
$file = substr($file, 0, dol_strlen($file)-4);
$file = $reg[1];
$classname = substr($file,4);
require_once(DOL_DOCUMENT_ROOT ."/core/modules/expedition/".$file.".php");
@@ -482,15 +493,14 @@ print "</tr>\n";
clearstatcache();
foreach ($conf->file->dol_document_root as $dirroot)
$var=true;
foreach ($dirmodels as $reldir)
{
$dir = $dirroot . "/core/modules/expedition/doc/";
$dir = dol_buildpath($reldir."core/modules/expedition/doc/");
if (is_dir($dir))
{
$handle=opendir($dir);
$var=true;
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
@@ -613,4 +623,4 @@ dol_htmloutput_mesg($mesg);
$db->close();
llxFooter();
?>
?>