Fix: add generic doc and use doc dir instead pdf
This commit is contained in:
parent
3daf06960d
commit
64b757ed81
@ -4,7 +4,7 @@
|
|||||||
* 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-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 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
|
* 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']);
|
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||||
foreach($dirmodels as $reldir)
|
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))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound=1;
|
$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')
|
if ($action == 'set')
|
||||||
{
|
{
|
||||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
@ -356,75 +385,101 @@ clearstatcache();
|
|||||||
$var=true;
|
$var=true;
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/livraison/pdf/");
|
$dir = dol_buildpath($reldir."core/modules/livraison/doc/");
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
$handle = opendir($dir);
|
$handle = opendir($dir);
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
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))
|
||||||
{
|
{
|
||||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
if (file_exists($dir.'/'.$file))
|
||||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
{
|
||||||
|
$var=!$var;
|
||||||
|
|
||||||
$var=!$var;
|
$name = substr($file, 4, dol_strlen($file) -16);
|
||||||
|
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'><td>';
|
require_once $dir.'/'.$file;
|
||||||
print $name;
|
$module = new $classname($db);
|
||||||
print "</td><td>\n";
|
|
||||||
require_once $dir.$file;
|
|
||||||
$module = new $classname($db);
|
|
||||||
|
|
||||||
print $module->description;
|
$modulequalified=1;
|
||||||
print '</td>';
|
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||||
|
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||||
|
|
||||||
// Activ
|
if ($modulequalified)
|
||||||
if (in_array($name, $def))
|
{
|
||||||
{
|
print '<tr '.$bc[$var].'><td width="100">';
|
||||||
print "<td align=\"center\">\n";
|
print (empty($module->name)?$name:$module->name);
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
print "</td><td>\n";
|
||||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
if (method_exists($module,'info')) print $module->info($langs);
|
||||||
print '</a>';
|
else print $module->description;
|
||||||
print "</td>";
|
print '</td>';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "<td align=\"center\">\n";
|
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
|
||||||
print "</td>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default
|
// Active
|
||||||
print "<td align=\"center\">";
|
if (in_array($name, $def))
|
||||||
if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
|
{
|
||||||
{
|
print "<td align=\"center\">\n";
|
||||||
print img_picto($langs->trans("Default"),'on');
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||||
}
|
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||||
else
|
print '</a>';
|
||||||
{
|
print "</td>";
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
}
|
||||||
}
|
else
|
||||||
print '</td>';
|
{
|
||||||
|
print "<td align=\"center\">\n";
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
|
||||||
// Info
|
// Default
|
||||||
$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;
|
if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
|
||||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").'</u>:';
|
{
|
||||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
|
print img_picto($langs->trans("Default"),'on');
|
||||||
print '<td align="center">';
|
}
|
||||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
else
|
||||||
print '</td>';
|
{
|
||||||
print '<td align="center">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>';
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
// 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><u>'.$langs->trans("FeaturesSupported").'</u>:';
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
|
||||||
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* 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) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||||
* Copyright (C) 2008 Chiptronik
|
* Copyright (C) 2008 Chiptronik
|
||||||
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
* 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
|
* \ingroup livraison
|
||||||
* \brief File of class to manage receving receipts with template Typhon
|
* \brief File of class to manage receving receipts with template Typhon
|
||||||
* \author Laurent Destailleur
|
* \author Laurent Destailleur
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||||
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
* 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);
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user