Fix: compatibility with custom path

This commit is contained in:
Regis Houssin 2011-05-15 08:43:29 +00:00
parent 48d0356d7e
commit 488938cde1

View File

@ -448,96 +448,99 @@ foreach ($conf->file->dol_document_root as $dirroot)
{ {
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{ {
$name = substr($file, 4, dol_strlen($file) -16); if (file_exists($dir.'/'.$file))
$classname = substr($file, 0, dol_strlen($file) -12); {
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once($dir.'/'.$file); require_once($dir.'/'.$file);
$module = new $classname($db); $module = new $classname($db);
$modulequalified=1; $modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified) if ($modulequalified)
{ {
$var = !$var; $var = !$var;
print '<tr '.$bc[$var].'><td width="100">'; print '<tr '.$bc[$var].'><td width="100">';
print (empty($module->name)?$name:$module->name); print (empty($module->name)?$name:$module->name);
print "</td><td>\n"; print "</td><td>\n";
if (method_exists($module,'info')) print $module->info($langs); if (method_exists($module,'info')) print $module->info($langs);
else print $module->description; else print $module->description;
print '</td>'; print '</td>';
// Active // Active
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if ($conf->global->FACTURE_ADDON_PDF != "$name") if ($conf->global->FACTURE_ADDON_PDF != "$name")
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$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->FACTURE_ADDON_PDF == "$name") if ($conf->global->FACTURE_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("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur; $htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
} }
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; $htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); $htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); $htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); $htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
$htmltooltip.='<br>'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1); $htmltooltip.='<br>'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1);
$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); $htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); $htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark,1,1); $htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark,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>';
// Preview // Preview
print '<td align="center">'; print '<td align="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
} }
else else
{ {
print img_object($langs->trans("PreviewNotAvailable"),'generic'); print img_object($langs->trans("PreviewNotAvailable"),'generic');
} }
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
} }
}
} }
} }
} }