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
{
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); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/expedition/".$file.".php");
$expedition->initAsSpecimen();
// Info $module = new $file;
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; // Show modules according to features level
$facture->type=0; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
$nextval=$module->getNextValue($mysoc,$expedition); if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{ if ($module->isEnabled())
$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_')
{
$name = substr($file, 15, dol_strlen($file) - 27);
$classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var; if (is_resource($handle))
print "<tr $bc[$var]><td>"; {
print $name; while (($file = readdir($handle))!==false)
print "</td><td>\n"; {
require_once($dir.$file); if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')
$module = new $classname(); {
$name = substr($file, 15, dol_strlen($file) - 27);
$classname = substr($file, 0, dol_strlen($file) - 12);
print $module->description; $var=!$var;
print '</td>'; print "<tr $bc[$var]><td>";
print $name;
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname();
// Active print $module->description;
if (in_array($name, $def)) print '</td>';
{
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 // Active
print "<td align=\"center\">"; if (in_array($name, $def))
if ($conf->global->EXPEDITION_ADDON_PDF == $name) {
{ print "<td align=\"center\">\n";
print img_picto($langs->trans("Default"),'on'); 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 '<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 '</a>';
} }
print '</td>'; 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>";
}
// Info // Default
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; print "<td align=\"center\">";
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($conf->global->EXPEDITION_ADDON_PDF == $name)
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; {
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; print img_picto($langs->trans("Default"),'on');
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); }
print '<td align="center">'; else
print $html->textwithpicto('',$htmltooltip,1,0); {
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>';
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 '</td>';
print '</tr>'; // Info
} $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
} $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
closedir($handle); $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);
else print '<td align="center">';
{ print $html->textwithpicto('',$htmltooltip,1,0);
print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n"; 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>'; 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_')
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var; $var=!$var;
print "<tr $bc[$var]><td>"; print "<tr $bc[$var]><td>";
print $name; print $name;
print "</td><td>\n"; print "</td><td>\n";
require_once($dir.$file); require_once($dir.$file);
$module = new $classname($db); $module = new $classname($db);
print $module->description; print $module->description;
print '</td>'; print '</td>';
// Activ // Activ
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if ($conf->global->LIVRAISON_ADDON_PDF != "$name") 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 '<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 img_picto($langs->trans("Enabled"),'on');
print '</a>'; print '</a>';
} }
else else
{ {
print img_picto($langs->trans("Enabled"),'on'); print img_picto($langs->trans("Enabled"),'on');
} }
print "</td>"; print "</td>";
} }
else else
{ {
print "<td align=\"center\">\n"; 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 '<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>"; print "</td>";
} }
// Defaut // Defaut
print "<td align=\"center\">"; print "<td align=\"center\">";
if ($conf->global->LIVRAISON_ADDON_PDF == "$name") if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"),'on'); print img_picto($langs->trans("Default"),'on');
} }
else 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 '<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>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $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>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); $htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">'; print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0); print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>'; print '</td>';
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 '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
} }
closedir($handle); closedir($handle);
} }
} }
else
{
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);