Merge pull request #8068 from atm-quentin/NEW_filter_export_model_by_user
NEW export filter models can be share or not by user
This commit is contained in:
commit
8d983717a3
103
htdocs/admin/export.php
Normal file
103
htdocs/admin/export.php
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2011 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) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2011-2015 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/admin/expedition.php
|
||||||
|
* \ingroup expedition
|
||||||
|
* \brief Page d'administration/configuration du module Expedition
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
|
||||||
|
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("exports");
|
||||||
|
|
||||||
|
$langs->load('other');
|
||||||
|
|
||||||
|
if (! $user->admin)
|
||||||
|
accessforbidden();
|
||||||
|
|
||||||
|
$action=GETPOST('action','alpha');
|
||||||
|
$value=GETPOST('value','alpha');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$page_name = "ExportSetup";
|
||||||
|
llxHeader('', $langs->trans($page_name));
|
||||||
|
|
||||||
|
// Subheader
|
||||||
|
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
|
||||||
|
. $langs->trans("BackToModuleList") . '</a>';
|
||||||
|
print_fiche_titre($langs->trans($page_name), $linkback);
|
||||||
|
|
||||||
|
// Configuration header
|
||||||
|
|
||||||
|
dol_fiche_head(
|
||||||
|
$head,
|
||||||
|
'settings',
|
||||||
|
$langs->trans("ExportsArea"),
|
||||||
|
0,
|
||||||
|
"exports"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Setup page goes here
|
||||||
|
$form=new Form($db);
|
||||||
|
$var=false;
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("ExportModel").'</td>'."\n";
|
||||||
|
print '<td align="center" width="20"> </td>';
|
||||||
|
print '<td align="center" width="100"></td>'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
// Example with a yes / no select
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
print '<td>'.$langs->trans("set_EXPORTS_SHARE_MODELS").'</td>';
|
||||||
|
print '<td align="center" width="20"> </td>';
|
||||||
|
print '<td align="center" width="100">';
|
||||||
|
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_EXPORTS_SHARE_MODELS">';
|
||||||
|
echo ajax_constantonoff('EXPORTS_SHARE_MODELS');
|
||||||
|
print '</form>';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
@ -61,13 +61,15 @@ class FormOther
|
|||||||
* @param string $htmlname Nom de la zone select
|
* @param string $htmlname Nom de la zone select
|
||||||
* @param string $type Type des modeles recherches
|
* @param string $type Type des modeles recherches
|
||||||
* @param int $useempty Affiche valeur vide dans liste
|
* @param int $useempty Affiche valeur vide dans liste
|
||||||
|
* @param int $fk_user Utilisateur créant le modèle
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function select_export_model($selected='',$htmlname='exportmodelid',$type='',$useempty=0)
|
function select_export_model($selected='',$htmlname='exportmodelid',$type='',$useempty=0, $fk_user=null)
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid, label";
|
$sql = "SELECT rowid, label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."export_model";
|
$sql.= " FROM ".MAIN_DB_PREFIX."export_model";
|
||||||
$sql.= " WHERE type = '".$type."'";
|
$sql.= " WHERE type = '".$type."'";
|
||||||
|
if(!empty($fk_user))$sql.=" AND fk_user=".$fk_user;
|
||||||
$sql.= " ORDER BY rowid";
|
$sql.= " ORDER BY rowid";
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class modExport extends DolibarrModules
|
|||||||
$this->dirs = array("/export/temp");
|
$this->dirs = array("/export/temp");
|
||||||
|
|
||||||
// Config pages
|
// Config pages
|
||||||
$this->config_page_url = array();
|
$this->config_page_url = array("export.php");
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
$this->depends = array();
|
$this->depends = array();
|
||||||
|
|||||||
@ -697,11 +697,13 @@ class Export
|
|||||||
$sql.= 'label,';
|
$sql.= 'label,';
|
||||||
$sql.= 'type,';
|
$sql.= 'type,';
|
||||||
$sql.= 'field,';
|
$sql.= 'field,';
|
||||||
|
$sql.= 'fk_user,';
|
||||||
$sql.= 'filter';
|
$sql.= 'filter';
|
||||||
$sql.= ') VALUES (';
|
$sql.= ') VALUES (';
|
||||||
$sql.= "'".$this->db->escape($this->model_name)."',";
|
$sql.= "'".$this->db->escape($this->model_name)."',";
|
||||||
$sql.= "'".$this->db->escape($this->datatoexport)."',";
|
$sql.= "'".$this->db->escape($this->datatoexport)."',";
|
||||||
$sql.= "'".$this->db->escape($this->hexa)."',";
|
$sql.= "'".$this->db->escape($this->hexa)."',";
|
||||||
|
$sql.= "'".$user->id."',";
|
||||||
$sql.= "'".$this->db->escape($this->hexafiltervalue)."'";
|
$sql.= "'".$this->db->escape($this->hexafiltervalue)."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
|
|||||||
@ -551,7 +551,8 @@ if ($step == 2 && $datatoexport)
|
|||||||
print '<input type="hidden" name="datatoexport" value="'.$datatoexport.'">';
|
print '<input type="hidden" name="datatoexport" value="'.$datatoexport.'">';
|
||||||
print '<table><tr><td colspan="2">';
|
print '<table><tr><td colspan="2">';
|
||||||
print $langs->trans("SelectExportFields").' ';
|
print $langs->trans("SelectExportFields").' ';
|
||||||
$htmlother->select_export_model($exportmodelid,'exportmodelid',$datatoexport,1);
|
if(empty($conf->global->EXPORTS_SHARE_MODELS))$htmlother->select_export_model($exportmodelid,'exportmodelid',$datatoexport,1,$user->id);
|
||||||
|
else $htmlother->select_export_model($exportmodelid,'exportmodelid',$datatoexport,1);
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
@ -1082,6 +1083,7 @@ if ($step == 4 && $datatoexport)
|
|||||||
$sql = "SELECT rowid, label";
|
$sql = "SELECT rowid, label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."export_model";
|
$sql.= " FROM ".MAIN_DB_PREFIX."export_model";
|
||||||
$sql.= " WHERE type = '".$datatoexport."'";
|
$sql.= " WHERE type = '".$datatoexport."'";
|
||||||
|
if(empty($conf->global->EXPORTS_SHARE_MODELS))$sql.=" AND fk_user=".$user->id;
|
||||||
$sql.= " ORDER BY rowid";
|
$sql.= " ORDER BY rowid";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -131,3 +131,7 @@ KeysToUseForUpdates=Clé à utiliser pour mettre à jour les données
|
|||||||
NbInsert=Nombre de lignes insérées: %s
|
NbInsert=Nombre de lignes insérées: %s
|
||||||
NbUpdate=Nombre de lignes mises à jour: %s
|
NbUpdate=Nombre de lignes mises à jour: %s
|
||||||
MultipleRecordFoundWithTheseFilters=Plusieurs enregistrements ont été trouvés avec ces filtres: %s
|
MultipleRecordFoundWithTheseFilters=Plusieurs enregistrements ont été trouvés avec ces filtres: %s
|
||||||
|
## setup page
|
||||||
|
ExportSetup=Configuration du module Export
|
||||||
|
ExportModel = Modèle d'export
|
||||||
|
set_EXPORTS_SHARE_MODELS = Partager tous les profils d'export
|
||||||
Loading…
Reference in New Issue
Block a user