diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index c1ff22a4da3..43ca9701e2c 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -328,7 +328,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf); } -if ($_POST['action'] == 'setpdfmodel' && $user->rights->propale->creer) +if ($_POST['action'] == 'builddoc' && $user->rights->propale->creer) { $propal = new Propal($db, 0, $_GET['propalid']); $propal->set_pdf_model($user, $_POST['modelpdf']); diff --git a/htdocs/exports/export.class.php b/htdocs/exports/export.class.php index 7b34cf73f22..b8eb67ce3f6 100644 --- a/htdocs/exports/export.class.php +++ b/htdocs/exports/export.class.php @@ -1,6 +1,5 @@ - * * * 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 @@ -97,15 +96,22 @@ class Export { $bool=$user->rights->$perm[0]->$perm[1]; } - if ($bool) // Permissions ok + + // Permissions ok + if ($bool) { - dolibarr_syslog("Export chargé pour le module ".$modulename." en index ".$i); + // Nom module $this->array_export_module[$i]=$module; + // Code du dataset export $this->array_export_code[$i]=$module->export_code[$r]; + // Libellé du dataset export $this->array_export_label[$i]=$module->export_label[$r]; - $this->array_export_fields_code[$i]=$module->export_fields_code[$r]; - $this->array_export_fields_label[$i]=$module->export_fields_label[$r]; + // Tableau des champ à exporter (clé=champ, valeur=libellé) + $this->array_export_fields[$i]=$module->export_fields_array[$r]; + // Requete sql du dataset $this->array_export_sql[$i]=$module->export_sql[$r]; + + dolibarr_syslog("Export chargé pour le module ".$modulename." en index ".$i.", dataset=".$module->export_code[$r].", nbre de champs=".sizeof($module->export_fields_code[$r])); $i++; } } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 23bc1d63621..f9ace0345c5 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -36,18 +36,59 @@ $user->getrights(); if (! $user->societe_id == 0) accessforbidden(); - - +$array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array(); +$datatoexport=isset($_GET["datatoexport"])?$_GET["datatoexport"]:''; $export=new Export($db); -$export->load_arrays($user,isset($datatoexport)?$datatoexport:''); +$export->load_arrays($user,$datatoexport); +$action=isset($_GET["action"])?$_GET["action"]:''; +$step=isset($_GET["step"])?$_GET["step"]:'1'; -if (! isset($datatoexport)) + +/* + * Actions + */ +if ($action=='selectfield') +{ + $array_selected[$_GET["field"]]=1; + //print_r($array_selected); + $_SESSION["export_selected_fields"]=$array_selected; +} +if ($action=='unselectfield') +{ + $array_selected[$_GET["field"]]=0; + //print_r($array_selected); + $_SESSION["export_selected_fields"]=$array_selected; +} +if ($step == 1 || $action == 'cleanselect') +{ + $_SESSION["export_selected_fields"]=array(); +} + + +if ($step == 1 || ! $datatoexport) { llxHeader('',$langs->trans("NewExport")); + + /* + * Affichage onglets + */ + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1'; + $head[$h][1] = $langs->trans("Step1"); + $hselected=$h; + $h++; + + /* + $head[$h][0] = ''; + $head[$h][1] = $langs->trans("Step2"); + $h++; + */ - print_fiche_titre($langs->trans("NewExport")); - + dolibarr_fiche_head($head, $hselected, $langs->trans("NewExport")); + + print '
| '; print $export->array_export_label[$key]; - print ' | '; - print ''.img_picto($langs->trans("NewExport"),'filenew').''; + print ' | '; + print ''.img_picto($langs->trans("NewExport"),'filenew').''; print ' | '; } } @@ -85,40 +126,289 @@ if (! isset($datatoexport)) print '
| '.$langs->trans("ExportableFields").' | '; - print ''; - print ' | '.$langs->trans("ExportedFields").' | '; - print '||||||||||||||||||||||||||||||||||||||||
';
-
- // Champs exportables
- $fieldscode=split(',',$export->array_export_fields_code);
- $fieldslib=split(',',$export->array_export_fields_lib);
- foreach($fieldscode as $i=>$code)
- {
-
-
- }
+ $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport;
+ $head[$h][1] = $langs->trans("Step2");
+ $hselected=$h;
+ $h++;
+ dolibarr_fiche_head($head, $hselected, $langs->trans("NewExport"));
+
+ print '
'; + + print $langs->trans("SelectExportFields").' '; + + print '
';
+
+ if (sizeof($array_selected))
+ {
+ print ''.$langs->trans("NextStep").'';
+ }
+
+ print ' ';
+}
+
+if ($step == 3 && $datatoexport)
+{
+ llxHeader('',$langs->trans("NewExport"));
+
+ /*
+ * Affichage onglets
+ */
+ $h = 0;
+
+ $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1';
+ $head[$h][1] = $langs->trans("Step1");
+ $h++;
+
+ $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport;
+ $head[$h][1] = $langs->trans("Step2");
+ $h++;
+
+ $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport;
+ $head[$h][1] = $langs->trans("Step3");
+ $hselected=$h;
+ $h++;
+
+ dolibarr_fiche_head($head, $hselected, $langs->trans("NewExport"));
+
+ print '
'; + + print $langs->trans("ChooseFieldsOrdersAndTitle").' '; + + print '
';
+
+ if (sizeof($array_selected))
+ {
+ print ''.$langs->trans("NextStep").'';
+ }
+
+ print ' ';
+}
+
+
+if ($step == 4 && $datatoexport)
+{
+ llxHeader('',$langs->trans("NewExport"));
+
+ /*
+ * Affichage onglets
+ */
+ $h = 0;
+
+ $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1';
+ $head[$h][1] = $langs->trans("Step1");
+ $h++;
+
+ $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport;
+ $head[$h][1] = $langs->trans("Step2");
+ $h++;
+
+ $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport;
+ $head[$h][1] = $langs->trans("Step3");
+ $h++;
+
+ $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=4&datatoexport='.$datatoexport;
+ $head[$h][1] = $langs->trans("Step4");
+ $hselected=$h;
+ $h++;
+
+ dolibarr_fiche_head($head, $hselected, $langs->trans("NewExport"));
+
+ print '
'; + + print $langs->trans("NowClickToGenerateToBuildExportFile").' '; + print ' '; + + // Liste des formats d'exports disponibles + $var=true; + print '
| '.$langs->trans("AvailableFormats").' | '; print ''.$langs->trans("LibraryUsed").' | '; print ''.$langs->trans("LibraryVersion").' | '; print '|||||||||||||||||||||||||||||||||||||||
| Excel | Php_WriteExcel | '; -print ''; -print ' | ||||||||||||||||||||||||||||||||||||||||
| Csv | Dolibarr | '; -print ''; -print ' | ||||||||||||||||||||||||||||||||||||||||
| '.$model->getModelName($key).' | '.$model->getDriverName($key).' | '.$model->getDriverVersion($key).' |