Browse Source

NEW: add csv separator setup in module admin

florian HENRY 5 years ago
parent
commit
15614abc3f

+ 14 - 5
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 '<table class="noborder centpercent">';
@@ -84,13 +84,22 @@ print '<tr class="oddeven">';
 print '<td>'.$langs->trans("EXPORTS_SHARE_MODELS").'</td>';
 print '<td class="center" width="20">&nbsp;</td>';
 print '<td class="center" width="100">';
-
 print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
 print '<input type="hidden" name="token" value="'.newToken().'">';
 print '<input type="hidden" name="action" value="set_EXPORTS_SHARE_MODELS">';
 echo ajax_constantonoff('EXPORTS_SHARE_MODELS');
 print '</form>';
+print '</td></tr>';
 
+print '<tr class="oddeven">';
+print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
+print '<input type="hidden" name="token" value="'.newToken().'">';
+print '<input type="hidden" name="action" value="setModuleOptions">';
+print '<input type="hidden" name="param" value="EXPORT_CSV_SEPARATOR_TO_USE">';
+print '<td>'.$langs->trans("ExportCsvSeparator").'</td>';
+print '<td width="60" align="center">'."<input size=\"3\" class=\"flat\" type=\"text\" name=\"value\" value=\"".$conf->global->EXPORT_CSV_SEPARATOR_TO_USE."\"></td>";
+print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
+print '</form>';
 print '</td></tr>';
 
 print '</table>';

+ 99 - 0
htdocs/admin/import.php

@@ -0,0 +1,99 @@
+<?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@inodbox.com>
+ * Copyright (C) 2011-2012	Juanjo Menent			<jmenent@2byte.es>
+ * Copyright (C) 2011-2018	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 <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ *	\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 = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
+
+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 '<table class="noborder centpercent">';
+print '<tr class="liste_titre">';
+print '<td>'.$langs->trans("Parameters").'</td>'."\n";
+print '<td class="center" width="20">&nbsp;</td>';
+print '<td class="center" width="100"></td>'."\n";
+
+print '<tr class="oddeven">';
+print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
+print '<input type="hidden" name="token" value="'.newToken().'">';
+print '<input type="hidden" name="action" value="setModuleOptions">';
+print '<input type="hidden" name="param" value="IMPORT_CSV_SEPARATOR_TO_USE">';
+
+print '<td>'.$langs->trans("ImportCsvSeparator").'</td>';
+print '<td width="60" align="center">'."<input size=\"3\" class=\"flat\" type=\"text\" name=\"value\" value=\"".$conf->global->IMPORT_CSV_SEPARATOR_TO_USE."\"></td>";
+print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
+print '</td></tr>';
+print '</form>';
+
+print '</table>';
+
+dol_fiche_end();
+
+// End of page
+llxFooter();
+$db->close();

+ 1 - 1
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

+ 1 - 0
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

+ 2 - 0
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.