diff --git a/htdocs/boxes.php b/htdocs/boxes.php index 4d580f437d46032559127daf0fbd496704596273..27e133882368132529850fee1e48d4bb7e4204e8 100644 --- a/htdocs/boxes.php +++ b/htdocs/boxes.php @@ -209,7 +209,7 @@ class InfoBox $part=split(':',$collist); $colonne=$part[0]; $list=$part[1]; - dol_syslog('InfoBox::saveboxorder colonne='.$colonne.' list='.$list); + dol_syslog('InfoBox::saveboxorder column='.$colonne.' list='.$list); $i=0; $listarray=split(',',$list); diff --git a/htdocs/imports/ajaximport.php b/htdocs/imports/ajaximport.php new file mode 100644 index 0000000000000000000000000000000000000000..c5bb91d8707b39056efba771a8a500b3ac73f034 --- /dev/null +++ b/htdocs/imports/ajaximport.php @@ -0,0 +1,61 @@ +<?php +/* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> + * Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net> + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + * \file htdocs/ajaximport.php + * \brief File to return Ajax response on Fields move in import page + * \version $Id$ + */ + +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); + +// This is to make Dolibarr working with Plesk +set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); + +// Retrieve the entity in the cookie +$entityCookieName = "DOLENTITYID_dolibarr"; +if (isset($_COOKIE[$entityCookieName])) $_SESSION["dol_entity"] = $_COOKIE[$entityCookieName]; + +require('../master.inc.php'); + +// Enregistrement de la position des champs + +//$_SESSION["dol_array_match_file_to_database"] +dol_syslog("AjaxImport boxorder=".$_GET['boxorder']." userid=".$_GET['userid'], LOG_DEBUG); + +$part=split(':',$collist); +$colonne=$part[0]; +$list=$part[1]; +dol_syslog('AjaxImport column='.$colonne.' list='.$list); + + +// We define array_match_file_to_database +$array_match_file_to_database=array(); + + + +// We save new matching in session +$_SESSION["dol_array_match_file_to_database"]=$array_match_file_to_database; + +?> diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 5789e6c6c0f096171dd133696b0ec52f5dcded22..9c9d8a55887f2daa4fdd4940a00a9f4120362ffe 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -20,7 +20,7 @@ /** * \file htdocs/imports/import.php * \ingroup import - * \brief Page d'edition d'un import + * \brief Edit import page * \version $Id$ */ @@ -85,53 +85,6 @@ $sqlusedforimport=''; * Actions */ -/* -if ($action=='selectfield') -{ - if ($_GET["field"]=='all') - { - $fieldsarray=$objimport->array_import_alias[0]; - foreach($fieldsarray as $key=>$val) - { - if (! empty($array_match_file_to_database[$key])) continue; // If already selected, select next - $array_match_file_to_database[$key]=sizeof($array_match_file_to_database)+1; - //print_r($array_match_file_to_database); - $_SESSION["dol_array_match_file_to_database"]=$array_match_file_to_database; - } - } - else - { - $array_match_file_to_database[$_GET["field"]]=sizeof($array_match_file_to_database)+1; - //print_r($array_match_file_to_database); - $_SESSION["dol_array_match_file_to_database"]=$array_match_file_to_database; - } - -} -if ($action=='unselectfield') -{ - if ($_GET["field"]=='all') - { - $array_match_file_to_database=array(); - $_SESSION["dol_array_match_file_to_database"]=$array_match_file_to_database; - } - else - { - unset($array_match_file_to_database[$_GET["field"]]); - // Renumber fields of array_selected (from 1 to nb_elements) - asort($array_match_file_to_database); - $i=0; - $array_match_file_to_database_save=$array_match_file_to_database; - foreach($array_match_file_to_database as $code=>$value) - { - $i++; - $array_match_file_to_database[$code]=$i; - //print "x $code x $i y<br>"; - } - $_SESSION["dol_array_match_file_to_database"]=$array_match_file_to_database; - } -} -*/ - if ($action=='downfield' || $action=='upfield') { $pos=$array_match_file_to_database[$_GET["field"]]; @@ -180,9 +133,9 @@ if ($action == 'deleteprof') } } +// Save import config to file if ($action == 'add_import_model') { - // TODO Save a matching model if ($import_name) { asort($array_match_file_to_database); @@ -222,7 +175,8 @@ if ($action == 'add_import_model') if ($step == 3 && $action == 'select_model') { - // TODO Use a matching model + // Load model from $importmodelid and set $array_match_file_to_database + // and $_SESSION["dol_array_match_file_to_database"] $_SESSION["dol_array_match_file_to_database"]=array(); $array_match_file_to_database=array(); $result = $objimport->fetch($importmodelid); @@ -468,6 +422,7 @@ if ($step == 2 && $datatoimport) } +// Page to make matching between source file and database fields if ($step == 3 && $datatoimport) { // Load source fields in input file @@ -508,11 +463,9 @@ if ($step == 3 && $datatoimport) $_SESSION["dol_array_match_file_to_database"]=$array_match_file_to_database; } + llxHeader('',$langs->trans("NewImport"),'EN:Module_Imports_En|FR:Module_Imports|ES:Módulo_Importaciones'); - /* - * Affichage onglets - */ $h = 0; $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=1'; @@ -705,7 +658,7 @@ if ($step == 3 && $datatoimport) print "\n"; print '<script type="text/javascript" language="javascript">'; print 'function updateOrder(){'; - print 'var left_list = cleanSerialize(Sortable.serialize(\'left\'));'; + print 'var left_list = cleanSerialize(Sortable.serialize(\'left\'));'; //print 'var right_list = cleanSerialize(Sortable.serialize(\'right\'));'; print 'var boxorder = \'A:\' + left_list;'; //print 'var boxorder = \'A:\' + left_list + \'-B:\' + right_list;'; @@ -715,7 +668,7 @@ if ($step == 3 && $datatoimport) print 'o_options = new Object();'; print 'o_options = {asynchronous:true,method: \'get\',parameters: \'boxorder=\' + boxorder + \'&userid=\' + userid};'; print 'var myAjax = new Ajax.Request(url, o_options);'; - print '}'; + print '}'; print "\n"; print '// <![CDATA['."\n"; @@ -959,11 +912,21 @@ function show_elem($fieldssource,$pos,$var,$key) print '<tr class="liste_total" height="20">'; if (empty($key)) { - print '<td class="nocellnopadding" colspan="2"> </td>'; + print '<td class="nocellnopadding" width="16" style="font-weight: normal">'; + print img_picto($langs->trans("MoveBox",$pos),'uparrow','class="boxhandle" style="cursor:move;"'); + print '</td>'; + print '<td style="font-weight: normal">'; + print $langs->trans("NoFields"); + print '</td>'; } elseif ($key == 'none') { - print '<td class="nocellnopadding" colspan="2" style="font-weight: normal">'.$langs->trans("NoDiscardedFields").'</td>'; + print '<td class="nocellnopadding" width="16" style="font-weight: normal">'; + print img_picto($langs->trans("MoveBox",$pos),'uparrow','class="boxhandle" style="cursor:move;"'); + print '</td>'; + print '<td style="font-weight: normal">'; + print $langs->trans("NoFields"); + print '</td>'; } else { @@ -974,7 +937,7 @@ function show_elem($fieldssource,$pos,$var,$key) print '</td>'; print '<td style="font-weight: normal">'; print $langs->trans("Field").' '.$key.': '; - print $fieldssource[$key]['name'].' ('.$fieldssource[$key]['example1'].')'; + print '<b>'.$fieldssource[$key]['name'].'</b> ('.$fieldssource[$key]['example1'].')'; print '</td>'; } print '</tr>'; diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index ec326bc94982d1956366c680f57488b2315178c9..40a2f7c63bdc67bb8bc3ecd8d67240efde19f509 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -61,3 +61,4 @@ FileMustHaveOneOfFollowingFormat=File to import must have one of following forma ChooseFileToImport=Upload or choose file to import then click on picto %s ... FieldsInSourceFile=Fields in source file FieldsInTargetDatabase=Target fields in Dolibarr database +NoFields=No fields \ No newline at end of file diff --git a/htdocs/langs/fr_FR/exports.lang b/htdocs/langs/fr_FR/exports.lang index cc6abd9e0de7f3804b3c51af849c0096e4ab2325..1897761cccac05304750284a3eda88209c03b831 100644 --- a/htdocs/langs/fr_FR/exports.lang +++ b/htdocs/langs/fr_FR/exports.lang @@ -60,4 +60,5 @@ FileToImport=Fichier source à importer FileMustHaveOneOfFollowingFormat=Le fichier à importer doit avoir un des formats suivants ChooseFileToImport=Ajouter ou choisissez le fichier à importer puis cliquez sur le picto %s ... FieldsInSourceFile=Champs dans le fichier source -FieldsInTargetDatabase=Champs cibles dans la base Dolibarr \ No newline at end of file +FieldsInTargetDatabase=Champs cibles dans la base Dolibarr +NoFields=Aucun champ \ No newline at end of file