diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 8e4be407b31..0cac36859f2 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -497,7 +497,7 @@ else $var=!$var; print ''.$langs->trans("CompanyCurrency").''; - print $form->currency_name($conf->global->MAIN_MONNAIE,1); + print currency_name($conf->global->MAIN_MONNAIE,1); print ' ('.$conf->global->MAIN_MONNAIE.')'; print ''; @@ -733,4 +733,46 @@ else $db->close(); llxFooter('$Date$ - $Revision$'); + + + +/** +* \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; + } + + } +} + ?> diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 21d0c5f9057..6bbe7cfa2ba 100755 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -34,6 +34,7 @@ require_once("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/cactioncomm.class.php"); require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); +require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); $langs->load("companies"); $langs->load("commercial"); @@ -188,8 +189,8 @@ if ($_GET["id"] > 0) if ($mesg) { print $mesg."
"; } // Affiche formulaire upload - $html=new Form($db); - $html->form_attach_new_file('document.php?id='.$act->id); + $formfile=new FormFile($db); + $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/action/document.php?id='.$act->id); // Affiche liste des documents existant print_titre($langs->trans("AttachedFiles")); diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 5c199471205..b0e01687316 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/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."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); $langs->load('compta'); $langs->load('other'); @@ -160,8 +160,8 @@ if ($propalid > 0) if ($mesg) { print "$mesg
"; } // Affiche formulaire upload - $html=new Form($db); - $html->form_attach_new_file('document.php?propalid='.$propal->id); + $formfile=new FormFile($db); + $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id); // Affiche liste des documents existant print_titre($langs->trans("AttachedFiles")); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 566253654bc..a345fecc2de 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 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$ */ /** @@ -31,6 +30,7 @@ require('./pre.inc.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/order.lib.php'); +require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); $user->getrights('commande'); if (!$user->rights->commande->lire) @@ -154,9 +154,9 @@ if ($id > 0) if ($mesg) { print $mesg."
"; } - // Affiche formulaire upload - $html=new Form($db); - $html->form_attach_new_file('document.php?id='.$commande->id); + // Affiche formulaire upload + $formfile=new FormFile($db); + $formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$commande->id); // Affiche liste des documents existant print_titre($langs->trans("AttachedFiles")); diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 72e2869bcc5..52d0e03fa6c 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/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."/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/invoice.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); $langs->load('propal'); $langs->load('compta'); @@ -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.'/compta/facture/document.php?facid='.$facture->id); // Affiche liste des documents existant print_titre($langs->trans("AttachedFiles")); diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 5ca508e6afd..a9514d0a40d 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * * 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 @@ -26,8 +26,10 @@ */ require("./pre.inc.php"); -require_once("../../tva.class.php"); -require_once("../../chargesociales.class.php"); +require_once(DOL_DOCUMENT_ROOT."/tva.class.php"); +require_once(DOL_DOCUMENT_ROOT."/chargesociales.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/report.inc.php"); + $langs->load("bills"); @@ -67,7 +69,7 @@ else { $builddate=time(); $exportlink=$langs->trans("NotYetAvailable"); } -$html->report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); +report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); // Affiche rapport print ''; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 01d7fb85d91..6e19b3da74e 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * * 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 @@ -26,6 +26,8 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/report.inc.php"); + $year_start=isset($_GET["year_start"])?$_GET["year_start"]:$_POST["year_start"]; $year_current = strftime("%Y",time()); @@ -74,7 +76,7 @@ else { $builddate=time(); $exportlink=$langs->trans("NotYetAvailable"); } -$html->report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); +report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); /* diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index e70e0716840..448905f716f 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * * 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 @@ -26,6 +26,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/report.inc.php"); $year=$_GET["year"]; @@ -67,7 +68,7 @@ else { $builddate=time(); $exportlink=$langs->trans("NotYetAvailable"); } -$html->report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); +report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); // Charge tableau diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 78e73e17af1..4a23ae6c124 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2007 Franky Van Liedekerke * * This program is free software; you can redistribute it and/or modify @@ -27,6 +27,8 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/report.inc.php"); + $langs->load("companies"); $year=$_GET["year"]; @@ -67,7 +69,7 @@ else { $builddate=time(); $exportlink=$langs->trans("NotYetAvailable"); } -$html->report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); +report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); // Charge tableau diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index b5a1a05e2f0..fb4bfe2b121 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * * 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 @@ -26,6 +26,8 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/report.inc.php"); + $year_start=isset($_GET["year_start"])?$_GET["year_start"]:$_POST["year_start"]; $year_current = strftime("%Y",time()); @@ -71,7 +73,7 @@ else { $builddate=time(); $exportlink=$langs->trans("NotYetAvailable"); } -$html->report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); +report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); if ($modecompta == 'CREANCES-DETTES') { diff --git a/htdocs/contact.class.php b/htdocs/contact.class.php index 7e734bddc54..8b545affe63 100644 --- a/htdocs/contact.class.php +++ b/htdocs/contact.class.php @@ -723,6 +723,20 @@ class Contact extends CommonObject } + /** + * \brief Retourne le libelle de civilite du contact + * \return string Nom traduit de la civilité + */ + function getCivilityLabel() + { + global $langs; + $langs->load("dict"); + + $code=$this->civilite_id; + return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : $code; + } + + /** * \brief Return full name (name+' '+lastname) * \param langs Lang for output diff --git a/htdocs/contact/exportimport.php b/htdocs/contact/exportimport.php index 941333b8091..e3b3fad8f45 100644 --- a/htdocs/contact/exportimport.php +++ b/htdocs/contact/exportimport.php @@ -119,7 +119,7 @@ else // Civility print ''; print '
'.$langs->trans("UserTitle").''; -print $form->civilite_name($contact->civilite_id); +print $contact->getCivilityLabel(); print '
'; diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 20eb4578f4e..0bb23cf028e 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -511,7 +511,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit') // Civility print ''.$langs->trans("UserTitle").''; - print $form->civilite_name($contact->civilite_id); + print $contact->getCivilityLabel(); print ''; print 'Poste/Fonction'.$contact->poste.''; diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 20839f0070b..e6617da178f 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -122,7 +122,7 @@ else // Civility print ''.$langs->trans("UserTitle").''; -print $form->civilite_name($contact->civilite_id); +print $contact->getCivilityLabel(); print ''; // LDAP DN diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 4e1e66f6d92..822306cfc39 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -142,7 +142,7 @@ if ($_GET["action"] == 'edit') // Civility print ''.$langs->trans("UserTitle").''; - print $form->civilite_name($contact->civilite_id); + print $contact->getCivilityLabel(); print ''; // Birthday @@ -208,7 +208,7 @@ else // Civility print ''.$langs->trans("UserTitle").''; - print $form->civilite_name($contact->civilite_id); + print $contact->getCivilityLabel(); print ''; // 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 '"; - print "
'; - - $max=$conf->upload; // En Kb - $maxphp=@ini_get('upload_max_filesize'); // En inconnu - if (eregi('m$',$maxphp)) $maxphp=$maxphp*1024; - if (eregi('k$',$maxphp)) $maxphp=$maxphp; - // Now $max and $maxphp are in Kb - if ($maxphp > 0) $max=min($max,$maxphp); - - if ($conf->upload > 0) - { - print ''; - } - print ''; - print '   '; - print ''; - - if ($addcancel) - { - print '   '; - print ''; - } - - print ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb").')'; - - print "
"; - - 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 ''; - if (! $variante) print ''; - print ''; - - // Ligne de la periode d'analyse du rapport - print ''; - print ''; - if (! $periodlink) print ''; - print ''; - - // Ligne de description - print ''; - print ''; - print ''; - print ''; - - // Ligne d'export - print ''; - print ''; - if (! $exportlink) print ''; - - print '
'.$langs->trans("ReportName").''; - else print ''; - print $nom; - if ($variante) print ''.$variante; - print '
'.$langs->trans("ReportPeriod").''; - else print ''; - print $period; - if ($periodlink) print ''.$periodlink; - print '
'.$langs->trans("ReportDescription").''.$description.'
'.$langs->trans("GeneratedOn").''; - else print ''; - print dolibarr_print_date($builddate); - if ($exportlink) print ''.$langs->trans("Export").''.$exportlink; - 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 '"; + print "
'; + + $max=$conf->upload; // En Kb + $maxphp=@ini_get('upload_max_filesize'); // En inconnu + if (eregi('m$',$maxphp)) $maxphp=$maxphp*1024; + if (eregi('k$',$maxphp)) $maxphp=$maxphp; + // Now $max and $maxphp are in Kb + if ($maxphp > 0) $max=min($max,$maxphp); + + if ($conf->upload > 0) + { + print ''; + } + print ''; + print '   '; + print ''; + + if ($addcancel) + { + print '   '; + print ''; + } + + print ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb").')'; + + print "
"; + + 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 ''; + if (! $variante) print ''; + print ''; + + // Ligne de la periode d'analyse du rapport + print ''; + print ''; + if (! $periodlink) print ''; + print ''; + + // Ligne de description + print ''; + print ''; + print ''; + print ''; + + // Ligne d'export + print ''; + print ''; + if (! $exportlink) print ''; + + print '
'.$langs->trans("ReportName").''; + else print ''; + print $nom; + if ($variante) print ''.$variante; + print '
'.$langs->trans("ReportPeriod").''; + else print ''; + print $period; + if ($periodlink) print ''.$periodlink; + print '
'.$langs->trans("ReportDescription").''.$description.'
'.$langs->trans("GeneratedOn").''; + else print ''; + print dolibarr_print_date($builddate); + if ($exportlink) print ''.$langs->trans("Export").''.$exportlink; + 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 '