Fix: possibility to use an alternative path

This commit is contained in:
Regis Houssin 2011-04-17 07:15:17 +00:00
parent 7919c35891
commit c50a14c5f7
5 changed files with 327 additions and 307 deletions

View File

@ -1,10 +1,10 @@
<?php
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -245,7 +245,6 @@ if ($_GET["action"] == 'setmodel')
* View
*/
$dir = DOL_DOCUMENT_ROOT."/includes/modules/expedition/";
$html=new Form($db);
@ -297,80 +296,87 @@ print "</tr>\n";
clearstatcache();
//$dir = "../includes/modules/expedition/";
$handle = opendir($dir);
if (is_resource($handle))
foreach ($conf->file->dol_document_root as $dirroot)
{
$var=true;
$dir = $dirroot . "/includes/modules/expedition/";
while (($file = readdir($handle))!==false)
if (is_dir($dir))
{
if (substr($file, 0, 15) == 'mod_expedition_' && substr($file, dol_strlen($file)-3, 3) == 'php')
$handle = opendir($dir);
if (is_resource($handle))
{
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/expedition/".$file.".php");
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
$var=true;
while (($file = readdir($handle))!==false)
{
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td>\n";
print '<td>';
print $module->info();
print '</td>';
// Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
print '<td align="center">';
if ($conf->global->EXPEDITION_ADDON_NUMBER == "$file")
if (substr($file, 0, 15) == 'mod_expedition_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
print img_picto($langs->trans("Activated"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$file.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Disabled"),'off');
print '</a>';
}
print '</td>';
$expedition=new Expedition($db);
$expedition->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0;
$nextval=$module->getNextValue($mysoc,$expedition);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{
$htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval)
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/expedition/".$file.".php");
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
$htmltooltip.=$nextval.'<br>';
}
else
{
$htmltooltip.=$langs->trans($module->error).'<br>';
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td>\n";
print '<td>';
print $module->info();
print '</td>';
// Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
print '<td align="center">';
if ($conf->global->EXPEDITION_ADDON_NUMBER == "$file")
{
print img_picto($langs->trans("Activated"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$file.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Disabled"),'off');
print '</a>';
}
print '</td>';
$expedition=new Expedition($db);
$expedition->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0;
$nextval=$module->getNextValue($mysoc,$expedition);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{
$htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval)
{
$htmltooltip.=$nextval.'<br>';
}
else
{
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
}
}
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
}
closedir($handle);
}
}
closedir($handle);
}
print '</table><br>';
@ -418,90 +424,90 @@ print "</tr>\n";
clearstatcache();
$dir = DOL_DOCUMENT_ROOT."/includes/modules/expedition/pdf/";
if(is_dir($dir))
foreach ($conf->file->dol_document_root as $dirroot)
{
$handle=opendir($dir);
$var=true;
$dir = $dirroot . "/includes/modules/expedition/pdf/";
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')
{
$name = substr($file, 15, dol_strlen($file) - 27);
$classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var;
print "<tr $bc[$var]><td>";
print $name;
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname();
print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->EXPEDITION_ADDON_PDF != $name)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_picto($langs->trans("Activated"),'on');
print '</a>';
}
else
{
print img_picto($langs->trans("Activated"),'on');
}
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Default
print "<td align=\"center\">";
if ($conf->global->EXPEDITION_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>';
print '</td>';
print '</tr>';
}
}
closedir($handle);
}
}
else
{
print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n";
if (is_dir($dir))
{
$handle=opendir($dir);
$var=true;
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')
{
$name = substr($file, 15, dol_strlen($file) - 27);
$classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var;
print "<tr $bc[$var]><td>";
print $name;
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname();
print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->EXPEDITION_ADDON_PDF != $name)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_picto($langs->trans("Activated"),'on');
print '</a>';
}
else
{
print img_picto($langs->trans("Activated"),'on');
}
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Default
print "<td align=\"center\">";
if ($conf->global->EXPEDITION_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>';
print '</td>';
print '</tr>';
}
}
closedir($handle);
}
}
}
print '</table>';

View File

