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

View File

@ -1,10 +1,10 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* 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 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * 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 * 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
@ -166,7 +166,6 @@ if ($_GET["action"] == 'setmod')
* View * View
*/ */
$dir = DOL_DOCUMENT_ROOT."/includes/modules/livraison/";
$html=new Form($db); $html=new Form($db);
llxHeader("",""); llxHeader("","");
@ -213,78 +212,85 @@ print '</tr>'."\n";
clearstatcache(); clearstatcache();
$handle = opendir($dir); foreach ($conf->file->dol_document_root as $dirroot)
$var=true;
if (is_resource($handle))
{ {
$var=true; $dir = $dirroot . "/includes/modules/livraison/";
while (($file = readdir($handle))!==false)
{ if (is_dir($dir))
if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, dol_strlen($file)-3, 3) == 'php') {
$handle = opendir($dir);
if (is_resource($handle))
{ {
$file = substr($file, 0, dol_strlen($file)-4); $var=true;
while (($file = readdir($handle))!==false)
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; if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, dol_strlen($file)-3, 3) == 'php')
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'); $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>'; print '</table>';
@ -331,89 +337,87 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
$dir = DOL_DOCUMENT_ROOT."/includes/modules/livraison/pdf/"; foreach ($conf->file->dol_document_root as $dirroot)
if(is_dir($dir))
{ {
$handle=opendir($dir); $dir = $dirroot . "/includes/modules/livraison/pdf/";
$var=true;
if (is_resource($handle)) if (is_dir($dir))
{ {
while (($file = readdir($handle))!==false) $handle = opendir($dir);
{ if (is_resource($handle))
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_') {
{ while (($file = readdir($handle))!==false)
$name = substr($file, 4, dol_strlen($file) - 16); {
$classname = substr($file, 0, dol_strlen($file) - 12); if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
{
$var=!$var; $name = substr($file, 4, dol_strlen($file) - 16);
print "<tr $bc[$var]><td>"; $classname = substr($file, 0, dol_strlen($file) - 12);
print $name;
print "</td><td>\n"; $var=!$var;
require_once($dir.$file); print "<tr $bc[$var]><td>";
$module = new $classname($db); print $name;
print "</td><td>\n";
print $module->description; require_once($dir.$file);
print '</td>'; $module = new $classname($db);
// Activ print $module->description;
if (in_array($name, $def)) print '</td>';
{
print "<td align=\"center\">\n"; // Activ
if ($conf->global->LIVRAISON_ADDON_PDF != "$name") if (in_array($name, $def))
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print "<td align=\"center\">\n";
print img_picto($langs->trans("Enabled"),'on'); if ($conf->global->LIVRAISON_ADDON_PDF != "$name")
print '</a>'; {
} print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
else print img_picto($langs->trans("Enabled"),'on');
{ print '</a>';
print img_picto($langs->trans("Enabled"),'on'); }
} else
print "</td>"; {
} print img_picto($langs->trans("Enabled"),'on');
else }
{ print "</td>";
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>'; else
print "</td>"; {
} 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>';
// Defaut print "</td>";
print "<td align=\"center\">"; }
if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
{ // Defaut
print img_picto($langs->trans("Default"),'on'); print "<td align=\"center\">";
} if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
else {
{ print img_picto($langs->trans("Default"),'on');
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>'; }
} else
print '</td>'; {
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>';
// Info }
$htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); print '</td>';
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':'; // Info
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); $htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
print '<td align="center">'; $htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
print $html->textwithpicto('',$htmltooltip,1,0); $htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
print '</td>'; $htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">'; print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>'; print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>'; print '</td>';
print '<td align="center">';
print '</tr>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>';
} print '</td>';
}
closedir($handle); print '</tr>';
} }
} }
else closedir($handle);
{ }
print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n"; }
} }
print '</table>'; print '</table>';
/* /*

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* 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) 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) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* *

View File

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

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* 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) 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 * 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
@ -144,7 +144,7 @@ function delivery_order_pdf_create($db, $object, $model='', $outputlangs='')
global $conf,$langs; global $conf,$langs;
$langs->load("deliveries"); $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 // Positionne modele sur le nom du modele de bon de livraison a utiliser
if (! dol_strlen($model)) if (! dol_strlen($model))
@ -161,10 +161,12 @@ function delivery_order_pdf_create($db, $object, $model='', $outputlangs='')
} }
// Charge le modele // Charge le modele
$file = "pdf_".$model.".modules.php"; $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; $classname = "pdf_".$model;
require_once($dir.$file); require_once($file);
$obj = new $classname($db); $obj = new $classname($db);