From 15614abc3fb29e113756a0d8da1796bd75b5819f Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 18 Mar 2020 15:08:58 +0100 Subject: [PATCH] NEW: add csv separator setup in module admin --- htdocs/admin/export.php | 19 +++-- htdocs/admin/import.php | 99 +++++++++++++++++++++++++ htdocs/core/modules/modImport.class.php | 2 +- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/exports.lang | 2 + 5 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 htdocs/admin/import.php diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php index 107954fa4cd..f18b2357cf6 100644 --- a/htdocs/admin/export.php +++ b/htdocs/admin/export.php @@ -23,9 +23,9 @@ */ /** - * \file htdocs/admin/expedition.php - * \ingroup expedition - * \brief Page d'administration/configuration du module Expedition + * \file htdocs/admin/export.php + * \ingroup export + * \brief config Page module Export */ require '../main.inc.php'; @@ -69,7 +69,7 @@ $head[$h][1] = $langs->trans("Setup"); $head[$h][2] = 'setup'; $h++; -dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "exports"); +dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "technic"); print ''; @@ -84,13 +84,22 @@ print ''; print ''; print ''; print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print '"; +print ''; +print ''; print ''; print '
'.$langs->trans("EXPORTS_SHARE_MODELS").' '; - print '
'; print ''; print ''; echo ajax_constantonoff('EXPORTS_SHARE_MODELS'); print '
'; +print '
'.$langs->trans("ExportCsvSeparator").''."global->EXPORT_CSV_SEPARATOR_TO_USE."\">
'; diff --git a/htdocs/admin/import.php b/htdocs/admin/import.php new file mode 100644 index 00000000000..898d5dc4900 --- /dev/null +++ b/htdocs/admin/import.php @@ -0,0 +1,99 @@ + + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2018 Philippe Grand + * + * 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 . + */ + +/** + * \file htdocs/admin/import.php + * \ingroup import + * \brief config page module import + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'exports', 'other')); + +if (!$user->admin) + accessforbidden(); + +$action = GETPOST('action', 'alpha'); +$value = GETPOST('value', 'alpha'); + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + + +/* + * View + */ + +$form = new Form($db); + +$page_name = "ImportSetup"; +llxHeader('', $langs->trans($page_name)); + +// Subheader +$linkback = ''.$langs->trans("BackToModuleList").''; + +print load_fiche_titre($langs->trans($page_name), $linkback); + +//$head = export_admin_prepare_head(); +$h = 0; +$head = array(); +$head[$h][0] = DOL_URL_ROOT.'/admin/import.php'; +$head[$h][1] = $langs->trans("Setup"); +$head[$h][2] = 'setup'; +$h++; + +dol_fiche_head($head, 'setup', $langs->trans("ImportArea"), -1, "technic"); + + +print ''; +print ''; +print ''."\n"; +print ''; +print ''."\n"; + +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; +print '"; +print ''; +print ''; +print ''; + +print '
'.$langs->trans("Parameters").' 
'.$langs->trans("ImportCsvSeparator").''."global->IMPORT_CSV_SEPARATOR_TO_USE."\">
'; + +dol_fiche_end(); + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/core/modules/modImport.class.php b/htdocs/core/modules/modImport.class.php index 6071f04fc44..c725660f239 100644 --- a/htdocs/core/modules/modImport.class.php +++ b/htdocs/core/modules/modImport.class.php @@ -57,7 +57,7 @@ class modImport extends DolibarrModules $this->dirs = array("/import/temp"); // Config pages - $this->config_page_url = array(); + $this->config_page_url = array("import.php"); // Dependencies $this->hidden = false; // A condition to hide module diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7a4de856ba2..62119428b9a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1959,6 +1959,7 @@ WarningValueHigherSlowsDramaticalyOutput=Warning, higher values slows dramatical ModuleActivated=Module %s is activated and slows the interface EXPORTS_SHARE_MODELS=Export models are share with everybody ExportSetup=Setup of module Export +ImportSetup=Setup of module Import InstanceUniqueID=Unique ID of the instance SmallerThan=Smaller than LargerThan=Larger than diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index 2dcf4317e00..3549e3f8b23 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -26,6 +26,8 @@ FieldTitle=Field title NowClickToGenerateToBuildExportFile=Now, select the file format in the combo box and click on "Generate" to build the export file... AvailableFormats=Available Formats LibraryShort=Library +ExportCsvSeparator=Csv caracter separator +ImportCsvSeparator=Csv caracter separator Step=Step FormatedImport=Import Assistant FormatedImportDesc1=This module allows you to update existing data or add new objects into the database from a file without technical knowledge, using an assistant.