New: Ajout module export
This commit is contained in:
parent
f5210df4bb
commit
a672cc1a70
@ -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']);
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 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
|
||||
@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 '<table class="notopnoleftnoright" width="100%">';
|
||||
|
||||
print $langs->trans("SelectExportDataSet").'<br>';
|
||||
@ -71,8 +112,8 @@ if (! isset($datatoexport))
|
||||
print $export->array_export_module[$key]->getName();
|
||||
print '</td><td>';
|
||||
print $export->array_export_label[$key];
|
||||
print '</td><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/exports/export.php?datatoexport='.$export->array_export_code[$key].'">'.img_picto($langs->trans("NewExport"),'filenew').'</a>';
|
||||
print '</td><td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$export->array_export_code[$key].'">'.img_picto($langs->trans("NewExport"),'filenew').'</a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
@ -85,40 +126,289 @@ if (! isset($datatoexport))
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if (isset($datatoexport))
|
||||
if ($step == 2 && $datatoexport)
|
||||
{
|
||||
llxHeader('',$langs->trans("NewExport"));
|
||||
|
||||
print_fiche_titre($langs->trans("NewExport")." - ".$export->array_export_label[0]);
|
||||
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$h = 0;
|
||||
|
||||
print $langs->trans("SelectExportFields").'<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<table>';
|
||||
print '<tr><td>'.$langs->trans("ExportableFields").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>'.$langs->trans("ExportedFields").'</td>';
|
||||
print '</tr>';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1';
|
||||
$head[$h][1] = $langs->trans("Step1");
|
||||
$h++;
|
||||
|
||||
print '<tr><td>';
|
||||
|
||||
// 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 '<table width="100%" class="border">';
|
||||
|
||||
// Module
|
||||
print '<tr><td width="25%">'.$langs->trans("Module").'</td>';
|
||||
print '<td>';
|
||||
print img_object($export->array_export_module[0]->getName(),$export->array_export_module[0]->picto).' ';
|
||||
print $export->array_export_module[0]->getName();
|
||||
print '</td></tr>';
|
||||
|
||||
// Lot de données à exporter
|
||||
print '<tr><td width="25%">'.$langs->trans("DatasetToExport").'</td>';
|
||||
print '<td>'.$export->array_export_label[0].'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("SelectExportFields").'<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="48%">'.$langs->trans("ExportableFields").'</td>';
|
||||
print '<td width="4%"> </td>';
|
||||
print '<td width="48%">'.$langs->trans("ExportedFields").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Champs exportables
|
||||
$fieldsarray=$export->array_export_fields[0];
|
||||
|
||||
# $this->array_export_module[$i]=$module;
|
||||
# $this->array_export_code[$i]=$module->export_code[$r];
|
||||
# $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];
|
||||
# $this->array_export_sql[$i]=$module-
|
||||
|
||||
$var=true;
|
||||
foreach($fieldsarray as $code=>$label)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
if (isset($array_selected[$code]) && $array_selected[$code])
|
||||
{
|
||||
// Champ sélectionné
|
||||
print '<td> </td>';
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=unselectfield&field='.$code.'">'.img_left().'</a></td>';
|
||||
print '<td>'.$label.' ('.$code.')</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>'.$label.' ('.$code.')</td>';
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=selectfield&field='.$code.'">'.img_right().'</a></td>';
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Barre d'action
|
||||
*
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (sizeof($array_selected))
|
||||
{
|
||||
print '<a class="butAction" href="export.php?step=3&datatoexport='.$datatoexport.'">'.$langs->trans("NextStep").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
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 '<table width="100%" class="border">';
|
||||
|
||||
// Module
|
||||
print '<tr><td width="25%">'.$langs->trans("Module").'</td>';
|
||||
print '<td>';
|
||||
print img_object($export->array_export_module[0]->getName(),$export->array_export_module[0]->picto).' ';
|
||||
print $export->array_export_module[0]->getName();
|
||||
print '</td></tr>';
|
||||
|
||||
// Lot de données à exporter
|
||||
print '<tr><td width="25%">'.$langs->trans("DatasetToExport").'</td>';
|
||||
print '<td>'.$export->array_export_label[0].'</td></tr>';
|
||||
|
||||
// Nbre champs exportés
|
||||
print '<tr><td width="25%">'.$langs->trans("ExportedFields").'</td>';
|
||||
$list='';
|
||||
foreach($array_selected as $code=>$label)
|
||||
{
|
||||
$list.=($list?',':'');
|
||||
$list.=$export->array_export_fields[0][$code];
|
||||
}
|
||||
print '<td>'.$list.'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("ChooseFieldsOrdersAndTitle").'<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="48%">'.$langs->trans("ExportedFields").'</td>';
|
||||
print '<td>'.$langs->trans("Position").'</td>';
|
||||
print '<td>'.$langs->trans("FieldsTitle").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
foreach($array_selected as $code=>$value)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td>'.$export->array_export_fields[0][$code].' ('.$code.')</td>';
|
||||
|
||||
print '<td>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?step=3&datatoexport='.$datatoexport.'&action=upfield&field='.$field.'">'.img_up().'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?step=3&datatoexport='.$datatoexport.'&action=downfield&field='.$field.'">'.img_down().'</a>';
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.$export->array_export_fields[0][$code].'</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Barre d'action
|
||||
*
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (sizeof($array_selected))
|
||||
{
|
||||
print '<a class="butAction" href="export.php?step=4&datatoexport='.$datatoexport.'">'.$langs->trans("NextStep").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
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 '<table width="100%" class="border">';
|
||||
|
||||
// Module
|
||||
print '<tr><td width="25%">'.$langs->trans("Module").'</td>';
|
||||
print '<td>';
|
||||
print img_object($export->array_export_module[0]->getName(),$export->array_export_module[0]->picto).' ';
|
||||
print $export->array_export_module[0]->getName();
|
||||
print '</td></tr>';
|
||||
|
||||
// Lot de données à exporter
|
||||
print '<tr><td width="25%">'.$langs->trans("DatasetToExport").'</td>';
|
||||
print '<td>'.$export->array_export_label[0].'</td></tr>';
|
||||
|
||||
// Nbre champs exportés
|
||||
print '<tr><td width="25%">'.$langs->trans("ExportedFields").'</td>';
|
||||
$list='';
|
||||
foreach($array_selected as $code=>$label)
|
||||
{
|
||||
$list.=($list?',':'');
|
||||
$list.=$export->array_export_fields[0][$code];
|
||||
}
|
||||
print '<td>'.$list.'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("NowClickToGenerateToBuildExportFile").'<br>';
|
||||
print '<br>';
|
||||
|
||||
// Liste des formats d'exports disponibles
|
||||
$var=true;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("AvailableFormats").'</td>';
|
||||
print '<td>'.$langs->trans("LibraryUsed").'</td>';
|
||||
print '<td>'.$langs->trans("LibraryVersion").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/export/modules_export.php');
|
||||
$model=new ModeleExports();
|
||||
$liste=$model->liste_modeles($db);
|
||||
|
||||
foreach($liste as $key)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$model->getModelName($key).'</td><td>'.$model->getDriverName($key).'</td><td>'.$model->getDriverVersion($key).'</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
$htmlform=new Form($db);
|
||||
print '<table width="100%"><tr><td width="50%">';
|
||||
|
||||
if (! is_dir($conf->export->dir_ouput)) create_exdir($conf->export->dir_ouput);
|
||||
|
||||
$filename=$datatoexport;
|
||||
$htmlform->show_documents('export',$filename,$conf->export->dir_ouput,$_SERVER["PHP_SELF"].'?step=4&datatoexport='.$datatoexport,1,1,'csv');
|
||||
|
||||
print '</td><td width="50%"> </td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
@ -59,14 +59,17 @@ print '<td>'.$langs->trans("AvailableFormats").'</td>';
|
||||
print '<td>'.$langs->trans("LibraryUsed").'</td>';
|
||||
print '<td>'.$langs->trans("LibraryVersion").'</td>';
|
||||
print '</tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>Excel</td><td>Php_WriteExcel</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>Csv</td><td>Dolibarr</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/export/modules_export.php');
|
||||
$model=new ModeleExports();
|
||||
$liste=$model->liste_modeles($db);
|
||||
|
||||
foreach($liste as $key)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$model->getModelName($key).'</td><td>'.$model->getDriverName($key).'</td><td>'.$model->getDriverVersion($key).'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -92,7 +95,7 @@ if (sizeof($export->array_export_code))
|
||||
print '</td><td>';
|
||||
print $export->array_export_label[$key];
|
||||
print '</td><td width="24">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/exports/export.php?datatoexport='.$export->array_export_code[$key].'">'.img_picto($langs->trans("NewExport"),'filenew').'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$export->array_export_code[$key].'&action=cleanselect">'.img_picto($langs->trans("NewExport"),'filenew').'</a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1809,54 +1809,71 @@ class Form
|
||||
if ($modulepart == 'expedition') { $extension='pdf'; $relativepath = get_exdir("${filename}")."${filename}.pdf"; }
|
||||
if ($modulepart == 'don') { $extension='html'; $relativepath = get_exdir("${filename}")."${filename}.html"; }
|
||||
|
||||
$i=0;
|
||||
$headershown=0;
|
||||
|
||||
// Affiche en-tete tableau
|
||||
if ($genallowed)
|
||||
{
|
||||
$liste=array();
|
||||
if ($modulepart == 'propal')
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/propale/modules_propale.php');
|
||||
$model=new ModelePDFPropales();
|
||||
$liste=$model->liste_modeles($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'facture')
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php');
|
||||
$model=new ModelePDFFactures();
|
||||
$liste=$model->liste_modeles($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'export')
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/export/modules_export.php');
|
||||
$model=new ModeleExports();
|
||||
$liste=$model->liste_modeles($this->db);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db,'Bad value for modulepart');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$headershown=1;
|
||||
|
||||
print '<form action="'.$urlsource.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="builddoc">';
|
||||
|
||||
print_titre($langs->trans("Documents"));
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans('Model').'</td><td align="center">';
|
||||
$this->select_array('modelpdf',$liste,$modelselected);
|
||||
$texte=$langs->trans('Generate');
|
||||
print '</td><td align="center" colspan="2"><input class="button" type="submit" value="'.$texte.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Affiche lignes
|
||||
if (is_dir($filedir))
|
||||
{
|
||||
$i=0;
|
||||
|
||||
$handle=opendir($filedir);
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
// Si fichier non lisible ou non .pdf, on passe au suivant
|
||||
// Si fichier non lisible ou mauvaise extension, on passe au suivant
|
||||
if (! is_readable($filedir."/".$file) || ! eregi('\.'.$extension.'$',$file)) continue;
|
||||
|
||||
if ($i==0)
|
||||
if (! $headershown)
|
||||
{
|
||||
// Affiche en-tete tableau
|
||||
if ($genallowed)
|
||||
{
|
||||
print '<form action="'.$urlsource.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="setpdfmodel">';
|
||||
}
|
||||
$headershown=1;
|
||||
|
||||
print_titre($langs->trans("Documents"));
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
if ($genallowed)
|
||||
{
|
||||
$liste=array();
|
||||
if ($modulepart == 'propal')
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/propale/modules_propale.php');
|
||||
$model=new ModelePDFPropales();
|
||||
$liste=$model->liste_modeles($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'facture')
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php');
|
||||
$model=new ModelePDFFactures();
|
||||
$liste=$model->liste_modeles($this->db);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db,'Bad value for modulepart');
|
||||
}
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans('Model').'</td><td align="center">';
|
||||
$this->select_array('modelpdf',$liste,$modelselected);
|
||||
$texte=$langs->trans('Generate');
|
||||
print '</td><td align="center" colspan="2"><input class="button" type="submit" value="'.$texte.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
$mimetype=strtoupper($extension);
|
||||
if ($extension == 'pdf') $mimetype='PDF';
|
||||
@ -1872,7 +1889,7 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
if ($i > 0)
|
||||
if ($headershown)
|
||||
{
|
||||
// Affiche pied du tableau
|
||||
print "</table>\n";
|
||||
|
||||
94
htdocs/includes/modules/export/modules_export.php
Normal file
94
htdocs/includes/modules/export/modules_export.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 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.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/export/modules_export.php
|
||||
\ingroup export
|
||||
\brief Fichier contenant la classe mère de generation des exports
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\class ModelePDFFactures
|
||||
\brief Classe mère des modèles de facture
|
||||
*/
|
||||
|
||||
class ModeleExports
|
||||
{
|
||||
var $error='';
|
||||
|
||||
var $modelname;
|
||||
var $drivername;
|
||||
var $driverversion;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
*/
|
||||
function ModeleExports()
|
||||
{
|
||||
$this->modelname=array('csv'=>'Csv','excel'=>'Excel');
|
||||
$this->drivername=array('csv'=>'Dolibarr','excel'=>'Php_WriteExcel');
|
||||
$this->driverversion=array('csv'=>DOL_VERSION,'excel'=>'?');
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi la liste des modèles actifs
|
||||
* \param db Handler de base
|
||||
*/
|
||||
function liste_modeles($db)
|
||||
{
|
||||
//$liste=array('csv','excel');
|
||||
$liste=array('csv');
|
||||
|
||||
return $liste;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi nom d'un format export
|
||||
*/
|
||||
function getModelName($key)
|
||||
{
|
||||
return $this->modelname[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi libelle d'un driver export
|
||||
*/
|
||||
function getDriverName($key)
|
||||
{
|
||||
return $this->drivername[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi version d'un driver export
|
||||
*/
|
||||
function getDriverVersion($key)
|
||||
{
|
||||
return $this->driverversion[$key];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@ -195,9 +195,8 @@ class modAdherent extends DolibarrModules
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->numero.'_'.$r;
|
||||
$this->export_label[$r]='Adhérents et attributs';
|
||||
$this->export_fields_code[$r]=array(0=>'a.nom',1=>'a.prenom',2=>'a.login',3=>'a.cp',4=>'a.ville',5=>'a.pays',6=>'a.email',7=>'a.login',8=>'a.naiss');
|
||||
$this->export_fields_label[$r]=array(0=>"Lastname",1=>"Firstname",2=>"Address",3=>"Zip",4=>"Town",5=>"Country",6=>"Email",7=>"Login",8=>"Birthday");
|
||||
$this->export_sql[$r]="select ".join(',',$this->export_fields_code[$r]).' from '.MAIN_DB_PREFIX.'adherent';
|
||||
$this->export_fields_array[$r]=array('a.nom'=>"Lastname",'a.prenom'=>"Firstname",'a.address'=>"Address",'a.cp'=>"Zip",'a.ville'=>"Town",'a.pays'=>"Country",'a.email'=>"Email",'a.login'=>"Login",'a.naiss'=>"Birthday");
|
||||
$this->export_sql[$r]="select ".join(',',array_keys($this->export_fields_array[$r])).' from '.MAIN_DB_PREFIX.'adherent as a';
|
||||
$this->export_permission[$r]=array(array("adherent","export"));
|
||||
}
|
||||
|
||||
|
||||
104
htdocs/includes/modules/modExport.class.php
Normal file
104
htdocs/includes/modules/modExport.class.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 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.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/** \defgroup export Module export
|
||||
\brief Module générique pour réaliser des exports de données en base
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/modExport.class.php
|
||||
\ingroup export
|
||||
\brief Fichier de description et activation du module export
|
||||
*/
|
||||
|
||||
include_once "DolibarrModules.class.php";
|
||||
|
||||
/** \class modExport
|
||||
\brief Classe de description et activation du module export
|
||||
*/
|
||||
|
||||
class modExport extends DolibarrModules
|
||||
{
|
||||
|
||||
/**
|
||||
* \brief Constructeur. Definit les noms, constantes et boites
|
||||
* \param DB handler d'accès base
|
||||
*/
|
||||
function modExport($DB)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->numero = 240;
|
||||
|
||||
$this->family = "technic";
|
||||
$this->name = "Exports";
|
||||
$this->description = "Permet export des données de la base en fichiers";
|
||||
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
|
||||
$this->const_name = 'MAIN_MODULE_EXPORT';
|
||||
$this->special = 0;
|
||||
$this->picto='';
|
||||
|
||||
// Dir
|
||||
$this->dirs = array();
|
||||
|
||||
// Config pages
|
||||
$this->config_page_url = array();
|
||||
|
||||
// Dépendances
|
||||
$this->depends = array();
|
||||
$this->requiredby = array();
|
||||
$this->phpmin = array(4,2,0);
|
||||
$this->phpmax = array();
|
||||
|
||||
// Constantes
|
||||
$this->const = array();
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array();
|
||||
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'export';
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction appelée lors de l'activation du module. Insère en base les constantes, boites, permissions du module.
|
||||
* Définit également les répertoires de données à créer pour ce module.
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
return $this->_init($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction appelée lors de la désactivation d'un module.
|
||||
* Supprime de la base les constantes, boites et permissions du module.
|
||||
*/
|
||||
function remove()
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
return $this->_remove($sql);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -4,4 +4,11 @@ ExportableDatas=Exportable dataset
|
||||
SelectExportDataSet=Choose dataset you want to export...
|
||||
SelectExportFields=Choose fields you want to export...
|
||||
ExportableFields=Exportable fields
|
||||
ExportedFields=Exported fields
|
||||
ExportedFields=Exported fields
|
||||
DatasetToExport=Dataset to export
|
||||
Dataset=Dataset
|
||||
ChooseFieldsOrdersAndTitle=Choose fields order and title
|
||||
FieldsOrder=Fields order
|
||||
FieldsTitle=Fields title
|
||||
ChooseExportFormat=Choose export format
|
||||
NowClickToGenerateToBuildExportFile=Now, click on "Generate" to build export file
|
||||
@ -4,4 +4,11 @@ ExportableDatas=Lot de donn
|
||||
SelectExportDataSet=Choisissez le lot de données que vous désirez exporter...
|
||||
SelectExportFields=Choisissez les champs à exporter...
|
||||
ExportableFields=Champs exportables
|
||||
ExportedFields=Champs à exporter
|
||||
ExportedFields=Champs à exporter
|
||||
DatasetToExport=Lot de données à exporter
|
||||
Dataset=Lot de données
|
||||
ChooseFieldsOrdersAndTitle=Choisissez l'ordre et titre des champs
|
||||
FieldsOrder=Ordre des champs
|
||||
FieldsTitle=Titre champs
|
||||
ChooseExportFormat=Choisissez le format d'export
|
||||
NowClickToGenerateToBuildExportFile=Maintenant, cliquez sur "Générer" pour générer le fichier export
|
||||
@ -841,6 +841,33 @@ function img_up($alt = "default", $selected=1)
|
||||
else return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1uparrow_notselected.png" border="0" alt="'.$alt.'" title="'.$alt.'">';
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Affiche logo gauche
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param selected Affiche version "selected" du logo
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
function img_left($alt = "default", $selected=1)
|
||||
{
|
||||
global $conf,$langs;
|
||||
if ($alt=="default") $alt=$langs->trans("Left");
|
||||
if ($selected) return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1leftarrow.png" border="0" alt="'.$alt.'" title="'.$alt.'">';
|
||||
else return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1leftarrow_notselected.png" border="0" alt="'.$alt.'" title="'.$alt.'">';
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Affiche logo droite
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param selected Affiche version "selected" du logo
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
function img_right($alt = "default", $selected=1)
|
||||
{
|
||||
global $conf,$langs;
|
||||
if ($alt=="default") $alt=$langs->trans("Right");
|
||||
if ($selected) return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1rightarrow.png" border="0" alt="'.$alt.'" title="'.$alt.'">';
|
||||
else return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1rightarrow_notselected.png" border="0" alt="'.$alt.'" title="'.$alt.'">';
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Affiche logo tick
|
||||
|
||||
@ -324,7 +324,8 @@ $conf->voyage->enabled=0;
|
||||
// Module actionscomm
|
||||
$conf->actionscomm->dir_output=DOL_DATA_ROOT."/action";
|
||||
// Module export
|
||||
$conf->export->enabled=0;
|
||||
$conf->export->enabled=defined("MAIN_MODULE_EXPORT")?MAIN_MODULE_EXPORT:0;
|
||||
$conf->export->dir_ouput=DOL_DATA_ROOT."/export";
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 784 B After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 810 B After Width: | Height: | Size: 1.0 KiB |
Loading…
Reference in New Issue
Block a user