New: For admin users, show the SQL request in export build.
This commit is contained in:
parent
d0d9e8252f
commit
32faa96ab6
@ -37,6 +37,7 @@ For users:
|
|||||||
- New: Changements to support the external BitTorrent module.
|
- New: Changements to support the external BitTorrent module.
|
||||||
- New: Can filter on social contribution type in list.
|
- New: Can filter on social contribution type in list.
|
||||||
- New: Upload of joined files need create/modify permissions to work.
|
- New: Upload of joined files need create/modify permissions to work.
|
||||||
|
- New: For admin users, show the SQL request in export build.
|
||||||
- Fix: Partial payment on social contributions not shown on main page.
|
- Fix: Partial payment on social contributions not shown on main page.
|
||||||
- Fix: Handle correctly the comment in status changing of supplier orders.
|
- Fix: Handle correctly the comment in status changing of supplier orders.
|
||||||
- Fix: Author, title and topic are correctly encoded in PDF.
|
- Fix: Author, title and topic are correctly encoded in PDF.
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
class Export
|
class Export
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
|
|
||||||
var $array_export_code=array(); // Tableau de "idmodule_numlot"
|
var $array_export_code=array(); // Tableau de "idmodule_numlot"
|
||||||
var $array_export_module=array(); // Tableau de "nom de modules"
|
var $array_export_module=array(); // Tableau de "nom de modules"
|
||||||
var $array_export_label=array(); // Tableau de "libelle de lots"
|
var $array_export_label=array(); // Tableau de "libelle de lots"
|
||||||
@ -41,13 +41,15 @@ class Export
|
|||||||
var $array_export_fields=array(); // Tableau des listes de champ+libell<6C> <20> exporter
|
var $array_export_fields=array(); // Tableau des listes de champ+libell<6C> <20> exporter
|
||||||
var $array_export_alias=array(); // Tableau des listes de champ+alias <20> exporter
|
var $array_export_alias=array(); // Tableau des listes de champ+alias <20> exporter
|
||||||
var $array_export_special=array(); // Tableau des operations speciales sur champ
|
var $array_export_special=array(); // Tableau des operations speciales sur champ
|
||||||
|
|
||||||
// To store export modules
|
// To store export modules
|
||||||
var $hexa;
|
var $hexa;
|
||||||
var $datatoexport;
|
var $datatoexport;
|
||||||
var $model_name;
|
var $model_name;
|
||||||
|
|
||||||
|
var $sqlusedforexport;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* \brief Constructeur de la classe
|
||||||
* \param DB Handler acces base de donnees
|
* \param DB Handler acces base de donnees
|
||||||
@ -56,8 +58,8 @@ class Export
|
|||||||
{
|
{
|
||||||
$this->db=$DB;
|
$this->db=$DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Load an exportable dataset
|
* \brief Load an exportable dataset
|
||||||
* \param user Object user making export
|
* \param user Object user making export
|
||||||
@ -66,7 +68,7 @@ class Export
|
|||||||
function load_arrays($user,$filter='')
|
function load_arrays($user,$filter='')
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
dol_syslog("Export::load_arrays user=".$user->id." filter=".$filter);
|
dol_syslog("Export::load_arrays user=".$user->id." filter=".$filter);
|
||||||
|
|
||||||
$dir=DOL_DOCUMENT_ROOT."/includes/modules";
|
$dir=DOL_DOCUMENT_ROOT."/includes/modules";
|
||||||
@ -80,12 +82,12 @@ class Export
|
|||||||
if (eregi("^(mod.*)\.class\.php",$file,$reg))
|
if (eregi("^(mod.*)\.class\.php",$file,$reg))
|
||||||
{
|
{
|
||||||
$modulename=$reg[1];
|
$modulename=$reg[1];
|
||||||
|
|
||||||
// Defined if module is enabled
|
// Defined if module is enabled
|
||||||
$enabled=true;
|
$enabled=true;
|
||||||
$part=strtolower(eregi_replace('^mod','',$modulename));
|
$part=strtolower(eregi_replace('^mod','',$modulename));
|
||||||
if (empty($conf->$part->enabled)) $enabled=false;
|
if (empty($conf->$part->enabled)) $enabled=false;
|
||||||
|
|
||||||
if ($enabled)
|
if ($enabled)
|
||||||
{
|
{
|
||||||
// Chargement de la classe
|
// Chargement de la classe
|
||||||
@ -99,7 +101,7 @@ class Export
|
|||||||
foreach($module->export_code as $r => $value)
|
foreach($module->export_code as $r => $value)
|
||||||
{
|
{
|
||||||
if ($filter && ($filter != $module->export_code[$r])) continue;
|
if ($filter && ($filter != $module->export_code[$r])) continue;
|
||||||
|
|
||||||
// Test si permissions ok \todo tester sur toutes permissions
|
// Test si permissions ok \todo tester sur toutes permissions
|
||||||
$perm=$module->export_permission[$r][0];
|
$perm=$module->export_permission[$r][0];
|
||||||
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
|
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
|
||||||
@ -113,7 +115,7 @@ class Export
|
|||||||
}
|
}
|
||||||
if ($perm[0]=='user' && $user->admin) $bool=true;
|
if ($perm[0]=='user' && $user->admin) $bool=true;
|
||||||
//print $bool." $perm[0]"."<br>";
|
//print $bool." $perm[0]"."<br>";
|
||||||
|
|
||||||
// Permissions ok
|
// Permissions ok
|
||||||
// if ($bool)
|
// if ($bool)
|
||||||
// {
|
// {
|
||||||
@ -121,12 +123,12 @@ class Export
|
|||||||
$langtoload=$module->getLangFilesArray();
|
$langtoload=$module->getLangFilesArray();
|
||||||
if (is_array($langtoload))
|
if (is_array($langtoload))
|
||||||
{
|
{
|
||||||
foreach($langtoload as $key)
|
foreach($langtoload as $key)
|
||||||
{
|
{
|
||||||
$langs->load($key);
|
$langs->load($key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module
|
// Module
|
||||||
$this->array_export_module[$i]=$module;
|
$this->array_export_module[$i]=$module;
|
||||||
// Permission
|
// Permission
|
||||||
@ -145,16 +147,16 @@ class Export
|
|||||||
$this->array_export_alias[$i]=$module->export_alias_array[$r];
|
$this->array_export_alias[$i]=$module->export_alias_array[$r];
|
||||||
// Tableau des operations speciales sur champ
|
// Tableau des operations speciales sur champ
|
||||||
$this->array_export_special[$i]=$module->export_special_array[$r];
|
$this->array_export_special[$i]=$module->export_special_array[$r];
|
||||||
|
|
||||||
// Requete sql du dataset
|
// Requete sql du dataset
|
||||||
$this->array_export_sql_start[$i]=$module->export_sql_start[$r];
|
$this->array_export_sql_start[$i]=$module->export_sql_start[$r];
|
||||||
$this->array_export_sql_end[$i]=$module->export_sql_end[$r];
|
$this->array_export_sql_end[$i]=$module->export_sql_end[$r];
|
||||||
//$this->array_export_sql[$i]=$module->export_sql[$r];
|
//$this->array_export_sql[$i]=$module->export_sql[$r];
|
||||||
|
|
||||||
dol_syslog("Export loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".sizeof($module->export_fields_code[$r]));
|
dol_syslog("Export loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".sizeof($module->export_fields_code[$r]));
|
||||||
$i++;
|
$i++;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -170,23 +172,23 @@ class Export
|
|||||||
* \param array_selected Tableau des champs <EFBFBD> exporter
|
* \param array_selected Tableau des champs <EFBFBD> exporter
|
||||||
* \remarks Les tableaux array_export_xxx sont d<EFBFBD>j<EFBFBD> charg<EFBFBD>es pour le bon datatoexport
|
* \remarks Les tableaux array_export_xxx sont d<EFBFBD>j<EFBFBD> charg<EFBFBD>es pour le bon datatoexport
|
||||||
* aussi le parametre datatoexport est inutilis<EFBFBD>
|
* aussi le parametre datatoexport est inutilis<EFBFBD>
|
||||||
*/
|
*/
|
||||||
function build_file($user, $model, $datatoexport, $array_selected)
|
function build_file($user, $model, $datatoexport, $array_selected)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$indice=0;
|
$indice=0;
|
||||||
asort($array_selected);
|
asort($array_selected);
|
||||||
|
|
||||||
dol_syslog("Export::build_file $model, $datatoexport, $array_selected");
|
dol_syslog("Export::build_file $model, $datatoexport, $array_selected");
|
||||||
|
|
||||||
// Creation de la classe d'export du model ExportXXX
|
// Creation de la classe d'export du model ExportXXX
|
||||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/export/";
|
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/export/";
|
||||||
$file = "export_".$model.".modules.php";
|
$file = "export_".$model.".modules.php";
|
||||||
$classname = "Export".$model;
|
$classname = "Export".$model;
|
||||||
require_once($dir.$file);
|
require_once($dir.$file);
|
||||||
$objmodel = new $classname($db);
|
$objmodel = new $classname($db);
|
||||||
|
|
||||||
// Build the sql request
|
// Build the sql request
|
||||||
$sql=$this->array_export_sql_start[$indice];
|
$sql=$this->array_export_sql_start[$indice];
|
||||||
$i=0;
|
$i=0;
|
||||||
@ -202,8 +204,9 @@ class Export
|
|||||||
$sql.=$newfield;
|
$sql.=$newfield;
|
||||||
}
|
}
|
||||||
$sql.=$this->array_export_sql_end[$indice];
|
$sql.=$this->array_export_sql_end[$indice];
|
||||||
|
|
||||||
// Run the sql
|
// Run the sql
|
||||||
|
$this->sqlusedforexport=$sql;
|
||||||
dol_syslog("Export::build_file sql=".$sql);
|
dol_syslog("Export::build_file sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -214,7 +217,7 @@ class Export
|
|||||||
$dirname=$conf->export->dir_temp.'/'.$user->id;
|
$dirname=$conf->export->dir_temp.'/'.$user->id;
|
||||||
|
|
||||||
$outputlangs=$langs; // Lang for output
|
$outputlangs=$langs; // Lang for output
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
create_exdir($dirname);
|
create_exdir($dirname);
|
||||||
$result=$objmodel->open_file($dirname."/".$filename, $outputlangs);
|
$result=$objmodel->open_file($dirname."/".$filename, $outputlangs);
|
||||||
@ -230,7 +233,7 @@ class Export
|
|||||||
while ($objp = $this->db->fetch_object($resql))
|
while ($objp = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
// Process special operations
|
// Process special operations
|
||||||
if (! empty($this->array_export_special[$indice]))
|
if (! empty($this->array_export_special[$indice]))
|
||||||
{
|
{
|
||||||
@ -252,13 +255,13 @@ class Export
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end of special operation processing
|
// end of special operation processing
|
||||||
|
|
||||||
$objmodel->write_record($this->array_export_alias[$indice],$array_selected,$objp,$outputlangs);
|
$objmodel->write_record($this->array_export_alias[$indice],$array_selected,$objp,$outputlangs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Genere en-tete
|
// Genere en-tete
|
||||||
$objmodel->write_footer($outputlangs);
|
$objmodel->write_footer($outputlangs);
|
||||||
|
|
||||||
// Close file
|
// Close file
|
||||||
$objmodel->close_file();
|
$objmodel->close_file();
|
||||||
}
|
}
|
||||||
@ -276,7 +279,7 @@ class Export
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Create an export model in database
|
* \brief Create an export model in database
|
||||||
* \param user Objet utilisateur qui cree
|
* \param user Objet utilisateur qui cree
|
||||||
@ -284,15 +287,15 @@ class Export
|
|||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
dol_syslog("Export.class.php::create");
|
dol_syslog("Export.class.php::create");
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'export_model (';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'export_model (';
|
||||||
$sql.= 'label, type, field)';
|
$sql.= 'label, type, field)';
|
||||||
$sql.= " VALUES ('".$this->model_name."', '".$this->datatoexport."', '".$this->hexa."')";
|
$sql.= " VALUES ('".$this->model_name."', '".$this->datatoexport."', '".$this->hexa."')";
|
||||||
|
|
||||||
dol_syslog("Export::create sql=".$sql, LOG_DEBUG);
|
dol_syslog("Export::create sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -319,7 +322,7 @@ class Export
|
|||||||
$sql = 'SELECT em.rowid, em.field, em.label, em.type';
|
$sql = 'SELECT em.rowid, em.field, em.label, em.type';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'export_model as em';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'export_model as em';
|
||||||
$sql.= ' WHERE em.rowid = '.$id;
|
$sql.= ' WHERE em.rowid = '.$id;
|
||||||
|
|
||||||
dol_syslog("Export::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog("Export::fetch sql=".$sql, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql) ;
|
$result = $this->db->query($sql) ;
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -331,13 +334,13 @@ class Export
|
|||||||
$this->hexa = $obj->field;
|
$this->hexa = $obj->field;
|
||||||
$this->model_name = $obj->label;
|
$this->model_name = $obj->label;
|
||||||
$this->datatoexport = $obj->type;
|
$this->datatoexport = $obj->type;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error="Model not found";
|
$this->error="Model not found";
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -346,8 +349,8 @@ class Export
|
|||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Delete object in database
|
* \brief Delete object in database
|
||||||
* \param user User that delete
|
* \param user User that delete
|
||||||
@ -358,32 +361,32 @@ class Export
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."export_model";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."export_model";
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
// want this action call a trigger.
|
// want this action call a trigger.
|
||||||
|
|
||||||
//// Call triggers
|
//// Call triggers
|
||||||
//include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
//include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||||
//$interface=new Interfaces($this->db);
|
//$interface=new Interfaces($this->db);
|
||||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
//// End call triggers
|
//// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
@ -391,7 +394,7 @@ class Export
|
|||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1*$error;
|
return -1*$error;
|
||||||
}
|
}
|
||||||
@ -401,7 +404,7 @@ class Export
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -23,7 +23,7 @@
|
|||||||
\brief Page d'edition d'un export
|
\brief Page d'edition d'un export
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once("./pre.inc.php");
|
require_once("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php");
|
||||||
@ -78,14 +78,15 @@ $objmodelexport=new ModeleExports();
|
|||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
$htmlother = new FormOther($db);
|
$htmlother = new FormOther($db);
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
|
$sqlusedforexport='';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action=='selectfield')
|
if ($action=='selectfield')
|
||||||
{
|
{
|
||||||
if ($_GET["field"]=='all')
|
if ($_GET["field"]=='all')
|
||||||
{
|
{
|
||||||
$fieldsarray=$objexport->array_export_alias[0];
|
$fieldsarray=$objexport->array_export_alias[0];
|
||||||
@ -103,17 +104,17 @@ if ($action=='selectfield')
|
|||||||
//print_r($array_selected);
|
//print_r($array_selected);
|
||||||
$_SESSION["export_selected_fields"]=$array_selected;
|
$_SESSION["export_selected_fields"]=$array_selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($action=='unselectfield')
|
if ($action=='unselectfield')
|
||||||
{
|
{
|
||||||
if ($_GET["field"]=='all')
|
if ($_GET["field"]=='all')
|
||||||
{
|
{
|
||||||
$array_selected=array();
|
$array_selected=array();
|
||||||
$_SESSION["export_selected_fields"]=$array_selected;
|
$_SESSION["export_selected_fields"]=$array_selected;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unset($array_selected[$_GET["field"]]);
|
unset($array_selected[$_GET["field"]]);
|
||||||
// Renumber fields of array_selected (from 1 to nb_elements)
|
// Renumber fields of array_selected (from 1 to nb_elements)
|
||||||
asort($array_selected);
|
asort($array_selected);
|
||||||
@ -129,7 +130,7 @@ if ($action=='unselectfield')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($action=='downfield' || $action=='upfield')
|
if ($action=='downfield' || $action=='upfield')
|
||||||
{
|
{
|
||||||
$pos=$array_selected[$_GET["field"]];
|
$pos=$array_selected[$_GET["field"]];
|
||||||
if ($action=='downfield') $newpos=$pos+1;
|
if ($action=='downfield') $newpos=$pos+1;
|
||||||
if ($action=='upfield') $newpos=$pos-1;
|
if ($action=='upfield') $newpos=$pos-1;
|
||||||
@ -169,6 +170,7 @@ if ($action == 'builddoc')
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="ok">'.$langs->trans("FileSuccessfullyBuilt").'</div>';
|
$mesg='<div class="ok">'.$langs->trans("FileSuccessfullyBuilt").'</div>';
|
||||||
|
$sqlusedforexport=$objexport->sqlusedforexport;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +200,7 @@ if ($action == 'add_export_model')
|
|||||||
$objexport->model_name = $export_name;
|
$objexport->model_name = $export_name;
|
||||||
$objexport->datatoexport = $datatoexport;
|
$objexport->datatoexport = $datatoexport;
|
||||||
$objexport->hexa = $hexa;
|
$objexport->hexa = $hexa;
|
||||||
|
|
||||||
$result = $objexport->create($user);
|
$result = $objexport->create($user);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
@ -209,7 +211,7 @@ if ($action == 'add_export_model')
|
|||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
if ($objexport->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
if ($objexport->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorExportDuplicateProfil").'</div>';
|
$mesg='<div class="error">'.$langs->trans("ErrorExportDuplicateProfil").'</div>';
|
||||||
}
|
}
|
||||||
else $mesg='<div class="error">'.$objexport->error.'</div>';
|
else $mesg='<div class="error">'.$objexport->error.'</div>';
|
||||||
}
|
}
|
||||||
@ -221,7 +223,7 @@ if ($action == 'add_export_model')
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($step == 2 && $action == 'select_model')
|
if ($step == 2 && $action == 'select_model')
|
||||||
{
|
{
|
||||||
$_SESSION["export_selected_fields"]=array();
|
$_SESSION["export_selected_fields"]=array();
|
||||||
$array_selected=array();
|
$array_selected=array();
|
||||||
$result = $objexport->fetch($exportmodelid);
|
$result = $objexport->fetch($exportmodelid);
|
||||||
@ -243,7 +245,7 @@ if ($step == 2 && $action == 'select_model')
|
|||||||
* Affichage Pages des Etapes
|
* Affichage Pages des Etapes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if ($step == 1 || ! $datatoexport)
|
if ($step == 1 || ! $datatoexport)
|
||||||
{
|
{
|
||||||
llxHeader('',$langs->trans("NewExport"));
|
llxHeader('',$langs->trans("NewExport"));
|
||||||
@ -263,14 +265,14 @@ if ($step == 1 || ! $datatoexport)
|
|||||||
$head[$h][1] = $langs->trans("Step")." 2";
|
$head[$h][1] = $langs->trans("Step")." 2";
|
||||||
$h++;
|
$h++;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
|
dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
|
||||||
|
|
||||||
|
|
||||||
print '<table class="notopnoleftnoright" width="100%">';
|
print '<table class="notopnoleftnoright" width="100%">';
|
||||||
|
|
||||||
print $langs->trans("SelectExportDataSet").'<br>';
|
print $langs->trans("SelectExportDataSet").'<br>';
|
||||||
|
|
||||||
// Affiche les modules d'exports
|
// Affiche les modules d'exports
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -307,10 +309,10 @@ if ($step == 1 || ! $datatoexport)
|
|||||||
{
|
{
|
||||||
print '<tr><td '.$bc[false].' colspan="2">'.$langs->trans("NoExportableData").'</td></tr>';
|
print '<tr><td '.$bc[false].' colspan="2">'.$langs->trans("NoExportableData").'</td></tr>';
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
if ($mesg) print $mesg;
|
if ($mesg) print $mesg;
|
||||||
@ -335,7 +337,7 @@ if ($step == 2 && $datatoexport)
|
|||||||
$head[$h][1] = $langs->trans("Step")." 2";
|
$head[$h][1] = $langs->trans("Step")." 2";
|
||||||
$hselected=$h;
|
$hselected=$h;
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
|
dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
|
||||||
|
|
||||||
print '<table width="100%" class="border">';
|
print '<table width="100%" class="border">';
|
||||||
@ -353,10 +355,10 @@ if ($step == 2 && $datatoexport)
|
|||||||
print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_icon[0]).' ';
|
print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_icon[0]).' ';
|
||||||
print $objexport->array_export_label[0];
|
print $objexport->array_export_label[0];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Liste deroulante des modeles d'export
|
// Liste deroulante des modeles d'export
|
||||||
print '<form action="export.php" method="post">';
|
print '<form action="export.php" method="post">';
|
||||||
print '<input type="hidden" name="action" value="select_model">';
|
print '<input type="hidden" name="action" value="select_model">';
|
||||||
@ -369,7 +371,7 @@ if ($step == 2 && $datatoexport)
|
|||||||
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -393,10 +395,10 @@ if ($step == 2 && $datatoexport)
|
|||||||
# $this->array_export_fields[0]=$module->export_fields_array[$r];
|
# $this->array_export_fields[0]=$module->export_fields_array[$r];
|
||||||
# $this->array_export_entities[0]=$module->export_fields_entities[$r];
|
# $this->array_export_entities[0]=$module->export_fields_entities[$r];
|
||||||
# $this->array_export_alias[0]=$module->export_fields_alias[$r];
|
# $this->array_export_alias[0]=$module->export_fields_alias[$r];
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
foreach($fieldsarray as $code=>$label)
|
foreach($fieldsarray as $code=>$label)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -450,7 +452,7 @@ if ($step == 2 && $datatoexport)
|
|||||||
{
|
{
|
||||||
print '<a class="butActionRefused" href="#">'.$langs->trans("NextStep").'</a>';
|
print '<a class="butActionRefused" href="#">'.$langs->trans("NextStep").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -460,7 +462,7 @@ if ($step == 3 && $datatoexport)
|
|||||||
asort($array_selected);
|
asort($array_selected);
|
||||||
|
|
||||||
llxHeader('',$langs->trans("NewExport"));
|
llxHeader('',$langs->trans("NewExport"));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
*/
|
*/
|
||||||
@ -478,7 +480,7 @@ if ($step == 3 && $datatoexport)
|
|||||||
$head[$h][1] = $langs->trans("Step")." 3";
|
$head[$h][1] = $langs->trans("Step")." 3";
|
||||||
$hselected=$h;
|
$hselected=$h;
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
|
dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
|
||||||
|
|
||||||
print '<table width="100%" class="border">';
|
print '<table width="100%" class="border">';
|
||||||
@ -509,9 +511,9 @@ if ($step == 3 && $datatoexport)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print $langs->trans("ChooseFieldsOrdersAndTitle").'<br>';
|
print $langs->trans("ChooseFieldsOrdersAndTitle").'<br>';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Entities").'</td>';
|
print '<td>'.$langs->trans("Entities").'</td>';
|
||||||
@ -532,7 +534,7 @@ if ($step == 3 && $datatoexport)
|
|||||||
$entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity;
|
$entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity;
|
||||||
|
|
||||||
print '<td>'.img_object('',$entityicon).' '.$langs->trans($entitylang).'</td>';
|
print '<td>'.img_object('',$entityicon).' '.$langs->trans($entitylang).'</td>';
|
||||||
|
|
||||||
print '<td>'.$langs->trans($objexport->array_export_fields[0][$code]).' ('.$code.')</td>';
|
print '<td>'.$langs->trans($objexport->array_export_fields[0][$code]).' ('.$code.')</td>';
|
||||||
|
|
||||||
print '<td align="right" width="100">';
|
print '<td align="right" width="100">';
|
||||||
@ -550,12 +552,12 @@ if ($step == 3 && $datatoexport)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
if ($mesg) print $mesg;
|
if ($mesg) print $mesg;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Barre d'action
|
* Barre d'action
|
||||||
*
|
*
|
||||||
@ -569,13 +571,13 @@ if ($step == 3 && $datatoexport)
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
// Area for profils export
|
// Area for profils export
|
||||||
if (sizeof($array_selected))
|
if (sizeof($array_selected))
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print $langs->trans("SaveExportModel");
|
print $langs->trans("SaveExportModel");
|
||||||
|
|
||||||
print '<form class="nocellnopadd" action="export.php" method="post">';
|
print '<form class="nocellnopadd" action="export.php" method="post">';
|
||||||
print '<input type="hidden" name="action" value="add_export_model">';
|
print '<input type="hidden" name="action" value="add_export_model">';
|
||||||
print '<input type="hidden" name="step" value="'.$step.'">';
|
print '<input type="hidden" name="step" value="'.$step.'">';
|
||||||
@ -621,11 +623,11 @@ if ($step == 3 && $datatoexport)
|
|||||||
else {
|
else {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($step == 4 && $datatoexport)
|
if ($step == 4 && $datatoexport)
|
||||||
@ -633,7 +635,7 @@ if ($step == 4 && $datatoexport)
|
|||||||
asort($array_selected);
|
asort($array_selected);
|
||||||
|
|
||||||
llxHeader('',$langs->trans("NewExport"));
|
llxHeader('',$langs->trans("NewExport"));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
*/
|
*/
|
||||||
@ -655,7 +657,7 @@ if ($step == 4 && $datatoexport)
|
|||||||
$head[$h][1] = $langs->trans("Step")." 4";
|
$head[$h][1] = $langs->trans("Step")." 4";
|
||||||
$hselected=$h;
|
$hselected=$h;
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
|
dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
|
||||||
|
|
||||||
print '<table width="100%" class="border">';
|
print '<table width="100%" class="border">';
|
||||||
@ -686,9 +688,9 @@ if ($step == 4 && $datatoexport)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print $langs->trans("NowClickToGenerateToBuildExportFile").'<br>';
|
print $langs->trans("NowClickToGenerateToBuildExportFile").'<br>';
|
||||||
|
|
||||||
// Liste des formats d'exports disponibles
|
// Liste des formats d'exports disponibles
|
||||||
$var=true;
|
$var=true;
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@ -704,11 +706,24 @@ if ($step == 4 && $datatoexport)
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>'.$objmodelexport->getDriverLabel($key).'</td><td>'.$objmodelexport->getLibLabel($key).'</td><td>'.$objmodelexport->getLibVersion($key).'</td></tr>';
|
print '<tr '.$bc[$var].'><td>'.$objmodelexport->getDriverLabel($key).'</td><td>'.$objmodelexport->getLibLabel($key).'</td><td>'.$objmodelexport->getLibVersion($key).'</td></tr>';
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
if ($mesg) print $mesg;
|
print '<table width="100%">';
|
||||||
|
if ($mesg)
|
||||||
|
{
|
||||||
|
print '<tr><td colspan="2">';
|
||||||
|
print $mesg;
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
if ($sqlusedforexport && $user->admin)
|
||||||
|
{
|
||||||
|
print '<tr><td>';
|
||||||
|
print info_admin($langs->trans("SQLUsedForExport").':<br> '.$sqlusedforexport);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
print '<table width="100%"><tr><td width="50%">';
|
print '<table width="100%"><tr><td width="50%">';
|
||||||
|
|
||||||
@ -717,10 +732,10 @@ if ($step == 4 && $datatoexport)
|
|||||||
// Affiche liste des documents
|
// Affiche liste des documents
|
||||||
// NB: La fonction show_documents rescanne les modules qd genallowed=1
|
// NB: La fonction show_documents rescanne les modules qd genallowed=1
|
||||||
$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);
|
$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);
|
||||||
|
|
||||||
print '</td><td width="50%"> </td></tr>';
|
print '</td><td width="50%"> </td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
// If external library PHPEXCELREADER is available
|
// If external library PHPEXCELREADER is available
|
||||||
// and defined by PHPEXCELREADER constant.
|
// and defined by PHPEXCELREADER constant.
|
||||||
if (file_exists(PHPEXCELREADER.'excelreader.php'))
|
if (file_exists(PHPEXCELREADER.'excelreader.php'))
|
||||||
@ -731,10 +746,10 @@ if ($step == 4 && $datatoexport)
|
|||||||
//viewExcelFileContent($conf->export->dir_temp.'/1/export_member_1.xls',5,3);
|
//viewExcelFileContent($conf->export->dir_temp.'/1/export_member_1.xls',5,3);
|
||||||
//viewCsvFileContent($conf->export->dir_temp.'/1/export_member_1.csv',5);
|
//viewCsvFileContent($conf->export->dir_temp.'/1/export_member_1.csv',5);
|
||||||
//print '</td></tr></table>';
|
//print '</td></tr></table>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -33,4 +33,5 @@ FormatedExportDesc2=First step is to choose a predefined dataset, then to choose
|
|||||||
FormatedExportDesc3=When data to export are selected, you can define output file format you want to export your data to.
|
FormatedExportDesc3=When data to export are selected, you can define output file format you want to export your data to.
|
||||||
Sheet=Sheet
|
Sheet=Sheet
|
||||||
NoImportableData=No importable data (no module with definitions to allow data imports)
|
NoImportableData=No importable data (no module with definitions to allow data imports)
|
||||||
FileSuccessfullyBuilt=Export file generated
|
FileSuccessfullyBuilt=Export file generated
|
||||||
|
SQLUsedForExport=SQL Request used to build export file
|
||||||
|
|||||||
@ -33,4 +33,5 @@ FormatedExportDesc2=La première étape est de choisir un des lots de données p
|
|||||||
FormatedExportDesc3=Une fois les données sélectionnées, il est possible de choisir le format du fichier export généré.
|
FormatedExportDesc3=Une fois les données sélectionnées, il est possible de choisir le format du fichier export généré.
|
||||||
Sheet=Feuille
|
Sheet=Feuille
|
||||||
NoImportableData=Pas de type de données importable (aucun module contenant des définitions de données importable n'est actif)
|
NoImportableData=Pas de type de données importable (aucun module contenant des définitions de données importable n'est actif)
|
||||||
FileSuccessfullyBuilt=Fichier export généré
|
FileSuccessfullyBuilt=Fichier export généré
|
||||||
|
SQLUsedForExport=Requête SQL utilisée pour construire le fichier export
|
||||||
@ -1291,9 +1291,9 @@ function img_mime($file,$alt='')
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Affiche info admin
|
* \brief Show information for admin users
|
||||||
* \param text Text info
|
* \param text Text info
|
||||||
* \param infoonimgalt Info is shown on alt of star picto
|
* \param infoonimgalt Info is shown on alt of star picto, otherwise it is show on output
|
||||||
* \return string String with info text
|
* \return string String with info text
|
||||||
*/
|
*/
|
||||||
function info_admin($texte,$infoonimgalt=0)
|
function info_admin($texte,$infoonimgalt=0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user