Skip to content
Snippets Groups Projects
Commit 94d3e6d3 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into

develop

Conflicts:
	htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php
parents 70f7321d 07cba2d2
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
$langs->load("admin"); $langs->load("admin");
$langs->load("errors"); $langs->load("errors");
...@@ -68,18 +69,150 @@ if ($action == 'setmod') ...@@ -68,18 +69,150 @@ if ($action == 'setmod')
dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity); dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity);
} }
/* else if ($action == 'specimen') // For contract
// constants of magre model {
if ($action == 'updateMatrice') dolibarr_set_const($db, "CONTRACT_NUM_MATRICE",$_POST["matrice"],'chaine',0,'',$conf->entity); $modele= GETPOST('module','alpha');
if ($action == 'updatePrefix') dolibarr_set_const($db, "CONTRACT_NUM_PREFIX",$_POST["prefix"],'chaine',0,'',$conf->entity);
if ($action == 'setOffset') dolibarr_set_const($db, "CONTRACT_NUM_DELTA",$_POST["offset"],'chaine',0,'',$conf->entity); $contract = new Contrat($db);
if ($action == 'setNumRestart') dolibarr_set_const($db, "CONTRACT_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"],'chaine',0,'',$conf->entity); $contract->initAsSpecimen();
*/
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/contract/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
$module = new $classname($db);
if ($module->write_file($contract,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=contract&file=SPECIMEN.pdf");
return;
}
else
{
setEventMessage($obj->error,'errors');
dol_syslog($obj->error, LOG_ERR);
}
}
else
{
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
// Activate a model
else if ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
else if ($action == 'del')
{
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->CONTRACT_ADDON_PDF == "$value") dolibarr_del_const($db, 'CONTRACT_ADDON_PDF',$conf->entity);
}
}
// Set default model
else if ($action == 'setdoc')
{
if (dolibarr_set_const($db, "CONTRACT_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->CONTRACT_ADDON_PDF = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
else if ($action == 'setmod')
{
// TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated
dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity);
}
else if ($action == 'set_CONTRAT_FREE_TEXT')
{
$freetext= GETPOST('CONTRAT_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "CONTRAT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
}
else
{
setEventMessage($langs->trans("Error"),'errors');
}
}
else if ($action == 'set_CONTRAT_DRAFT_WATERMARK')
{
$draft= GETPOST('CONTRAT_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "CONTRAT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
}
else
{
setEventMessage($langs->trans("Error"),'errors');
}
}
elseif ($action == 'set_CONTRAT_PRINT_PRODUCTS')
{
$val = GETPOST('CONTRAT_PRINT_PRODUCTS','alpha');
$res = dolibarr_set_const($db, "CONTRAT_PRINT_PRODUCTS",($val == 'on'),'bool',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
}
else
{
setEventMessage($langs->trans("Error"),'errors');
}
}
/* /*
* View * View
*/ */
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader(); llxHeader();
$dir=DOL_DOCUMENT_ROOT."/core/modules/contract/"; $dir=DOL_DOCUMENT_ROOT."/core/modules/contract/";
...@@ -90,15 +223,9 @@ print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup'); ...@@ -90,15 +223,9 @@ print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup');
print "<br>"; print "<br>";
$h = 0; $head=contract_admin_prepare_head();
$head[$h][0] = DOL_URL_ROOT."/admin/contract.php"; dol_fiche_head($head, 'contract', $langs->trans("ModuleSetup"));
$head[$h][1] = $langs->trans("Contracts");
$head[$h][2] = 'Contract';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
/* /*
* Contracts Numbering model * Contracts Numbering model
...@@ -199,6 +326,195 @@ if (is_resource($handle)) ...@@ -199,6 +326,195 @@ if (is_resource($handle))
print '</table><br>'; print '</table><br>';
/*
* Documents models for Contracts
*/
print_titre($langs->trans("TemplatePDFContracts"));
// Defini tableau def des modeles
$type='contrat';
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
if ($resql)
{
$i = 0;
$num_rows=$db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
}
else
{
dol_print_error($db);
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/contract/doc/");
if (is_dir($dir))
{
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
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;
print '<tr '.$bc[$var].'><td>';
echo "$name";
print "</td><td>\n";
require_once $dir.$file;
$module = new $classname($db);
print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
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"),'switch_on');
print '</a>';
print "</td>";
}
else
{
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"),'switch_off').'</a>';
print "</td>";
}
// Default
print "<td align=\"center\">";
if ($conf->global->CONTRACT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
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 '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$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;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$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("PaymentConditions").': '.yn($module->option_condreg,1,1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,-1,0);
print '</td>';
// Preview
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'contract').'</a>';
print '<td align="center">';
print $link;
print '</td>';
print '</tr>';
}
}
closedir($handle);
}
}
}
print '</table>';
print "<br>";
/*
* Other options
*
*/
print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$var=true;
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_CONTRAT_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnContracts").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print '<textarea name="CONTRAT_FREE_TEXT" class="flat" cols="120">'.$conf->global->CONTRAT_FREE_TEXT.'</textarea>';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
//Use draft Watermark
$var=!$var;
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_CONTRAT_DRAFT_WATERMARK\">";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("WatermarkOnDraftContractCards").'<br>';
print '<input size="50" class="flat" type="text" name="CONTRAT_DRAFT_WATERMARK" value="'.$conf->global->CONTRAT_DRAFT_WATERMARK.'">';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
// print products on fichinter
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_CONTRAT_PRINT_PRODUCTS">';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("PrintProductsOnContract").' ('.$langs->trans("PrintProductsOnContractDetails").')</td>';
print '<td align="center"><input type="checkbox" name="CONTRAT_PRINT_PRODUCTS" ';
if ($conf->global->CONTRAT_PRINT_PRODUCTS)
print 'checked="checked" ';
print '/>';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
print '</table>';
print '<br>';
$db->close(); $db->close();
llxFooter(); llxFooter();
......
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/contrat/admin/contract_extrafields.php
* \ingroup contrat
* \brief Page to setup extra fields of contract
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("companies");
$langs->load("admin");
$langs->load("contracts");
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label=getStaticMember(get_class($extrafields),'type2label');
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
$elementtype='contrat'; //Must be the $element of the class that manage extrafield
if (!$user->admin) accessforbidden();
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
/*
* View
*/
llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup');
print '<br>';
$head=contract_admin_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("ModuleSetup"), 0, 'contrat');
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
/* ************************************************************************** */
/* */
/* Creation d'un champ optionnel
/* */
/* ************************************************************************** */
if ($action == 'create')
{
print "<br>";
print_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
/* */
/* Edition d'un champ optionnel */
/* */
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
llxFooter();
$db->close();
?>
...@@ -84,4 +84,39 @@ function contract_prepare_head($object) ...@@ -84,4 +84,39 @@ function contract_prepare_head($object)
return $head; return $head;
} }
/**
* Return array head with list of tabs to view object informations.
*
* @return array head array with tabs
*/
function contract_admin_prepare_head()
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT."/admin/contract.php";
$head[$h][1] = $langs->trans("Contracts");
$head[$h][2] = 'contract';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'contract_admin');
$head[$h][0] = DOL_URL_ROOT.'/contrat/admin/contract_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'contract_admin','remove');
return $head;
}
?> ?>
\ No newline at end of file
This diff is collapsed.
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* 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>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* *
* 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
...@@ -24,9 +25,42 @@ ...@@ -24,9 +25,42 @@
/** /**
* \file htdocs/core/modules/contract/modules_contract.php * \file htdocs/core/modules/contract/modules_contract.php
* \ingroup contract * \ingroup contract
* \brief File of class to manage contract numbering * \brief Fichier contenant la classe mere de generation des fiches interventions en PDF and File of class to manage contract numbering
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
/**
* Parent class to manage intervention document templates
*/
abstract class ModelePDFContract extends CommonDocGenerator
{
var $error='';
/**
* Return list of active generation modules
*
* @param DoliDB $db Database handler
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;
$type='contract';
$liste=array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$liste=getListOfModels($db,$type,$maxfilenamelength);
return $liste;
}
}
/** /**
* Parent class for all contract numbering modules * Parent class for all contract numbering modules
*/ */
...@@ -107,4 +141,109 @@ class ModelNumRefContracts ...@@ -107,4 +141,109 @@ class ModelNumRefContracts
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");
} }
} }
/**
* Create a contract document on disk using template defined into CONTRACT_ADDON_PDF
*
* @param DoliDB $db objet base de donnee
* @param Object $object Object contract
* @param string $modele force le modele a utiliser ('' par defaut)
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @return int 0 if KO, 1 if OK
*/
function contract_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$langs,$user;
$langs->load("contract");
$error=0;
$srctemplatepath='';
// Positionne modele sur le nom du modele de contrat a utiliser
if (! dol_strlen($modele))
{
if (! empty($conf->global->CONTRACT_ADDON_PDF))
{
$modele = $conf->global->CONTRACT_ADDON_PDF;
}
else
{
$modele = 'strato';
}
}
// If selected modele is a filename template (then $modele="modelname:filename")
$tmp=explode(':',$modele,2);
if (! empty($tmp[1]))
{
$modele=$tmp[0];
$srctemplatepath=$tmp[1];
}
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array('/');
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
foreach(array('doc','pdf') as $prefix)
{
$file = $prefix."_".$modele.".modules.php";
// On verifie l'emplacement du modele
$file=dol_buildpath($reldir."core/modules/contract/doc/".$file,0);
if (file_exists($file))
{
$filefound=1;
$classname=$prefix.'_'.$modele;
break;
}
}
if ($filefound) break;
}
// Charge le modele
if ($filefound)
{
require_once $file;
$obj = new $classname($db);
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
{
$outputlangs->charset_output=$sav_charset_output;
// We delete old preview
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_delete_preview($object);
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('CONTRACT_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
return 1;
}
else
{
$outputlangs->charset_output=$sav_charset_output;
dol_print_error($db,"contract_pdf_create Error: ".$obj->error);
return 0;
}
}
else
{
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
return 0;
}
}
?> ?>
...@@ -1107,6 +1107,9 @@ WatermarkOnDraftInterventionCards=Filigrane sur les brouillons des fiches d'inte ...@@ -1107,6 +1107,9 @@ WatermarkOnDraftInterventionCards=Filigrane sur les brouillons des fiches d'inte
##### Contracts ##### ##### Contracts #####
ContractsSetup=Configuration du module contrats ContractsSetup=Configuration du module contrats
ContractsNumberingModules=Modèles de numérotation des contrats ContractsNumberingModules=Modèles de numérotation des contrats
FreeLegalTextOnContracts=Mention complémentaire sur les contrats
WatermarkOnDraftContractCards=Filigrane sur les brouillons des contrats (aucun si vide)
TemplatePDFContracts=Modèles de document des contrats
##### Members ##### ##### Members #####
MembersSetup=Configuration du module Adhérents MembersSetup=Configuration du module Adhérents
MemberMainOptions=Options principales MemberMainOptions=Options principales
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment