Skip to content
Snippets Groups Projects
Commit 64b757ed authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: add generic doc and use doc dir instead pdf

parent 3daf0696
Branches
Tags
No related merge requests found
......@@ -4,7 +4,7 @@
* 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-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
*
......@@ -95,7 +95,7 @@ if ($action == 'specimen')
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/livraison/pdf/pdf_".$modele.".modules.php",0);
$file=dol_buildpath($reldir."core/modules/livraison/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
......@@ -128,6 +128,35 @@ if ($action == 'specimen')
}
}
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
if ($action == 'setModuleOptions')
{
$post_size=count($_POST);
$db->begin();
for($i=0;$i < $post_size;$i++)
{
if (array_key_exists('param'.$i,$_POST))
{
$param=GETPOST("param".$i,'alpha');
$value=GETPOST("value".$i,'alpha');
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
}
if (! $error)
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
}
else
{
$db->rollback();
setEventMessage($langs->trans("Error"),'errors');
}
}
if ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
......@@ -356,7 +385,7 @@ clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/livraison/pdf/");
$dir = dol_buildpath($reldir."core/modules/livraison/doc/");
if (is_dir($dir))
{
......@@ -365,23 +394,39 @@ foreach ($dirmodels as $reldir)
{
while (($file = readdir($handle))!==false)
{
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
$filelist[]=$file;
}
closedir($handle);
arsort($filelist);
foreach($filelist as $file)
{
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{
if (file_exists($dir.'/'.$file))
{
$var=!$var;
$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;
require_once $dir.'/'.$file;
$module = new $classname($db);
print $module->description;
$modulequalified=1;
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 ($modulequalified)
{
print '<tr '.$bc[$var].'><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module,'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Activ
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
......@@ -417,14 +462,24 @@ foreach ($dirmodels as $reldir)
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
// Preview
print '<td align="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>';
}
else
{
print img_object($langs->trans("PreviewNotAvailable"),'generic');
}
print '</td>';
print '</tr>';
}
}
closedir($handle);
}
}
}
}
}
......
<?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2008 Chiptronik
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
......@@ -21,7 +21,7 @@
*/
/**
* \file htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
* \file htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
* \ingroup livraison
* \brief File of class to manage receving receipts with template Typhon
* \author Laurent Destailleur
......
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
......@@ -953,7 +953,7 @@ class Livraison extends CommonObject
}
}
$modelpath = "core/modules/livraison/pdf/";
$modelpath = "core/modules/livraison/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, 0, 0, 0);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment