forked from Wavyzz/dolibarr
Merge branch '3.9_dalibo' of github.com:ATM-Consulting/dolibarr into NEW_odt_others_objects
Conflicts: htdocs/core/class/html.formfile.class.php htdocs/product/admin/product.php htdocs/product/card.php
This commit is contained in:
@@ -35,16 +35,83 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
|||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
|
|
||||||
if (! $user->admin) accessforbidden();
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
$value = GETPOST('value','alpha');
|
||||||
|
$type='user';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
if (preg_match('/set_(.*)/',$action,$reg))
|
|
||||||
|
// Activate a model
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($action == 'set_default')
|
||||||
|
{
|
||||||
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
|
$res = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
elseif ($action == 'del_default')
|
||||||
|
{
|
||||||
|
$ret = delDocumentModel($value, $type);
|
||||||
|
if ($ret > 0)
|
||||||
|
{
|
||||||
|
if ($conf->global->USER_ADDON_PDF_ODT == "$value") dolibarr_del_const($db, 'USER_ADDON_PDF_ODT',$conf->entity);
|
||||||
|
}
|
||||||
|
$res = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set default model
|
||||||
|
elseif ($action == 'setdoc')
|
||||||
|
{
|
||||||
|
if (dolibarr_set_const($db, "USER_ADDON_PDF_ODT",$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->USER_ADDON_PDF_ODT = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// On active le modele
|
||||||
|
$ret = delDocumentModel($value, $type);
|
||||||
|
if ($ret > 0)
|
||||||
|
{
|
||||||
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
|
}
|
||||||
|
$res = true;
|
||||||
|
}
|
||||||
|
elseif (preg_match('/set_(.*)/',$action,$reg))
|
||||||
{
|
{
|
||||||
$code=$reg[1];
|
$code=$reg[1];
|
||||||
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
|
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
|
||||||
@@ -58,7 +125,7 @@ if (preg_match('/set_(.*)/',$action,$reg))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/del_(.*)/',$action,$reg))
|
elseif (preg_match('/del_(.*)/',$action,$reg))
|
||||||
{
|
{
|
||||||
$code=$reg[1];
|
$code=$reg[1];
|
||||||
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
|
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
|
||||||
@@ -72,7 +139,7 @@ if (preg_match('/del_(.*)/',$action,$reg))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Set hide closed customer into combox or select
|
//Set hide closed customer into combox or select
|
||||||
if ($action == 'sethideinactiveuser')
|
elseif ($action == 'sethideinactiveuser')
|
||||||
{
|
{
|
||||||
$status = GETPOST('status','alpha');
|
$status = GETPOST('status','alpha');
|
||||||
|
|
||||||
@@ -138,6 +205,164 @@ print '</td></tr>';
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
// Defini tableau def des modeles
|
||||||
|
$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)
|
||||||
|
{
|
||||||
|
foreach (array('','/doc') as $valdir)
|
||||||
|
{
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/user".$valdir);
|
||||||
|
if (is_dir($dir))
|
||||||
|
{
|
||||||
|
$handle=opendir($dir);
|
||||||
|
if (is_resource($handle))
|
||||||
|
{
|
||||||
|
while (($file = readdir($handle))!==false)
|
||||||
|
{
|
||||||
|
$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))
|
||||||
|
{
|
||||||
|
$name = substr($file, 4, dol_strlen($file) -16);
|
||||||
|
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||||
|
|
||||||
|
require_once $dir.'/'.$file;
|
||||||
|
$module = new $classname($db);
|
||||||
|
|
||||||
|
$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)
|
||||||
|
{
|
||||||
|
$var = !$var;
|
||||||
|
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>';
|
||||||
|
|
||||||
|
// Active
|
||||||
|
if (in_array($name, $def))
|
||||||
|
{
|
||||||
|
print '<td align="center">'."\n";
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del_default&value='.$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_default&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defaut
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($conf->global->USER_ADDON_PDF == $name)
|
||||||
|
{
|
||||||
|
print img_picto($langs->trans("Default"),'on');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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 '</td>';
|
||||||
|
|
||||||
|
// Info
|
||||||
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||||
|
if ($module->type == 'pdf')
|
||||||
|
{
|
||||||
|
$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
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($module->type == 'pdf')
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'contract').'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print img_object($langs->trans("PreviewNotAvailable"),'generic');
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print "<br>";
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
316
htdocs/admin/usergroup.php
Normal file
316
htdocs/admin/usergroup.php
Normal file
@@ -0,0 +1,316 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
|
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
*
|
||||||
|
* 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/admin/usergroup.php
|
||||||
|
* \ingroup core
|
||||||
|
* \brief Page to setup usergroup module
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("members");
|
||||||
|
$langs->load("users");
|
||||||
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
$value = GETPOST('value','alpha');
|
||||||
|
$type='group';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Action
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Activate a model
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($action == 'set_default')
|
||||||
|
{
|
||||||
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
|
$res = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
elseif ($action == 'del_default')
|
||||||
|
{
|
||||||
|
$ret = delDocumentModel($value, $type);
|
||||||
|
if ($ret > 0)
|
||||||
|
{
|
||||||
|
if ($conf->global->USERGROUP_ADDON_PDF_ODT == "$value") dolibarr_del_const($db, 'USERGROUP_ADDON_PDF_ODT',$conf->entity);
|
||||||
|
}
|
||||||
|
$res = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set default model
|
||||||
|
elseif ($action == 'setdoc')
|
||||||
|
{
|
||||||
|
if (dolibarr_set_const($db, "USERGROUP_ADDON_PDF_ODT",$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->USERGROUP_ADDON_PDF_ODT = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// On active le modele
|
||||||
|
$ret = delDocumentModel($value, $type);
|
||||||
|
if ($ret > 0)
|
||||||
|
{
|
||||||
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
|
}
|
||||||
|
$res = true;
|
||||||
|
}
|
||||||
|
elseif (preg_match('/set_(.*)/',$action,$reg))
|
||||||
|
{
|
||||||
|
$code=$reg[1];
|
||||||
|
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
|
||||||
|
{
|
||||||
|
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
elseif (preg_match('/del_(.*)/',$action,$reg))
|
||||||
|
{
|
||||||
|
$code=$reg[1];
|
||||||
|
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
|
||||||
|
{
|
||||||
|
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$help_url='EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios';
|
||||||
|
llxHeader('',$langs->trans("UsersSetup"),$help_url);
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print load_fiche_titre($langs->trans("UsersSetup"),$linkback,'title_setup');
|
||||||
|
|
||||||
|
|
||||||
|
$head=user_admin_prepare_head();
|
||||||
|
|
||||||
|
dol_fiche_head($head,'usergroupcard', $langs->trans("MenuUsersAndGroups"), 0, 'user');
|
||||||
|
|
||||||
|
|
||||||
|
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
// Defini tableau def des modeles
|
||||||
|
$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)
|
||||||
|
{
|
||||||
|
foreach (array('','/doc') as $valdir)
|
||||||
|
{
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/usergroup".$valdir);
|
||||||
|
if (is_dir($dir))
|
||||||
|
{
|
||||||
|
$handle=opendir($dir);
|
||||||
|
if (is_resource($handle))
|
||||||
|
{
|
||||||
|
while (($file = readdir($handle))!==false)
|
||||||
|
{
|
||||||
|
$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))
|
||||||
|
{
|
||||||
|
$name = substr($file, 4, dol_strlen($file) -16);
|
||||||
|
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||||
|
|
||||||
|
require_once $dir.'/'.$file;
|
||||||
|
$module = new $classname($db);
|
||||||
|
|
||||||
|
$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)
|
||||||
|
{
|
||||||
|
$var = !$var;
|
||||||
|
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>';
|
||||||
|
|
||||||
|
// Active
|
||||||
|
if (in_array($name, $def))
|
||||||
|
{
|
||||||
|
print '<td align="center">'."\n";
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del_default&value='.$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_default&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defaut
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($conf->global->USERGROUP_ADDON_PDF == $name)
|
||||||
|
{
|
||||||
|
print img_picto($langs->trans("Default"),'on');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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 '</td>';
|
||||||
|
|
||||||
|
// Info
|
||||||
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||||
|
if ($module->type == 'pdf')
|
||||||
|
{
|
||||||
|
$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
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($module->type == 'pdf')
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'contract').'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print img_object($langs->trans("PreviewNotAvailable"),'generic');
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print "<br>";
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@@ -319,6 +319,33 @@ abstract class CommonDocGenerator
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define array with couple subtitution key => subtitution value
|
||||||
|
*
|
||||||
|
* @param Object $object Dolibarr Object
|
||||||
|
* @param Translate $outputlangs Language object for output
|
||||||
|
* @param boolean $recursive Want to fetch child array or child object
|
||||||
|
* @return array Array of substitution key->code
|
||||||
|
*/
|
||||||
|
function get_substitutionarray_each_var_object(&$object,$outputlangs,$recursive=true) {
|
||||||
|
$array_other = array();
|
||||||
|
if(!empty($object)) {
|
||||||
|
foreach($object as $key => $value) {
|
||||||
|
if(!empty($value)) {
|
||||||
|
if(!is_array($value) && !is_object($value)) {
|
||||||
|
$array_other['object_'.$key] = $value;
|
||||||
|
}
|
||||||
|
if(is_array($value) && $recursive){
|
||||||
|
$array_other['object_'.$key] = $this->get_substitutionarray_each_var_object($value,$outputlangs,false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $array_other;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define array with couple substitution key => substitution value
|
* Define array with couple substitution key => substitution value
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3895,6 +3895,7 @@ abstract class CommonObject
|
|||||||
$srctemplatepath=$tmp[1];
|
$srctemplatepath=$tmp[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Search template files
|
// Search template files
|
||||||
$file=''; $classname=''; $filefound=0;
|
$file=''; $classname=''; $filefound=0;
|
||||||
$dirmodels=array('/');
|
$dirmodels=array('/');
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ class Conf
|
|||||||
$this->propal = new stdClass();
|
$this->propal = new stdClass();
|
||||||
$this->facture = new stdClass();
|
$this->facture = new stdClass();
|
||||||
$this->contrat = new stdClass();
|
$this->contrat = new stdClass();
|
||||||
|
$this->usergroup = new stdClass();
|
||||||
$this->adherent = new stdClass();
|
$this->adherent = new stdClass();
|
||||||
$this->bank = new stdClass();
|
$this->bank = new stdClass();
|
||||||
$this->notification = new stdClass();
|
$this->notification = new stdClass();
|
||||||
@@ -324,6 +325,10 @@ class Conf
|
|||||||
$this->user->dir_output=$rootforuser."/users";
|
$this->user->dir_output=$rootforuser."/users";
|
||||||
$this->user->dir_temp=$rootforuser."/users/temp";
|
$this->user->dir_temp=$rootforuser."/users/temp";
|
||||||
|
|
||||||
|
// UserGroup
|
||||||
|
$this->usergroup->dir_output=$rootforuser."/usergroups";
|
||||||
|
$this->usergroup->dir_temp=$rootforuser."/usergroups/temp";
|
||||||
|
|
||||||
// For propal storage
|
// For propal storage
|
||||||
$this->propal->dir_output=$rootfordata."/propale";
|
$this->propal->dir_output=$rootfordata."/propale";
|
||||||
$this->propal->dir_temp=$rootfordata."/propale/temp";
|
$this->propal->dir_temp=$rootfordata."/propale/temp";
|
||||||
|
|||||||
@@ -1530,7 +1530,6 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
|
|||||||
|
|
||||||
$const=$obj->description;
|
$const=$obj->description;
|
||||||
$dirtoscan.=($dirtoscan?',':'').preg_replace('/[\r\n]+/',',',trim($conf->global->$const));
|
$dirtoscan.=($dirtoscan?',':'').preg_replace('/[\r\n]+/',',',trim($conf->global->$const));
|
||||||
|
|
||||||
$listoffiles=array();
|
$listoffiles=array();
|
||||||
|
|
||||||
// Now we add models found in directories scanned
|
// Now we add models found in directories scanned
|
||||||
|
|||||||
@@ -239,6 +239,11 @@ function user_admin_prepare_head()
|
|||||||
$head[$h][2] = 'card';
|
$head[$h][2] = 'card';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/admin/usergroup.php';
|
||||||
|
$head[$h][1] = $langs->trans("Group");
|
||||||
|
$head[$h][2] = 'usergroupcard';
|
||||||
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
|
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
|
||||||
$head[$h][1] = $langs->trans("ExtraFields");
|
$head[$h][1] = $langs->trans("ExtraFields");
|
||||||
$head[$h][2] = 'attributes';
|
$head[$h][2] = 'attributes';
|
||||||
|
|||||||
@@ -24,6 +24,43 @@
|
|||||||
* \class ModeleProductCode
|
* \class ModeleProductCode
|
||||||
* \brief Parent class for product code generators
|
* \brief Parent class for product code generators
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/modules/contract/modules_contract.php
|
||||||
|
* \ingroup contract
|
||||||
|
* \brief File with parent class for generating contracts to 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 ModelePDFProduct extends CommonDocGenerator
|
||||||
|
{
|
||||||
|
var $error='';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of active generation modules
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param integer $maxfilenamelength Max length of value to show
|
||||||
|
* @return array List of templates
|
||||||
|
*/
|
||||||
|
static function liste_modeles($db,$maxfilenamelength=0)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$type='product';
|
||||||
|
$liste=array();
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
$liste=getListOfModels($db,$type,$maxfilenamelength);
|
||||||
|
return $liste;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
abstract class ModeleProductCode
|
abstract class ModeleProductCode
|
||||||
{
|
{
|
||||||
var $error='';
|
var $error='';
|
||||||
|
|||||||
62
htdocs/core/modules/user/modules_user.class.php
Normal file
62
htdocs/core/modules/user/modules_user.class.php
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.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/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \class ModeleProductCode
|
||||||
|
* \brief Parent class for product code generators
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/modules/contract/modules_contract.php
|
||||||
|
* \ingroup contract
|
||||||
|
* \brief File with parent class for generating contracts to 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 ModelePDFUser extends CommonDocGenerator
|
||||||
|
{
|
||||||
|
var $error='';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of active generation modules
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param integer $maxfilenamelength Max length of value to show
|
||||||
|
* @return array List of templates
|
||||||
|
*/
|
||||||
|
static function liste_modeles($db,$maxfilenamelength=0)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$type='user';
|
||||||
|
$liste=array();
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
$liste=getListOfModels($db,$type,$maxfilenamelength);
|
||||||
|
return $liste;
|
||||||
|
}
|
||||||
|
}
|
||||||
62
htdocs/core/modules/usergroup/modules_usergroup.class.php
Normal file
62
htdocs/core/modules/usergroup/modules_usergroup.class.php
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.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/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \class ModeleProductCode
|
||||||
|
* \brief Parent class for product code generators
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/modules/contract/modules_contract.php
|
||||||
|
* \ingroup contract
|
||||||
|
* \brief File with parent class for generating contracts to 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 ModelePDFUserGroup extends CommonDocGenerator
|
||||||
|
{
|
||||||
|
var $error='';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of active generation modules
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param integer $maxfilenamelength Max length of value to show
|
||||||
|
* @return array List of templates
|
||||||
|
*/
|
||||||
|
static function liste_modeles($db,$maxfilenamelength=0)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$type='usergroup';
|
||||||
|
$liste=array();
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
$liste=getListOfModels($db,$type,$maxfilenamelength);
|
||||||
|
return $liste;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,6 +63,7 @@ create table llx_user
|
|||||||
fk_user integer, -- Hierarchic parent
|
fk_user integer, -- Hierarchic parent
|
||||||
note_public text,
|
note_public text,
|
||||||
note text DEFAULT NULL,
|
note text DEFAULT NULL,
|
||||||
|
model_pdf varchar(255) DEFAULT NULL,
|
||||||
datelastlogin datetime,
|
datelastlogin datetime,
|
||||||
datepreviouslogin datetime,
|
datepreviouslogin datetime,
|
||||||
egroupware_id integer,
|
egroupware_id integer,
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ create table llx_usergroup
|
|||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
datec datetime,
|
datec datetime,
|
||||||
tms timestamp,
|
tms timestamp,
|
||||||
note text
|
note text,
|
||||||
|
model_pdf varchar(255) DEFAULT NULL,
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -3429,6 +3429,41 @@ class Product extends CommonObject
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a document onto disk according to template module.
|
||||||
|
*
|
||||||
|
* @param string $modele Force model to use ('' to not force)
|
||||||
|
* @param Translate $outputlangs Object langs to use for output
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||||
|
{
|
||||||
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
|
$langs->load("products");
|
||||||
|
|
||||||
|
// Positionne le modele sur le nom du modele a utiliser
|
||||||
|
if (! dol_strlen($modele))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->PRODUCT_ADDON_PDF))
|
||||||
|
{
|
||||||
|
$modele = $conf->global->PRODUCT_ADDON_PDF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$modele = 'strato';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelpath = "core/modules/product/doc/";
|
||||||
|
|
||||||
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return label of status of object
|
* Return label of status of object
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ require '../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
@@ -590,6 +591,11 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Actions to build doc
|
||||||
|
$upload_dir = $conf->user->dir_output;
|
||||||
|
$permissioncreate=$user->rights->user->user->creer;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -600,6 +606,7 @@ if (empty($reshook)) {
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formother=new FormOther($db);
|
$formother=new FormOther($db);
|
||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
llxHeader('',$langs->trans("UserCard"));
|
llxHeader('',$langs->trans("UserCard"));
|
||||||
|
|
||||||
@@ -2339,8 +2346,41 @@ else
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||||
|
/*
|
||||||
|
* Documents generes
|
||||||
|
*/
|
||||||
|
$filename = dol_sanitizeFileName($object->ref);
|
||||||
|
$filedir = $conf->user->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
|
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||||
|
$genallowed = $user->rights->user->user->creer;
|
||||||
|
$delallowed = $user->rights->user->user->supprimer;
|
||||||
|
|
||||||
|
$var = true;
|
||||||
|
|
||||||
|
$somethingshown = $formfile->show_documents('user', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
|
||||||
|
|
||||||
|
// Linked object block
|
||||||
|
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||||
|
|
||||||
|
// Show links to link elements
|
||||||
|
$linktoelem = $form->showLinkToObjectBlock($object);
|
||||||
|
if ($linktoelem) print '<br>'.$linktoelem;
|
||||||
|
|
||||||
|
|
||||||
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
// List of actions on element
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
|
$formactions = new FormActions($db);
|
||||||
|
$somethingshown = $formactions->showactions($object, 'user', $socid);
|
||||||
|
|
||||||
|
|
||||||
|
print '</div></div></div>';
|
||||||
|
|
||||||
if (! empty($conf->ldap->enabled) && ! empty($object->ldap_sid)) $ldap->close;
|
if (! empty($conf->ldap->enabled) && ! empty($object->ldap_sid)) $ldap->close;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->api->enabled) && ! empty($conf->use_javascript_ajax))
|
if (! empty($conf->api->enabled) && ! empty($conf->use_javascript_ajax))
|
||||||
|
|||||||
@@ -2753,5 +2753,39 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a document onto disk according to template module.
|
||||||
|
*
|
||||||
|
* @param string $modele Force model to use ('' to not force)
|
||||||
|
* @param Translate $outputlangs Object langs to use for output
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||||
|
{
|
||||||
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
|
$langs->load("user");
|
||||||
|
|
||||||
|
// Positionne le modele sur le nom du modele a utiliser
|
||||||
|
if (! dol_strlen($modele))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->USER_ADDON_PDF))
|
||||||
|
{
|
||||||
|
$modele = $conf->global->USER_ADDON_PDF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$modele = 'bluesky';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelpath = "core/modules/user/doc/";
|
||||||
|
|
||||||
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -819,5 +819,39 @@ class UserGroup extends CommonObject
|
|||||||
$this->datem=time();
|
$this->datem=time();
|
||||||
$this->members=array($user->id); // Members of this group is just me
|
$this->members=array($user->id); // Members of this group is just me
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a document onto disk according to template module.
|
||||||
|
*
|
||||||
|
* @param string $modele Force model to use ('' to not force)
|
||||||
|
* @param Translate $outputlangs Object langs to use for output
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||||
|
{
|
||||||
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
|
$langs->load("user");
|
||||||
|
|
||||||
|
// Positionne le modele sur le nom du modele a utiliser
|
||||||
|
if (! dol_strlen($modele))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->USERGROUP_ADDON_PDF))
|
||||||
|
{
|
||||||
|
$modele = $conf->global->USERGROUP_ADDON_PDF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$modele = 'grass';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelpath = "core/modules/usergroup/doc/";
|
||||||
|
|
||||||
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ require '../../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
if(! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
if(! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
||||||
|
|
||||||
// Defini si peux lire/modifier utilisateurs et permisssions
|
// Defini si peux lire/modifier utilisateurs et permisssions
|
||||||
@@ -220,6 +221,8 @@ llxHeader('',$langs->trans("GroupCard"));
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$fuserstatic = new User($db);
|
$fuserstatic = new User($db);
|
||||||
|
$form = new Form($db);
|
||||||
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
@@ -495,6 +498,42 @@ else
|
|||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print "<br>";
|
print "<br>";
|
||||||
|
|
||||||
|
// Actions to build doc
|
||||||
|
$upload_dir = $conf->usergroup->dir_output;
|
||||||
|
$permissioncreate=$user->rights->user->user->creer;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Documents generes
|
||||||
|
*/
|
||||||
|
$filename = dol_sanitizeFileName($object->ref);
|
||||||
|
$filedir = $conf->usergroup->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
|
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||||
|
$genallowed = $user->rights->user->user->creer;
|
||||||
|
$delallowed = $user->rights->user->user->supprimer;
|
||||||
|
|
||||||
|
$var = true;
|
||||||
|
|
||||||
|
$somethingshown = $formfile->show_documents('usergroup', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
|
||||||
|
|
||||||
|
// Linked object block
|
||||||
|
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||||
|
|
||||||
|
// Show links to link elements
|
||||||
|
$linktoelem = $form->showLinkToObjectBlock($object);
|
||||||
|
if ($linktoelem) print '<br>'.$linktoelem;
|
||||||
|
|
||||||
|
|
||||||
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
// List of actions on element
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
|
$formactions = new FormActions($db);
|
||||||
|
$somethingshown = $formactions->showactions($object, 'usergroup', $socid);
|
||||||
|
|
||||||
|
|
||||||
|
print '</div></div></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -551,7 +590,6 @@ else
|
|||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user