Skip to content
Newer
Older
100644 813 lines (681 sloc) 25.6 KB
b321ce7 @eldy Suite de la fonction g�n�rique d'export
eldy authored
1 <?php
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
2 /* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
47cde9d New: early development of multi-company module
Regis Houssin authored
3 * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
b321ce7 @eldy Suite de la fonction g�n�rique d'export
eldy authored
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20 /**
8b12e7c @eldy Work on import module
eldy authored
21 * \file htdocs/exports/export.php
22 * \ingroup export
23 * \brief Page d'edition d'un export
24 * \version $Id$
25 */
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
26
54f160a @eldy Suite fonction g�n�rique export
eldy authored
27 require_once("./pre.inc.php");
eeb8bfa @eldy Qual: D�placement show_document dans html.formfile.class.php
eldy authored
28 require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
211be07 @eldy Reduce amount of memory.
eldy authored
29 require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php");
54f160a @eldy Suite fonction g�n�rique export
eldy authored
30 require_once(DOL_DOCUMENT_ROOT."/exports/export.class.php");
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
31 require_once(DOL_DOCUMENT_ROOT.'/includes/modules/export/modules_export.php');
32
54f160a @eldy Suite fonction g�n�rique export
eldy authored
33 $langs->load("exports");
b321ce7 @eldy Suite de la fonction g�n�rique d'export
eldy authored
34
d8281ab @eldy Fix: Everybody should be able to make exports
eldy authored
35 // Everybody should be able to go on this page
36 //if (! $user->admin)
37 // accessforbidden();
b321ce7 @eldy Suite de la fonction g�n�rique d'export
eldy authored
38
c1d3521 @eldy New: Am�lioration du module de gestion des adh�rents
eldy authored
39 $entitytoicon=array(
40 'invoice'=>'bill','invoice_line'=>'bill',
136fc5e @eldy New: Ajout export des r�glements fournisseurs
eldy authored
41 'order'=>'order' ,'order_line'=>'order',
d154c26 @eldy Can export commercial proposals
eldy authored
42 'propal'=>'propal', 'propal_line'=>'propal',
8104948 @eldy New: task #7560 : Droit et definition d'un filtre d'export des interv…
eldy authored
43 'intervention'=>'intervention' ,'inter_line'=>'intervention',
136fc5e @eldy New: Ajout export des r�glements fournisseurs
eldy authored
44 'member'=>'user' ,'member_type'=>'group','subscription'=>'payment',
45 'tax'=>'generic' ,'tax_type'=>'generic',
31ba858 @eldy New: Ajout fonction export des relev�s et transactions bancaires
eldy authored
46 'account'=>'account',
cfcab72 @eldy Tache #6967 Export factures/avoirs : manque des champs dans lignes de…
eldy authored
47 'payment'=>'payment',
95bd741 @eldy Fix: Bad translation in exports
eldy authored
48 'product'=>'product','stock'=>'generic','warehouse'=>'stock',
78f894f @eldy Add categories export dataset
eldy authored
49 'category'=>'generic',
88532cb @eldy New: Export stocks
eldy authored
50 'other'=>'generic',
51 );
b7b1a25 @eldy Fix: Traduction libell� fonctions exports
eldy authored
52 $entitytolang=array( // Translation code
c1d3521 @eldy New: Am�lioration du module de gestion des adh�rents
eldy authored
53 'user'=>'User',
54 'company'=>'Company','contact'=>'Contact',
55 'invoice'=>'Bill','invoice_line'=>'InvoiceLine',
76d6c7f Ajout des commandes clients dans l'assistant export
Regis Houssin authored
56 'order'=>'Order','order_line'=>'OrderLine',
d154c26 @eldy Can export commercial proposals
eldy authored
57 'propal'=>'Proposal','propal_line'=>'ProposalLine',
8104948 @eldy New: task #7560 : Droit et definition d'un filtre d'export des interv…
eldy authored
58 'intervention'=>'Intervention' ,'inter_line'=>'InterLine',
136fc5e @eldy New: Ajout export des r�glements fournisseurs
eldy authored
59 'member'=>'Member','member_type'=>'MemberType','subscription'=>'Subscription',
60 'tax'=>'SocialContribution','tax_type'=>'DictionnarySocialContributions',
31ba858 @eldy New: Ajout fonction export des relev�s et transactions bancaires
eldy authored
61 'account'=>'BankTransactions',
cfcab72 @eldy Tache #6967 Export factures/avoirs : manque des champs dans lignes de…
eldy authored
62 'payment'=>'Payment',
95bd741 @eldy Fix: Bad translation in exports
eldy authored
63 'product'=>'Product','stock'=>'Stock','warehouse'=>'Warehouse',
78f894f @eldy Add categories export dataset
eldy authored
64 'category'=>'Category',
88532cb @eldy New: Export stocks
eldy authored
65 'other'=>'Other'
66 );
89e4d8a @eldy New: Am�lioration de la fonction d'export pour afficher picto de l'en…
eldy authored
67
a672cc1 @eldy New: Ajout module export
eldy authored
68 $array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array();
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
69 $datatoexport=isset($_GET["datatoexport"])? $_GET["datatoexport"] : (isset($_POST["datatoexport"])?$_POST["datatoexport"]:'');
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
70 $action=isset($_GET["action"]) ? $_GET["action"] : (isset($_POST["action"])?$_POST["action"]:'');
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
71 $step=isset($_GET["step"])? $_GET["step"] : (isset($_POST["step"])?$_POST["step"]:1);
72 $export_name=isset($_POST["export_name"])? $_POST["export_name"] : '';
73 $hexa=isset($_POST["hexa"])? $_POST["hexa"] : '';
74 $exportmodelid=isset($_POST["exportmodelid"])? $_POST["exportmodelid"] : '';
b321ce7 @eldy Suite de la fonction g�n�rique d'export
eldy authored
75
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
76 $objexport=new Export($db);
77 $objexport->load_arrays($user,$datatoexport);
78
c1d3521 @eldy New: Am�lioration du module de gestion des adh�rents
eldy authored
79 $objmodelexport=new ModeleExports();
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
80 $html = new Form($db);
211be07 @eldy Reduce amount of memory.
eldy authored
81 $htmlother = new FormOther($db);
eeb8bfa @eldy Qual: D�placement show_document dans html.formfile.class.php
eldy authored
82 $formfile = new FormFile($db);
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
83 $sqlusedforexport='';
b321ce7 @eldy Suite de la fonction g�n�rique d'export
eldy authored
84
a672cc1 @eldy New: Ajout module export
eldy authored
85
86 /*
87 * Actions
88 */
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
89
a672cc1 @eldy New: Ajout module export
eldy authored
90 if ($action=='selectfield')
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
91 {
2dbd038 @eldy Added option All/None in export module step 2
eldy authored
92 if ($_GET["field"]=='all')
93 {
94 $fieldsarray=$objexport->array_export_alias[0];
95 foreach($fieldsarray as $key=>$val)
96 {
97 if (! empty($array_selected[$key])) continue; // If already selected, select next
98 $array_selected[$key]=sizeof($array_selected)+1;
99 //print_r($array_selected);
100 $_SESSION["export_selected_fields"]=$array_selected;
101 }
102 }
103 else
104 {
105 $array_selected[$_GET["field"]]=sizeof($array_selected)+1;
106 //print_r($array_selected);
107 $_SESSION["export_selected_fields"]=$array_selected;
108 }
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
109
a672cc1 @eldy New: Ajout module export
eldy authored
110 }
111 if ($action=='unselectfield')
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
112 {
2dbd038 @eldy Added option All/None in export module step 2
eldy authored
113 if ($_GET["field"]=='all')
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
114 {
2dbd038 @eldy Added option All/None in export module step 2
eldy authored
115 $array_selected=array();
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
116 $_SESSION["export_selected_fields"]=$array_selected;
2dbd038 @eldy Added option All/None in export module step 2
eldy authored
117 }
118 else
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
119 {
2dbd038 @eldy Added option All/None in export module step 2
eldy authored
120 unset($array_selected[$_GET["field"]]);
121 // Renumber fields of array_selected (from 1 to nb_elements)
122 asort($array_selected);
123 $i=0;
124 $array_selected_save=$array_selected;
125 foreach($array_selected as $code=>$value)
126 {
127 $i++;
128 $array_selected[$code]=$i;
129 //print "x $code x $i y<br>";
130 }
131 $_SESSION["export_selected_fields"]=$array_selected;
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
132 }
133 }
134 if ($action=='downfield' || $action=='upfield')
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
135 {
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
136 $pos=$array_selected[$_GET["field"]];
137 if ($action=='downfield') $newpos=$pos+1;
138 if ($action=='upfield') $newpos=$pos-1;
924f541 @eldy Work on import module
eldy authored
139 // Recherche code avec qui switcher
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
140 $newcode="";
141 foreach($array_selected as $code=>$value)
142 {
143 if ($value == $newpos)
144 {
145 $newcode=$code;
146 break;
147 }
148 }
149 //print("Switch pos=$pos (code=".$_GET["field"].") and newpos=$newpos (code=$newcode)");
924f541 @eldy Work on import module
eldy authored
150 if ($newcode) // Si newcode trouve (protection contre resoumission de page)
040de4c @eldy Fix: Evite mauvais ordre si page de choix ordre export soumise 2 fois.
eldy authored
151 {
152 $array_selected[$_GET["field"]]=$newpos;
153 $array_selected[$newcode]=$pos;
154 $_SESSION["export_selected_fields"]=$array_selected;
155 }
a672cc1 @eldy New: Ajout module export
eldy authored
156 }
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
157
a672cc1 @eldy New: Ajout module export
eldy authored
158 if ($step == 1 || $action == 'cleanselect')
159 {
160 $_SESSION["export_selected_fields"]=array();
4b3dbfa @eldy New: Ajout module export
eldy authored
161 $array_selected=array();
a672cc1 @eldy New: Ajout module export
eldy authored
162 }
54f160a @eldy Suite fonction g�n�rique export
eldy authored
163
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
164 if ($action == 'builddoc')
165 {
f4ecf33 @eldy Fix: Export for bank module always export credit and devit instead of…
eldy authored
166 // Build export file
f191dfc @eldy Fix: Le composant show_document renvoi le model sous le nom 'model' p…
eldy authored
167 $result=$objexport->build_file($user, $_POST['model'], $datatoexport, $array_selected);
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
168 if ($result < 0)
169 {
170 $mesg='<div class="error">'.$objexport->error.'</div>';
171 }
172 else
173 {
3332d0b @eldy New: On g�n�re la requete d'export au moment de l'export plutot que f…
eldy authored
174 $mesg='<div class="ok">'.$langs->trans("FileSuccessfullyBuilt").'</div>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
175 $sqlusedforexport=$objexport->sqlusedforexport;
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
176 }
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
177 }
178
174dcf2 @eldy Can delete an export profil.
eldy authored
179 if ($action == 'deleteprof')
180 {
181 if ($_GET["id"])
182 {
183 $objexport->fetch($_GET["id"]);
184 $result=$objexport->delete($user);
185 }
186 }
187
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
188 if ($action == 'add_export_model')
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
189 {
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
190 if ($export_name)
191 {
192 asort($array_selected);
193
194 // Set save string
195 $hexa='';
196 foreach($array_selected as $key=>$val)
197 {
198 if ($hexa) $hexa.=',';
199 $hexa.=$key;
200 }
201
202 $objexport->model_name = $export_name;
203 $objexport->datatoexport = $datatoexport;
204 $objexport->hexa = $hexa;
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
205
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
206 $result = $objexport->create($user);
207 if ($result >= 0)
208 {
209 $mesg='<div class="ok">'.$langs->trans("ExportModelSaved",$objexport->model_name).'</div>';
210 }
211 else
212 {
174dcf2 @eldy Can delete an export profil.
eldy authored
213 $langs->load("errors");
214 if ($objexport->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
215 {
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
216 $mesg='<div class="error">'.$langs->trans("ErrorExportDuplicateProfil").'</div>';
174dcf2 @eldy Can delete an export profil.
eldy authored
217 }
218 else $mesg='<div class="error">'.$objexport->error.'</div>';
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
219 }
220 }
221 else
222 {
223 $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("ExportModelName")).'</div>';
224 }
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
225 }
226
227 if ($step == 2 && $action == 'select_model')
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
228 {
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
229 $_SESSION["export_selected_fields"]=array();
230 $array_selected=array();
231 $result = $objexport->fetch($exportmodelid);
232 if ($result > 0)
233 {
01291c4 Fix: function "split" is deprecated since php 5.3.0
Regis Houssin authored
234 $fieldsarray=explode(',',$objexport->hexa);
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
235 $i=1;
236 foreach($fieldsarray as $val)
237 {
238 $array_selected[$val]=$i;
239 $i++;
240 }
241 $_SESSION["export_selected_fields"]=$array_selected;
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
242 }
243 }
244
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
245
246 /*
c11cef6 @eldy Add help link to online wiki
eldy authored
247 * View
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
248 */
54f160a @eldy Suite fonction g�n�rique export
eldy authored
249
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
250
a672cc1 @eldy New: Ajout module export
eldy authored
251 if ($step == 1 || ! $datatoexport)
54f160a @eldy Suite fonction g�n�rique export
eldy authored
252 {
c11cef6 @eldy Add help link to online wiki
eldy authored
253 llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:M&oacute;dulo_Exportaciones');
a672cc1 @eldy New: Ajout module export
eldy authored
254
255 /*
256 * Affichage onglets
257 */
258 $h = 0;
259
260 $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1';
bc8f2d8 @eldy Trad: Traduction "Step" dans export
eldy authored
261 $head[$h][1] = $langs->trans("Step")." 1";
a672cc1 @eldy New: Ajout module export
eldy authored
262 $hselected=$h;
263 $h++;
264
265 /*
266 $head[$h][0] = '';
bc8f2d8 @eldy Trad: Traduction "Step" dans export
eldy authored
267 $head[$h][1] = $langs->trans("Step")." 2";
a672cc1 @eldy New: Ajout module export
eldy authored
268 $h++;
269 */
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
270
0823322 @eldy Qual: All call to dolibarr_ functions are made on dol_ functions.
eldy authored
271 dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
a672cc1 @eldy New: Ajout module export
eldy authored
272
273
54f160a @eldy Suite fonction g�n�rique export
eldy authored
274 print '<table class="notopnoleftnoright" width="100%">';
275
276 print $langs->trans("SelectExportDataSet").'<br>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
277
54f160a @eldy Suite fonction g�n�rique export
eldy authored
278 // Affiche les modules d'exports
279 print '<table class="noborder" width="100%">';
280 print '<tr class="liste_titre">';
5369b04 @eldy Trad: Traduction des libell�s d'exports
eldy authored
281 print '<td>'.$langs->trans("Module").'</td>';
54f160a @eldy Suite fonction g�n�rique export
eldy authored
282 print '<td>'.$langs->trans("ExportableDatas").'</td>';
283 print '<td>&nbsp;</td>';
284 print '</tr>';
285 $val=true;
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
286 if (sizeof($objexport->array_export_code))
54f160a @eldy Suite fonction g�n�rique export
eldy authored
287 {
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
288 foreach ($objexport->array_export_code as $key => $value)
54f160a @eldy Suite fonction g�n�rique export
eldy authored
289 {
290 $val=!$val;
5369b04 @eldy Trad: Traduction des libell�s d'exports
eldy authored
291 print '<tr '.$bc[$val].'><td nospan="nospan">';
67303a1 @eldy Use correct icon
eldy authored
292 //print img_object($objexport->array_export_module[$key]->getName(),$export->array_export_module[$key]->picto).' ';
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
293 print $objexport->array_export_module[$key]->getName();
54f160a @eldy Suite fonction g�n�rique export
eldy authored
294 print '</td><td>';
b7b1a25 @eldy Fix: Traduction libell� fonctions exports
eldy authored
295 //print $value;
174dcf2 @eldy Can delete an export profil.
eldy authored
296 print img_object($objexport->array_export_module[$key]->getName(),$objexport->array_export_icon[$key]).' ';
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
297 print $objexport->array_export_label[$key];
a672cc1 @eldy New: Ajout module export
eldy authored
298 print '</td><td align="right">';
66dafbd @eldy Show greyed lines for not allowed export filters
eldy authored
299 if ($objexport->array_export_perms[$key])
300 {
301 print '<a href="'.DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$objexport->array_export_code[$key].'">'.img_picto($langs->trans("NewExport"),'filenew').'</a>';
302 }
303 else
304 {
305 print $langs->trans("NotEnoughPermissions");
306 }
307 print '</td></tr>';
54f160a @eldy Suite fonction g�n�rique export
eldy authored
308 }
309 }
310 else
311 {
c85b9cb @eldy Add first files for import module
eldy authored
312 print '<tr><td '.$bc[false].' colspan="3">'.$langs->trans("NoExportableData").'</td></tr>';
54f160a @eldy Suite fonction g�n�rique export
eldy authored
313 }
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
314 print '</table>';
54f160a @eldy Suite fonction g�n�rique export
eldy authored
315
316 print '</table>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
317
1e06a25 @eldy Qual: Tous les r�pertoires qui servent � g�n�rer des donn�es temporai…
eldy authored
318 print '</div>';
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
319
320 if ($mesg) print $mesg;
321
54f160a @eldy Suite fonction g�n�rique export
eldy authored
322 }
323
a672cc1 @eldy New: Ajout module export
eldy authored
324 if ($step == 2 && $datatoexport)
54f160a @eldy Suite fonction g�n�rique export
eldy authored
325 {
c11cef6 @eldy Add help link to online wiki
eldy authored
326 llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:M&oacute;dulo_Exportaciones');
95bd741 @eldy Fix: Bad translation in exports
eldy authored
327
328
a672cc1 @eldy New: Ajout module export
eldy authored
329 /*
330 * Affichage onglets
331 */
332 $h = 0;
333
334 $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1';
bc8f2d8 @eldy Trad: Traduction "Step" dans export
eldy authored
335 $head[$h][1] = $langs->trans("Step")." 1";
a672cc1 @eldy New: Ajout module export
eldy authored
336 $h++;
337
69c987d @eldy Fix: La suppression d'un fichier faisait quitter la page
eldy authored
338 $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport;
bc8f2d8 @eldy Trad: Traduction "Step" dans export
eldy authored
339 $head[$h][1] = $langs->trans("Step")." 2";
a672cc1 @eldy New: Ajout module export
eldy authored
340 $hselected=$h;
341 $h++;
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
342
0823322 @eldy Qual: All call to dolibarr_ functions are made on dol_ functions.
eldy authored
343 dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
a672cc1 @eldy New: Ajout module export
eldy authored
344
345 print '<table width="100%" class="border">';
346
347 // Module
348 print '<tr><td width="25%">'.$langs->trans("Module").'</td>';
349 print '<td>';
174dcf2 @eldy Can delete an export profil.
eldy authored
350 //print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_module[0]->picto).' ';
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
351 print $objexport->array_export_module[0]->getName();
a672cc1 @eldy New: Ajout module export
eldy authored
352 print '</td></tr>';
353
2dbd038 @eldy Added option All/None in export module step 2
eldy authored
354 // Lot de donnees a exporter
a672cc1 @eldy New: Ajout module export
eldy authored
355 print '<tr><td width="25%">'.$langs->trans("DatasetToExport").'</td>';
174dcf2 @eldy Can delete an export profil.
eldy authored
356 print '<td>';
357 print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_icon[0]).' ';
358 print $objexport->array_export_label[0];
359 print '</td></tr>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
360
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
361 print '</table>';
362 print '<br>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
363
b0e3b12 @eldy Work on import module
eldy authored
364 // Combo list of export models
365 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
e5d222b Fix: r�gression sur l'utilisation des niveau du jeton, on test sur le…
Regis Houssin authored
366 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
367 print '<input type="hidden" name="action" value="select_model">';
368 print '<input type="hidden" name="step" value="2">';
369 print '<input type="hidden" name="datatoexport" value="'.$datatoexport.'">';
b0e3b12 @eldy Work on import module
eldy authored
370 print '<table><tr><td colspan="2">';
371 print $langs->trans("SelectExportFields").' ';
211be07 @eldy Reduce amount of memory.
eldy authored
372 $htmlother->select_export_model($exportmodelid,'exportmodelid',$datatoexport,1);
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
373 print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
374 print '</td></tr></table>';
375 print '</form>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
376
54f160a @eldy Suite fonction g�n�rique export
eldy authored
377
a672cc1 @eldy New: Ajout module export
eldy authored
378 print '<table class="noborder" width="100%">';
89e4d8a @eldy New: Am�lioration de la fonction d'export pour afficher picto de l'en…
eldy authored
379 print '<tr class="liste_titre">';
380 print '<td>'.$langs->trans("Entities").'</td>';
381 print '<td>'.$langs->trans("ExportableFields").'</td>';
d9ecd23 @eldy Work on import module
eldy authored
382 print '<td width="100" align="center">';
2dbd038 @eldy Added option All/None in export module step 2
eldy authored
383 print '<a title='.$langs->trans("All").' alt='.$langs->trans("All").' href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=selectfield&field=all">'.$langs->trans("All")."</a>";
384 print '/';
385 print '<a title='.$langs->trans("None").' alt='.$langs->trans("None").' href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=unselectfield&field=all">'.$langs->trans("None")."</a>";
386 print '</td>';
f444385 @eldy New: Ajout fonction export des relev�s et transactions bancaires
eldy authored
387 print '<td width="44%">'.$langs->trans("ExportedFields").'</td>';
a672cc1 @eldy New: Ajout module export
eldy authored
388 print '</tr>';
389
390 // Champs exportables
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
391 $fieldsarray=$objexport->array_export_fields[0];
d9ecd23 @eldy Work on import module
eldy authored
392 // Select request if all fields are selected
393 $sqlmaxforexport=$objexport->build_sql(0,array());
a672cc1 @eldy New: Ajout module export
eldy authored
394
89e4d8a @eldy New: Am�lioration de la fonction d'export pour afficher picto de l'en…
eldy authored
395 # $this->array_export_module[0]=$module;
396 # $this->array_export_code[0]=$module->export_code[$r];
397 # $this->array_export_label[0]=$module->export_label[$r];
398 # $this->array_export_sql[0]=$module->export_sql[$r];
399 # $this->array_export_fields[0]=$module->export_fields_array[$r];
400 # $this->array_export_entities[0]=$module->export_fields_entities[$r];
401 # $this->array_export_alias[0]=$module->export_fields_alias[$r];
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
402
a672cc1 @eldy New: Ajout module export
eldy authored
403 $var=true;
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
404 $i = 0;
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
405
a672cc1 @eldy New: Ajout module export
eldy authored
406 foreach($fieldsarray as $code=>$label)
407 {
408 $var=!$var;
409 print "<tr $bc[$var]>";
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
410
411 $i++;
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
412
89e4d8a @eldy New: Am�lioration de la fonction d'export pour afficher picto de l'en…
eldy authored
413 $entity=$objexport->array_export_entities[0][$code];
414 $entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity;
415 $entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity;
416
f444385 @eldy New: Ajout fonction export des relev�s et transactions bancaires
eldy authored
417 print '<td nowrap="nowrap">'.img_object('',$entityicon).' '.$langs->trans($entitylang).'</td>';
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
418 if ((isset($array_selected[$code]) && $array_selected[$code]) || $modelchoice == 1)
a672cc1 @eldy New: Ajout module export
eldy authored
419 {
2dbd038 @eldy Added option All/None in export module step 2
eldy authored
420 // Selected fields
a672cc1 @eldy New: Ajout module export
eldy authored
421 print '<td>&nbsp;</td>';
2dbd038 @eldy Added option All/None in export module step 2
eldy authored
422 print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=unselectfield&field='.$code.'">'.img_left().'</a></td>';
d9ecd23 @eldy Work on import module
eldy authored
423 print '<td>';
424 $text=$langs->trans($label);
425 $tablename=getablenamefromfield($code,$sqlmaxforexport);
426 $htmltext =$langs->trans("Table").": <b>".$tablename."</b><br>";
427 $htmltext.=$langs->trans("Field").': <b>'.$code."</b><br>";
428 print $html->textwithpicto($text,$htmltext);
429 //print ' ('.$code.')';
430 print '</td>';
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
431 $bit=1;
a672cc1 @eldy New: Ajout module export
eldy authored
432 }
433 else
434 {
2dbd038 @eldy Added option All/None in export module step 2
eldy authored
435 // Fields not selected
d9ecd23 @eldy Work on import module
eldy authored
436 print '<td>';
437 $text=$langs->trans($label);
438 $tablename=getablenamefromfield($code,$sqlmaxforexport);
439 $htmltext =$langs->trans("Table").": <b>".$tablename."</b><br>";
440 $htmltext.=$langs->trans("Field").': <b>'.$code."</b><br>";
441 print $html->textwithpicto($text,$htmltext);
442 //print ' ('.$code.')';
443 print '</td>';
2dbd038 @eldy Added option All/None in export module step 2
eldy authored
444 print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=selectfield&field='.$code.'">'.img_right().'</a></td>';
a672cc1 @eldy New: Ajout module export
eldy authored
445 print '<td>&nbsp;</td>';
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
446 $bit=0;
a672cc1 @eldy New: Ajout module export
eldy authored
447 }
448
449 print '</tr>';
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
450 $save_select.=$bit;
a672cc1 @eldy New: Ajout module export
eldy authored
451 }
9b96692 Ajout possibilit� d'enregistrer des mod�les d'exports afin de ne pas …
Regis Houssin authored
452
a672cc1 @eldy New: Ajout module export
eldy authored
453 print '</table>';
454
455 print '</div>';
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
456
457 if ($mesg) print $mesg;
458
a672cc1 @eldy New: Ajout module export
eldy authored
459 /*
460 * Barre d'action
461 *
462 */
463 print '<div class="tabsAction">';
464
465 if (sizeof($array_selected))
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
466 {
467 print '<a class="butAction" href="export.php?step=3&datatoexport='.$datatoexport.'">'.$langs->trans("NextStep").'</a>';
2dbd038 @eldy Added option All/None in export module step 2
eldy authored
468 }
469 else
470 {
d9ecd23 @eldy Work on import module
eldy authored
471 print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("SelectAtLeastOneField")).'">'.$langs->trans("NextStep").'</a>';
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
472 }
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
473
1e06a25 @eldy Qual: Tous les r�pertoires qui servent � g�n�rer des donn�es temporai…
eldy authored
474 print '</div>';
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
475
a672cc1 @eldy New: Ajout module export
eldy authored
476 }
477
478 if ($step == 3 && $datatoexport)
479 {
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
480 asort($array_selected);
481
c11cef6 @eldy Add help link to online wiki
eldy authored
482 llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:M&oacute;dulo_Exportaciones');
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
483
a672cc1 @eldy New: Ajout module export
eldy authored
484 /*
485 * Affichage onglets
486 */
487 $h = 0;
488
489 $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1';
bc8f2d8 @eldy Trad: Traduction "Step" dans export
eldy authored
490 $head[$h][1] = $langs->trans("Step")." 1";
a672cc1 @eldy New: Ajout module export
eldy authored
491 $h++;
492
69c987d @eldy Fix: La suppression d'un fichier faisait quitter la page
eldy authored
493 $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport;
bc8f2d8 @eldy Trad: Traduction "Step" dans export
eldy authored
494 $head[$h][1] = $langs->trans("Step")." 2";
a672cc1 @eldy New: Ajout module export
eldy authored
495 $h++;
496
69c987d @eldy Fix: La suppression d'un fichier faisait quitter la page
eldy authored
497 $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport;
bc8f2d8 @eldy Trad: Traduction "Step" dans export
eldy authored
498 $head[$h][1] = $langs->trans("Step")." 3";
a672cc1 @eldy New: Ajout module export
eldy authored
499 $hselected=$h;
500 $h++;
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
501
0823322 @eldy Qual: All call to dolibarr_ functions are made on dol_ functions.
eldy authored
502 dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
a672cc1 @eldy New: Ajout module export
eldy authored
503
504 print '<table width="100%" class="border">';
505
506 // Module
507 print '<tr><td width="25%">'.$langs->trans("Module").'</td>';
508 print '<td>';
174dcf2 @eldy Can delete an export profil.
eldy authored
509 //print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_module[0]->picto).' ';
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
510 print $objexport->array_export_module[0]->getName();
a672cc1 @eldy New: Ajout module export
eldy authored
511 print '</td></tr>';
512
47cde9d New: early development of multi-company module
Regis Houssin authored
513 // Lot de donnees a exporter
a672cc1 @eldy New: Ajout module export
eldy authored
514 print '<tr><td width="25%">'.$langs->trans("DatasetToExport").'</td>';
174dcf2 @eldy Can delete an export profil.
eldy authored
515 print '<td>';
516 print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_icon[0]).' ';
517 print $objexport->array_export_label[0];
518 print '</td></tr>';
a672cc1 @eldy New: Ajout module export
eldy authored
519
47cde9d New: early development of multi-company module
Regis Houssin authored
520 // Nbre champs exportes
a672cc1 @eldy New: Ajout module export
eldy authored
521 print '<tr><td width="25%">'.$langs->trans("ExportedFields").'</td>';
522 $list='';
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
523 foreach($array_selected as $code=>$value)
a672cc1 @eldy New: Ajout module export
eldy authored
524 {
d9ecd23 @eldy Work on import module
eldy authored
525 $list.=($list?', ':'');
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
526 $list.=$langs->trans($objexport->array_export_fields[0][$code]);
a672cc1 @eldy New: Ajout module export
eldy authored
527 }
528 print '<td>'.$list.'</td></tr>';
529
530 print '</table>';
54f160a @eldy Suite fonction g�n�rique export
eldy authored
531 print '<br>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
532
d9ecd23 @eldy Work on import module
eldy authored
533 // Select request if all fields are selected
534 $sqlmaxforexport=$objexport->build_sql(0,array());
535
a672cc1 @eldy New: Ajout module export
eldy authored
536 print $langs->trans("ChooseFieldsOrdersAndTitle").'<br>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
537
a672cc1 @eldy New: Ajout module export
eldy authored
538 print '<table class="noborder" width="100%">';
89e4d8a @eldy New: Am�lioration de la fonction d'export pour afficher picto de l'en…
eldy authored
539 print '<tr class="liste_titre">';
54664b9 Ajout de phpexcelreader afin de lire des fichiers excel
Regis Houssin authored
540 print '<td>'.$langs->trans("Entities").'</td>';
89e4d8a @eldy New: Am�lioration de la fonction d'export pour afficher picto de l'en…
eldy authored
541 print '<td>'.$langs->trans("ExportedFields").'</td>';
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
542 print '<td align="right" colspan="2">'.$langs->trans("Position").'</td>';
d9ecd23 @eldy Work on import module
eldy authored
543 //print '<td>&nbsp;</td>';
544 //print '<td>'.$langs->trans("FieldsTitle").'</td>';
54f160a @eldy Suite fonction g�n�rique export
eldy authored
545 print '</tr>';
546
a672cc1 @eldy New: Ajout module export
eldy authored
547 $var=true;
548 foreach($array_selected as $code=>$value)
549 {
550 $var=!$var;
551 print "<tr $bc[$var]>";
89e4d8a @eldy New: Am�lioration de la fonction d'export pour afficher picto de l'en…
eldy authored
552
553 $entity=$objexport->array_export_entities[0][$code];
554 $entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity;
555 $entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity;
556
557 print '<td>'.img_object('',$entityicon).' '.$langs->trans($entitylang).'</td>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
558
d9ecd23 @eldy Work on import module
eldy authored
559 print '<td>';
560 $text=$langs->trans($objexport->array_export_fields[0][$code]);
561 $tablename=getablenamefromfield($code,$sqlmaxforexport);
562 $htmltext =$langs->trans("Table").": <b>".$tablename."</b><br>";
563 $htmltext.=$langs->trans("Field").': <b>'.$code."</b><br>";
564 print $html->textwithpicto($text,$htmltext);
565 //print ' ('.$code.')';
566 print '</td>';
a672cc1 @eldy New: Ajout module export
eldy authored
567
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
568 print '<td align="right" width="100">';
569 print $value.' ';
570 print '</td><td align="center" width="20">';
69c987d @eldy Fix: La suppression d'un fichier faisait quitter la page
eldy authored
571 if ($value < sizeof($array_selected)) print '<a href="'.$_SERVER["PHP_SELF"].'?step=3&datatoexport='.$datatoexport.'&action=downfield&field='.$code.'">'.img_down().'</a>';
572 if ($value > 1) print '<a href="'.$_SERVER["PHP_SELF"].'?step=3&datatoexport='.$datatoexport.'&action=upfield&field='.$code.'">'.img_up().'</a>';
a672cc1 @eldy New: Ajout module export
eldy authored
573 print '</td>';
574
d9ecd23 @eldy Work on import module
eldy authored
575 //print '<td>&nbsp;</td>';
576 //print '<td>'.$langs->trans($objexport->array_export_fields[0][$code]).'</td>';
a672cc1 @eldy New: Ajout module export
eldy authored
577
578 print '</tr>';
579 }
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
580
a672cc1 @eldy New: Ajout module export
eldy authored
581 print '</table>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
582
583
174dcf2 @eldy Can delete an export profil.
eldy authored
584 print '</div>';
585
586 if ($mesg) print $mesg;
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
587
174dcf2 @eldy Can delete an export profil.
eldy authored
588 /*
589 * Barre d'action
590 *
591 */
592 print '<div class="tabsAction">';
593
594 if (sizeof($array_selected))
595 {
596 print '<a class="butAction" href="export.php?step=4&datatoexport='.$datatoexport.'">'.$langs->trans("NextStep").'</a>';
597 }
598
599 print '</div>';
600
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
601
174dcf2 @eldy Can delete an export profil.
eldy authored
602 // Area for profils export
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
603 if (sizeof($array_selected))
604 {
605 print '<br>';
606 print $langs->trans("SaveExportModel");
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
607
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
608 print '<form class="nocellnopadd" action="export.php" method="post">';
e5d222b Fix: r�gression sur l'utilisation des niveau du jeton, on test sur le…
Regis Houssin authored
609 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
610 print '<input type="hidden" name="action" value="add_export_model">';
611 print '<input type="hidden" name="step" value="'.$step.'">';
612 print '<input type="hidden" name="datatoexport" value="'.$datatoexport.'">';
613 print '<input type="hidden" name="hexa" value="'.$hexa.'">';
614
615 print '<table class="noborder" width="100%">';
616 print '<tr class="liste_titre">';
617 print '<td>'.$langs->trans("ExportModelName").'</td>';
618 print '<td>&nbsp;</td>';
619 print '</tr>';
620 $var=false;
621 print '<tr '.$bc[$var].'>';
174dcf2 @eldy Can delete an export profil.
eldy authored
622 print '<td><input name="export_name" size="32" value=""></td><td align="right">';
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
623 print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
624 print '</td></tr>';
174dcf2 @eldy Can delete an export profil.
eldy authored
625
626 // List of existing export profils
627 $sql = "SELECT rowid, label";
628 $sql.= " FROM ".MAIN_DB_PREFIX."export_model";
629 $sql.= " WHERE type = '".$datatoexport."'";
630 $sql.= " ORDER BY rowid";
631 $resql = $db->query($sql);
632 if ($resql)
633 {
634 $num = $db->num_rows($resql);
635 $i = 0;
636 $var=false;
637 while ($i < $num)
638 {
639 $var=!$var;
640 $obj = $db->fetch_object($resql);
641 print '<tr '.$bc[$var].'><td>';
642 print $obj->label;
643 print '</td><td align="right">';
644 print '<a href="'.$_SERVER["PHP_SELF"].'?step='.$step.'&datatoexport='.$datatoexport.'&action=deleteprof&id='.$obj->rowid.'">';
645 print img_delete();
646 print '</a>';
647 print '</tr>';
648 $i++;
649 }
650 }
651 else {
0823322 @eldy Qual: All call to dolibarr_ functions are made on dol_ functions.
eldy authored
652 dol_print_error($this->db);
174dcf2 @eldy Can delete an export profil.
eldy authored
653 }
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
654
8393500 @eldy Am�lioration sauvegarde profil export:
eldy authored
655 print '</table>';
656 print '</form>';
657 }
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
658
a672cc1 @eldy New: Ajout module export
eldy authored
659 }
660
661 if ($step == 4 && $datatoexport)
662 {
8b5005b @eldy New: Possibilit� de choisir les ordres des champs dans les exports
eldy authored
663 asort($array_selected);
664
c11cef6 @eldy Add help link to online wiki
eldy authored
665 llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:M&oacute;dulo_Exportaciones');
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
666
a672cc1 @eldy New: Ajout module export
eldy authored
667 /*
668 * Affichage onglets
669 */
670 $h = 0;
671
672 $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1';
bc8f2d8 @eldy Trad: Traduction "Step" dans export
eldy authored
673 $head[$h][1] = $langs->trans("Step")." 1";
a672cc1 @eldy New: Ajout module export
eldy authored
674 $h++;
675
69c987d @eldy Fix: La suppression d'un fichier faisait quitter la page
eldy authored
676 $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport;
bc8f2d8 @eldy Trad: Traduction "Step" dans export
eldy authored
677 $head[$h][1] = $langs->trans("Step")." 2";
a672cc1 @eldy New: Ajout module export
eldy authored
678 $h++;
679
69c987d @eldy Fix: La suppression d'un fichier faisait quitter la page
eldy authored
680 $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport;
bc8f2d8 @eldy Trad: Traduction "Step" dans export
eldy authored
681 $head[$h][1] = $langs->trans("Step")." 3";
a672cc1 @eldy New: Ajout module export
eldy authored
682 $h++;
683
69c987d @eldy Fix: La suppression d'un fichier faisait quitter la page
eldy authored
684 $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=4&datatoexport='.$datatoexport;
bc8f2d8 @eldy Trad: Traduction "Step" dans export
eldy authored
685 $head[$h][1] = $langs->trans("Step")." 4";
a672cc1 @eldy New: Ajout module export
eldy authored
686 $hselected=$h;
687 $h++;
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
688
0823322 @eldy Qual: All call to dolibarr_ functions are made on dol_ functions.
eldy authored
689 dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
a672cc1 @eldy New: Ajout module export
eldy authored
690
691 print '<table width="100%" class="border">';
692
693 // Module
694 print '<tr><td width="25%">'.$langs->trans("Module").'</td>';
695 print '<td>';
174dcf2 @eldy Can delete an export profil.
eldy authored
696 //print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_module[0]->picto).' ';
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
697 print $objexport->array_export_module[0]->getName();
54f160a @eldy Suite fonction g�n�rique export
eldy authored
698 print '</td></tr>';
699
d86be05 @eldy New: Save last choice of format
eldy authored
700 // Lot de donnees a exporter
a672cc1 @eldy New: Ajout module export
eldy authored
701 print '<tr><td width="25%">'.$langs->trans("DatasetToExport").'</td>';
174dcf2 @eldy Can delete an export profil.
eldy authored
702 print '<td>';
703 print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_icon[0]).' ';
704 print $objexport->array_export_label[0];
705 print '</td></tr>';
a672cc1 @eldy New: Ajout module export
eldy authored
706
d86be05 @eldy New: Save last choice of format
eldy authored
707 // Nbre champs exportes
a672cc1 @eldy New: Ajout module export
eldy authored
708 print '<tr><td width="25%">'.$langs->trans("ExportedFields").'</td>';
709 $list='';
710 foreach($array_selected as $code=>$label)
711 {
d9ecd23 @eldy Work on import module
eldy authored
712 $list.=($list?', ':'');
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
713 $list.=$langs->trans($objexport->array_export_fields[0][$code]);
a672cc1 @eldy New: Ajout module export
eldy authored
714 }
715 print '<td>'.$list.'</td></tr>';
716
717 print '</table>';
718 print '<br>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
719
a672cc1 @eldy New: Ajout module export
eldy authored
720 print $langs->trans("NowClickToGenerateToBuildExportFile").'<br>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
721
a672cc1 @eldy New: Ajout module export
eldy authored
722 // Liste des formats d'exports disponibles
723 $var=true;
724 print '<table class="noborder" width="100%">';
725 print '<tr class="liste_titre">';
8b12e7c @eldy Work on import module
eldy authored
726 print '<td colspan="2">'.$langs->trans("AvailableFormats").'</td>';
a672cc1 @eldy New: Ajout module export
eldy authored
727 print '<td>'.$langs->trans("LibraryUsed").'</td>';
a588260 @eldy Work on import module
eldy authored
728 print '<td align="right">'.$langs->trans("LibraryVersion").'</td>';
80d4b9b @eldy Work on import module
eldy authored
729 print '</tr>'."\n";
a672cc1 @eldy New: Ajout module export
eldy authored
730
c1d3521 @eldy New: Am�lioration du module de gestion des adh�rents
eldy authored
731 $liste=$objmodelexport->liste_modeles($db);
a672cc1 @eldy New: Ajout module export
eldy authored
732 foreach($liste as $key)
733 {
734 $var=!$var;
8b12e7c @eldy Work on import module
eldy authored
735 print '<tr '.$bc[$var].'>';
a588260 @eldy Work on import module
eldy authored
736 print '<td width="16">'.img_picto_common($key,$objmodelexport->getPicto($key)).'</td>';
80d4b9b @eldy Work on import module
eldy authored
737 $text=$objmodelexport->getDriverDesc($key);
738 print '<td>'.$html->textwithpicto($objmodelexport->getDriverLabel($key),$text).'</td>';
739 print '<td>'.$objmodelexport->getLibLabel($key).'</td><td align="right">'.$objmodelexport->getLibVersion($key).'</td></tr>'."\n";
a672cc1 @eldy New: Ajout module export
eldy authored
740 }
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
741 print '</table>';
a672cc1 @eldy New: Ajout module export
eldy authored
742
743 print '</div>';
744
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
745 print '<table width="100%">';
746 if ($mesg)
747 {
748 print '<tr><td colspan="2">';
749 print $mesg;
750 print '</td></tr>';
751 }
752 if ($sqlusedforexport && $user->admin)
753 {
754 print '<tr><td>';
755 print info_admin($langs->trans("SQLUsedForExport").':<br> '.$sqlusedforexport);
756 print '</td></tr>';
757 }
758 print '</table>';
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
759
a672cc1 @eldy New: Ajout module export
eldy authored
760 print '<table width="100%"><tr><td width="50%">';
761
1e06a25 @eldy Qual: Tous les r�pertoires qui servent � g�n�rer des donn�es temporai…
eldy authored
762 if (! is_dir($conf->export->dir_temp)) create_exdir($conf->export->dir_temp);
a672cc1 @eldy New: Ajout module export
eldy authored
763
879f882 @eldy New: Ca y est. L'export est compl�tement op�rationnel.
eldy authored
764 // Affiche liste des documents
765 // NB: La fonction show_documents rescanne les modules qd genallowed=1
d86be05 @eldy New: Save last choice of format
eldy authored
766 $formfile->show_documents('export','',$conf->export->dir_temp.'/'.$user->id,$_SERVER["PHP_SELF"].'?step=4&datatoexport='.$datatoexport,$liste,1,(! empty($_POST['model'])?$_POST['model']:'csv'),'',1);
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
767
a672cc1 @eldy New: Ajout module export
eldy authored
768 print '</td><td width="50%">&nbsp;</td></tr>';
54f160a @eldy Suite fonction g�n�rique export
eldy authored
769 print '</table>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
770
2cffacc @eldy Extract from cvs non GPL library
eldy authored
771 // If external library PHPEXCELREADER is available
772 // and defined by PHPEXCELREADER constant.
773 if (file_exists(PHPEXCELREADER.'excelreader.php'))
774 {
775 // Test d'affichage du tableau excel et csv
776 //print '<table width="100%"><tr><td>';
777 //require_once(DOL_DOCUMENT_ROOT.'/lib/viewfiles.lib.php');
778 //viewExcelFileContent($conf->export->dir_temp.'/1/export_member_1.xls',5,3);
779 //viewCsvFileContent($conf->export->dir_temp.'/1/export_member_1.csv',5);
780 //print '</td></tr></table>';
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
781 }
54f160a @eldy Suite fonction g�n�rique export
eldy authored
782 }
b321ce7 @eldy Suite de la fonction g�n�rique d'export
eldy authored
783
32faa96 @eldy New: For admin users, show the SQL request in export build.
eldy authored
784
1e06a25 @eldy Qual: Tous les r�pertoires qui servent � g�n�rer des donn�es temporai…
eldy authored
785 print '<br>';
b321ce7 @eldy Suite de la fonction g�n�rique d'export
eldy authored
786
a672cc1 @eldy New: Ajout module export
eldy authored
787
b321ce7 @eldy Suite de la fonction g�n�rique d'export
eldy authored
788 $db->close();
789
790 llxFooter('$Date$ - $Revision$');
d9ecd23 @eldy Work on import module
eldy authored
791
792
793 /**
794 * \brief Return table name of an alias. For this, we look for the "tablename as alias" in sql string.
795 * \param code Alias.Fieldname
796 * \param sqlmaxforexport SQL request to parse
797 */
798 function getablenamefromfield($code,$sqlmaxforexport)
799 {
800 $newsql=$sqlmaxforexport;
d9dadd9 Fix: functions "ereg", "ereg_replace", "eregi", "eregi_replace" is de…
Regis Houssin authored
801 $newsql=preg_replace('/^(.*) FROM /i','',$newsql);
802 $newsql=preg_replace('/ WHERE (.*)$/i','',$newsql);
803 $alias=preg_replace('/\.(.*)$/i','',$code);
d9ecd23 @eldy Work on import module
eldy authored
804 //print $newsql.' '.$alias;
d9dadd9 Fix: functions "ereg", "ereg_replace", "eregi", "eregi_replace" is de…
Regis Houssin authored
805 if (preg_match('/([a-zA-Z_]+) as /i'.$alias.'[, \)]',$newsql,$reg))
d9ecd23 @eldy Work on import module
eldy authored
806 {
807 return $reg[1];
808 }
809 else return '';
810 }
811
b321ce7 @eldy Suite de la fonction g�n�rique d'export
eldy authored
812 ?>
Something went wrong with that request. Please try again.