@ -1,10 +1,10 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -166,7 +166,6 @@ if ($_GET["action"] == 'setmod')
* View
*/
$dir = DOL_DOCUMENT_ROOT."/includes/modules/livraison/";
$html=new Form($db);
llxHeader("","");
@ -213,78 +212,85 @@ print '</tr>'."\n";
clearstatcache();
$handle = opendir($dir);
$var=true;
if (is_resource($handle))
foreach ($conf->file->dol_document_root as $dirroot)
{
$var=true;
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, dol_strlen($file)-3, 3) == 'php')
$dir = $dirroot . "/includes/modules/livraison/";
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/livraison/".$file.".php");
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
$var=true;
while (($file = readdir($handle))!==false)
{
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info();
print '</td>';
// Affiche example
print '<td nowrap="nowrap">'.$module->getExample().'</td>';
print '<td align="center">';
if ($conf->global->LIVRAISON_ADDON == "$file")
if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
print img_picto($langs->trans("Activated"),'on');
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/livraison/".$file.".php");
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info();
print '</td>';
// Affiche example
print '<td nowrap="nowrap">'.$module->getExample().'</td>';
print '<td align="center">';
if ($conf->global->LIVRAISON_ADDON == "$file")
{
print img_picto($langs->trans("Activated"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
$livraison=new Livraison($db);
$livraison->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0;
$nextval=$module->getNextValue($mysoc,$livraison);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{
$htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval)
{
$htmltooltip.=$nextval.'<br>';
}
else
{
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
}
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
$livraison=new Livraison($db);
$livraison->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0;
$nextval=$module->getNextValue($mysoc,$livraison);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{
$htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval)
{
$htmltooltip.=$nextval.'<br>';
}
else
{
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
}
closedir($handle);
}
}
closedir($handle);
}
}
print '</table>';
@ -331,89 +337,87 @@ print "</tr>\n";
clearstatcache();
$dir = DOL_DOCUMENT_ROOT."/includes/modules/livraison/pdf/";
if(is_dir($dir))
foreach ($conf->file->dol_document_root as $dirroot)
{
$handle=opendir($dir);
$var=true;
$dir = $dirroot . "/includes/modules/livraison/pdf/";
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var;
print "<tr $bc[$var]><td>";
print $name;
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print '</td>';
// Activ
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->LIVRAISON_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'on');
print '</a>';
}
else
{
print img_picto($langs->trans("Enabled"),'on');
}
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Defaut
print "<td align=\"center\">";
if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>';
print '</td>';
print '</tr>';
}
}
closedir($handle);
}
}
else
{
print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n";
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var;
print "<tr $bc[$var]><td>";
print $name;
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print '</td>';
// Activ
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->LIVRAISON_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'on');
print '</a>';
}
else
{
print img_picto($langs->trans("Enabled"),'on');
}
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Defaut
print "<td align=\"center\">";
if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>';
print '</td>';
print '</tr>';
}
}
closedir($handle);
}
}
}
print '</table>';
/*

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -71,19 +71,25 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
global $conf,$langs;
$langs->load("sendings");
$dir = DOL_DOCUMENT_ROOT."/includes/modules/expedition/pdf/";
$dir = "/includes/modules/expedition/pdf/";
$modelisok=0;
// Positionne modele sur le nom du modele de commande a utiliser
$file = "pdf_expedition_".$modele.".modules.php";
if ($modele && file_exists($dir.$file)) $modelisok=1;
// On verifie l'emplacement du modele
$file = dol_buildpath($dir.$file);
if ($modele && file_exists($file)) $modelisok=1;
// Si model pas encore bon
if (! $modelisok)
{
if ($conf->global->EXPEDITION_ADDON_PDF) $modele = $conf->global->EXPEDITION_ADDON_PDF;
$file = "pdf_expedition_".$modele.".modules.php";
if (file_exists($dir.$file)) $modelisok=1;
// On verifie l'emplacement du modele
$file = dol_buildpath($dir.$file);
if (file_exists($file)) $modelisok=1;
}
// Si model pas encore bon
@ -94,7 +100,9 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
$liste=$model->liste_modeles($db);
$modele=key($liste); // Renvoie premiere valeur de cle trouve dans le tableau
$file = "pdf_expedition_".$modele.".modules.php";
if (file_exists($dir.$file)) $modelisok=1;
// On verifie l'emplacement du modele
$file = dol_buildpath($dir.$file);
if (file_exists($file)) $modelisok=1;
}
// Charge le modele
@ -102,7 +110,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
{
dol_syslog("expedition_pdf_create ".$modele);
$classname = "pdf_expedition_".$modele;
require_once($dir.$file);
require_once($file);
$obj = new $classname($db);

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006-2011 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -144,7 +144,7 @@ function delivery_order_pdf_create($db, $object, $model='', $outputlangs='')
global $conf,$langs;
$langs->load("deliveries");
$dir = DOL_DOCUMENT_ROOT."/includes/modules/livraison/pdf/";
$dir = "/includes/modules/livraison/pdf/";
// Positionne modele sur le nom du modele de bon de livraison a utiliser
if (! dol_strlen($model))
@ -161,10 +161,12 @@ function delivery_order_pdf_create($db, $object, $model='', $outputlangs='')
}
// Charge le modele
$file = "pdf_".$model.".modules.php";
if (file_exists($dir.$file))
// On verifie l'emplacement du modele
$file = dol_buildpath($dir.$file);
if (file_exists($file))
{
$classname = "pdf_".$model;
require_once($dir.$file);
require_once($file);
$obj = new $classname($db);