';
// Birthday
diff --git a/htdocs/docsoc.php b/htdocs/docsoc.php
index 5253b513e3a..a31a1fb2a20 100644
--- a/htdocs/docsoc.php
+++ b/htdocs/docsoc.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2007 Laurent Destailleur
+ * Copyright (C) 2004-2008 Laurent Destailleur
* Copyright (C) 2005-2007 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -29,6 +29,7 @@
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
$langs->load("companies");
$langs->load('other');
@@ -164,7 +165,8 @@ if ($socid > 0)
if ($mesg) { print "$mesg "; }
// Affiche formulaire upload
- $html->form_attach_new_file('docsoc.php?socid='.$socid);
+ $formfile=new FormFile($db);
+ $formfile->form_attach_new_file(DOL_URL_ROOT.'/docsoc.php?socid='.$socid);
// Affiche liste des documents existant
print_titre($langs->trans("AttachedFiles"));
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index f7edaf9541b..ed15272baa2 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2006 Laurent Destailleur
+ * Copyright (C) 2004-2008 Laurent Destailleur
* Copyright (C) 2005 Marc Barilley / Ocebo
* Copyright (C) 2005 Regis Houssin
*
@@ -19,7 +19,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
- * $Source$
*/
/**
@@ -32,6 +31,7 @@
require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.facture.class.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/fourn.lib.php');
+require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
$langs->load('bills');
$langs->load('other');
@@ -162,8 +162,8 @@ if ($facid > 0)
if ($mesg) { print $mesg.' '; }
// Affiche formulaire upload
- $html=new Form($db);
- $html->form_attach_new_file('document.php?facid='.$facture->id);
+ $formfile=new FormFile($db);
+ $formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$facture->id);
// Affiche liste des documents existant
print_titre($langs->trans('AttachedFiles'));
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index de25d2f7cde..5eef1d5e934 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -1801,19 +1801,6 @@ class Form
}
- /**
- * \brief Retourne le nom traduit de la civilité
- * \param code Code de la civilité
- * \return string Nom traduit de la civilité
- */
- function civilite_name($code)
- {
- global $langs;
- $langs->load("dict");
- return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : $code;
- }
-
-
/**
* \brief Retourne la liste déroulante des formes juridiques tous pays confondus ou pour un pays donné.
* \remarks Dans le cas d'une liste tous pays confondu, on affiche une rupture sur le pays
@@ -1917,24 +1904,6 @@ class Form
}
- /**
- * \brief Retourne le formulaire de saisie d'un identifiant professionnel (siren, siret, etc...)
- * \param idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm)
- * \param soc Objet societe
- * \param htmlname Nom de la zone input
- */
- function id_prof($idprof,$soc,$htmlname,$selected='')
- {
- global $langs;
- $formlength=16;
- if ($idprof==1 && $soc->pays_code == 'FR') $formlength=9;
- if ($idprof==2 && $soc->pays_code == 'FR') $formlength=14;
- if ($idprof==3 && $soc->pays_code == 'FR') $formlength=4;
- if ($idprof==4 && $soc->pays_code == 'FR') $formlength=12;
- print '';
- }
-
-
/**
* \brief Retourne le nom traduit ou code+nom d'un pays
* \param id id du pays
@@ -1967,46 +1936,6 @@ class Form
}
}
-
- /**
- * \brief Retourne le nom traduit ou code+nom d'une devise
- * \param code_iso Code iso de la devise
- * \param withcode 1=affiche code + nom
- * \return string Nom traduit de la devise
- */
- function currency_name($code_iso,$withcode=0)
- {
- global $langs;
-
- // Si il existe une traduction, on peut renvoyer de suite le libellé
- if ($langs->trans("Currency".$code_iso)!="Currency".$code_iso)
- {
- return $langs->trans("Currency".$code_iso);
- }
-
- // Si pas de traduction, on consulte libellé par défaut en table
- $sql = "SELECT label FROM ".MAIN_DB_PREFIX."c_currencies";
- $sql.= " WHERE code_iso='$code_iso';";
-
- if ($this->db->query($sql))
- {
- $num = $this->db->num_rows();
-
- if ($num)
- {
- $obj = $this->db->fetch_object();
- $label=($obj->label!='-'?$obj->label:'');
- if ($withcode) return $label==$code_iso?"$code_iso":"$code_iso - $label";
- else return $label;
- }
- else
- {
- return $code_iso;
- }
-
- }
- }
-
/**
* \brief Affiche formulaire de demande de confirmation
@@ -2267,64 +2196,6 @@ class Form
}
- /**
- * \brief Affiche formulaire ajout fichier
- * \param url Url
- * \param titre Titre zone
- * \param addcancel 1=Ajoute un bouton 'Annuler'
- * \return int <0 si ko, >0 si ok
- */
- function form_attach_new_file($url,$titre='',$addcancel=0)
- {
- global $conf,$langs;
-
- if ($conf->upload != 0)
- {
- print "\n\n\n";
-
- if (! $titre) $titre=$langs->trans("AttachANewFile");
- print_titre($titre);
-
- print '';
- print ' ';
-
- print "\n\n\n";
- }
-
- return 1;
- }
-
/**
* \brief Affiche formulaire de selection de la remise fixe
* \param page Page
@@ -2658,59 +2529,6 @@ class Form
print '';
}
- /**
- *
- *
- *
- *
- */
- function load_tva($name='tauxtva', $defaulttx='', $societe_vendeuse='', $societe_acheteuse='', $taux_produit='')
- {
- global $langs,$conf,$mysoc;
-
- if (is_object($societe_vendeuse->pays_code))
- {
- $code_pays=$societe_vendeuse->pays_code;
- }
- else
- {
- $code_pays=$mysoc->pays_code; // Pour compatibilite ascendente
- }
-
- // Recherche liste des codes TVA du pays vendeur
- $sql = "SELECT t.taux,t.recuperableonly";
- $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
- $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$code_pays."'";
- $sql .= " AND t.active = 1";
- $sql .= " ORDER BY t.taux ASC, t.recuperableonly ASC";
-
- $resql=$this->db->query($sql);
- if ($resql)
- {
- $num = $this->db->num_rows($resql);
- for ($i = 0; $i < $num; $i++)
- {
- $obj = $this->db->fetch_object($resql);
- $txtva[ $i ] = $obj->taux;
- $libtva[ $i ] = $obj->taux.'%'.($obj->recuperableonly ? ' *':'');
- }
- }
-
- // Définition du taux à pré-sélectionner
- if ($defaulttx == '') $defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$taux_produit);
- // Si taux par defaut n'a pu etre trouvé, on prend dernier.
- // Comme ils sont triés par ordre croissant, dernier = plus élevé = taux courant
- if ($defaulttx == '') $defaulttx = $txtva[sizeof($txtva)-1];
-
- $nbdetaux = sizeof($txtva);
-
- for ($i = 0 ; $i < $nbdetaux ; $i++)
- {
- $this->tva_taux_value[$i] = $txtva[$i];
- $this->tva_taux_libelle[$i] = $libtva[$i];
- }
- }
-
/**
* \brief Affiche zone de selection de date
@@ -3050,15 +2868,6 @@ class Form
}
- /**
- * \brief Renvoie la chaine de caractère décrivant l'erreur
- */
- function error()
- {
- return $this->error;
- }
-
-
/**
* \brief Selection de oui/non en chaine (renvoie yes/no)
* \param name Nom du select
@@ -3092,83 +2901,6 @@ class Form
return $resultyesno;
}
- /**
- * \brief Checkbox
- *
- */
- function checkbox($name,$checked=0,$value=1)
- {
- if ($checked==1){
- print "\n";
- }else{
- print "\n";
- }
- }
-
-
- /**
- * \brief Affiche la cartouche générique d'un rapport
- * \param nom Valeur pour nom du rapport
- * \param variante Lien optionnel de variante du rapport
- * \param period Periode du reporting
- * \param periodlink Lien pour changer de période
- * \param description Description
- * \param builddate Date génération
- * \param exportlink Lien pour export
- */
- function report_header($nom,$variante='',$period,$periodlink,$description,$builddate,$exportlink)
- {
- global $langs;
-
- print "\n\n\n";
-
- $h=0;
- $head[$h][0] = $_SERVER["PHP_SELF"];
- $head[$h][1] = $langs->trans("Report");
- dolibarr_fiche_head($head, $hselected, $societe->nom);
-
- print '
';
-
- // Ligne de titre
- print '
';
- print '
'.$langs->trans("ReportName").'
';
- if (! $variante) print '
';
- else print '
';
- print $nom;
- if ($variante) print '
'.$variante;
- print '
';
- print '
';
-
- // Ligne de la periode d'analyse du rapport
- print '
';
- print '
'.$langs->trans("ReportPeriod").'
';
- if (! $periodlink) print '
';
- else print '
';
- print $period;
- if ($periodlink) print '
'.$periodlink;
- print '
';
- print '
';
-
- // Ligne de description
- print '
';
- print '
'.$langs->trans("ReportDescription").'
';
- print '
'.$description.'
';
- print '
';
-
- // Ligne d'export
- print '
';
- print '
'.$langs->trans("GeneratedOn").'
';
- if (! $exportlink) print '
';
- else print '
';
- print dolibarr_print_date($builddate);
- if ($exportlink) print '
'.$langs->trans("Export").'
'.$exportlink;
- print '
';
-
- print '
';
- print '';
- print "\n\n\n";
- }
-
/**
* \brief Affiche la cartouche de la liste des documents d'une propale, facture...
* \param modulepart propal=propal, facture=facture, ...
diff --git a/htdocs/html.formfile.class.php b/htdocs/html.formfile.class.php
new file mode 100644
index 00000000000..86232a8de0b
--- /dev/null
+++ b/htdocs/html.formfile.class.php
@@ -0,0 +1,108 @@
+
+ *
+ * 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$
+ */
+
+/**
+ \file htdocs/html.formfile.class.php
+ \brief Fichier de la classe des fonctions prédéfinie de composants html fichiers
+*/
+
+
+/**
+ \class FormFile
+ \brief Classe permettant la génération de composants html fichiers
+*/
+class FormFile
+{
+ var $db;
+ var $error;
+
+
+ /**
+ * \brief Constructeur
+ * \param DB handler d'accès base de donnée
+ */
+ function FormFile($DB)
+ {
+ $this->db = $DB;
+
+ return 1;
+ }
+
+
+ /**
+ * \brief Affiche formulaire ajout fichier
+ * \param url Url
+ * \param titre Titre zone
+ * \param addcancel 1=Ajoute un bouton 'Annuler'
+ * \return int <0 si ko, >0 si ok
+ */
+ function form_attach_new_file($url,$titre='',$addcancel=0)
+ {
+ global $conf,$langs;
+
+ if ($conf->upload != 0)
+ {
+ print "\n\n\n";
+
+ if (! $titre) $titre=$langs->trans("AttachANewFile");
+ print_titre($titre);
+
+ print '';
+ print ' ';
+
+ print "\n\n\n";
+ }
+
+ return 1;
+ }
+}
+
+?>
diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php
index 9e7ef92586a..2aeef489d68 100644
--- a/htdocs/lib/functions.inc.php
+++ b/htdocs/lib/functions.inc.php
@@ -28,14 +28,6 @@
/**
\file htdocs/lib/functions.inc.php
\brief Ensemble de fonctions de base de dolibarr sous forme d'include
- \author Rodolphe Quiedeville
- \author Jean-Louis Bergamo
- \author Laurent Destailleur
- \author Sebastien Di Cintio
- \author Benoit Mortier
- \version $Revision$
-
- Ensemble de fonctions de base de dolibarr sous forme d'include
*/
// Pour compatibilité lors de l'upgrade
@@ -3422,4 +3414,15 @@ function dol_htmloutput_errors($mesgstring='',$mesgarray='')
return $ret;
}
+
+/**
+ * \brief This function output memory used by PHP and exit everything. Used for debugging purpose.
+ */
+function stopwithmem()
+{
+ print memory_get_usage();
+ llxFooter();
+ exit;
+}
+
?>
diff --git a/htdocs/lib/report.inc.php b/htdocs/lib/report.inc.php
new file mode 100644
index 00000000000..c3602ada3b8
--- /dev/null
+++ b/htdocs/lib/report.inc.php
@@ -0,0 +1,91 @@
+
+ *
+ * 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$
+ */
+
+/**
+ \file htdocs/lib/report.inc.php
+ \brief Ensemble de fonctions de base de dolibarr pour reporting sous forme d'include
+*/
+
+
+/**
+* \brief Affiche la cartouche générique d'un rapport
+* \param nom Valeur pour nom du rapport
+* \param variante Lien optionnel de variante du rapport
+* \param period Periode du reporting
+* \param periodlink Lien pour changer de période
+* \param description Description
+* \param builddate Date génération
+* \param exportlink Lien pour export
+*/
+function report_header($nom,$variante='',$period,$periodlink,$description,$builddate,$exportlink)
+{
+ global $langs;
+
+ print "\n\n\n";
+
+ $h=0;
+ $head[$h][0] = $_SERVER["PHP_SELF"];
+ $head[$h][1] = $langs->trans("Report");
+ dolibarr_fiche_head($head, $hselected, $societe->nom);
+
+ print '
';
+
+ // Ligne de titre
+ print '
';
+ print '
'.$langs->trans("ReportName").'
';
+ if (! $variante) print '
';
+ else print '
';
+ print $nom;
+ if ($variante) print '
'.$variante;
+ print '
';
+ print '
';
+
+ // Ligne de la periode d'analyse du rapport
+ print '
';
+ print '
'.$langs->trans("ReportPeriod").'
';
+ if (! $periodlink) print '
';
+ else print '
';
+ print $period;
+ if ($periodlink) print '
'.$periodlink;
+ print '
';
+ print '
';
+
+ // Ligne de description
+ print '
';
+ print '
'.$langs->trans("ReportDescription").'
';
+ print '
'.$description.'
';
+ print '
';
+
+ // Ligne d'export
+ print '
';
+ print '
'.$langs->trans("GeneratedOn").'
';
+ if (! $exportlink) print '
';
+ else print '
';
+ print dolibarr_print_date($builddate);
+ if ($exportlink) print '
'.$langs->trans("Export").'
'.$exportlink;
+ print '
';
+
+ print '
';
+ print '';
+ print "\n\n\n";
+}
+
+?>
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index f21c945b80b..f3ba8890823 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -29,6 +29,15 @@
\version $Revision$
*/
+// Pour le tuning optionnel. Activer si la variable d'environnement DOL_TUNING est positionnee.
+// A appeler avant tout. Fait l'equivalent de la fonction dol_microtime_float
+$micro_start_time=0;
+if (! empty($_SERVER['DOL_TUNING']))
+{
+ list($usec, $sec) = explode(" ", microtime());
+ $micro_start_time=((float)$usec + (float)$sec);
+}
+
// Forcage du parametrage PHP magic_quotes_gpc et nettoyage des parametres
// (Sinon il faudrait a chaque POST, conditionner
// la lecture de variable par stripslashes selon etat de get_magic_quotes).
@@ -77,9 +86,11 @@ foreach ($_POST as $key => $val)
require_once("master.inc.php");
+
// Chargement des includes complementaire de presentation
if (! defined('NOREQUIREMENU')) require_once(DOL_DOCUMENT_ROOT ."/menu.class.php");
if (! defined('NOREQUIREHTML')) require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php");
+stopwithmem();
if (! defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) require_once(DOL_DOCUMENT_ROOT.'/lib/ajax.lib.php');
// Init session
@@ -610,11 +621,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
*/
function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0)
{
- global $user, $conf, $langs, $db, $micro_start_time;
-
- // Pour le tuning optionnel. Activer si la variable d'environnement DOL_TUNING
- // est positionne A appeler avant tout.
- if (isset($_SERVER['DOL_TUNING'])) $micro_start_time=dol_microtime_float(true);
+ global $user, $conf, $langs, $db;
if (! $conf->css) $conf->css ='/theme/eldy/eldy.css.php';
@@ -960,7 +967,7 @@ function llxFooter($foot='',$limitIEbug=1)
print "\n\n".''."\n";
print "\n\n".''."\n";
- if (isset($_SERVER['DOL_TUNING']))
+ if (! empty($_SERVER['DOL_TUNING']))
{
$micro_end_time=dol_microtime_float(true);
print '