From 3836b1ad16c44c2183f9fab354baaa25160da2a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 07:28:11 +0000 Subject: [PATCH 01/33] Fix: Tooltip is visible on picto hover --- htdocs/core/class/html.form.class.php | 20 ++++++++------------ htdocs/lib/functions.lib.php | 15 ++++++++------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5f47437f830..6a8724a71be 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -31,7 +31,7 @@ * \file htdocs/core/class/html.form.class.php * \ingroup core * \brief File of class with all html predefined components - * \version $Id: html.form.class.php,v 1.184 2011/06/29 15:48:03 grandoc Exp $ + * \version $Id: html.form.class.php,v 1.185 2011/07/04 07:28:11 eldy Exp $ */ @@ -163,19 +163,14 @@ class Form if ($incbefore) $text = $incbefore.$text; if (! $htmltext) return $text; - $paramfortooltip =''; - // Sanitize tooltip $htmltext=str_replace("\\","\\\\",$htmltext); - //$htmltext=str_replace("'","\'",$htmltext); - //$htmltext=str_replace("'","\'",$htmltext); $htmltext=str_replace("\r","",$htmltext); - $htmltext=str_replace("
\n","
",$htmltext); $htmltext=str_replace("\n","",$htmltext); $htmltext=str_replace('"',""",$htmltext); - $extracss = (!empty($extracss) ? ' '.$extracss : ''); - $paramfortooltip.=' class="classfortooltip'.$extracss.'" title="'.$htmltext.'"'; // Attribut to put on td tag to store tooltip + $paramfortooltipimg=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.dol_escape_htmltag($htmltext,1).'"'; // Attribut to put on td img tag to store tooltip + $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag $s=""; if (empty($notabs)) $s.=''; @@ -183,18 +178,18 @@ class Form { if ($text != '') { - $s.=''.$text; + $s.=''.$text; if ($direction) $s.=' '; $s.=''; } - if ($direction) $s.=''.$img.''; + if ($direction) $s.=''.$img.''; } else { - if ($direction) $s.=''.$img.''; + if ($direction) $s.=''.$img.''; if ($text != '') { - $s.=''; + $s.=''; if ($direction) $s.=' '; $s.=$text.''; } @@ -210,6 +205,7 @@ class Form * @param htmltooltip Content of tooltip * @param direction 1=Icon is after text, -1=Icon is before text * @param type Type of picto (info, help, warning, superadmin...) + * @param extracss Add a CSS style to td tags * @return string HTML code of text, picto, tooltip */ function textwithpicto($text,$htmltext,$direction=1,$type='help',$extracss='') diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 69b57e0336f..e3cd2d50cfb 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -29,7 +29,7 @@ * \file htdocs/lib/functions.lib.php * \brief A set of functions for Dolibarr * This file contains all frequently used functions. - * \version $Id: functions.lib.php,v 1.534 2011/07/03 18:31:13 eldy Exp $ + * \version $Id: functions.lib.php,v 1.535 2011/07/04 07:28:36 eldy Exp $ */ // For compatibility during upgrade @@ -319,19 +319,20 @@ function dol_escape_js($stringtoescape) /** - * \brief Returns text escaped for inclusion in HTML alt or title tags - * \param $stringtoescape String to escape - * \return string Escaped string + * Returns text escaped for inclusion in HTML alt or title tags + * @param $stringtoescape String to escape + * @param $keepb Do not clean tags + * @return string Escaped string */ -function dol_escape_htmltag($stringtoescape) +function dol_escape_htmltag($stringtoescape,$keepb=0) { // escape quotes and backslashes, newlines, etc. $tmp=dol_html_entity_decode($stringtoescape,ENT_COMPAT,'UTF-8'); - $tmp=strtr($tmp, array('"'=>'',"\r"=>'\\r',"\n"=>'\\n',""=>'',''=>'')); + if ($keepb) $tmp=strtr($tmp, array('"'=>'',"\r"=>'\\r',"\n"=>'\\n')); + else $tmp=strtr($tmp, array('"'=>'',"\r"=>'\\r',"\n"=>'\\n',""=>'',''=>'')); return dol_htmlentities($tmp,ENT_COMPAT,'UTF-8'); } - /* For backward compatiblity */ function dolibarr_syslog($message, $level=LOG_INFO) { From 00d69a5855bada7ee53384ba94fa28ab6ce72161 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 07:36:30 +0000 Subject: [PATCH 02/33] Fix: pgsql compatibility --- htdocs/lib/databases/pgsql.lib.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/lib/databases/pgsql.lib.php b/htdocs/lib/databases/pgsql.lib.php index 26cad4ba543..4a6e7947683 100644 --- a/htdocs/lib/databases/pgsql.lib.php +++ b/htdocs/lib/databases/pgsql.lib.php @@ -24,7 +24,7 @@ /** * \file htdocs/lib/databases/pgsql.lib.php * \brief Fichier de la classe permettant de gerer une base pgsql - * \version $Id$ + * \version $Id: pgsql.lib.php,v 1.109 2011/07/04 07:36:30 eldy Exp $ */ // For compatibility during upgrade if (! defined('DOL_DOCUMENT_ROOT')) define('DOL_DOCUMENT_ROOT', '../..'); @@ -1104,19 +1104,19 @@ class DoliDb // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql= "ALTER TABLE ".$table." ADD ".$field_name." "; $sql .= $field_desc['type']; - if( preg_match("/^[^\s]/i",$field_desc['value'])) - $sql .= "(".$field_desc['value'].")"; - if( preg_match("/^[^\s]/i",$field_desc['attribute'])) - $sql .= " ".$field_desc['attribute']; - if( preg_match("/^[^\s]/i",$field_desc['null'])) - $sql .= " ".$field_desc['null']; - if( preg_match("/^[^\s]/i",$field_desc['default'])) - if(preg_match("/null/i",$field_desc['default'])) - $sql .= " default ".$field_desc['default']; + if ($field_desc['type'] != 'int' && preg_match("/^[^\s]/i",$field_desc['value'])) + $sql .= "(".$field_desc['value'].")"; + if (preg_match("/^[^\s]/i",$field_desc['attribute'])) + $sql .= " ".$field_desc['attribute']; + if (preg_match("/^[^\s]/i",$field_desc['null'])) + $sql .= " ".$field_desc['null']; + if (preg_match("/^[^\s]/i",$field_desc['default'])) + if (preg_match("/null/i",$field_desc['default'])) + $sql .= " default ".$field_desc['default']; else - $sql .= " default '".$field_desc['default']."'"; - if( preg_match("/^[^\s]/i",$field_desc['extra'])) - $sql .= " ".$field_desc['extra']; + $sql .= " default '".$field_desc['default']."'"; + if (preg_match("/^[^\s]/i",$field_desc['extra'])) + $sql .= " ".$field_desc['extra']; $sql .= " ".$field_position; dol_syslog($sql,LOG_DEBUG); From 588547ea6c19d1dcf8469d3e235e1bef89893741 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 07:38:22 +0000 Subject: [PATCH 03/33] Qual: Uniformize code --- htdocs/admin/societe.php | 8 ++++---- htdocs/admin/societe_extrafields.php | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php index d5c45d54f13..37fe17f7311 100644 --- a/htdocs/admin/societe.php +++ b/htdocs/admin/societe.php @@ -23,7 +23,7 @@ * \file htdocs/admin/societe.php * \ingroup company * \brief Third party module setup page - * \version $Id$ + * \version $Id: societe.php,v 1.60 2011/07/04 07:38:22 eldy Exp $ */ require("../main.inc.php"); @@ -166,8 +166,8 @@ if ($_GET["action"] == 'setdoc') $form=new Form($db); - -llxHeader('',$langs->trans("CompanySetup"),'EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers'); +$help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers'; +llxHeader('',$langs->trans("CompanySetup"),$help_url); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("CompanySetup"),$linkback,'setup'); @@ -499,5 +499,5 @@ dol_fiche_end(); $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 07:38:22 $ - $Revision: 1.60 $'); ?> diff --git a/htdocs/admin/societe_extrafields.php b/htdocs/admin/societe_extrafields.php index ac6b0a8374a..fe274220197 100755 --- a/htdocs/admin/societe_extrafields.php +++ b/htdocs/admin/societe_extrafields.php @@ -22,7 +22,7 @@ * \file htdocs/admin/societe_extrafields.php * \ingroup societe * \brief Page to setup extra fields of third party - * \version $Id$ + * \version $Id: societe_extrafields.php,v 1.4 2011/07/04 07:38:22 eldy Exp $ */ require("../main.inc.php"); @@ -169,7 +169,7 @@ if ($action == 'delete') $textobject=$langs->transnoentitiesnoconv("ThirdParty"); -$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; +$help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers'; llxHeader('',$langs->trans("CompanySetup"),$help_url); @@ -312,5 +312,5 @@ if ($_GET["attrname"] && $action == 'edit') $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 07:38:22 $ - $Revision: 1.4 $'); ?> From c341b68eae60db805061ddb1e44eddafb557b4db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 08:00:52 +0000 Subject: [PATCH 04/33] New: Project creation page has a cancel button --- htdocs/contact/fiche.php | 20 ++++++++++---------- htdocs/lib/company.lib.php | 14 ++++++++------ htdocs/projet/fiche.php | 28 ++++++++++++++++++++++------ htdocs/societe/soc.php | 15 ++------------- 4 files changed, 42 insertions(+), 35 deletions(-) diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 6fc5ef70e40..3e40da58a72 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -24,7 +24,7 @@ * \file htdocs/contact/fiche.php * \ingroup societe * \brief Card of a contact - * \version $Id: fiche.php,v 1.220 2011/07/02 14:53:42 eldy Exp $ + * \version $Id: fiche.php,v 1.221 2011/07/04 08:00:52 eldy Exp $ */ require("../main.inc.php"); @@ -123,7 +123,14 @@ if (method_exists($objcanvas->control,'doActions')) if (empty($reshook)) { - // Creation utilisateur depuis contact + // Cancel + if (GETPOST("cancel") && GETPOST('backtopage')) + { + header("Location: ".GETPOST('backtopage')); + exit; + } + + // Creation utilisateur depuis contact if ($_POST["action"] == 'confirm_create_user' && $_POST["confirm"] == 'yes' && $user->rights->user->user->creer) { // Recuperation contact actuel @@ -162,13 +169,6 @@ if (empty($reshook)) } } - // Cancel - if (GETPOST("cancel") && GETPOST('backtopage')) - { - header("Location: ".GETPOST('backtopage')); - exit; - } - // Add contact if (GETPOST("action") == 'add' && $user->rights->societe->contact->creer) { @@ -974,5 +974,5 @@ else $db->close(); -llxFooter('$Date: 2011/07/02 14:53:42 $ - $Revision: 1.220 $'); +llxFooter('$Date: 2011/07/04 08:00:52 $ - $Revision: 1.221 $'); ?> diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php index fd74cf79c4b..0b72ea1049a 100644 --- a/htdocs/lib/company.lib.php +++ b/htdocs/lib/company.lib.php @@ -24,7 +24,7 @@ * \file htdocs/lib/company.lib.php * \brief Ensemble de fonctions de base pour le module societe * \ingroup societe - * \version $Id: company.lib.php,v 1.120 2011/07/03 18:32:08 eldy Exp $ + * \version $Id: company.lib.php,v 1.121 2011/07/04 08:00:52 eldy Exp $ */ /** @@ -331,9 +331,9 @@ function currency_name($code_iso,$withcode=0) } /** - * \brief Retourne le nom traduit de la forme juridique - * \param code Code de la forme juridique - * \return string Nom traduit du pays + * Retourne le nom traduit de la forme juridique + * @param code Code de la forme juridique + * @return string Nom traduit du pays */ function getFormeJuridiqueLabel($code) { @@ -387,7 +387,8 @@ function show_projects($conf,$langs,$db,$object,$backtopage='') $buttoncreate=''; if ($conf->projet->enabled && $user->rights->projet->creer) { - $buttoncreate=''.$langs->trans("AddProject").''; + //$buttoncreate=''.$langs->trans("AddProject").''; + $buttoncreate=''.$langs->trans("AddProject").' '.img_picto($langs->trans("AddProject"),'filenew').''."\n"; } print "\n"; @@ -487,7 +488,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $buttoncreate=''; if ($user->rights->societe->contact->creer) { - $buttoncreate=''.$langs->trans("AddContact").''."\n"; + //$buttoncreate=''.$langs->trans("AddContact").''."\n"; + $buttoncreate=''.$langs->trans("AddContact").' '.img_picto($langs->trans("AddContact"),'filenew').''."\n"; } print "\n"; diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 3c1c0c69080..8806bc7c32e 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -1,7 +1,7 @@ - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin * * 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 @@ -22,7 +22,7 @@ * \file htdocs/projet/fiche.php * \ingroup projet * \brief Project card - * \version $Id$ + * \version $Id: fiche.php,v 1.126 2011/07/04 08:00:52 eldy Exp $ */ require("../main.inc.php"); @@ -55,6 +55,13 @@ $result = restrictedArea($user, 'projet', $projectid); * Actions */ +// Cancel +if (GETPOST("cancel") && GETPOST('backtopage')) +{ + header("Location: ".GETPOST('backtopage')); + exit; +} + if ($_POST["action"] == 'add' && $user->rights->projet->creer) { $error=0; @@ -270,8 +277,10 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print '
'; print ''; - print '
'; print ''; + print ''; + + print '
'; $project = new Project($db); @@ -323,7 +332,14 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print '
'; - print '
'; + print '
'; + print ''; + if (GETPOST('backtopage')) + { + print '     '; + print ''; + } + print '
'; print ''; } @@ -592,5 +608,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 08:00:52 $ - $Revision: 1.126 $'); ?> diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index ed83535f983..b9cbbc020b4 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -26,7 +26,7 @@ * \file htdocs/societe/soc.php * \ingroup societe * \brief Third party card page - * \version $Id: soc.php,v 1.120 2011/07/02 14:51:27 eldy Exp $ + * \version $Id: soc.php,v 1.121 2011/07/04 08:00:53 eldy Exp $ */ require("../main.inc.php"); @@ -1903,17 +1903,6 @@ else print ''.$langs->trans("Modify").''."\n"; } - /*if ($user->rights->societe->contact->creer) - { - print ''.$langs->trans("AddContact").''."\n"; - } - */ - - /*if ($conf->projet->enabled && $user->rights->projet->creer) - { - print ''.$langs->trans("AddProject").''."\n"; - }*/ - if ($user->rights->societe->supprimer) { if ($conf->use_javascript_ajax) @@ -1972,5 +1961,5 @@ else $db->close(); -llxFooter('$Date: 2011/07/02 14:51:27 $ - $Revision: 1.120 $'); +llxFooter('$Date: 2011/07/04 08:00:53 $ - $Revision: 1.121 $'); ?> \ No newline at end of file From ff1df55cefa1176fbaf140aa2fcec9669dee4ab3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 08:01:30 +0000 Subject: [PATCH 05/33] Prepare 3.1.0 --- build/doxygen/dolibarr-doxygen.doxyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/doxygen/dolibarr-doxygen.doxyfile b/build/doxygen/dolibarr-doxygen.doxyfile index 409f376e01a..0b91506e862 100644 --- a/build/doxygen/dolibarr-doxygen.doxyfile +++ b/build/doxygen/dolibarr-doxygen.doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = dolibarr # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 3.0.0 +PROJECT_NUMBER = 3.1.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. From 2660682956662e91da89e0c36c354d55ba6b5844 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 08:03:37 +0000 Subject: [PATCH 06/33] Prepare 3.1 --- build/perl/virtualmin/dolibarr.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/perl/virtualmin/dolibarr.pl b/build/perl/virtualmin/dolibarr.pl index 253b958ebab..6d9c923c88a 100644 --- a/build/perl/virtualmin/dolibarr.pl +++ b/build/perl/virtualmin/dolibarr.pl @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------- # \file dolibarr.pl # \brief Dolibarr script install for Virtualmin Pro -# \version $Revision$ +# \version $Revision: 1.20 $ # \author (c)2009-2011 Regis Houssin #---------------------------------------------------------------------------- @@ -31,7 +31,7 @@ return "Regis Houssin"; # script_dolibarr_versions() sub script_dolibarr_versions { -return ( "3.0.0" ); +return ( "3.1.0" ); } sub script_dolibarr_category From 872c5a623ca78bbe109bde0aaaf45325d4f609e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 08:38:51 +0000 Subject: [PATCH 07/33] doxygen --- htdocs/cashdesk/class/Facturation.class.php | 120 +++++++++--------- ...terface_modPaypal_PaypalWorkflow.class.php | 4 +- htdocs/lib/company.lib.php | 10 +- htdocs/lib/date.lib.php | 4 +- htdocs/lib/functions.lib.php | 64 ++++++---- htdocs/lib/functions2.lib.php | 56 ++++---- htdocs/lib/functions_ch.lib.php | 7 +- 7 files changed, 137 insertions(+), 128 deletions(-) diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index fd55c4996c7..dd7bd57b2cd 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -27,17 +27,17 @@ include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php'); class Facturation { /** - * Attributs "volatiles" : reinitialises apres chaque traitement d'un article - *

Attributs "volatiles" : reinitialises apres chaque traitement d'un article

- * @var int $id => 'rowid' du produit dans llx_product - * @var string $ref => 'ref' du produit dans llx_product - * @var int $qte => Quantite pour le produit en cours de traitement - * @var int $stock => Stock theorique pour le produit en cours de traitement - * @var int $remise_percent => Remise en pourcent sur le produit en cours - * @var int $montant_remise => Remise en pourcent sur le produit en cours - * @var int $prix => Prix HT du produit en cours - * @var int $tva => 'rowid' du taux de tva dans llx_c_tva - */ + * Attributs "volatiles" : reinitialises apres chaque traitement d'un article + *

Attributs "volatiles" : reinitialises apres chaque traitement d'un article

+ * int $id => 'rowid' du produit dans llx_product + * string $ref => 'ref' du produit dans llx_product + * int $qte => Quantite pour le produit en cours de traitement + * int $stock => Stock theorique pour le produit en cours de traitement + * int $remise_percent => Remise en pourcent sur le produit en cours + * int $montant_remise => Remise en pourcent sur le produit en cours + * int $prix => Prix HT du produit en cours + * int $tva => 'rowid' du taux de tva dans llx_c_tva + */ var $id; protected $ref; protected $qte; @@ -48,17 +48,17 @@ class Facturation { protected $tva; /** - * Attributs persistants : utilises pour toute la duree de la vente (jusqu'a validation ou annulation) - * @var string $num_facture => Numero de la facture (de la forme FAYYMM-XXXX) - * @var string $mode_reglement => Mode de reglement (ESP, CB ou CHQ) - * @var int $montant_encaisse => Montant encaisse en cas de reglement en especes - * @var int $montant_rendu => Monnaie rendue en cas de reglement en especes - * @var int $paiement_le => Date de paiement en cas de paiement differe - * - * @var int $prix_total_ht => Prix total hors taxes - * @var int $montant_tva => Montant total de la TVA, tous taux confondus - * @var int $prix_total_ttc => Prix total TTC - */ + * Attributs persistants : utilises pour toute la duree de la vente (jusqu'a validation ou annulation) + * string $num_facture => Numero de la facture (de la forme FAYYMM-XXXX) + * string $mode_reglement => Mode de reglement (ESP, CB ou CHQ) + * int $montant_encaisse => Montant encaisse en cas de reglement en especes + * int $montant_rendu => Monnaie rendue en cas de reglement en especes + * int $paiement_le => Date de paiement en cas de paiement differe + * + * int $prix_total_ht => Prix total hors taxes + * int $montant_tva => Montant total de la TVA, tous taux confondus + * int $prix_total_ttc => Prix total TTC + */ protected $num_facture; protected $mode_reglement; protected $montant_encaisse; @@ -82,9 +82,9 @@ class Facturation { // Methodes de traitement des donnees - /** - * \brief Ajout d'un article au panier - */ + /** + * Ajout d'un article au panier + */ public function ajoutArticle() { global $db; @@ -96,7 +96,7 @@ class Facturation { dol_syslog("ajoutArticle sql=".$sql); $resql = $db->query($sql); - if ($resql) + if ($resql) { $obj = $db->fetch_object($resql); $vat_rate=$obj->taux; @@ -156,10 +156,10 @@ class Facturation { } - /** - * Suppression du panier d'un article identifie par son id dans la table llx_pos_tmp - * @param aArticle - */ + /** + * Suppression du panier d'un article identifie par son id dans la table llx_pos_tmp + * @param aArticle + */ public function supprArticle($aArticle) { global $db; @@ -172,9 +172,9 @@ class Facturation { } - /** - * \brief Calcul du total HT, total TTC et montants TVA - */ + /** + * \brief Calcul du total HT, total TTC et montants TVA + */ public function calculTotaux() { global $db; @@ -234,7 +234,7 @@ class Facturation { } /** - * Reinitialisation des attributs persistants + * Reinitialisation des attributs persistants */ public function raz_pers () { @@ -300,10 +300,10 @@ class Facturation { } /** - * Getter for qte - * @param $aQte - * @return - */ + * Getter for qte + * @param $aQte + * @return + */ public function qte ( $aQte=null ) { if ( !$aQte ) { @@ -322,11 +322,11 @@ class Facturation { } - /** - * Getter for stock - * @param aStock - * @return - */ + /** + * Getter for stock + * @param aStock + * @return + */ public function stock ( $aStock=null ) { @@ -347,10 +347,10 @@ class Facturation { } /** - * Getter for remise_percent - * @param aRemisePercent - * @return - */ + * Getter for remise_percent + * @param aRemisePercent + * @return + */ public function remise_percent ( $aRemisePercent=null ) { @@ -371,10 +371,10 @@ class Facturation { } /** - * Getter for montant_remise - * @param aMontantRemise - * @return - */ + * Getter for montant_remise + * @param aMontantRemise + * @return + */ public function montant_remise ( $aMontantRemise=null ) { if ( !$aMontantRemise ) { @@ -394,10 +394,10 @@ class Facturation { } /** - * Getter for prix - * @param aPrix - * @return - */ + * Getter for prix + * @param aPrix + * @return + */ public function prix ( $aPrix=null ) { @@ -417,11 +417,11 @@ class Facturation { } - /** - * Getter for tva - * @param aTva - * @return - */ + /** + * Getter for tva + * @param aTva + * @return + */ public function tva ( $aTva=null ) { diff --git a/htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php b/htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php index 0c22711c308..ff999068808 100644 --- a/htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php +++ b/htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php @@ -17,10 +17,10 @@ */ /** - * \file /paypal/inc/triggers/interface_modPaypal_PaypalWorkflow.class.php + * \file /htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php * \ingroup paypal * \brief Trigger file for paypal workflow - * \version $Id$ + * \version $Id: interface_modPaypal_PaypalWorkflow.class.php,v 1.6 2011/07/04 08:38:51 eldy Exp $ */ diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php index 0b72ea1049a..91fe7bfcfad 100644 --- a/htdocs/lib/company.lib.php +++ b/htdocs/lib/company.lib.php @@ -24,7 +24,7 @@ * \file htdocs/lib/company.lib.php * \brief Ensemble de fonctions de base pour le module societe * \ingroup societe - * \version $Id: company.lib.php,v 1.121 2011/07/04 08:00:52 eldy Exp $ + * \version $Id: company.lib.php,v 1.122 2011/07/04 08:38:51 eldy Exp $ */ /** @@ -212,7 +212,7 @@ function societe_admin_prepare_head($object) * @param id Id or code of country * @param withcode 0=Return label, 1=Return code + label, 2=Return code from id, 3=Return id from code * @param dbtouse Database handler (using in global way may fail because of conflicts with some autoload features) - * @param outputlangs Lang object for output translation + * @param outputlangs Langs object for output translation * @param entconv 0=Return value without entities and not converted to output charset * @return string String with country code or translated country name */ @@ -369,7 +369,7 @@ function getFormeJuridiqueLabel($code) /** * Show html area for list of projects * @param conf Object conf - * @param lang Object lang + * @param langs Object langs * @param db Database handler * @param object Third party object * @param backtopage Url to go once contact is created @@ -466,7 +466,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='') /** * Show html area for list of contacts * @param conf Object conf - * @param lang Object lang + * @param langs Object langs * @param db Database handler * @param object Third party object * @param backtopage Url to go once contact is created @@ -940,7 +940,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) /** * Show html area for list of subsidiaries * @param conf Object conf - * @param lang Object lang + * @param langs Object langs * @param db Database handler * @param object Third party object */ diff --git a/htdocs/lib/date.lib.php b/htdocs/lib/date.lib.php index 4e21c4a28e2..36f8669a8db 100644 --- a/htdocs/lib/date.lib.php +++ b/htdocs/lib/date.lib.php @@ -22,7 +22,7 @@ /** * \file htdocs/lib/date.lib.php * \brief Set of function to manipulate dates - * \version $Id$ + * \version $Id: date.lib.php,v 1.32 2011/07/04 08:38:51 eldy Exp $ */ @@ -242,6 +242,7 @@ function dol_get_next_month($month, $year) /** Return previous week * @param day Day * @param week Week + * @param month Month * @param year Year * @return array Previous year,month,day */ @@ -258,6 +259,7 @@ function dol_get_prev_week($day, $week, $month, $year) /** Return next week * @param day Day * @param week Week + * @param month Month * @param year Year * @return array Next year,month,day */ diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index e3cd2d50cfb..ffbe9964b2b 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -29,7 +29,7 @@ * \file htdocs/lib/functions.lib.php * \brief A set of functions for Dolibarr * This file contains all frequently used functions. - * \version $Id: functions.lib.php,v 1.535 2011/07/04 07:28:36 eldy Exp $ + * \version $Id: functions.lib.php,v 1.536 2011/07/04 08:38:51 eldy Exp $ */ // For compatibility during upgrade @@ -321,7 +321,7 @@ function dol_escape_js($stringtoescape) /** * Returns text escaped for inclusion in HTML alt or title tags * @param $stringtoescape String to escape - * @param $keepb Do not clean tags + * @param $keepb Do not clean b tags * @return string Escaped string */ function dol_escape_htmltag($stringtoescape,$keepb=0) @@ -807,6 +807,7 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$chec * @param year Year * @param gm 1=Input informations are GMT values, otherwise local to server TZ * @param check 0=No check on parameters (Can use day 32, etc...) + * @param isdst Dayling saving time * @return timestamp Date as a timestamp, '' if error * @see dol_print_date, dol_stringtotime */ @@ -921,11 +922,11 @@ function dol_print_size($size,$shortvalue=0,$shortunit=0) } /** - * \brief Show Url link - * \param url Url to show - * \param target Target for link - * \param max Max number of characters to show - * \return string HTML Link + * Show Url link + * @param url Url to show + * @param target Target for link + * @param max Max number of characters to show + * @return string HTML Link */ function dol_print_url($url,$target='_blank',$max=32) { @@ -942,14 +943,14 @@ function dol_print_url($url,$target='_blank',$max=32) } /** - * \brief Show EMail link - * \param email EMail to show (only email, without ) - * \param cid Id of contact if known - * \param socid Id of third party if known - * \param addlink 0=no link to create action - * \param max Max number of characters to show - * \param showinvalid Show warning if syntax email is wrong - * \return string HTML Link + * Show EMail link + * @param email EMail to show (only email, without 'Name of recipient' before) + * @param cid Id of contact if known + * @param socid Id of third party if known + * @param addlink 0=no link to create action + * @param max Max number of characters to show + * @param showinvalid Show warning if syntax email is wrong + * @return string HTML Link */ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=1) { @@ -1539,7 +1540,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8') /** - * Show a picto according to module/object (generic function) + * Show a picto according to module or object (generic function) * @param alt Text of alt on image * @param object Objet pour lequel il faut afficher le logo (example: user, group, action, bill, contract, propal, product, ...) * Pour les modules externe utiliser nomimage@mymodule pour rechercher dans le repertoire "img" du module @@ -1720,6 +1721,7 @@ function img_edit_remove($alt = "default") * Affiche logo editer/modifier fiche * @param alt Texte sur le alt de l'image * @param float Si il faut y mettre le style "float: right" + * @param other Add more attributes on img * @return string Retourne tag img */ function img_edit($alt = "default", $float=0, $other='') @@ -1737,6 +1739,7 @@ function img_edit($alt = "default", $float=0, $other='') * Affiche logo voir fiche * @param alt Texte sur le alt de l'image * @param float Si il faut y mettre le style "float: right" + * @param other Add more attributes on img * @return string Retourne tag img */ function img_view($alt = "default", $float=0, $other='') @@ -1957,6 +1960,7 @@ function img_tick($alt = "default") /** * Affiche le logo tick si allow * @param allow Authorise ou non + * @param alt Alt text for img * @return string Retourne tag img */ function img_allow($allow,$alt='default') @@ -2000,20 +2004,20 @@ function img_mime($file,$alt='') * @param infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto * @return string String with info text */ -function info_admin($texte,$infoonimgalt=0) +function info_admin($text,$infoonimgalt=0) { global $conf,$langs; $s=''; if ($infoonimgalt) { - $s.=img_picto($texte,'star'); + $s.=img_picto($text,'star'); } else { $s.='
'; $s.=img_picto($langs->trans("InfoAdmin"),'star'); $s.=' '; - $s.=$texte; + $s.=$text; $s.='
'; } return $s; @@ -2783,7 +2787,7 @@ function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrow * Fonction qui retourne un taux de tva formate pour visualisation * Utilisee dans les pdf et les pages html * @param rate Rate value to format (19.6 19,6 19.6% 19,6%,...) - * @param foundpercent Add a percent % sign in output + * @param addpercent Add a percent % sign in output * @param info_bits Miscellanous information on vat * @return string Chaine avec montant formate (19,6 ou 19,6% ou 8.5% *) */ @@ -3356,7 +3360,7 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1) /** * Replace CRLF in string with a HTML BR tag. - * @param string2encode String to encode + * @param stringtoencode String to encode * @param nl2brmode 0=Adding br before \n, 1=Replacing \n by br * @param forxml false=Use
, true=Use
* @return string String encoded @@ -3416,6 +3420,7 @@ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8') /** * This function is called to decode a HTML string (it decodes entities and br tags) * @param stringtodecode String to decode + * @param pagecodeto Page code for result */ function dol_htmlentitiesbr_decode($stringtodecode,$pagecodeto='UTF-8') { @@ -3520,17 +3525,17 @@ function dol_nboflines($s,$maxchar=0) * Return nb of lines of a formated text with \n and
* @param texte Text * @param maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut) - * @param charset Give the charset used to encode the $texte variable in memory. + * @param charset Give the charset used to encode the $text variable in memory. * @return int Number of lines */ -function dol_nboflines_bis($texte,$maxlinesize=0,$charset='UTF-8') +function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8') { - //print $texte; + //print $text; $repTable = array("\t" => " ", "\n" => "
", "\r" => " ", "\0" => " ", "\x0B" => " "); - $texte = strtr($texte, $repTable); + $text = strtr($text, $repTable); if ($charset == 'UTF-8') { $pattern = '/(<[^>]+>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support else $pattern = '/(<[^>]+>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. - $a = preg_split($pattern, $texte, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $nblines = floor((count($a)+1)/2); // count possible auto line breaks if($maxlinesize) @@ -3602,6 +3607,7 @@ function dol_textishtml($msg,$option=0) * - From $substitutionarray (oldval=>newval) * - From special constants (__XXX__=>f(objet->xxx)) by substitutions modules * @param chaine Source string in which we must do substitution + * @param substitutionarray Array with key->val to substitute * @return string Output string after subsitutions */ function make_substitutions($chaine,$substitutionarray) @@ -3656,6 +3662,7 @@ function complete_substitutions_array(&$substitutionarray,$outputlangs,$object=' * @param date_start Start date * @param date_end End date * @param format Output format + * @param outputlangs Output language */ function print_date_range($date_start,$date_end,$format = '',$outputlangs='') { @@ -3667,6 +3674,7 @@ function print_date_range($date_start,$date_end,$format = '',$outputlangs='') * @param date_start Start date * @param date_end End date * @param format Output format + * @param outputlangs Output language */ function get_date_range($date_start,$date_end,$format = '',$outputlangs='') { @@ -3883,7 +3891,7 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb * Print formated error messages to output (Used to show messages on html output) * @param mesgstring Error message * @param mesgarray Error messages array - * @return keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify) + * @param keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify) * @see dol_print_error * @see dol_htmloutput_mesg */ @@ -3927,7 +3935,7 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort, $case_sensitive /** * Check if a string is in UTF8 - * @param $Str String to check + * @param $str String to check * @return boolean True if string is UTF8 or ISO compatible with UTF8, False if not (ISO with special char or Binary) */ function utf8_check($str) diff --git a/htdocs/lib/functions2.lib.php b/htdocs/lib/functions2.lib.php index 9b3899b15c1..57b891e00ee 100644 --- a/htdocs/lib/functions2.lib.php +++ b/htdocs/lib/functions2.lib.php @@ -22,7 +22,7 @@ * \file htdocs/lib/functions2.lib.php * \brief A set of functions for Dolibarr * This file contains all rare functions. - * \version $Id$ + * \version $Id: functions2.lib.php,v 1.75 2011/07/04 08:38:51 eldy Exp $ */ @@ -632,10 +632,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m /** * Check value - * - * @param $db Database handler * @param $mask Mask to use - * @param $value + * @param $value Value * @return int <0 if KO, 0 if OK */ function check_value($mask,$value) @@ -723,11 +721,11 @@ function check_value($mask,$value) /** - * \brief Convert a binary data to string that represent hexadecimal value - * \param bin Value to convert - * \param pad Add 0 - * \param upper Convert to tupper - * \return string x + * Convert a binary data to string that represent hexadecimal value + * @param bin Value to convert + * @param pad Add 0 + * @param upper Convert to tupper + * @return string x */ function binhex($bin, $pad=false, $upper=false) { @@ -741,9 +739,9 @@ function binhex($bin, $pad=false, $upper=false) /** - * \brief Convertir de l'hexadecimal en binaire - * \param string hexa - * \return string bin + * Convert an hexadecimal string into a binary string + * @param hexa Hexadecimal string to convert (example: 'FF') + * @return string bin */ function hexbin($hexa) { @@ -757,9 +755,9 @@ function hexbin($hexa) /** - * \brief Retourne le numero de la semaine par rapport a une date - * \param time Date au format 'timestamp' - * \return int Numero de semaine + * Retourne le numero de la semaine par rapport a une date + * @param time Date au format 'timestamp' + * @return int Numero de semaine */ function numero_semaine($time) { @@ -838,11 +836,11 @@ function numero_semaine($time) /** - * \brief Convertit une masse d'une unite vers une autre unite - * \param weight float Masse a convertir - * \param from_unit int Unite originale en puissance de 10 - * \param to_unit int Nouvelle unite en puissance de 10 - * \return float Masse convertie + * Convertit une masse d'une unite vers une autre unite + * @param weight float Masse a convertir + * @param from_unit int Unite originale en puissance de 10 + * @param to_unit int Nouvelle unite en puissance de 10 + * @return float Masse convertie */ function weight_convert($weight,&$from_unit,$to_unit) { @@ -872,11 +870,12 @@ function weight_convert($weight,&$from_unit,$to_unit) /** - * \brief Save personnal parameter - * \param db Handler database - * \param user Object user - * \param tab Tableau (cle=>valeur) des parametres a sauvegarder - * \return int <0 if KO, >0 if OK + * Save personnal parameter + * @param db Handler database + * @param conf Object conf + * @param user Object user + * @param tab Tableau (cle=>valeur) des parametres a sauvegarder + * @return int <0 if KO, >0 if OK */ function dol_set_user_param($db, $conf, &$user, $tab) { @@ -936,9 +935,10 @@ function dol_set_user_param($db, $conf, &$user, $tab) /** - * \brief Returns formated reduction - * \param reduction Reduction percentage - * \return string Formated reduction + * Returns formated reduction + * @param reduction Reduction percentage + * @param langs Output language + * @return string Formated reduction */ function dol_print_reduction($reduction=0,$langs) { diff --git a/htdocs/lib/functions_ch.lib.php b/htdocs/lib/functions_ch.lib.php index 14ccac984d2..dffa7910e21 100644 --- a/htdocs/lib/functions_ch.lib.php +++ b/htdocs/lib/functions_ch.lib.php @@ -21,17 +21,16 @@ * \file htdocs/lib/functions_ch.lib.php * \brief A set of swiss functions for Dolibarr * This file contains rare functions. - * \version $Id$ + * \version $Id: functions_ch.lib.php,v 1.3 2011/07/04 08:38:51 eldy Exp $ */ /** * Return if a BVRB number is valid or not (For switzerland) - * - * @param string BVRB number + * @param bvrb BVRB number * @return bool True if OK, false if KO */ -function dol_ch_controle_bvrb ($bvrb) +function dol_ch_controle_bvrb($bvrb) { // Init array for control $tableau[0][0]=0; From 9e5dc296e174cc562b074767e5adb8642b230cc7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 08:53:01 +0000 Subject: [PATCH 08/33] doxygen --- htdocs/core/class/html.formother.class.php | 5 ++- htdocs/imports/import.php | 8 ++-- .../modules/member/cards/modules_cards.php | 15 +++---- .../modules/propale/modules_propale.php | 10 ++--- htdocs/lib/functions.lib.php | 10 ++--- htdocs/lib/pdf.lib.php | 44 +++++++++---------- htdocs/main.inc.php | 30 ++++++------- 7 files changed, 61 insertions(+), 61 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index eb73df74443..cbf91f7ef94 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -29,7 +29,7 @@ * \file htdocs/core/class/html.formother.class.php * \ingroup core * \brief Fichier de la classe des fonctions predefinie de composants html autre - * \version $Id: html.formother.class.php,v 1.16 2011/06/26 09:32:13 hregis Exp $ + * \version $Id: html.formother.class.php,v 1.17 2011/07/04 08:53:01 eldy Exp $ */ @@ -653,7 +653,8 @@ class FormOther * @param $parent * @param $lines * @param $level - * @param $selected + * @param $selectedtask + * @param $selectedproject */ function PLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0) { diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index a865628c652..c2f23f30e05 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -21,7 +21,7 @@ * \file htdocs/imports/import.php * \ingroup import * \brief Pages of import Wizard - * \version $Id$ + * \version $Id: import.php,v 1.66 2011/07/04 08:53:01 eldy Exp $ */ require_once("../main.inc.php"); @@ -1669,7 +1669,7 @@ print '
'; $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 08:53:01 $ - $Revision: 1.66 $'); /* @@ -1729,8 +1729,8 @@ function show_elem($fieldssource,$i,$pos,$key,$var,$nostyle='') /** * Return not used field number - * - * @param $listofkey + * @param $fieldssource + * @param $listofkey * @return */ function getnewkey(&$fieldssource,&$listofkey) diff --git a/htdocs/includes/modules/member/cards/modules_cards.php b/htdocs/includes/modules/member/cards/modules_cards.php index 29a04a084c1..8a3409f3030 100644 --- a/htdocs/includes/modules/member/cards/modules_cards.php +++ b/htdocs/includes/modules/member/cards/modules_cards.php @@ -24,7 +24,7 @@ * \file htdocs/includes/modules/member/cards/modules_cards.php * \ingroup member * \brief File of parent class of document generator for members cards. - * \version $Id$ + * \version $Id: modules_cards.php,v 1.10 2011/07/04 08:53:01 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); @@ -61,13 +61,12 @@ class ModelePDFCards /** - * \brief Cree un fichier de cartes de visites en fonction du modele de ADHERENT_CARDS_ADDON_PDF - * \param db objet base de donnee - * \param id id de la facture a creer - * \param message message - * \param modele force le modele a utiliser ('' to not force) - * \param outputlangs objet lang a utiliser pour traduction - * \return int <0 if KO, >0 if OK + * Cree un fichier de cartes de visites en fonction du modele de ADHERENT_CARDS_ADDON_PDF + * @param db Database handler + * @param arrayofmembers Array of members + * @param modele Force modele to use ('' to not force) + * @param outputlangs Objet langs to use for translation + * @return int <0 if KO, >0 if OK */ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs) { diff --git a/htdocs/includes/modules/propale/modules_propale.php b/htdocs/includes/modules/propale/modules_propale.php index 5114bf2e343..5828075a41e 100644 --- a/htdocs/includes/modules/propale/modules_propale.php +++ b/htdocs/includes/modules/propale/modules_propale.php @@ -24,7 +24,7 @@ * \ingroup propale * \brief Fichier contenant la classe mere de generation des propales en PDF * et la classe mere de numerotation des propales - * \version $Id$ + * \version $Id: modules_propale.php,v 1.61 2011/07/04 08:53:01 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); @@ -132,10 +132,10 @@ class ModeleNumRefPropales /** * Cree une propale sur disque en fonction du modele de PROPALE_ADDON_PDF - * @param db objet base de donnee - * @param id id de la propale a creer - * @param modele force le modele a utiliser ('' to not force) - * @param outputlangs objet lang a utiliser pour traduction + * @param db Database handler + * @param object Object proposal + * @param modele Force model to use ('' to not force) + * @param outputlangs Object langs to use for output * @param hidedetails Hide details of lines * @param hidedesc Hide description * @param hideref Hide ref diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index ffbe9964b2b..6ce212c314d 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -29,7 +29,7 @@ * \file htdocs/lib/functions.lib.php * \brief A set of functions for Dolibarr * This file contains all frequently used functions. - * \version $Id: functions.lib.php,v 1.536 2011/07/04 08:38:51 eldy Exp $ + * \version $Id: functions.lib.php,v 1.537 2011/07/04 08:53:01 eldy Exp $ */ // For compatibility during upgrade @@ -2766,7 +2766,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so * @param file Lien * @param options Autres parametres d'url a propager dans les liens ("" par defaut) * @param nextpage Faut-il une page suivante - * @param betweenarraows HTML Content to show between arrows + * @param betweenarrows HTML Content to show between arrows */ function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrows='') { @@ -3523,7 +3523,7 @@ function dol_nboflines($s,$maxchar=0) /** * Return nb of lines of a formated text with \n and
- * @param texte Text + * @param text Text * @param maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut) * @param charset Give the charset used to encode the $text variable in memory. * @return int Number of lines @@ -3905,11 +3905,11 @@ function dol_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0) * ascending (default) or descending output and uses optionally * natural case insensitive sorting (which can be optionally case * sensitive as well). - * @param array Array to sort + * @param array Array to sort * @param index * @param order * @param natsort - * @param cas_sensitive + * @param case_sensitive Sort is case sensitive * @return Sorted array */ function dol_sort_array(&$array, $index, $order='asc', $natsort, $case_sensitive) diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php index 9560c981840..1f307302975 100644 --- a/htdocs/lib/pdf.lib.php +++ b/htdocs/lib/pdf.lib.php @@ -25,7 +25,7 @@ * \file htdocs/lib/pdf.lib.php * \brief Set of functions used for PDF generation * \ingroup core - * \version $Id: pdf.lib.php,v 1.95 2011/06/30 13:27:21 hregis Exp $ + * \version $Id: pdf.lib.php,v 1.96 2011/07/04 08:53:01 eldy Exp $ */ @@ -682,7 +682,7 @@ function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hide * Return line description translated in outputlangs and encoded in UTF8 * @param object Object * @param i Current line number - * @param outputlang Object lang for output + * @param outputlangs Object langs for output * @param hideref Hide reference * @param hidedesc Hide description * @param issupplierline Is it a line for a supplier object ? @@ -814,7 +814,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl * Return line num * @param object Object * @param $i Current line number - * @param outputlang Object lang for output + * @param outputlangs Object langs for output */ function pdf_getlinenum($object,$i,$outputlangs) { @@ -854,8 +854,8 @@ function pdf_getlineref($object,$i,$outputlangs) /** * Return line ref_supplier * @param object Object - * @param $i Current line number - * @param outputlang Object lang for output + * @param i Current line number + * @param outputlangs Object langs for output */ function pdf_getlineref_supplier($object,$i,$outputlangs) { @@ -874,8 +874,8 @@ function pdf_getlineref_supplier($object,$i,$outputlangs) /** * Return line vat rate * @param object Object - * @param $i Current line number - * @param outputlang Object lang for output + * @param i Current line number + * @param outputlangs Object langs for output * @param hidedetails Hide value * 0 = no * 1 = yes @@ -901,8 +901,8 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0) /** * Return line unit price excluding tax * @param object Object - * @param $i Current line number - * @param outputlang Object lang for output + * @param i Current line number + * @param outputlangs Object langs for output * @param hidedetails Hide value * 0 = no * 1 = yes @@ -928,8 +928,8 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0) /** * Return line quantity * @param object Object - * @param $i Current line number - * @param outputlang Object lang for output + * @param i Current line number + * @param outputlangs Object langs for output * @param hidedetails Hide value * 0 = no * 1 = yes @@ -958,8 +958,8 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0) /** * Return line quantity asked * @param object Object - * @param $i Current line number - * @param outputlang Object lang for output + * @param i Current line number + * @param outputlangs Object langs for output * @param hidedetails Hide value * 0 = no * 1 = yes @@ -988,8 +988,8 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0) /** * Return line quantity shipped * @param object Object - * @param $i Current line number - * @param outputlang Object lang for output + * @param i Current line number + * @param outputlangs Object langs for output * @param hidedetails Hide value * 0 = no * 1 = yes @@ -1018,8 +1018,8 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0) /** * Return line keep to ship quantity * @param object Object - * @param $i Current line number - * @param outputlang Object lang for output + * @param i Current line number + * @param outputlangs Object langs for output * @param hidedetails Hide value * 0 = no * 1 = yes @@ -1048,8 +1048,8 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0) /** * Return line remise percent * @param object Object - * @param $i Current line number - * @param outputlang Object lang for output + * @param i Current line number + * @param outputlangs Object langs for output * @param hidedetails Hide value * 0 = no * 1 = yes @@ -1080,8 +1080,8 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0) /** * Return line total excluding tax * @param object Object - * @param $i Current line number - * @param outputlang Object lang for output + * @param i Current line number + * @param outputlangs Object langs for output * @param hidedetails Hide value * 0 = no * 1 = yes @@ -1115,7 +1115,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0) * Return total quantity of products and/or services * @param object Object * @param type Type of line (all=all, 0=product, 1=service, 9=other) - * @param outputlang Object lang for output + * @param outputlangs Object langs for output */ function pdf_getTotalQty($object,$type='',$outputlangs) { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7054204a43f..8a406ab8f65 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -26,7 +26,7 @@ * \file htdocs/main.inc.php * \ingroup core * \brief File that defines environment for Dolibarr pages only (variables not required by scripts) - * \version $Id: main.inc.php,v 1.748 2011/07/03 13:16:46 hregis Exp $ + * \version $Id: main.inc.php,v 1.749 2011/07/04 08:53:01 eldy Exp $ */ @ini_set('memory_limit', '64M'); // This may be useless if memory is hard limited by your PHP @@ -814,22 +814,22 @@ if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) // Functions -/** - * Show HTML header HTML + BODY + Top menu + left menu + DIV - * @param head Add optionnal head lines - * @param title Title of web page - * @param help_url Url links to help page - * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage - * For other external page: http://server/url - * @param target Target to use in menu links - * @param disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax) - * @param disablehead Do not output head section - * @param arrayofjs Array of js files to add in header - * @param arrayofcss Array of css files to add in header - * @param morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) - */ if (! function_exists("llxHeader")) { + /** + * Show HTML header HTML + BODY + Top menu + left menu + DIV + * @param head Add optionnal head lines + * @param title Title of web page + * @param help_url Url links to help page + * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage + * For other external page: http://server/url + * @param target Target to use in menu links + * @param disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax) + * @param disablehead Do not output head section + * @param arrayofjs Array of js files to add in header + * @param arrayofcss Array of css files to add in header + * @param morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) + */ function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='') { top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers From aad939a270f182d106d9180c0d6a86ad90022735 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 09:01:37 +0000 Subject: [PATCH 09/33] doxygen --- htdocs/compta/bank/class/account.class.php | 12 ++++++------ htdocs/compta/tva/quadri.php | 16 +++++++--------- htdocs/lib/prelevement.lib.php | 6 +++--- htdocs/lib/product.lib.php | 8 ++++---- htdocs/lib/project.lib.php | 10 +++++----- htdocs/lib/security.lib.php | 4 ++-- htdocs/lib/tax.lib.php | 19 ++++++++++--------- htdocs/lib/treeview.lib.php | 4 ++-- htdocs/lib/usergroups.lib.php | 7 ++++--- 9 files changed, 43 insertions(+), 43 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 8abe4185e16..4c71c9c956f 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -24,7 +24,7 @@ * \file htdocs/compta/bank/class/account.class.php * \ingroup banque * \brief File of class to manage bank accounts - * \version $Id$ + * \version $Id: account.class.php,v 1.31 2011/07/04 09:01:38 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); @@ -1040,7 +1040,7 @@ class AccountLine extends CommonObject /** * Load into memory content of a bank transaction line - * @param id Id of bank transaction to load + * @param rowid Id of bank transaction to load * @param ref Ref of bank transaction to load * @param num External num to load (ex: num of transaction for paypal fee) * @return int <0 if KO, >0 if OK @@ -1159,7 +1159,7 @@ class AccountLine extends CommonObject * Update bank account record in database * @param user Object user making update * @param notrigger 0=Disable all triggers - * @param int <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ function update($user,$notrigger=0) { @@ -1192,7 +1192,7 @@ class AccountLine extends CommonObject * Update conciliation field * @param user Objet user making update * @param cat Category id - * @param int <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ function update_conciliation($user,$cat) { @@ -1237,8 +1237,8 @@ class AccountLine extends CommonObject } /** - * Charge les informations d'ordre info dans l'objet facture - * @param id Id de la facture a charger + * Charge les informations d'ordre info dans l'objet + * @param rowid Id of object */ function info($rowid) { diff --git a/htdocs/compta/tva/quadri.php b/htdocs/compta/tva/quadri.php index 685dfac79dd..8ada959f602 100644 --- a/htdocs/compta/tva/quadri.php +++ b/htdocs/compta/tva/quadri.php @@ -24,7 +24,7 @@ \file htdocs/compta/tva/quadri.php \ingroup tax \brief Trimestrial page - \version $Id$ + \version $Id: quadri.php,v 1.14 2011/07/04 09:01:38 eldy Exp $ \todo Deal with recurrent invoices as well */ @@ -49,13 +49,12 @@ $result = restrictedArea($user, 'tax', '', '', 'charges'); /** * Gets VAT to collect for the given month of the given year - * * The function gets the VAT in split results, as the VAT declaration asks * to report the amounts for different VAT rates as different lines. * This function also accounts recurrent invoices - * @param object Database handler object - * @param integer Year - * @param integer Year quarter (1-4) + * @param db Database handler + * @param y Year + * @param q Year quarter (1-4) */ function tva_coll($db,$y,$q) { @@ -116,12 +115,11 @@ function tva_coll($db,$y,$q) /** * Gets VAT to pay for the given month of the given year - * * The function gets the VAT in split results, as the VAT declaration asks * to report the amounts for different VAT rates as different lines. * @param object Database handler object - * @param integer Year - * @param integer Year quarter (1-4) + * @param y Year + * @param q Year quarter (1-4) */ function tva_paye($db, $y,$q) { @@ -317,5 +315,5 @@ echo ''; $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 09:01:38 $ - $Revision: 1.14 $'); ?> diff --git a/htdocs/lib/prelevement.lib.php b/htdocs/lib/prelevement.lib.php index a6879b8f0b1..617cb297697 100644 --- a/htdocs/lib/prelevement.lib.php +++ b/htdocs/lib/prelevement.lib.php @@ -23,7 +23,7 @@ * \file htdocs/lib/prelevement.lib.php * \brief Ensemble de fonctions de base pour le module prelevement * \ingroup propal - * \version $Id$ + * \version $Id: prelevement.lib.php,v 1.8 2011/07/04 09:01:38 eldy Exp $ * * Ensemble de fonctions de base de dolibarr sous forme d'include */ @@ -31,8 +31,8 @@ /** * Prepare head for prelevement screen and return it - * @param prelevement class BonPrelevement - * @return array head + * @param object Object BonPrelevement + * @return array head */ function prelevement_prepare_head($object) { diff --git a/htdocs/lib/product.lib.php b/htdocs/lib/product.lib.php index cb7a472ce21..043c137e166 100644 --- a/htdocs/lib/product.lib.php +++ b/htdocs/lib/product.lib.php @@ -23,7 +23,7 @@ * \file htdocs/lib/product.lib.php * \brief Ensemble de fonctions de base pour le module produit et service * \ingroup product - * \version $Id$ + * \version $Id: product.lib.php,v 1.43 2011/07/04 09:01:38 eldy Exp $ * * Ensemble de fonctions de base de dolibarr sous forme d'include */ @@ -262,9 +262,9 @@ function show_stats_for_company($product,$socid) /** * Return translation label of a unit key - * @param int Unit key (-3,0,3,98,99...) - * @param measuring_style Style of unit: weight, volume,... - * @return string Unit string + * @param unit Unit key (-3,0,3,98,99...) + * @param measuring_style Style of unit: weight, volume,... + * @return string Unit string * @see load_measuring_units */ function measuring_units_string($unit,$measuring_style='') diff --git a/htdocs/lib/project.lib.php b/htdocs/lib/project.lib.php index 496b16a85f6..2d5ec19e880 100644 --- a/htdocs/lib/project.lib.php +++ b/htdocs/lib/project.lib.php @@ -22,7 +22,7 @@ * \file htdocs/lib/project.lib.php * \brief Functions used by project module * \ingroup project - * \version $Id$ + * \version $Id: project.lib.php,v 1.68 2011/07/04 09:01:38 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php"); @@ -98,7 +98,7 @@ function project_prepare_head($object) * \file htdocs/lib/project.lib.php * \brief Ensemble de fonctions de base pour le module projet * \ingroup societe - * \version $Id$ + * \version $Id: project.lib.php,v 1.68 2011/07/04 09:01:38 eldy Exp $ */ function task_prepare_head($object) { @@ -239,14 +239,14 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid') /** - * Enter description here... - * + * Output a task line * @param $inc * @param $parent * @param $lines * @param $level * @param $projectsrole - * @param $mytask 0 or 1 to enable only if task is a task i am affected to + * @param $tasksrole + * @param $mytask 0 or 1 to enable only if task is a task i am affected to * @return $inc */ function PLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mytask=0) diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php index 8717d25c2ed..04f4a578d75 100644 --- a/htdocs/lib/security.lib.php +++ b/htdocs/lib/security.lib.php @@ -21,7 +21,7 @@ /** * \file htdocs/lib/security.lib.php * \brief Set of function used for dolibarr security - * \version $Id$ + * \version $Id: security.lib.php,v 1.123 2011/07/04 09:01:38 eldy Exp $ */ @@ -398,7 +398,7 @@ function encodedecode_dbpassconf($level=0) /** * Encode a string - * @param chaine chaine de caracteres a encoder + * @param chain chaine de caracteres a encoder * @return string_coded chaine de caracteres encodee */ function dol_encode($chain) diff --git a/htdocs/lib/tax.lib.php b/htdocs/lib/tax.lib.php index 8104025baeb..3a1ad141ebd 100644 --- a/htdocs/lib/tax.lib.php +++ b/htdocs/lib/tax.lib.php @@ -21,19 +21,20 @@ * \file htdocs/lib/tax.lib.php * \ingroup tax * \brief Library for tax module - * \version $Id$ + * \version $Id: tax.lib.php,v 1.20 2011/07/04 09:01:37 eldy Exp $ */ /** - * \brief Look for collectable VAT clients in the chosen year (and month) - * \param db Database handle - * \param y Year - * \param date_start Start date - * \param date_end End date - * \param modetax 0 or 1 (option vat on debit) - * \param direction 'sell' or 'buy' - * \return array List of customers third parties with vat, -1 if no accountancy module, -2 if not yet developped, -3 if error + * Look for collectable VAT clients in the chosen year (and month) + * @param db Database handle + * @param y Year + * @param date_start Start date + * @param date_end End date + * @param modetax 0 or 1 (option vat on debit) + * @param direction 'sell' or 'buy' + * @param m Month + * @return array List of customers third parties with vat, -1 if no accountancy module, -2 if not yet developped, -3 if error */ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction, $m=0) { diff --git a/htdocs/lib/treeview.lib.php b/htdocs/lib/treeview.lib.php index f8e5fc09f09..736f309ddc0 100644 --- a/htdocs/lib/treeview.lib.php +++ b/htdocs/lib/treeview.lib.php @@ -21,7 +21,7 @@ * \file htdocs/lib/treeview.lib.php * \ingroup core * \brief Libraries for tree views - * \version $Id$ + * \version $Id: treeview.lib.php,v 1.12 2011/07/04 09:01:38 eldy Exp $ */ @@ -75,9 +75,9 @@ function is_in_subtree($fulltree,$parentid,$childid) /** * Show picto of a tree view - * * @param fulltree Array of entries in correct order * @param key Key of value to show picto + * @param selected Selected value * @return array (0 or 1 if at least one of this level after, 0 or 1 if at least one of higher level after) */ function tree_showpad(&$fulltree,$key,$selected=0) diff --git a/htdocs/lib/usergroups.lib.php b/htdocs/lib/usergroups.lib.php index cd4704dcf3e..3f27a017ac5 100644 --- a/htdocs/lib/usergroups.lib.php +++ b/htdocs/lib/usergroups.lib.php @@ -22,7 +22,7 @@ /** * \file htdocs/lib/usergroups.lib.php * \brief Ensemble de fonctions de base pour la gestion des utilisaterus et groupes - * \version $Id$ + * \version $Id: usergroups.lib.php,v 1.28 2011/07/04 09:01:38 eldy Exp $ */ function user_prepare_head($object) { @@ -144,8 +144,9 @@ function group_prepare_head($object) /** * Show list of themes. Show all thumbs of themes - * @param fuser User concerned or '' for global theme - * @param edit 1 to add edit form + * @param fuser User concerned or '' for global theme + * @param edit 1 to add edit form + * @param foruserprofile Show for user profile view */ function show_theme($fuser,$edit=0,$foruserprofile=false) { From 7936cd8dead73a0b200db6c178820ab62b824062 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 09:36:29 +0000 Subject: [PATCH 10/33] doxygen --- htdocs/comm/action/class/actioncomm.class.php | 10 +- htdocs/commande/class/commande.class.php | 443 +++++++++--------- htdocs/contact/class/contact.class.php | 12 +- htdocs/core/class/commonobject.class.php | 45 +- .../class/fournisseur.commande.class.php | 226 ++++----- htdocs/lib/CMailFile.class.php | 36 +- htdocs/lib/CSMSFile.class.php | 5 +- 7 files changed, 399 insertions(+), 378 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index d6844299696..72bb4726321 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -23,7 +23,7 @@ * \file htdocs/comm/action/class/actioncomm.class.php * \ingroup commercial * \brief File of class to manage agenda events (actions) - * \version $Id: actioncomm.class.php,v 1.41 2011/06/30 07:52:43 eldy Exp $ + * \version $Id: actioncomm.class.php,v 1.42 2011/07/04 09:36:29 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'); @@ -391,8 +391,10 @@ class ActionComm extends CommonObject /** * Load all objects with filters - * @param socid Filter by thirdparty - * @param filter Other filter + * @param socid Filter by thirdparty + * @param fk_element Id of element action is linked to + * @param elementtype Type of element action is linked to + * @param filter Other filter */ function getActions($socid=0, $fk_element=0, $elementtype='', $filter='') { @@ -603,7 +605,7 @@ class ActionComm extends CommonObject * Utilise $this->id, $this->code et $this->label * @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param maxlength Nombre de caracteres max dans libelle - * @param class Force style class on a link + * @param classname Force style class on a link * @param option ''=Link to action,'birthday'=Link to contact * @return string Chaine avec URL */ diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index db86760da57..6e6ac3d4d82 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -25,7 +25,7 @@ * \file htdocs/commande/class/commande.class.php * \ingroup commande * \brief Fichier des classes de commandes - * \version $Id: commande.class.php,v 1.116 2011/06/30 13:27:20 hregis Exp $ + * \version $Id: commande.class.php,v 1.117 2011/07/04 09:36:29 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); @@ -177,7 +177,7 @@ class Commande extends CommonObject function valid($user) { global $conf,$langs; - require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); + require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); $error=0; @@ -239,7 +239,7 @@ class Commande extends CommonObject if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); - $langs->load("agenda"); + $langs->load("agenda"); // Loop on each line for ($i = 0 ; $i < sizeof($this->lines) ; $i++) @@ -347,7 +347,7 @@ class Commande extends CommonObject if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); - $langs->load("agenda"); + $langs->load("agenda"); for ($i = 0 ; $i < sizeof($this->lines) ; $i++) { @@ -402,7 +402,7 @@ class Commande extends CommonObject if ($this->statut != 3) { - return 0; + return 0; } $this->db->begin(); @@ -451,13 +451,13 @@ class Commande extends CommonObject function cloture($user) { global $conf; - $error=0; + $error=0; if ($user->rights->commande->valider) { - $this->db->begin(); + $this->db->begin(); - $now=dol_now(); + $now=dol_now(); $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; $sql.= ' SET fk_statut = 3,'; @@ -476,21 +476,21 @@ class Commande extends CommonObject if (! $error) { - $this->db->commit(); - return 1; + $this->db->commit(); + return 1; } else { - $this->db->rollback(); - return -1; + $this->db->rollback(); + return -1; } } else { - $this->error=$this->db->lasterror(); + $this->error=$this->db->lasterror(); dol_syslog($this->error, LOG_ERR); - $this->db->rollback(); + $this->db->rollback(); return -1; } } @@ -523,7 +523,7 @@ class Commande extends CommonObject if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); - $langs->load("agenda"); + $langs->load("agenda"); if ($this->lines[$i]->fk_product > 0) { @@ -570,9 +570,10 @@ class Commande extends CommonObject /** * Create order - * @param user Objet user that make creation - * @return int <0 if KO, >0 if OK - * remarks this->ref can be set or empty. If empty, we will use "(PROV)" + * Note that this->ref can be set or empty. If empty, we will use "(PROV)" + * @param user Objet user that make creation + * @param notrigger Disable all triggers + * @return int <0 if KO, >0 if OK */ function create($user, $notrigger=0) { @@ -694,7 +695,7 @@ class Commande extends CommonObject { if ($this->id) { - $this->ref="(PROV".$this->id.")"; + $this->ref="(PROV".$this->id.")"; // Add linked object if ($this->origin && $this->origin_id) @@ -728,7 +729,7 @@ class Commande extends CommonObject } } } - + if (! $notrigger) { // Appel des triggers @@ -825,23 +826,23 @@ class Commande extends CommonObject if (! $error) { // Hook of thirdparty module - if (! empty($object->hooks)) - { - foreach($object->hooks as $hook) - { - if (! empty($hook['modules'])) - { - foreach($hook['modules'] as $module) - { - if (method_exists($module,'createfrom')) - { - $result = $module->createfrom($objFrom,$result,$object->element); - if ($result < 0) $error++; - } - } - } - } - } + if (! empty($object->hooks)) + { + foreach($object->hooks as $hook) + { + if (! empty($hook['modules'])) + { + foreach($hook['modules'] as $module) + { + if (method_exists($module,'createfrom')) + { + $result = $module->createfrom($objFrom,$result,$object->element); + if ($result < 0) $error++; + } + } + } + } + } // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); @@ -865,103 +866,103 @@ class Commande extends CommonObject } - /** - * Load an object from a proposal and create a new order into database - * @param object Object source - * @param invertdetail Reverse sign of amounts for lines - * @return int <0 if KO, 0 if nothing done, 1 if OK - */ - function createFromProposal($object,$invertdetail=0) - { - global $conf,$user,$langs; + /** + * Load an object from a proposal and create a new order into database + * @param object Object source + * @param invertdetail Reverse sign of amounts for lines + * @return int <0 if KO, 0 if nothing done, 1 if OK + */ + function createFromProposal($object,$invertdetail=0) + { + global $conf,$user,$langs; - $error=0; + $error=0; - // Signed proposal - if ($object->statut == 2) - { - $this->date_commande = dol_now(); - $this->source = 0; + // Signed proposal + if ($object->statut == 2) + { + $this->date_commande = dol_now(); + $this->source = 0; - for ($i = 0 ; $i < sizeof($object->lines) ; $i++) - { - $line = new OrderLine($this->db); + for ($i = 0 ; $i < sizeof($object->lines) ; $i++) + { + $line = new OrderLine($this->db); - $line->libelle = $object->lines[$i]->libelle; - $line->desc = $object->lines[$i]->desc; - $line->price = $object->lines[$i]->price; - $line->subprice = $object->lines[$i]->subprice; - $line->tva_tx = $object->lines[$i]->tva_tx; - $line->localtax1_tx = $object->lines[$i]->localtax1_tx; - $line->localtax2_tx = $object->lines[$i]->localtax2_tx; - $line->qty = $object->lines[$i]->qty; - $line->fk_remise_except = $object->lines[$i]->fk_remise_except; - $line->remise_percent = $object->lines[$i]->remise_percent; - $line->fk_product = $object->lines[$i]->fk_product; - $line->info_bits = $object->lines[$i]->info_bits; - $line->product_type = $object->lines[$i]->product_type; - $line->rang = $object->lines[$i]->rang; - $line->special_code = $object->lines[$i]->special_code; - $line->fk_parent_line = $object->lines[$i]->fk_parent_line; + $line->libelle = $object->lines[$i]->libelle; + $line->desc = $object->lines[$i]->desc; + $line->price = $object->lines[$i]->price; + $line->subprice = $object->lines[$i]->subprice; + $line->tva_tx = $object->lines[$i]->tva_tx; + $line->localtax1_tx = $object->lines[$i]->localtax1_tx; + $line->localtax2_tx = $object->lines[$i]->localtax2_tx; + $line->qty = $object->lines[$i]->qty; + $line->fk_remise_except = $object->lines[$i]->fk_remise_except; + $line->remise_percent = $object->lines[$i]->remise_percent; + $line->fk_product = $object->lines[$i]->fk_product; + $line->info_bits = $object->lines[$i]->info_bits; + $line->product_type = $object->lines[$i]->product_type; + $line->rang = $object->lines[$i]->rang; + $line->special_code = $object->lines[$i]->special_code; + $line->fk_parent_line = $object->lines[$i]->fk_parent_line; - $this->lines[$i] = $line; - } + $this->lines[$i] = $line; + } - $this->socid = $object->socid; - $this->fk_project = $object->fk_project; - $this->cond_reglement_id = $object->cond_reglement_id; - $this->mode_reglement_id = $object->mode_reglement_id; - $this->availability_id = $object->availability_id; + $this->socid = $object->socid; + $this->fk_project = $object->fk_project; + $this->cond_reglement_id = $object->cond_reglement_id; + $this->mode_reglement_id = $object->mode_reglement_id; + $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; - $this->date_livraison = $object->date_livraison; - $this->fk_delivery_address = $object->fk_delivery_address; - $this->contact_id = $object->contactid; - $this->ref_client = $object->ref_client; - $this->note = $object->note; - $this->note_public = $object->note_public; + $this->date_livraison = $object->date_livraison; + $this->fk_delivery_address = $object->fk_delivery_address; + $this->contact_id = $object->contactid; + $this->ref_client = $object->ref_client; + $this->note = $object->note; + $this->note_public = $object->note_public; - $this->origin = $object->element; - $this->origin_id = $object->id; + $this->origin = $object->element; + $this->origin_id = $object->id; - $ret = $this->create($user); + $ret = $this->create($user); - if ($ret > 0) - { - // Hook of thirdparty module - if (! empty($object->hooks)) - { - foreach($object->hooks as $hook) - { - if (! empty($hook['modules'])) - { - foreach($hook['modules'] as $module) - { - if (method_exists($module,'createfrom')) - { - $result = $module->createfrom($object,$ret,$this->element); - if ($result < 0) $error++; - } - } - } - } - } + if ($ret > 0) + { + // Hook of thirdparty module + if (! empty($object->hooks)) + { + foreach($object->hooks as $hook) + { + if (! empty($hook['modules'])) + { + foreach($hook['modules'] as $module) + { + if (method_exists($module,'createfrom')) + { + $result = $module->createfrom($object,$ret,$this->element); + if ($result < 0) $error++; + } + } + } + } + } - if (! $error) - { - // Ne pas passer par la commande provisoire - if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1) - { - $this->fetch($ret); - $this->valid($user); - } - return 1; - } - else return -1; - } - else return -1; - } - else return 0; - } + if (! $error) + { + // Ne pas passer par la commande provisoire + if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1) + { + $this->fetch($ret); + $this->valid($user); + } + return 1; + } + else return -1; + } + else return -1; + } + else return 0; + } /** @@ -998,13 +999,13 @@ class Commande extends CommonObject // Clean parameters if (empty($remise_percent)) $remise_percent=0; - if (empty($qty)) $qty=0; - if (empty($info_bits)) $info_bits=0; - if (empty($rang)) $rang=0; - if (empty($txtva)) $txtva=0; - if (empty($txlocaltax1)) $txlocaltax1=0; - if (empty($txlocaltax2)) $txlocaltax2=0; - if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; + if (empty($qty)) $qty=0; + if (empty($info_bits)) $info_bits=0; + if (empty($rang)) $rang=0; + if (empty($txtva)) $txtva=0; + if (empty($txlocaltax1)) $txlocaltax1=0; + if (empty($txlocaltax2)) $txlocaltax2=0; + if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; $remise_percent=price2num($remise_percent); $qty=price2num($qty); @@ -1124,12 +1125,12 @@ class Commande extends CommonObject /** * Add line into array * $this->client doit etre charge - * @param idproduct Id du produit a ajouter - * @param qty Quantite - * @param date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) - * @param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) - * @remise_percent remise_percent Remise relative effectuee sur le produit - * @return void + * @param idproduct Id du produit a ajouter + * @param qty Quantite + * @param remise_percent Remise relative effectuee sur le produit + * @param date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + * @param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + * @return void * TODO Remplacer les appels a cette fonction par generation objet Ligne * insere dans tableau $this->products */ @@ -1202,7 +1203,7 @@ class Commande extends CommonObject * @param id Id of object to load * @param ref Ref of object * @param ref_ext External reference of object - * @param ref_int Internal reference of other object + * @param ref_int Internal reference of other object * @return int >0 if OK, <0 if KO */ function fetch($id, $ref='', $ref_ext='', $ref_int='') @@ -1231,9 +1232,9 @@ class Commande extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = c.rowid AND el.targettype = '".$this->element."'"; $sql.= " WHERE c.entity = ".$conf->entity; if ($id) $sql.= " AND c.rowid=".$id; - if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'"; - if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'"; - if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'"; + if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'"; + if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'"; + if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'"; dol_syslog("Commande::fetch sql=".$sql, LOG_DEBUG); $result = $this->db->query($sql) ; @@ -1330,9 +1331,9 @@ class Commande extends CommonObject /** - * \brief Ajout d'une ligne remise fixe dans la commande, en base - * \param idremise Id de la remise fixe - * \return int >0 si ok, <0 si ko + * Ajout d'une ligne remise fixe dans la commande, en base + * @param idremise Id de la remise fixe + * @return int >0 si ok, <0 si ko */ function insert_discount($idremise) { @@ -1405,9 +1406,9 @@ class Commande extends CommonObject /** - * \brief Reinitialize array lignes - * \param only_product Return only physical products - * \return int <0 if KO, >0 if OK + * Load array lines + * @param only_product Return only physical products + * @return int <0 if KO, >0 if OK */ function fetch_lines($only_product=0) { @@ -1558,12 +1559,12 @@ class Commande extends CommonObject */ function nb_expedition() { - $sql = 'SELECT count(*)'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'expedition as e'; - $sql.= ', '.MAIN_DB_PREFIX.'element_element as el'; - $sql.= ' WHERE el.fk_source = '.$this->id; - $sql.= " AND el.fk_target = e.rowid"; - $sql.= " AND el.targettype = 'shipping'"; + $sql = 'SELECT count(*)'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'expedition as e'; + $sql.= ', '.MAIN_DB_PREFIX.'element_element as el'; + $sql.= ' WHERE el.fk_source = '.$this->id; + $sql.= " AND el.fk_target = e.rowid"; + $sql.= " AND el.targettype = 'shipping'"; $resql = $this->db->query($sql); if ($resql) @@ -1571,7 +1572,7 @@ class Commande extends CommonObject $row = $this->db->fetch_row($resql); return $row[0]; } - else dol_print_error($this->db); + else dol_print_error($this->db); } /** @@ -1588,10 +1589,10 @@ class Commande extends CommonObject } /** - * \brief Renvoie un tableau avec les stocks restant par produit - * \param filtre_statut Filtre sur statut - * \return int 0 si OK, <0 si KO - * \todo FONCTION NON FINIE A FINIR + * Renvoie un tableau avec les stocks restant par produit + * @param filtre_statut Filtre sur statut + * @return int 0 si OK, <0 si KO + * TODO FONCTION NON FINIE A FINIR */ function stock_array($filtre_statut=-1) { @@ -1625,9 +1626,9 @@ class Commande extends CommonObject } /** - * \brief Supprime une ligne de la commande - * \param idligne Id de la ligne a supprimer - * \return int >0 si ok, 0 si rien a supprimer, <0 si ko + * Delete an order line + * @param lineid Id of line to delete + * @return int >0 if OK, 0 if nothing to do, <0 if KO */ function deleteline($lineid) { @@ -1700,10 +1701,10 @@ class Commande extends CommonObject } /** - * \brief Applique une remise relative - * \param user User qui positionne la remise - * \param remise - * \return int <0 si ko, >0 si ok + * Applique une remise relative + * @param user User qui positionne la remise + * @param remise + * @return int <0 if KO, >0 if OK */ function set_remise($user, $remise) { @@ -1733,10 +1734,10 @@ class Commande extends CommonObject /** - * \brief Applique une remise absolue - * \param user User qui positionne la remise - * \param remise - * \return int <0 si ko, >0 si ok + * Applique une remise absolue + * @param user User qui positionne la remise + * @param remise + * @return int <0 if KO, >0 if OK */ function set_remise_absolue($user, $remise) { @@ -1769,8 +1770,8 @@ class Commande extends CommonObject /** * Set the order date - * @param user Object user - * @param date_livraison Date delivery + * @param user Object user making change + * @param date Date * @return int <0 if KO, >0 if OK */ function set_date($user, $date) @@ -1802,10 +1803,10 @@ class Commande extends CommonObject } /** - * \brief Set the planned delivery date - * \param user Objet utilisateur qui modifie - * \param date_livraison Date de livraison - * \return int <0 si ko, >0 si ok + * Set the planned delivery date + * @param user Objet utilisateur qui modifie + * @param date_livraison Date de livraison + * @return int <0 si ko, >0 si ok */ function set_date_livraison($user, $date_livraison) { @@ -1836,10 +1837,10 @@ class Commande extends CommonObject } /** - * \brief Definit une adresse de livraison - * \param user Objet utilisateur qui modifie - * \param adresse_livraison Adresse de livraison - * \return int <0 si ko, >0 si ok + * Set address + * @param user Object user making change + * @param fk_address Adress of delivery + * @return int <0 ig KO, >0 if Ok */ function set_adresse_livraison($user, $fk_address) { @@ -1862,11 +1863,11 @@ class Commande extends CommonObject } } -/** - * \brief Set delivery - * \param user Objet utilisateur qui modifie - * \param delivery delai de livraison - * \return int <0 si ko, >0 si ok + /** + * Set availability + * @param user Object user making change + * @param id If of availability delay + * @return int <0 if KO, >0 if OK */ function set_availability($user, $id) { @@ -1891,10 +1892,10 @@ class Commande extends CommonObject } /** - * \brief Set source of demand - * \param user Objet utilisateur qui modifie - * \param delivery delai de livraison - * \return int <0 si ko, >0 si ok + * Set source of demand + * @param user Object user making change + * @param id Id of source + * @return int <0 if KO, >0 if OK */ function set_demand_reason($user, $id) { @@ -1935,7 +1936,7 @@ class Commande extends CommonObject $sql.= " WHERE c.entity = ".$conf->entity; $sql.= " AND c.fk_soc = s.rowid"; if ($brouillon) $sql.= " AND c.fk_statut = 0"; - if ($user) $sql.= " AND c.fk_user_author <> ".$user->id; + if ($user) $sql.= " AND c.fk_user_author <> ".$user->id; $sql .= " ORDER BY c.date_commande DESC"; $result=$this->db->query($sql); @@ -1963,9 +1964,9 @@ class Commande extends CommonObject } /** - * \brief Change les conditions de reglement de la commande - * \param cond_reglement_id Id de la nouvelle condition de reglement - * \return int >0 si ok, <0 si ko + * Change les conditions de reglement de la commande + * @param cond_reglement_id Id de la nouvelle condition de reglement + * @return int >0 if OK, <0 if KO */ function cond_reglement($cond_reglement_id) { @@ -2029,10 +2030,10 @@ class Commande extends CommonObject } } -/** - * \brief Change le delai de livraison - * \param mode Id du nouveau mode - * \return int >0 si ok, <0 si ko + /** + * Change le delai de livraison + * @param availability_id Id du nouveau mode + * @return int >0 if OK, <0 if KO */ function availability($availability_id) { @@ -2177,7 +2178,7 @@ class Commande extends CommonObject */ function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0) { - global $conf; + global $conf; dol_syslog("CustomerOrder::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type"); include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php'); @@ -2280,14 +2281,14 @@ class Commande extends CommonObject /** - * \brief Delete the customer order - * \user User object - * \return int <=0 if KO, >0 if OK + * Delete the customer order + * @param user User object + * @return int <=0 if KO, >0 if OK */ function delete($user) { global $conf, $langs; - require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); + require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); $err = 0; @@ -2380,9 +2381,9 @@ class Commande extends CommonObject /** - * Load indicators for dashboard (this->nbtodo and this->nbtodolate) - * @param user Objet user - * @return int <0 if KO, >0 if OK + * Load indicators for dashboard (this->nbtodo and this->nbtodolate) + * @param user Objet user + * @return int <0 if KO, >0 if OK */ function load_board($user) { @@ -2515,10 +2516,12 @@ class Commande extends CommonObject /** - * Return clicable link of object (with eventually picto) - * @param withpicto Add picto into link - * @param option Where point the link - * @return string String with URL + * Return clicable link of object (with eventually picto) + * @param withpicto Add picto into link + * @param option Where point the link + * @param max Max length to show + * @param short Use short labels + * @return string String with URL */ function getNomUrl($withpicto=0,$option=0,$max=0,$short=0) { @@ -2788,7 +2791,7 @@ class OrderLine { var $db; var $error; - + var $oldline; // From llx_commandedet @@ -2887,9 +2890,9 @@ class OrderLine $this->rang = $objp->rang; $this->ref = $objp->product_ref; // deprecated - $this->product_ref = $objp->product_ref; - $this->libelle = $objp->product_libelle; // deprecated - $this->product_label = $objp->product_libelle; + $this->product_ref = $objp->product_ref; + $this->libelle = $objp->product_libelle; // deprecated + $this->product_label = $objp->product_libelle; $this->product_desc = $objp->product_desc; $this->date_start = $this->db->jdate($objp->date_start); @@ -2951,17 +2954,17 @@ class OrderLine if (empty($this->localtax2_tx)) $this->localtax2_tx=0; if (empty($this->total_localtax1)) $this->total_localtax1=0; if (empty($this->total_localtax2)) $this->total_localtax2=0; - if (empty($this->rang)) $this->rang=0; - if (empty($this->remise)) $this->remise=0; - if (empty($this->remise_percent)) $this->remise_percent=0; - if (empty($this->info_bits)) $this->info_bits=0; - if (empty($this->special_code)) $this->special_code=0; - if (empty($this->fk_parent_line)) $this->fk_parent_line=0; + if (empty($this->rang)) $this->rang=0; + if (empty($this->remise)) $this->remise=0; + if (empty($this->remise_percent)) $this->remise_percent=0; + if (empty($this->info_bits)) $this->info_bits=0; + if (empty($this->special_code)) $this->special_code=0; + if (empty($this->fk_parent_line)) $this->fk_parent_line=0; - // Check parameters - if ($this->product_type < 0) return -1; + // Check parameters + if ($this->product_type < 0) return -1; - $this->db->begin(); + $this->db->begin(); // Insertion dans base de la ligne $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet'; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 7ca6f3ceb96..0243d4669b9 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -25,7 +25,7 @@ * \file htdocs/contact/class/contact.class.php * \ingroup societe * \brief File of contacts class - * \version $Id$ + * \version $Id: contact.class.php,v 1.30 2011/07/04 09:36:29 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); @@ -83,7 +83,6 @@ class Contact extends CommonObject /** * Constructor of class Contact * @param DB Habler d'acces base - * @param id Id contact */ function Contact($DB) { @@ -583,7 +582,7 @@ class Contact extends CommonObject } - /* + /** * \brief Charge le nombre d'elements auquel est lie ce contact * ref_facturation * ref_contrat @@ -626,9 +625,10 @@ class Contact extends CommonObject } } - /* - * \brief Efface le contact de la base - * \return int <0 si ko, >0 si ok + /** + * Efface le contact de la base + * @param notrigger Disable all trigger + * @return int <0 if KO, >0 if OK */ function delete($notrigger=0) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 98a83f441f6..cfe5baccb5b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -22,7 +22,7 @@ * \file htdocs/core/class/commonobject.class.php * \ingroup core * \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...) - * \version $Id: commonobject.class.php,v 1.143 2011/07/01 23:05:39 eldy Exp $ + * \version $Id: commonobject.class.php,v 1.144 2011/07/04 09:36:29 eldy Exp $ */ @@ -78,11 +78,12 @@ class CommonObject } /** - * \brief Add a link between element $this->element and a contact - * \param fk_socpeople Id of contact to link - * \param type_contact Type of contact (code or id) - * \param source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) - * \return int <0 if KO, >0 if OK + * Add a link between element $this->element and a contact + * @param fk_socpeople Id of contact to link + * @param type_contact Type of contact (code or id) + * @param source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) + * @param notrigger Disable all triggers + * @return int <0 if KO, >0 if OK */ function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0) { @@ -168,11 +169,11 @@ class CommonObject } /** - * \brief Update a link to contact line - * \param rowid Id of line contact-element - * \param statut New status of link - * \param type_contact_id Id of contact type - * \return int <0 if KO, >= 0 if OK + * Update a link to contact line + * @param rowid Id of line contact-element + * @param statut New status of link + * @param type_contact_id Id of contact type + * @return int <0 if KO, >= 0 if OK */ function update_contact($rowid, $statut, $type_contact_id) { @@ -194,9 +195,10 @@ class CommonObject } /** - * \brief Delete a link to contact line - * \param rowid Id of link line to delete - * \return statur >0 si ok, <0 si ko + * Delete a link to contact line + * @param rowid Id of contact link line to delete + * @param notrigger Disable all triggers + * @return int >0 if OK, <0 if KO */ function delete_contact($rowid,$notrigger=0) { @@ -1321,8 +1323,8 @@ class CommonObject /** * Set statut of an object * @param statut Statut to set - * @param elementid Id of element to force (use this->id by default) - * @param elementtype Type of element to force (use ->this->element by default) + * @param elementId Id of element to force (use this->id by default) + * @param elementType Type of element to force (use ->this->element by default) * @return int <0 if ko, >0 if ok */ function setStatut($statut,$elementId='',$elementType='') @@ -1664,6 +1666,8 @@ class CommonObject * TODO Edit templates to use global variables and include them directly in controller call * But for the moment we don't know if it's possible as we keep a method available on overloaded objects. * @param $dateSelector 1=Show also date range input fields + * @param $seller Object thirdparty who sell + * @param $buyer Object thirdparty who buy */ function formAddPredefinedProduct($dateSelector,$seller,$buyer) { @@ -1699,10 +1703,11 @@ class CommonObject * TODO Move this into an output class file (htmlline.class.php) * If lines are into a template, title must also be into a template * But for the moment we don't know if it'st possible as we keep a method available on overloaded objects. - * @param $seller Object of seller third party - * @param $buyer Object of buyer third party - * @param $selected Object line selected - * @param $dateSelector 1=Show also date range input fields + * @param $action Action code + * @param $seller Object of seller third party + * @param $buyer Object of buyer third party + * @param $selected Object line selected + * @param $dateSelector 1=Show also date range input fields */ function printObjectLines($action='viewline',$seller,$buyer,$selected=0,$dateSelector=0) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 41ad0943e93..5b8405499d7 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -25,7 +25,7 @@ * \file htdocs/fourn/class/fournisseur.commande.class.php * \ingroup fournisseur,commande * \brief File of class to manage suppliers orders - * \version $Id$ + * \version $Id: fournisseur.commande.class.php,v 1.47 2011/07/04 09:36:29 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); @@ -49,27 +49,27 @@ class CommandeFournisseur extends Commande var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $ref; // TODO deprecated - var $product_ref; - var $ref_supplier; + var $product_ref; + var $ref_supplier; var $brouillon; var $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially // -> 7=Canceled/Never received -> (reopen) 3=Process runing // -> 6=Canceled -> (reopen) 2=Approved // -> 9=Refused -> (reopen) 1=Validated - var $socid; - var $fourn_id; + var $socid; + var $fourn_id; var $date; - var $date_commande; - var $total_ht; - var $total_tva; + var $date_commande; + var $total_ht; + var $total_tva; var $total_localtax1; // Total Local tax 1 var $total_localtax2; // Total Local tax 2 - var $total_ttc; - var $source; - var $note; - var $note_public; - var $model_pdf; - var $fk_project; + var $total_ttc; + var $source; + var $note; + var $note_public; + var $model_pdf; + var $fk_project; var $cond_reglement_id; var $cond_reglement_code; var $mode_reglement_id; @@ -247,7 +247,7 @@ class CommandeFournisseur extends Commande * @param user User making action * @param statut Status of order * @param datelog Date of change - * @param comment Comment + * @param comment Comment * @return int <0 if KO, >0 if OK */ function log($user, $statut, $datelog, $comment='') @@ -278,7 +278,7 @@ class CommandeFournisseur extends Commande function valid($user) { global $langs,$conf; - require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); + require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); $error=0; @@ -479,18 +479,18 @@ class CommandeFournisseur extends Commande global $langs; $langs->load('orders'); - // List of language codes for status - $statutshort[0] = 'StatusOrderDraftShort'; - $statutshort[1] = 'StatusOrderValidatedShort'; - $statutshort[2] = 'StatusOrderApprovedShort'; - $statutshort[3] = 'StatusOrderOnProcessShort'; - $statutshort[4] = 'StatusOrderReceivedPartiallyShort'; - $statutshort[5] = 'StatusOrderReceivedAllShort'; - $statutshort[6] = 'StatusOrderCanceledShort'; - $statutshort[7] = 'StatusOrderCanceledShort'; - $statutshort[9] = 'StatusOrderRefusedShort'; + // List of language codes for status + $statutshort[0] = 'StatusOrderDraftShort'; + $statutshort[1] = 'StatusOrderValidatedShort'; + $statutshort[2] = 'StatusOrderApprovedShort'; + $statutshort[3] = 'StatusOrderOnProcessShort'; + $statutshort[4] = 'StatusOrderReceivedPartiallyShort'; + $statutshort[5] = 'StatusOrderReceivedAllShort'; + $statutshort[6] = 'StatusOrderCanceledShort'; + $statutshort[7] = 'StatusOrderCanceledShort'; + $statutshort[9] = 'StatusOrderRefusedShort'; - if ($mode == 0) + if ($mode == 0) { return $langs->trans($this->statuts[$statut]); } @@ -618,6 +618,7 @@ class CommandeFournisseur extends Commande /** * Accept an order * @param user Object user + * @return int <0 if KO, >0 if OK */ function approve($user) { @@ -647,7 +648,7 @@ class CommandeFournisseur extends Commande for ($i = 0 ; $i < sizeof($this->lines) ; $i++) { // Product with reference - if ($this->lines[$i]->fk_product > 0) + if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); // We decrement stock of product (and sub-products) @@ -739,9 +740,9 @@ class CommandeFournisseur extends Commande } /** - * Cancel an approved order + * Cancel an approved order. + * L'annulation se fait apres l'approbation * @param user User making action - * @remarks L'annulation se fait apres l'approbation */ function Cancel($user) { @@ -800,6 +801,11 @@ class CommandeFournisseur extends Commande /** * Send a supplier order to supplier + * @param user User making change + * @param date Date + * @param methode Method + * @param comment Comment + * @return int <0 if KO, >0 if OK */ function commande($user, $date, $methode, $comment='') { @@ -912,14 +918,14 @@ class CommandeFournisseur extends Commande /** * Add order line * @param desc Description - * @param pu Unit price + * @param pu_ht Unit price * @param qty Quantity * @param txtva Taux tva * @param txlocaltax1 Localtax1 tax * @param txlocaltax2 Localtax2 tax * @param fk_product Id produit * @param fk_prod_fourn_price Id supplier price - * @param fournref Supplier reference + * @param fourn_ref Supplier reference * @param remise_percent Remise * @param price_base_type HT or TTC * @param pu_ttc Unit price TTC @@ -1117,13 +1123,13 @@ class CommandeFournisseur extends Commande $mouv = new MouvementStock($this->db); if ($product > 0) { - $result=$mouv->reception($user, $product, $entrepot, $qty, $price, $comment); - if ($result < 0) - { - $this->error=$mouv->error; - dol_syslog("CommandeFournisseur::DispatchProduct ".$this->error, LOG_ERR); - $error++; - } + $result=$mouv->reception($user, $product, $entrepot, $qty, $price, $comment); + if ($result < 0) + { + $this->error=$mouv->error; + dol_syslog("CommandeFournisseur::DispatchProduct ".$this->error, LOG_ERR); + $error++; + } } $i++; } @@ -1159,15 +1165,15 @@ class CommandeFournisseur extends Commande dol_syslog("Fournisseur.commande.class::deleteline sql=".$sql); if ($resql) - { - $result=$this->update_price(); - return 0; - } - else - { - $this->error=$this->db->error(); - return -1; - } + { + $result=$this->update_price(); + return 0; + } + else + { + $this->error=$this->db->error(); + return -1; + } } else { @@ -1176,8 +1182,8 @@ class CommandeFournisseur extends Commande } /** - * \brief Delete an order - * \return int <0 if KO, >0 if OK + * Delete an order + * @return int <0 if KO, >0 if OK */ function delete() { @@ -1229,8 +1235,7 @@ class CommandeFournisseur extends Commande } /** - * - * + * Return list of order methods */ function get_methodes_commande() { @@ -1295,8 +1300,8 @@ class CommandeFournisseur extends Commande /** * Change le mode de reglement - * @param mode Id du nouveau mode - * @return int >0 si ok, <0 si ko + * @param mode_reglement_id Id du nouveau mode + * @return int >0 if OK, <0 if KO */ function mode_reglement($mode_reglement_id) { @@ -1331,6 +1336,7 @@ class CommandeFournisseur extends Commande * @param user User that input data * @param date Date of reception * @param type Type of receipt + * @param comment Comment */ function Livraison($user, $date, $type, $comment) { @@ -1388,7 +1394,8 @@ class CommandeFournisseur extends Commande /** * Cree la commande depuis une propale existante * @param user Utilisateur qui cree - * @param propale_id id de la propale qui sert de modele + * @param idc Id de la propale qui sert de modele + * @param comclientid Id thirdparty */ function updateFromCommandeClient($user, $idc, $comclientid) { @@ -1425,8 +1432,12 @@ class CommandeFournisseur extends Commande /** - * Met a jour les notes - * @return int <0 si ko, >=0 si ok + * Update notes + * @param user + * @param note + * @param note_public + * @return int <0 if KO, >=0 if OK + * TODO Use instead update_note_public and update_note */ function UpdateNote($user, $note, $note_public) { @@ -1457,10 +1468,8 @@ class CommandeFournisseur extends Commande return $result ; } - /* - * - * - * + /** + * Get list of user that can approve an order */ function ReadApprobators() { @@ -1500,6 +1509,7 @@ class CommandeFournisseur extends Commande /** * Tag order with a particular status * @param user Object user that change status + * @param status New status * @return int <0 if KO, >0 if OK */ function setStatus($user,$status) @@ -1688,7 +1698,7 @@ class CommandeFournisseur extends Commande $this->specimen=1; $this->socid = 1; $this->date = time(); - $this->date_commande = time(); + $this->date_commande = time(); $this->date_lim_reglement=$this->date+3600*24*30; $this->cond_reglement_code = 'RECEP'; $this->mode_reglement_code = 'CHQ'; @@ -1703,14 +1713,14 @@ class CommandeFournisseur extends Commande $line->desc=$langs->trans("Description")." ".$xnbp; $line->qty=1; $line->subprice=100; - $line->price=100; - $line->tva_tx=19.6; - $line->localtax1_tx=0; - $line->localtax2_tx=0; - $line->remise_percent=10; - $line->total_ht=90; - $line->total_ttc=107.64; // 90 * 1.196 - $line->total_tva=17.64; + $line->price=100; + $line->tva_tx=19.6; + $line->localtax1_tx=0; + $line->localtax2_tx=0; + $line->remise_percent=10; + $line->total_ht=90; + $line->total_ttc=107.64; // 90 * 1.196 + $line->total_tva=17.64; $line->ref_fourn='SUPPLIER_REF_'.$xnbp; $prodid = rand(1, $num_prods); $line->fk_product=$prodids[$prodid]; @@ -1726,48 +1736,48 @@ class CommandeFournisseur extends Commande $this->total_ttc = $xnbp*119.6; } - /** - * Load indicators for dashboard (this->nbtodo and this->nbtodolate) - * @param user Objet user - * @return int <0 if KO, >0 if OK - */ - function load_board($user) - { - global $conf, $user; + /** + * Load indicators for dashboard (this->nbtodo and this->nbtodolate) + * @param user Objet user + * @return int <0 if KO, >0 if OK + */ + function load_board($user) + { + global $conf, $user; - $now=gmmktime(); + $now=gmmktime(); - $this->nbtodo=$this->nbtodolate=0; - $clause = " WHERE"; + $this->nbtodo=$this->nbtodolate=0; + $clause = " WHERE"; - $sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; - if (!$user->rights->societe->client->voir && !$user->societe_id) - { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc"; - $sql.= " WHERE sc.fk_user = " .$user->id; - $clause = " AND"; - } - $sql.= $clause." c.entity = ".$conf->entity; - $sql.= " AND (c.fk_statut BETWEEN 1 AND 2)"; - if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id; + $sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; + if (!$user->rights->societe->client->voir && !$user->societe_id) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc"; + $sql.= " WHERE sc.fk_user = " .$user->id; + $clause = " AND"; + } + $sql.= $clause." c.entity = ".$conf->entity; + $sql.= " AND (c.fk_statut BETWEEN 1 AND 2)"; + if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id; - $resql=$this->db->query($sql); - if ($resql) - { - while ($obj=$this->db->fetch_object($resql)) - { - $this->nbtodo++; - if ($obj->fk_statut != 3 && $this->db->jdate($obj->datec) < ($now - $conf->commande->fournisseur->warning_delay)) $this->nbtodolate++; - } - return 1; - } - else - { - $this->error=$this->db->error(); - return -1; - } - } + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $this->nbtodo++; + if ($obj->fk_statut != 3 && $this->db->jdate($obj->datec) < ($now - $conf->commande->fournisseur->warning_delay)) $this->nbtodolate++; + } + return 1; + } + else + { + $this->error=$this->db->error(); + return -1; + } + } } diff --git a/htdocs/lib/CMailFile.class.php b/htdocs/lib/CMailFile.class.php index 48f9bff6b9c..ff8c991bd4b 100644 --- a/htdocs/lib/CMailFile.class.php +++ b/htdocs/lib/CMailFile.class.php @@ -25,7 +25,7 @@ /** * \file htdocs/lib/CMailFile.class.php * \brief File of class to send emails (with attachments or not) - * \version $Id: CMailFile.class.php,v 1.142 2011/07/02 16:48:31 eldy Exp $ + * \version $Id: CMailFile.class.php,v 1.143 2011/07/04 09:36:29 eldy Exp $ * \author Dan Potter. * \author Eric Seigne * \author Laurent Destailleur. @@ -86,20 +86,20 @@ class CMailFile /** - * \brief CMailFile - * \param subject Topic/Subject of mail - * \param to Recipients emails (RFC 2822: "Nom prenom [, ...]" ou "email[, ...]" ou "[, ...]") - * \param from Sender email (RFC 2822: "Nom prenom [, ...]" ou "email[, ...]" ou "[, ...]") - * \param msg Message - * \param filename_list List of files to attach (full path of filename on file system) - * \param mimetype_list List of MIME type of attached files - * \param mimefilename_list List of attached file name in message - * \param addr_cc Email cc - * \param addr_bcc Email bcc - * \param deliveryreceipt Ask a delivery receipt - * \param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection - * \param error_to Email errors - * \param css Css option + * CMailFile + * @param subject Topic/Subject of mail + * @param to Recipients emails (RFC 2822: "Nom prenom [, ...]" ou "email[, ...]" ou "[, ...]") + * @param from Sender email (RFC 2822: "Nom prenom [, ...]" ou "email[, ...]" ou "[, ...]") + * @param msg Message + * @param filename_list List of files to attach (full path of filename on file system) + * @param mimetype_list List of MIME type of attached files + * @param mimefilename_list List of attached file name in message + * @param addr_cc Email cc + * @param addr_bcc Email bcc + * @param deliveryreceipt Ask a delivery receipt + * @param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection + * @param errors_to Email errors + * @param css Css option */ function CMailFile($subject,$to,$from,$msg, $filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(), @@ -781,9 +781,8 @@ class CMailFile /** * Try to create a socket connection - * - * @param $host. Add ssl:// for SSL/TLS. - * @param $port. Example: 25, 465 + * @param $host Add ssl:// for SSL/TLS. + * @param $port Example: 25, 465 * @return Socket id if ok, 0 if KO */ function check_server_port($host,$port) @@ -939,7 +938,6 @@ class CMailFile /** * Return an address for SMTP protocol - * * @param adresses Example: 'John Doe ' or 'john@doe.com' * @param format 0=Auto, 1=emails with <>, 2=emails without <> * @param encode 1=Encode name to RFC2822 diff --git a/htdocs/lib/CSMSFile.class.php b/htdocs/lib/CSMSFile.class.php index ba87099186a..b0b9b46eb74 100755 --- a/htdocs/lib/CSMSFile.class.php +++ b/htdocs/lib/CSMSFile.class.php @@ -25,7 +25,7 @@ /** * \file htdocs/lib/CSMSFile.class.php * \brief File of class to send sms - * \version $Id$ + * \version $Id: CSMSFile.class.php,v 1.4 2011/07/04 09:36:29 eldy Exp $ * \author Laurent Destailleur. */ @@ -54,6 +54,9 @@ class CSMSFile * @param from Sender SMS * @param msg Message * @param deliveryreceipt Ask a delivery receipt + * @param deferred Deferred or not + * @param priority Priority + * @param class Class */ function CSMSFile($to,$from,$msg,$deliveryreceipt=0,$deferred=0,$priority=3,$class=1) { From 7521acb00a9267d5a3e50fcb25c0b450640e139d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 09:54:02 +0000 Subject: [PATCH 11/33] Fix: Creation category --- htdocs/categories/class/categorie.class.php | 32 ++++++++++++--------- htdocs/categories/fiche.php | 6 ++-- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 42d7e223766..22e3a9effe8 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2005 Davoleau Brice * Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2006-2008 Regis Houssin - * Copyright (C) 2006-2010 Laurent Destailleur + * Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * * This program is free software; you can redistribute it and/or modify @@ -25,7 +25,7 @@ * \file htdocs/categories/class/categorie.class.php * \ingroup categorie * \brief File of class to manage categories - * \version $Id: categorie.class.php,v 1.16 2011/06/28 09:25:57 cdelambert Exp $ + * \version $Id: categorie.class.php,v 1.17 2011/07/04 09:54:02 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); @@ -70,8 +70,8 @@ class Categorie } /** - * Charge la categorie - * @param id id de la categorie a charger + * Load category into memory from database + * @param id id of category */ function fetch($id) { @@ -121,7 +121,7 @@ class Categorie } /** - * Ajoute la categorie dans la base de donnees + * Add category into database * @return int -1 : erreur SQL * -2 : nouvel ID inconnu * -3 : categorie invalide @@ -147,14 +147,18 @@ class Categorie { $sql.= "fk_soc,"; } - $sql.= "visible, type, fk_parent_id) "; - $sql.= "VALUES ('".$this->db->escape($this->label)."', '".$this->db->escape($this->description)."',"; + $sql.= " visible,"; + $sql.= " type"; + //$sql.= ", fk_parent_id"; + $sql.= ")"; + $sql.= " VALUES ('".$this->db->escape($this->label)."', '".$this->db->escape($this->description)."',"; if ($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) { $sql.= ($this->socid != -1 ? $this->socid : 'null').","; } - $sql.= "'".$this->visible."',".$this->type.",".$this->parentId .")"; - + $sql.= "'".$this->visible."',".$this->type; + //$sql.= ",".$this->parentId; + $sql.= ")"; $res = $this->db->query ($sql); if ($res) @@ -254,7 +258,7 @@ class Categorie $sql .= ", fk_soc = ".($this->socid != -1 ? $this->socid : 'null'); } $sql .= ", visible = '".$this->visible."'"; - $sql .= ", fk_parent_id = ".$this->parentId; + //$sql .= ", fk_parent_id = ".$this->parentId; $sql .= " WHERE rowid = ".$this->id; dol_syslog("Categorie::update sql=".$sql); @@ -815,8 +819,8 @@ class Categorie } /** - * \brief Check if no category with same label already exists for this cat's parent or root and for this cat's type - * \return boolean 1 if already exist, 0 otherwise, -1 if error + * Check if no category with same label already exists for this cat's parent or root and for this cat's type + * @return boolean 1 if already exist, 0 otherwise, -1 if error */ function already_exists() { @@ -830,7 +834,7 @@ class Categorie $sql.= " JOIN ".MAIN_DB_PREFIX."categorie_association as ca"; $sql.= " ON c.rowid=ca.fk_categorie_fille"; $sql.= " WHERE ca.fk_categorie_mere=".$this->id_mere; - $sql.= " AND c.label='".$this->label."'"; + $sql.= " AND c.label='".$this->db->escape($this->label)."'"; } else // mother_id undefined (so it's root) { @@ -843,7 +847,7 @@ class Categorie $sql.= " JOIN ".MAIN_DB_PREFIX."categorie_association as ca"; $sql.= " ON c.rowid!=ca.fk_categorie_fille"; $sql.= " WHERE c.type=".$this->type; - $sql.= " AND c.label='".$this->label."'"; + $sql.= " AND c.label='".$this->db->escape($this->label)."'"; } dol_syslog("Categorie::already_exists sql=".$sql); $res = $this->db->query($sql); diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index a0ec25fbd17..01a5e1aee65 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -23,7 +23,7 @@ * \file htdocs/categories/fiche.php * \ingroup category * \brief Page to create a new category - * \version $Id$ + * \version $Id: fiche.php,v 1.84 2011/07/04 09:54:02 eldy Exp $ */ require("../main.inc.php"); @@ -131,7 +131,7 @@ if ($action == 'add' && $user->rights->categorie->creer) } // Confirm action -if ($action == 'add' && $user->rights->categorie->creer) +if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->creer) { // Action confirmation de creation categorie if ($action == 'confirmed') @@ -235,5 +235,5 @@ if ($user->rights->categorie->creer) $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 09:54:02 $ - $Revision: 1.84 $'); ?> From ea208fda3b09878f23b2ec9e6ad41a49036fa84f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 10:04:18 +0000 Subject: [PATCH 12/33] Fix: Better error management --- htdocs/product/stats/fiche.php | 79 ++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php index 77796470272..9cca548031b 100644 --- a/htdocs/product/stats/fiche.php +++ b/htdocs/product/stats/fiche.php @@ -23,7 +23,7 @@ * \file htdocs/product/stats/fiche.php * \ingroup product * \brief Page des stats produits - * \version $Id$ + * \version $Id: fiche.php,v 1.109 2011/07/04 10:04:18 eldy Exp $ */ require("../../main.inc.php"); @@ -37,6 +37,8 @@ $langs->load("bills"); $langs->load("other"); $mode=isset($_GET["mode"])?$_GET["mode"]:'byunit'; +$error=0; +$mesg=''; // Security check if (isset($_GET["id"]) || isset($_GET["ref"])) @@ -47,8 +49,6 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid); -$mesg = ''; - /* * View @@ -135,9 +135,10 @@ if ($_GET["id"] || $_GET["ref"]) $dir = (!empty($conf->product->dir_temp)?$conf->product->dir_temp:$conf->service->dir_temp); if (! file_exists($dir.'/'.$product->id)) { - if (create_exdir($dir.'/'.$product->id) < 0) + if (dol_mkdir($dir.'/'.$product->id) < 0) { $mesg = $langs->trans("ErrorCanNotCreateDir",$dir); + $error++; } } @@ -161,44 +162,48 @@ if ($_GET["id"] || $_GET["ref"]) ); $px = new DolGraph(); - $mesg = $px->isGraphKo(); - if (! $mesg) + + if (! $error) { - foreach($graphfiles as $key => $val) + $mesg = $px->isGraphKo(); + if (! $mesg) { - if (! $graphfiles[$key]['file']) continue; - - $graph_data = array(); - - // TODO Test si deja existant et recent, on ne genere pas - if ($key == 'propal') $graph_data = $product->get_nb_propal($socid,$mode); - if ($key == 'orders') $graph_data = $product->get_nb_order($socid,$mode); - if ($key == 'invoices') $graph_data = $product->get_nb_vente($socid,$mode); - if ($key == 'invoicessuppliers') $graph_data = $product->get_nb_achat($socid,$mode); - if (is_array($graph_data)) + foreach($graphfiles as $key => $val) { - $px->SetData($graph_data); - $px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue()); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->SetShading(3); - //print 'x '.$key.' '.$graphfiles[$key]['file']; - - $px->draw($dir."/".$graphfiles[$key]['file']); - } - else - { - dol_print_error($db,'Error for calculating graph on key='.$key.' - '.$product->error); + if (! $graphfiles[$key]['file']) continue; + + $graph_data = array(); + + // TODO Test si deja existant et recent, on ne genere pas + if ($key == 'propal') $graph_data = $product->get_nb_propal($socid,$mode); + if ($key == 'orders') $graph_data = $product->get_nb_order($socid,$mode); + if ($key == 'invoices') $graph_data = $product->get_nb_vente($socid,$mode); + if ($key == 'invoicessuppliers') $graph_data = $product->get_nb_achat($socid,$mode); + if (is_array($graph_data)) + { + $px->SetData($graph_data); + $px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue()); + $px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue()); + $px->SetWidth($WIDTH); + $px->SetHeight($HEIGHT); + $px->SetHorizTickIncrement(1); + $px->SetPrecisionY(0); + $px->SetShading(3); + //print 'x '.$key.' '.$graphfiles[$key]['file']; + + $px->draw($dir."/".$graphfiles[$key]['file']); + } + else + { + dol_print_error($db,'Error for calculating graph on key='.$key.' - '.$product->error); + } } } + + $mesg = $langs->trans("ChartGenerated"); } - - $mesg = $langs->trans("ChartGenerated"); - - // Affichage graphs + + // Show graphs $i=0; foreach($graphfiles as $key => $val) { @@ -266,5 +271,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 10:04:18 $ - $Revision: 1.109 $'); ?> \ No newline at end of file From a0e6bb5e9c04fed5077c5e0f2b23add7f01d27f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 10:30:00 +0000 Subject: [PATCH 13/33] Fix: pgql compatibility --- htdocs/adherents/class/adherentstats.class.php | 8 ++++---- htdocs/comm/propal.php | 10 +++++----- htdocs/comm/propal/class/propalestats.class.php | 8 ++++---- htdocs/commande/class/commandestats.class.php | 8 ++++---- htdocs/commande/liste.php | 12 ++++++------ .../deplacement/class/deplacementstats.class.php | 6 +++--- .../compta/facture/class/facturestats.class.php | 6 +++--- htdocs/compta/propal.php | 10 +++++----- htdocs/compta/sociales/index.php | 8 ++++---- htdocs/compta/stats/comp.php | 15 ++++++++------- htdocs/compta/tva/quadri.php | 16 ++++++++-------- .../expedition/class/expeditionstats.class.php | 4 ++-- htdocs/lib/accountancy.lib.php | 15 ++++++++------- 13 files changed, 64 insertions(+), 62 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 81d77d1f2c9..b47532e4a8c 100755 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -22,7 +22,7 @@ * \file htdocs/adherents/class/adherentstats.class.php * \ingroup member * \brief Fichier de la classe de gestion des stats des adhérents - * \version $Id$ + * \version $Id: adherentstats.class.php,v 1.2 2011/07/04 10:30:01 eldy Exp $ */ include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; @@ -90,7 +90,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql.= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(p.dateadh,'%Y') = ".$year; + $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -126,7 +126,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql.= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(p.dateadh,'%Y') = ".$year; + $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -144,7 +144,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql.= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(p.dateadh,'%Y') = ".$year; + $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 81169c18ab8..fd08c7bc5f5 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -27,7 +27,7 @@ * \file htdocs/comm/propal.php * \ingroup propale * \brief Page of commercial proposals card and list - * \version $Id: propal.php,v 1.607 2011/07/02 16:48:32 eldy Exp $ + * \version $Id: propal.php,v 1.608 2011/07/04 10:30:02 eldy Exp $ */ require("../main.inc.php"); @@ -1805,13 +1805,13 @@ else if ($month > 0) { if ($year > 0) - $sql.= " AND date_format(p.datep, '%Y-%m') = '$year-$month'"; + $sql.= " AND date_format(p.datep, '%Y-%m') = '".$year."-".$month."'"; else - $sql.= " AND date_format(p.datep, '%m') = '$month'"; + $sql.= " AND date_format(p.datep, '%m') = '".$month."'"; } if ($year > 0) { - $sql.= " AND date_format(p.datep, '%Y') = $year"; + $sql.= " AND date_format(p.datep, '%Y') = '".$year."'"; } if (dol_strlen($_POST['sf_ref']) > 0) { @@ -1975,6 +1975,6 @@ else } $db->close(); -llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.607 $'); +llxFooter('$Date: 2011/07/04 10:30:02 $ - $Revision: 1.608 $'); ?> diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index ac120ef6d4d..d880478352e 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -22,7 +22,7 @@ * \file htdocs/comm/propal/class/propalestats.class.php * \ingroup propales * \brief Fichier de la classe de gestion des stats des propales - * \version $Id$ + * \version $Id: propalestats.class.php,v 1.5 2011/07/04 10:30:03 eldy Exp $ */ include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; @@ -91,7 +91,7 @@ class PropaleStats extends Stats $sql = "SELECT date_format(p.datep,'%m') as dm, count(*)"; $sql.= " FROM ".$this->from; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(p.datep,'%Y') = ".$year; + $sql.= " WHERE date_format(p.datep,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -127,7 +127,7 @@ class PropaleStats extends Stats $sql = "SELECT date_format(p.datep,'%m') as dm, sum(p.".$this->field.")"; $sql.= " FROM ".$this->from; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(p.datep,'%Y') = ".$year; + $sql.= " WHERE date_format(p.datep,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -145,7 +145,7 @@ class PropaleStats extends Stats $sql = "SELECT date_format(p.datep,'%m') as dm, avg(p.".$this->field.")"; $sql.= " FROM ".$this->from; if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(p.datep,'%Y') = ".$year; + $sql.= " WHERE date_format(p.datep,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index 95ab36d59ff..9523d879cd9 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -22,7 +22,7 @@ * \file htdocs/commande/class/commandestats.class.php * \ingroup commandes * \brief Fichier de la classe de gestion des stats des commandes - * \version $Id$ + * \version $Id: commandestats.class.php,v 1.5 2011/07/04 10:30:01 eldy Exp $ */ include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; include_once DOL_DOCUMENT_ROOT . "/commande/class/commande.class.php"; @@ -102,7 +102,7 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_valid,'%m') as dm, count(*) nb"; $sql.= " FROM ".$this->from; if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year; + $sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -141,7 +141,7 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_valid,'%m') as dm, sum(c.".$this->field.")"; $sql.= " FROM ".$this->from; if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year; + $sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -161,7 +161,7 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_valid,'%m') as dm, avg(c.".$this->field.")"; $sql.= " FROM ".$this->from; if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year; + $sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php index 4e1c0f03c1e..871fe80c498 100644 --- a/htdocs/commande/liste.php +++ b/htdocs/commande/liste.php @@ -23,7 +23,7 @@ * \file htdocs/commande/liste.php * \ingroup commande * \brief Page to list orders - * \version $Id$ + * \version $Id: liste.php,v 1.77 2011/07/04 10:30:02 eldy Exp $ */ @@ -115,19 +115,19 @@ if ($viewstatut <> '') } if ($_GET['ordermonth'] > 0) { - $sql.= " AND date_format(c.date_valid, '%Y-%m') = '$orderyear-$ordermonth'"; + $sql.= " AND date_format(c.date_valid, '%Y-%m') = '".$orderyear."-".$ordermonth."'"; } if ($_GET['orderyear'] > 0) { - $sql.= " AND date_format(c.date_valid, '%Y') = $orderyear"; + $sql.= " AND date_format(c.date_valid, '%Y') = '".$orderyear."'"; } if ($_GET['deliverymonth'] > 0) { - $sql.= " AND date_format(c.date_livraison, '%Y-%m') = '$deliveryyear-$deliverymonth'"; + $sql.= " AND date_format(c.date_livraison, '%Y-%m') = '".$deliveryyear."-".$deliverymonth."'"; } if ($_GET['deliveryyear'] > 0) { - $sql.= " AND date_format(c.date_livraison, '%Y') = $deliveryyear"; + $sql.= " AND date_format(c.date_livraison, '%Y') = '".$deliveryyear."'"; } if (!empty($snom)) { @@ -278,5 +278,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 10:30:02 $ - $Revision: 1.77 $'); ?> diff --git a/htdocs/compta/deplacement/class/deplacementstats.class.php b/htdocs/compta/deplacement/class/deplacementstats.class.php index eb317b6d5f5..375d2901b1f 100644 --- a/htdocs/compta/deplacement/class/deplacementstats.class.php +++ b/htdocs/compta/deplacement/class/deplacementstats.class.php @@ -22,7 +22,7 @@ * \file htdocs/compta/deplacement/class/deplacementstats.class.php * \ingroup factures * \brief Fichier de la classe de gestion des stats des deplacement et notes de frais - * \version $Id$ + * \version $Id: deplacementstats.class.php,v 1.5 2011/07/04 10:30:02 eldy Exp $ */ include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; include_once DOL_DOCUMENT_ROOT . "/compta/deplacement/class/deplacement.class.php"; @@ -117,7 +117,7 @@ class DeplacementStats extends Stats { $sql = "SELECT date_format(dated,'%m') as dm, sum(".$this->field.")"; $sql.= " FROM ".$this->from; - $sql.= " WHERE date_format(dated,'%Y') = ".$year; + $sql.= " WHERE date_format(dated,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -136,7 +136,7 @@ class DeplacementStats extends Stats { $sql = "SELECT date_format(dated,'%m') as dm, avg(".$this->field.")"; $sql.= " FROM ".$this->from; - $sql.= " WHERE date_format(dated,'%Y') = ".$year; + $sql.= " WHERE date_format(dated,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 2953c14ba19..9ae7ef1aad9 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -22,7 +22,7 @@ * \file htdocs/compta/facture/class/facturestats.class.php * \ingroup factures * \brief Fichier de la classe de gestion des stats des factures - * \version $Id$ + * \version $Id: facturestats.class.php,v 1.6 2011/07/04 10:30:01 eldy Exp $ */ include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; include_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php"; @@ -78,7 +78,7 @@ class FactureStats extends Stats $this->where = " fk_statut > 0"; $this->where.= " AND entity = ".$conf->entity; - if ($mode == 'customer') $this->where.=" AND (fk_statut != 3 OR close_code != 'replaced')"; // Exclude replaced invoices as they are duplicated (we count closed invoices for other reasons) + if ($mode == 'customer') $this->where.=" AND (fk_statut <> 3 OR close_code <> 'replaced')"; // Exclude replaced invoices as they are duplicated (we count closed invoices for other reasons) if ($this->socid) { $this->where.=" AND fk_soc = ".$this->socid; @@ -132,7 +132,7 @@ class FactureStats extends Stats { $sql = "SELECT date_format(datef,'%m') as dm, SUM(".$this->field.")"; $sql.= " FROM ".$this->from; - $sql.= " WHERE date_format(datef,'%Y') = ".$year; + $sql.= " WHERE date_format(datef,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index bbe0895a61a..d4db8280805 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -25,7 +25,7 @@ * \file htdocs/compta/propal.php * \ingroup propale * \brief Page liste des propales (vision compta) - * \version $Id$ + * \version $Id: propal.php,v 1.193 2011/07/04 10:30:00 eldy Exp $ */ require('../main.inc.php'); @@ -561,11 +561,11 @@ else if ($month > 0) { if ($year > 0) - $sql.= " AND date_format(p.datep, '%Y-%m') = '$year-$month'"; + $sql.= " AND date_format(p.datep, '%Y-%m') = '".$year."-".$month."'"; else - $sql.= " AND date_format(p.datep, '%m') = '$month'"; + $sql.= " AND date_format(p.datep, '%m') = '".$month."'"; } - if ($year > 0) $sql .= " AND date_format(p.datep, '%Y') = $year"; + if ($year > 0) $sql .= " AND date_format(p.datep, '%Y') = '".$year."'"; if (!empty($_GET['search_ref'])) { $sql.= " AND p.ref LIKE '%".$db->escape($_GET['search_ref'])."%'"; @@ -702,6 +702,6 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 10:30:00 $ - $Revision: 1.193 $'); ?> diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index daafa781843..2aa820b029c 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -22,7 +22,7 @@ * \file htdocs/compta/sociales/index.php * \ingroup tax * \brief Page to list all social contributions - * \version $Id$ + * \version $Id: index.php,v 1.65 2011/07/04 10:30:01 eldy Exp $ */ require('../../main.inc.php'); @@ -86,8 +86,8 @@ if ($year > 0) $sql .= " AND ("; // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire - $sql .= " (s.periode is not null and date_format(s.periode, '%Y') = ".$year.") "; - $sql .= "or (s.periode is null and date_format(s.date_ech, '%Y') = ".$year.")"; + $sql .= " (s.periode is not null and date_format(s.periode, '%Y') = '".$year."') "; + $sql .= "or (s.periode is null and date_format(s.date_ech, '%Y') = '".$year."')"; $sql .= ")"; } if ($filtre) { @@ -229,5 +229,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 10:30:01 $ - $Revision: 1.65 $'); ?> diff --git a/htdocs/compta/stats/comp.php b/htdocs/compta/stats/comp.php index 5bee40758d8..e431ec86b78 100644 --- a/htdocs/compta/stats/comp.php +++ b/htdocs/compta/stats/comp.php @@ -21,7 +21,7 @@ /** * \file htdocs/compta/stats/comp.php * \ingroup commercial - * \version $Id: comp.php,v 1.43 2011/06/29 11:22:36 eldy Exp $ + * \version $Id: comp.php,v 1.44 2011/07/04 10:30:01 eldy Exp $ * TODO Remove or add page in menus */ @@ -47,8 +47,9 @@ function propals ($db, $year, $month) $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; $sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.fk_statut in (1,2,4)"; - $sql.= " AND date_format(p.datep, '%Y') = ".$year; - $sql.= " AND round(date_format(p.datep, '%m')) = ".$month; + // TODO Use between instead of date_format + $sql.= " AND date_format(p.datep, '%Y') = '".$year."'"; + $sql.= " AND round(date_format(p.datep, '%m')) = '".$month."'"; $sql.= " ORDER BY p.fk_statut"; $result = $db->query($sql); @@ -121,7 +122,7 @@ function factures ($db, $year, $month, $paye) $sql.= " AND f.entity = ".$conf->entity; if ($conf->compta->mode != 'CREANCES-DETTES') $sql.= " AND f.paye = ".$paye; $sql.= " AND f.fk_soc = s.rowid"; - $sql.= " AND date_format(f.datef, '%Y') = ".$year; + $sql.= " AND date_format(f.datef, '%Y') = '".$year."'"; $sql.= " AND round(date_format(f.datef, '%m')) = ".$month; $sql.= " ORDER BY f.datef DESC "; @@ -271,7 +272,7 @@ function ppt ($db, $year, $socid) $sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql.= " WHERE p.fk_statut in (1,2,4)"; $sql.= " AND p.entity = ".$conf->entity; - $sql.= " AND date_format(p.datep,'%Y') = ".$year; + $sql.= " AND date_format(p.datep,'%Y') = '".$year."'"; if ($socid) $sql.= " AND p.fk_soc = ".$socid; $sql.= " GROUP BY dm"; @@ -284,7 +285,7 @@ function ppt ($db, $year, $socid) $sql.= " WHERE f.fk_statut in (1,2)"; $sql.= " AND f.entity = ".$conf->entity; if ($conf->compta->mode != 'CREANCES-DETTES') $sql.= " AND f.paye = 1"; - $sql.= " AND date_format(f.datef,'%Y') = ".$year; + $sql.= " AND date_format(f.datef,'%Y') = '".$year."'"; if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY dm"; @@ -350,5 +351,5 @@ if ($details == 1) $db->close(); -llxFooter('$Date: 2011/06/29 11:22:36 $ - $Revision: 1.43 $'); +llxFooter('$Date: 2011/07/04 10:30:01 $ - $Revision: 1.44 $'); ?> diff --git a/htdocs/compta/tva/quadri.php b/htdocs/compta/tva/quadri.php index 8ada959f602..f85c447f383 100644 --- a/htdocs/compta/tva/quadri.php +++ b/htdocs/compta/tva/quadri.php @@ -24,7 +24,7 @@ \file htdocs/compta/tva/quadri.php \ingroup tax \brief Trimestrial page - \version $Id: quadri.php,v 1.14 2011/07/04 09:01:38 eldy Exp $ + \version $Id: quadri.php,v 1.15 2011/07/04 10:30:00 eldy Exp $ \todo Deal with recurrent invoices as well */ @@ -70,9 +70,9 @@ function tva_coll($db,$y,$q) $sql.= " AND s.entity = ".$conf->entity; $sql.= " AND f.fk_statut in (1,2)"; $sql.= " AND f.rowid = d.fk_facture "; - $sql.= " AND date_format(f.datef,'%Y') = ".$y; - $sql.= " AND (date_format(f.datef,'%m') > ".(($q-1)*3); - $sql.= " AND date_format(f.datef,'%m') <= ".($q*3).")"; + $sql.= " AND date_format(f.datef,'%Y') = '".$y."'"; + $sql.= " AND (round(date_format(f.datef,'%m') > ".(($q-1)*3); + $sql.= " AND round(date_format(f.datef,'%m')) <= ".($q*3).")"; $sql.= " ORDER BY rate, facid"; } @@ -136,9 +136,9 @@ function tva_paye($db, $y,$q) $sql.= " AND s.entity = ".$conf->entity; $sql.= " AND f.fk_statut = 1 "; $sql.= " AND f.rowid = d.fk_facture_fourn "; - $sql.= " AND date_format(f.datef,'%Y') = ".$y; - $sql.= " AND (date_format(f.datef,'%m') > ".(($q-1)*3); - $sql.= " AND date_format(f.datef,'%m') <= ".($q*3).")"; + $sql.= " AND date_format(f.datef,'%Y') = '".$y."'"; + $sql.= " AND (round(date_format(f.datef,'%m')) > ".(($q-1)*3); + $sql.= " AND round(date_format(f.datef,'%m')) <= ".($q*3).")"; $sql.= " ORDER BY rate, facid "; } else @@ -315,5 +315,5 @@ echo ''; $db->close(); -llxFooter('$Date: 2011/07/04 09:01:38 $ - $Revision: 1.14 $'); +llxFooter('$Date: 2011/07/04 10:30:00 $ - $Revision: 1.15 $'); ?> diff --git a/htdocs/expedition/class/expeditionstats.class.php b/htdocs/expedition/class/expeditionstats.class.php index 13e7de1b589..d7bf1e9dd7a 100644 --- a/htdocs/expedition/class/expeditionstats.class.php +++ b/htdocs/expedition/class/expeditionstats.class.php @@ -21,7 +21,7 @@ * \file htdocs/expedition/class/expeditionstats.class.php * \ingroup expedition * \brief Fichier des classes expedition - * \version $Id$ + * \version $Id: expeditionstats.class.php,v 1.4 2011/07/04 10:30:01 eldy Exp $ */ /** @@ -78,7 +78,7 @@ class ExpeditionStats $result = array(); $sql = "SELECT count(*), date_format(date_expedition,'%m') as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition"; - $sql.= " WHERE date_format(date_expedition,'%Y') = ".$year; + $sql.= " WHERE date_format(date_expedition,'%Y') = '".$year."'"; $sql.= " AND fk_statut > 0"; $sql.= " AND entity = ".$conf->entity; $sql.= " GROUP BY dm DESC"; diff --git a/htdocs/lib/accountancy.lib.php b/htdocs/lib/accountancy.lib.php index 57072ea1bad..6ef49c8af6a 100644 --- a/htdocs/lib/accountancy.lib.php +++ b/htdocs/lib/accountancy.lib.php @@ -20,21 +20,23 @@ /** * \file htdocs/lib/accountancy.lib.php * \brief Library of accountancy functions - * \version $Id$ + * \version $Id: accountancy.lib.php,v 1.2 2011/07/04 10:30:01 eldy Exp $ */ - +/** + * @param $db + * @param $year + * @param $socid + */ function get_ca_propal ($db, $year, $socid) { - - $sql = "SELECT sum(f.price - f.remise) as sum FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep, '%Y') = $year "; + $sql = "SELECT sum(f.price - f.remise) as sum FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep, '%Y') = '".$year."'"; if ($socid) { $sql .= " AND f.fk_soc = $socid"; } $result = $db->query($sql); - if ($result) { $res = $db->fetch_object($result); @@ -56,14 +58,13 @@ function get_ca ($db, $year, $socid) if ($conf->compta->mode != 'CREANCES-DETTES') { $sql .= " AND f.paye = 1"; } - $sql .= " AND date_format(f.datef , '%Y') = $year "; + $sql .= " AND date_format(f.datef , '%Y') = '".$year."'"; if ($socid) { $sql .= " AND f.fk_soc = $socid"; } $result = $db->query($sql); - if ($result) { $res = $db->fetch_object($result); From b3345bbfc1e280cc24d839a0bee17b01b0992bff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 10:33:56 +0000 Subject: [PATCH 14/33] Uniformize error report --- htdocs/compta/bank/virement.php | 8 +++----- htdocs/lib/functions.lib.php | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index 9dd871b2a58..8b6a658a406 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -22,7 +22,7 @@ * \file htdocs/compta/bank/virement.php * \ingroup banque * \brief Page de saisie d'un virement - * \version $Id$ + * \version $Id: virement.php,v 1.47 2011/07/04 10:33:56 eldy Exp $ */ require("./pre.inc.php"); @@ -138,9 +138,7 @@ $html=new Form($db); print_fiche_titre($langs->trans("BankTransfer")); -if ($mesg) { - print "$mesg
"; -} +dol_htmloutput_mesg($mesg); print $langs->trans("TransferDesc"); print "

"; @@ -178,5 +176,5 @@ print ""; $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 10:33:56 $ - $Revision: 1.47 $'); ?> diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 6ce212c314d..5cda1373034 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -29,7 +29,7 @@ * \file htdocs/lib/functions.lib.php * \brief A set of functions for Dolibarr * This file contains all frequently used functions. - * \version $Id: functions.lib.php,v 1.537 2011/07/04 08:53:01 eldy Exp $ + * \version $Id: functions.lib.php,v 1.538 2011/07/04 10:33:56 eldy Exp $ */ // For compatibility during upgrade @@ -3880,6 +3880,7 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb if ($iserror) { + $mesgstring=preg_replace('/<\/div>
/','
',$mesgstring); $mesgstring=preg_replace('/
/','',$mesgstring); $mesgstring=preg_replace('/<\/div>/','',$mesgstring); print get_htmloutput_mesg($mesgstring,$mesgarray,'error',$keepembedded); From 71466414d68bf21447b5e0bad494151921d10c7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 10:34:56 +0000 Subject: [PATCH 15/33] Fix: Trans --- htdocs/compta/bank/virement.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index 8b6a658a406..bbc9516dc16 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -22,7 +22,7 @@ * \file htdocs/compta/bank/virement.php * \ingroup banque * \brief Page de saisie d'un virement - * \version $Id: virement.php,v 1.47 2011/07/04 10:33:56 eldy Exp $ + * \version $Id: virement.php,v 1.48 2011/07/04 10:34:56 eldy Exp $ */ require("./pre.inc.php"); @@ -49,7 +49,7 @@ if ($_POST["action"] == 'add') if (! $label) { $error=1; - $mesg.="
".$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"))."
"; + $mesg.="
".$langs->trans("ErrorFieldRequired",$langs->transnoentities("Description"))."
"; } if (! $amount) { @@ -176,5 +176,5 @@ print ""; $db->close(); -llxFooter('$Date: 2011/07/04 10:33:56 $ - $Revision: 1.47 $'); +llxFooter('$Date: 2011/07/04 10:34:56 $ - $Revision: 1.48 $'); ?> From c10f895d77f7d2ad22826a0c553dc5652995d48a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 4 Jul 2011 10:35:48 +0000 Subject: [PATCH 16/33] Fix: add more triggers --- htdocs/comm/propal/index.php | 6 +++--- htdocs/commande/class/commande.class.php | 6 +++++- htdocs/compta/facture/class/facture.class.php | 8 ++++++-- .../includes/modules/commande/modules_commande.php | 12 ++++++++++-- .../includes/modules/facture/modules_facture.php | 13 +++++++++++-- .../includes/modules/propale/modules_propale.php | 12 ++++++++++-- .../triggers/interface_all_Demo.class.php-NORUN | 14 +++++++++++++- 7 files changed, 58 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 02df09c1d53..4943178e9c5 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -22,7 +22,7 @@ * \file htdocs/comm/propal/index.php * \ingroup propal * \brief Home page of proposal area - * \version $Id$ + * \version $Id: index.php,v 1.6 2011/07/04 10:35:49 hregis Exp $ */ require("../../main.inc.php"); @@ -249,7 +249,7 @@ if ($resql) print ''; $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); print ''; @@ -416,6 +416,6 @@ print ''; $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 10:35:49 $ - $Revision: 1.6 $'); ?> diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 6e6ac3d4d82..0bad431057f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -25,7 +25,7 @@ * \file htdocs/commande/class/commande.class.php * \ingroup commande * \brief Fichier des classes de commandes - * \version $Id: commande.class.php,v 1.117 2011/07/04 09:36:29 eldy Exp $ + * \version $Id: commande.class.php,v 1.118 2011/07/04 10:35:49 hregis Exp $ */ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); @@ -258,6 +258,8 @@ class Commande extends CommonObject if (! $error) { + $this->oldref=''; + // Rename directory if dir was a temporary ref if (preg_match('/^[\(]?PROV/i', $this->ref)) { @@ -273,6 +275,8 @@ class Commande extends CommonObject if (@rename($dirsource, $dirdest)) { + $this->oldref = $comref; + dol_syslog("Rename ok"); // Suppression ancien fichier PDF dans nouveau rep dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'.*'); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f8f946d3065..8060ef58a4c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -28,7 +28,7 @@ * \file htdocs/compta/facture/class/facture.class.php * \ingroup facture * \brief Fichier de la classe des factures clients - * \version $Id: facture.class.php,v 1.122 2011/06/30 13:27:20 hregis Exp $ + * \version $Id: facture.class.php,v 1.123 2011/07/04 10:35:48 hregis Exp $ */ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); @@ -1664,6 +1664,8 @@ class Facture extends CommonObject if (! $error) { + $this->oldref = ''; + // Rename directory if dir was a temporary ref if (preg_match('/^[\(]?PROV/i', $this->ref)) { @@ -1679,6 +1681,8 @@ class Facture extends CommonObject if (@rename($dirsource, $dirdest)) { + $this->oldref = $facref; + dol_syslog("Rename ok"); // Suppression ancien fichier PDF dans nouveau rep dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'.*'); @@ -1690,7 +1694,7 @@ class Facture extends CommonObject // Set new ref and define current statut if (! $error) { - $this->ref = $num; + $this->ref = $num; $this->facnumber=$num; $this->statut=1; } diff --git a/htdocs/includes/modules/commande/modules_commande.php b/htdocs/includes/modules/commande/modules_commande.php index 6bf604fb508..0a10adcd852 100644 --- a/htdocs/includes/modules/commande/modules_commande.php +++ b/htdocs/includes/modules/commande/modules_commande.php @@ -26,7 +26,7 @@ * \ingroup commande * \brief Fichier contenant la classe mere de generation des commandes en PDF * et la classe mere de numerotation des commandes - * \version $Id$ + * \version $Id: modules_commande.php,v 1.47 2011/07/04 10:35:49 hregis Exp $ */ require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); @@ -146,7 +146,7 @@ class ModeleNumRefCommandes */ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$langs; + global $conf,$user,$langs; $langs->load("orders"); $dir = "/includes/modules/commande/"; @@ -198,6 +198,14 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0 $outputlangs->charset_output=$sav_charset_output; // on supprime l'image correspondant au preview commande_delete_preview($db, $object->id); + + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($db); + $result=$interface->run_triggers('ORDER_BUILDDOC',$object,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + return 1; } else diff --git a/htdocs/includes/modules/facture/modules_facture.php b/htdocs/includes/modules/facture/modules_facture.php index 42e9248f8c9..9e1640010f4 100644 --- a/htdocs/includes/modules/facture/modules_facture.php +++ b/htdocs/includes/modules/facture/modules_facture.php @@ -25,7 +25,7 @@ * \ingroup facture * \brief Fichier contenant la classe mere de generation des factures en PDF * et la classe mere de numerotation des factures - * \version $Id$ + * \version $Id: modules_facture.php,v 1.92 2011/07/04 10:35:48 hregis Exp $ */ require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); @@ -147,7 +147,8 @@ class ModeleNumRefFactures */ function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$langs; + global $conf,$user,$langs; + $langs->load("bills"); // Increase limit for PDF build @@ -218,6 +219,14 @@ function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hide facture_delete_preview($db, $object->id); $outputlangs->charset_output=$sav_charset_output; + + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($db); + $result=$interface->run_triggers('BILL_BUILDDOC',$object,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + return 1; } else diff --git a/htdocs/includes/modules/propale/modules_propale.php b/htdocs/includes/modules/propale/modules_propale.php index 5828075a41e..b4572034c3a 100644 --- a/htdocs/includes/modules/propale/modules_propale.php +++ b/htdocs/includes/modules/propale/modules_propale.php @@ -24,7 +24,7 @@ * \ingroup propale * \brief Fichier contenant la classe mere de generation des propales en PDF * et la classe mere de numerotation des propales - * \version $Id: modules_propale.php,v 1.61 2011/07/04 08:53:01 eldy Exp $ + * \version $Id: modules_propale.php,v 1.62 2011/07/04 10:35:49 hregis Exp $ */ require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); @@ -143,7 +143,7 @@ class ModeleNumRefPropales */ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$langs; + global $conf,$user,$langs; $langs->load("propale"); $dir = "/includes/modules/propale/"; @@ -197,6 +197,14 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $outputlangs->charset_output=$sav_charset_output; // on supprime l'image correspondant au preview propale_delete_preview($db, $object->id); + + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($db); + $result=$interface->run_triggers('PROPAL_BUILDDOC',$object,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + return 1; } else diff --git a/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN b/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN index 21e9219ab8e..d4deae9b132 100644 --- a/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN +++ b/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN @@ -28,7 +28,7 @@ * - Le nom de la classe doit etre InterfaceMytrigger * - Le nom de la methode constructeur doit etre InterfaceMytrigger * - Le nom de la propriete name doit etre Mytrigger - * \version $Id$ + * \version $Id: interface_all_Demo.class.php-NORUN,v 1.26 2011/07/04 10:35:49 hregis Exp $ */ @@ -225,6 +225,10 @@ class InterfaceDemo { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } + elseif ($action == 'ORDER_BUILDDOC') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } elseif ($action == 'ORDER_SENTBYMAIL') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); @@ -269,6 +273,10 @@ class InterfaceDemo { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } + elseif ($action == 'PROPAL_BUILDDOC') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } elseif ($action == 'PROPAL_SENTBYMAIL') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); @@ -341,6 +349,10 @@ class InterfaceDemo { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } + elseif ($action == 'BILL_BUILDDOC') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } elseif ($action == 'BILL_SENTBYMAIL') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); From 6ea85f89719a7748a9c1b1762733776622d920e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 10:44:36 +0000 Subject: [PATCH 17/33] Fix: pgql compatibility --- htdocs/compta/bank/class/account.class.php | 77 +++++++++++----------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4c71c9c956f..d25fc241d5b 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -24,7 +24,7 @@ * \file htdocs/compta/bank/class/account.class.php * \ingroup banque * \brief File of class to manage bank accounts - * \version $Id: account.class.php,v 1.31 2011/07/04 09:01:38 eldy Exp $ + * \version $Id: account.class.php,v 1.32 2011/07/04 10:44:36 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); @@ -769,51 +769,54 @@ class Account extends CommonObject } /** - * + * @param rowid + * @param sign 1 or -1 + */ + function datev_change($rowid,$sign=1) + { + $sql = "SELECT datev FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; + $resql = $this->db->query($sql); + if ($resql) + { + $obj=$this->db->fetch_object($resql); + $newdate=$this->db->jdate($obj->datev)+(3600*24*$sign); + + $sql = "UPDATE ".MAIN_DB_PREFIX."bank SET "; + $sql.= " datev = '".$this->db->idate($newdate)."'"; + $sql.= " WHERE rowid = ".$rowid; + + $result = $this->db->query($sql); + if ($result) + { + if ($this->db->affected_rows($result)) + { + return 1; + } + } + else + { + dol_print_error($this->db); + return 0; + } + } + else dol_print_error($this->db); + return 0; + } + + /** + * @param rowid */ function datev_next($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX."bank SET "; - $sql.= " datev = adddate(datev, interval 1 day)"; - $sql.= " WHERE rowid = ".$rowid; - - $result = $this->db->query($sql); - if ($result) - { - if ($this->db->affected_rows($result)) - { - return 1; - } - } - else - { - dol_print_error($this->db); - return 0; - } + return $this->datev_change($rowid,1); } /** - * + * @param rowid */ function datev_previous($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX."bank SET "; - $sql.= " datev = adddate(datev, interval -1 day)"; - $sql.= " WHERE rowid = ".$rowid; - - $result = $this->db->query($sql); - if ($result) - { - if ($this->db->affected_rows($result)) - { - return 1; - } - } - else - { - dol_print_error($this->db); - return 0; - } + return $this->datev_change($rowid,-1); } /** From 97fa4ff5ae3771b8057db131ce0488cbf69f7eee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 10:56:12 +0000 Subject: [PATCH 18/33] Fix: pgql compatibility --- htdocs/projet/activity/index.php | 35 ++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index a6a745ad25c..60d89967b65 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -22,7 +22,7 @@ * \file htdocs/projet/activity/index.php * \ingroup projet * \brief Page activite perso du module projet - * \version $Id$ + * \version $Id: index.php,v 1.35 2011/07/04 10:56:12 eldy Exp $ */ require ("../../main.inc.php"); @@ -88,7 +88,7 @@ $sql.= " WHERE t.fk_projet = p.rowid"; $sql.= " AND p.entity = ".$conf->entity; $sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_user = ".$user->id; -$sql.= " AND date_format(task_date,'%d%m%y') = ".strftime("%d%m%y",time()); +$sql.= " AND date_format(task_date,'%y-%m-%d') = '".strftime("%y-%m-%d",$now)."'"; $sql.= " AND p.rowid in (".$projectsListId.")"; $sql.= " GROUP BY p.rowid, p.ref, p.title"; @@ -124,6 +124,10 @@ print ''.ConvertSecondToTime($total).''; print "\n"; print ""; +// TODO Do not use date_add function to be compatible with all database +if ($db->type != 'pgsql') +{ + /* Affichage de la liste des projets d'hier */ print '
'; print ''; @@ -139,9 +143,9 @@ $sql.= " WHERE t.fk_projet = p.rowid"; $sql.= " AND p.entity = ".$conf->entity; $sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_user = ".$user->id; -$sql.= " AND date_format(date_add(task_date, INTERVAL 1 DAY),'%d%m%y') = ".strftime("%d%m%y",time()); +$sql.= " AND date_format(date_add(task_date, INTERVAL 1 DAY),'%y-%m-%d') = '".strftime("%y-%m-%d",$now)."'"; $sql.= " AND p.rowid in (".$projectsListId.")"; -$sql.= " GROUP BY p.rowid"; +$sql.= " GROUP BY p.rowid, p.ref, p.title"; $resql = $db->query($sql); if ( $resql ) @@ -175,8 +179,15 @@ print ''; print "\n"; print "
'.ConvertSecondToTime($total).'
"; +} + + print ''; +// TODO Do not use week function to be compatible with all database +if ($db->type != 'pgsql') +{ + /* Affichage de la liste des projets de la semaine */ print ''; print ''; @@ -192,9 +203,9 @@ $sql.= " WHERE t.fk_projet = p.rowid"; $sql.= " AND p.entity = ".$conf->entity; $sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_user = ".$user->id; -$sql.= " AND week(task_date) = ".strftime("%W",time()); +$sql.= " AND week(task_date) = '".strftime("%W",time())."'"; $sql.= " AND p.rowid in (".$projectsListId.")"; -$sql.= " GROUP BY p.rowid"; +$sql.= " GROUP BY p.rowid, p.ref, p.title"; $resql = $db->query($sql); if ( $resql ) @@ -228,6 +239,8 @@ print ''; print "\n"; print "
'.ConvertSecondToTime($total).'

"; +} + /* Affichage de la liste des projets du mois */ print ''; print ''; @@ -243,9 +256,9 @@ $sql.= " WHERE t.fk_projet = p.rowid"; $sql.= " AND p.entity = ".$conf->entity; $sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_user = ".$user->id; -$sql.= " AND month(task_date) = ".strftime("%m",$now); +$sql.= " AND date_format(task_date,'%y-%m') = '".strftime("%y-%m",$now)."'"; $sql.= " AND p.rowid in (".$projectsListId.")"; -$sql.= " GROUP BY p.rowid"; +$sql.= " GROUP BY p.rowid, p.ref, p.title"; $resql = $db->query($sql); if ( $resql ) @@ -287,9 +300,9 @@ $sql.= " WHERE t.fk_projet = p.rowid"; $sql.= " AND p.entity = ".$conf->entity; $sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_user = ".$user->id; -$sql.= " AND YEAR(task_date) = ".strftime("%Y",$now); +$sql.= " AND YEAR(task_date) = '".strftime("%Y",$now)."'"; $sql.= " AND p.rowid in (".$projectsListId.")"; -$sql.= " GROUP BY p.rowid"; +$sql.= " GROUP BY p.rowid, p.ref, p.title"; $var=false; $resql = $db->query($sql); @@ -319,5 +332,5 @@ print '
'; $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 10:56:12 $ - $Revision: 1.35 $'); ?> From 1b296949a2dc768c993e360e70d201f6dbf74d51 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 11:33:22 +0000 Subject: [PATCH 19/33] Qual: Removed some deprecated/duplicated functions --- htdocs/compta/bank/account.php | 8 ++++---- htdocs/compta/bank/pre.inc.php | 11 +++-------- htdocs/compta/paiement/cheque/pre.inc.php | 11 +++-------- htdocs/core/class/html.form.class.php | 13 ++----------- htdocs/core/class/menu.class.php | 16 +--------------- htdocs/imports/import.php | 8 ++++---- htdocs/includes/menus/standard/eldy.lib.php | 12 ++++++------ 7 files changed, 23 insertions(+), 56 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index bc8cd6e16ce..fe77917adbc 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -25,7 +25,7 @@ * \file htdocs/compta/bank/account.php * \ingroup banque * \brief List of details of bank transactions for an account - * \version $Id$ + * \version $Id: account.php,v 1.154 2011/07/04 11:33:22 eldy Exp $ */ require("./pre.inc.php"); // We use pre.inc.php to have a dynamic menu @@ -491,7 +491,7 @@ if ($account || $_GET["ref"]) if ($result) { $now=dol_now(); - $nows=dol_date('Ymd',$now); + $nows=dol_print_date($now,'%Y%m%d'); //$html->load_cache_types_paiements(); //$html->cache_types_paiements @@ -510,7 +510,7 @@ if ($account || $_GET["ref"]) $var=!$var; // Is it a transaction in future ? - $dos=dol_date('Ymd',$db->jdate($objp->do)); + $dos=dol_print_date($db->jdate($objp->do),'%Y%m%d'); //print "dos=".$dos." nows=".$nows; if ($dos > $nows && !$sep) // Yes, we show a subtotal { @@ -786,5 +786,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 11:33:22 $ - $Revision: 1.154 $'); ?> diff --git a/htdocs/compta/bank/pre.inc.php b/htdocs/compta/bank/pre.inc.php index a0387aa950a..622913e139f 100644 --- a/htdocs/compta/bank/pre.inc.php +++ b/htdocs/compta/bank/pre.inc.php @@ -23,7 +23,7 @@ * \file htdocs/compta/bank/pre.inc.php * \ingroup compta * \brief Fichier gestionnaire du menu compta banque - * \version $Id$ + * \version $Id: pre.inc.php,v 1.51 2011/07/04 11:33:22 eldy Exp $ */ require_once("../../main.inc.php"); @@ -73,16 +73,11 @@ function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0 while ($i < $numr) { $objp = $db->fetch_object($resql); - $menu->add_submenu('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); + $menu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); if ($objp->rappro && $objp->courant != 2 && ! $objp->clos) // If not cash account and not closed and can be reconciliate { - $menu->add_submenu('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); + $menu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); } -/* - $menu->add_submenu("/compta/bank/annuel.php?account=".$objp->rowid ,$langs->trans("IOMonthlyReporting")); - $menu->add_submenu("/compta/bank/graph.php?account=".$objp->rowid ,$langs->trans("Graph")); - if ($objp->courant != 2) $menu->add_submenu("/compta/bank/releve.php?account=".$objp->rowid ,$langs->trans("AccountStatements")); -*/ $i++; } } diff --git a/htdocs/compta/paiement/cheque/pre.inc.php b/htdocs/compta/paiement/cheque/pre.inc.php index 7f7a49db0db..ad609ec5595 100644 --- a/htdocs/compta/paiement/cheque/pre.inc.php +++ b/htdocs/compta/paiement/cheque/pre.inc.php @@ -22,7 +22,7 @@ * \file htdocs/compta/paiement/cheque/pre.inc.php * \ingroup compta * \brief Fichier gestionnaire du menu cheques - * \version $Id$ + * \version $Id: pre.inc.php,v 1.19 2011/07/04 11:33:23 eldy Exp $ */ require_once("../../../main.inc.php"); @@ -72,16 +72,11 @@ function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0 while ($i < $numr) { $objp = $db->fetch_object($resql); - $menu->add_submenu('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); + $menu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); if ($objp->rappro && $objp->courant != 2) // If not cash account and can be reconciliate { - $menu->add_submenu('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); + $menu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); } -/* - $menu->add_submenu("/compta/bank/annuel.php?account=".$objp->rowid ,$langs->trans("IOMonthlyReporting")); - $menu->add_submenu("/compta/bank/graph.php?account=".$objp->rowid ,$langs->trans("Graph")); - if ($objp->courant != 2) $menu->add_submenu("/compta/bank/releve.php?account=".$objp->rowid ,$langs->trans("AccountStatements")); -*/ $i++; } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6a8724a71be..ff89055281e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -31,7 +31,7 @@ * \file htdocs/core/class/html.form.class.php * \ingroup core * \brief File of class with all html predefined components - * \version $Id: html.form.class.php,v 1.185 2011/07/04 07:28:11 eldy Exp $ + * \version $Id: html.form.class.php,v 1.186 2011/07/04 11:33:22 eldy Exp $ */ @@ -134,15 +134,6 @@ class Form return $ret; } - /** - * Old version of textwithtooltip. Kept for backward compatibility with modules for 2.6. - * @deprecated - */ - function textwithhelp($text,$htmltext,$tooltipon=1) - { - return $this->textwithtooltip($text,$htmltext,$tooltipon); - } - /** * Show a text and picto with tooltip on text or picto * @param text Text to show @@ -2507,7 +2498,7 @@ class Form } } } - + /** * \brief Affiche formulaire de selection des tiers * \param page Page diff --git a/htdocs/core/class/menu.class.php b/htdocs/core/class/menu.class.php index 5cae9dab8aa..7c90970d411 100644 --- a/htdocs/core/class/menu.class.php +++ b/htdocs/core/class/menu.class.php @@ -21,7 +21,7 @@ * \file htdocs/core/class/menu.class.php * \ingroup core * \brief Fichier de la classe de gestion du menu gauche - * \version $Id$ + * \version $Id: menu.class.php,v 1.4 2011/07/04 11:33:22 eldy Exp $ */ @@ -76,18 +76,4 @@ class Menu { if (sizeof($this->liste) > 1) array_pop($this->liste); } - /** - * \brief Add a menu entry - * \param url Url to follown on click - * \param titre Menu label to show - * \param level Level of menu to show (0=First level, 1=Second...) - * \param enabled Menu active or not - * \param target Target lien - * \deprecated - */ - function add_submenu($url, $titre, $level=1, $enabled=1, $target='') - { - $this->add($url, $titre, $level, $enabled, $target); - } - } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index c2f23f30e05..526527702a5 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -21,7 +21,7 @@ * \file htdocs/imports/import.php * \ingroup import * \brief Pages of import Wizard - * \version $Id: import.php,v 1.66 2011/07/04 08:53:01 eldy Exp $ + * \version $Id: import.php,v 1.67 2011/07/04 11:33:23 eldy Exp $ */ require_once("../main.inc.php"); @@ -195,8 +195,8 @@ if ($step == 3 && $datatoimport) if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - create_exdir($conf->import->dir_temp); - $nowyearmonth=dol_date('YmdHis',dol_now(),0); + dol_mkdir($conf->import->dir_temp); + $nowyearmonth=dol_print_date(dol_now(),'%Y%m%d%H%M%S'); $fullpath=$conf->import->dir_temp . "/" . $nowyearmonth . '-'.$_FILES['userfile']['name']; if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $fullpath,1) > 0) @@ -1669,7 +1669,7 @@ print '
'; $db->close(); -llxFooter('$Date: 2011/07/04 08:53:01 $ - $Revision: 1.66 $'); +llxFooter('$Date: 2011/07/04 11:33:23 $ - $Revision: 1.67 $'); /* diff --git a/htdocs/includes/menus/standard/eldy.lib.php b/htdocs/includes/menus/standard/eldy.lib.php index 3cf07c4dc17..7c50b92df5a 100644 --- a/htdocs/includes/menus/standard/eldy.lib.php +++ b/htdocs/includes/menus/standard/eldy.lib.php @@ -21,7 +21,7 @@ /** * \file htdocs/includes/menus/standard/eldy.lib.php * \brief Library for file eldy menus - * \version $Id: eldy.lib.php,v 1.54 2011/07/03 16:00:18 eldy Exp $ + * \version $Id: eldy.lib.php,v 1.55 2011/07/04 11:33:22 eldy Exp $ */ @@ -1012,13 +1012,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) { $newmenu->add("/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire); - $newmenu->add_submenu("/compta/bank/fiche.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer); - $newmenu->add_submenu("/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer); + $newmenu->add("/compta/bank/fiche.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer); + $newmenu->add("/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer); - $newmenu->add_submenu("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire); - $newmenu->add_submenu("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire); + $newmenu->add("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire); + $newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire); - $newmenu->add_submenu("/compta/bank/virement.php",$langs->trans("BankTransfers"),1,$user->rights->banque->transfer); + $newmenu->add("/compta/bank/virement.php",$langs->trans("BankTransfers"),1,$user->rights->banque->transfer); } // Prelevements From 347b20274ad0c3b7e528e3fdde03ccfca29aff13 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2011 11:41:02 +0000 Subject: [PATCH 20/33] Doxygen --- htdocs/societe/class/societe.class.php | 13 +++++++--- htdocs/user/class/user.class.php | 12 +++++++--- htdocs/user/class/usergroup.class.php | 33 +++++++++++++------------- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4f9c6550c32..7caf9a3e478 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -27,7 +27,7 @@ * \file htdocs/societe/class/societe.class.php * \ingroup societe * \brief File for third party class - * \version $Id: societe.class.php,v 1.88 2011/07/03 22:07:24 eldy Exp $ + * \version $Id: societe.class.php,v 1.89 2011/07/04 11:41:05 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); @@ -2105,6 +2105,13 @@ class Societe extends CommonObject } + /** + * Add permissions + * @param user_id + * @param read + * @param write + * @param perms + */ function AddPerms($user_id, $read, $write, $perms) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_perms"; @@ -2120,7 +2127,7 @@ class Societe extends CommonObject /** * Charge les informations d'ordre info dans l'objet societe - * @param id id de la societe a charger + * @param id Id de la societe a charger */ function info($id) { @@ -2183,7 +2190,7 @@ class Societe extends CommonObject /** * Return if a country is inside the EEC (European Economic Community) - * @param boolean true = pays inside EEC, false= pays outside EEC + * @return boolean true = pays inside EEC, false= pays outside EEC */ function isInEEC() { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 3425b0fe346..97901def506 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -25,7 +25,7 @@ /** * \file htdocs/user/class/user.class.php * \brief Fichier de la classe utilisateur - * \version $Id: user.class.php,v 1.43 2011/06/29 10:23:32 eldy Exp $ + * \version $Id: user.class.php,v 1.44 2011/07/04 11:41:02 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); @@ -1482,7 +1482,10 @@ class User extends CommonObject /** * Add user into a group - * @param group id du groupe + * @param group Id of group + * @param entity Entity + * @param notrigger Disable triggers + * @return int <0 if KO, >0 if OK */ function SetInGroup($group, $entity, $notrigger=0) { @@ -1539,7 +1542,10 @@ class User extends CommonObject /** * Remove a user from a group - * @param group id du groupe + * @param group Id of group + * @param entity Entity + * @param notrigger Disable triggers + * @return int <0 if KO, >0 if OK */ function RemoveFromGroup($group, $entity, $notrigger=0) { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 3bb668d7e55..51ba9f3efab 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -22,7 +22,7 @@ * \file htdocs/user/class/usergroup.class.php * \brief Fichier de la classe des groupes d'utilisateur * \author Rodolphe Qiedeville - * \version $Id$ + * \version $Id: usergroup.class.php,v 1.10 2011/07/04 11:41:04 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); @@ -55,9 +55,8 @@ class UserGroup extends CommonObject /** - * \brief Constructeur de la classe - * \param DB Handler acces base de donnees - * \param id Id du groupe (0 par defaut) + * Constructor + * @param DB Handler acces base de donnees */ function UserGroup($DB) { @@ -68,9 +67,9 @@ class UserGroup extends CommonObject /** - * \brief Charge un objet group avec toutes ces caracteristiques (excpet ->members array) - * \param id id du groupe a charger - * \return int <0 si KO, >0 si OK + * Charge un objet group avec toutes ces caracteristiques (excpet ->members array) + * @param id id du groupe a charger + * @return int <0 si KO, >0 si OK */ function fetch($id) { @@ -117,13 +116,13 @@ class UserGroup extends CommonObject /** * Return array of groups objects for a particular user - * @param usertosearch - * @return array of groups objects + * @param userid User id to search + * @return array Array of groups objects */ function listGroupsForUser($userid) { global $conf; - + $ret=array(); $sql = "SELECT g.rowid, ug.entity as usergroup_entity"; @@ -143,12 +142,12 @@ class UserGroup extends CommonObject $group=new UserGroup($this->db); $group->fetch($obj->rowid); $group->usergroup_entity = $obj->usergroup_entity; - + $ret[]=$group; } - + $this->db->free($result); - + return $ret; } else @@ -166,7 +165,7 @@ class UserGroup extends CommonObject function listUsersForGroup() { global $conf; - + $ret=array(); $sql = "SELECT u.rowid, ug.entity as usergroup_entity"; @@ -188,9 +187,9 @@ class UserGroup extends CommonObject $ret[]=$user; } - + $this->db->free($result); - + return $ret; } else @@ -524,7 +523,7 @@ class UserGroup extends CommonObject $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."usergroup"); if ($this->update(1) < 0) return -2; - + if (! $notrigger) { // Appel des triggers From e4ee479276f3ca3de96dcbf74dc1f1bdf737a15b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 4 Jul 2011 13:47:34 +0000 Subject: [PATCH 21/33] Fix: create directory if not exist --- htdocs/core/ajaxfileupload.php | 93 ++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/htdocs/core/ajaxfileupload.php b/htdocs/core/ajaxfileupload.php index f7be35cc5d8..cc51d9c2836 100644 --- a/htdocs/core/ajaxfileupload.php +++ b/htdocs/core/ajaxfileupload.php @@ -119,50 +119,57 @@ class UploadHandler private function create_scaled_image($file_name, $options) { $file_path = $this->options['upload_dir'].$file_name; $new_file_path = $options['upload_dir'].$file_name; - list($img_width, $img_height) = @getimagesize($file_path); - if (!$img_width || !$img_height) { - return false; + if (create_exdir($options['upload_dir']) >= 0) + { + list($img_width, $img_height) = @getimagesize($file_path); + if (!$img_width || !$img_height) { + return false; + } + $scale = min( + $options['max_width'] / $img_width, + $options['max_height'] / $img_height + ); + if ($scale > 1) { + $scale = 1; + } + $new_width = $img_width * $scale; + $new_height = $img_height * $scale; + $new_img = @imagecreatetruecolor($new_width, $new_height); + switch (strtolower(substr(strrchr($file_name, '.'), 1))) { + case 'jpg': + case 'jpeg': + $src_img = @imagecreatefromjpeg($file_path); + $write_image = 'imagejpeg'; + break; + case 'gif': + $src_img = @imagecreatefromgif($file_path); + $write_image = 'imagegif'; + break; + case 'png': + $src_img = @imagecreatefrompng($file_path); + $write_image = 'imagepng'; + break; + default: + $src_img = $image_method = null; + } + $success = $src_img && @imagecopyresampled( + $new_img, + $src_img, + 0, 0, 0, 0, + $new_width, + $new_height, + $img_width, + $img_height + ) && $write_image($new_img, $new_file_path); + // Free up memory (imagedestroy does not delete files): + @imagedestroy($src_img); + @imagedestroy($new_img); + return $success; } - $scale = min( - $options['max_width'] / $img_width, - $options['max_height'] / $img_height - ); - if ($scale > 1) { - $scale = 1; + else + { + return false; } - $new_width = $img_width * $scale; - $new_height = $img_height * $scale; - $new_img = @imagecreatetruecolor($new_width, $new_height); - switch (strtolower(substr(strrchr($file_name, '.'), 1))) { - case 'jpg': - case 'jpeg': - $src_img = @imagecreatefromjpeg($file_path); - $write_image = 'imagejpeg'; - break; - case 'gif': - $src_img = @imagecreatefromgif($file_path); - $write_image = 'imagegif'; - break; - case 'png': - $src_img = @imagecreatefrompng($file_path); - $write_image = 'imagepng'; - break; - default: - $src_img = $image_method = null; - } - $success = $src_img && @imagecopyresampled( - $new_img, - $src_img, - 0, 0, 0, 0, - $new_width, - $new_height, - $img_width, - $img_height - ) && $write_image($new_img, $new_file_path); - // Free up memory (imagedestroy does not delete files): - @imagedestroy($src_img); - @imagedestroy($new_img); - return $success; } private function has_error($uploaded_file, $file, $error) { @@ -202,7 +209,7 @@ class UploadHandler $file->size = intval($size); $file->type = $type; $error = $this->has_error($uploaded_file, $file, $error); - if (!$error && $file->name) { + if (!$error && $file->name && create_exdir($this->options['upload_dir']) >= 0) { if ($file->name[0] === '.') { $file->name = substr($file->name, 1); } From ae37f62729710db632614046e246382dff3859d4 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Mon, 4 Jul 2011 15:16:04 +0000 Subject: [PATCH 22/33] Trad: Best accurate translation --- htdocs/langs/ca_ES/boxes.lang | 4 ++-- htdocs/langs/ca_ES/commercial.lang | 2 +- htdocs/langs/ca_ES/compta.lang | 6 +++--- htdocs/langs/ca_ES/main.lang | 2 +- htdocs/langs/ca_ES/members.lang | 2 +- htdocs/langs/es_ES/boxes.lang | 4 ++-- htdocs/langs/es_ES/commercial.lang | 2 +- htdocs/langs/es_ES/compta.lang | 6 +++--- htdocs/langs/es_ES/main.lang | 2 +- htdocs/langs/es_ES/members.lang | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/langs/ca_ES/boxes.lang b/htdocs/langs/ca_ES/boxes.lang index d30e80ecd82..80b9e3cfc92 100644 --- a/htdocs/langs/ca_ES/boxes.lang +++ b/htdocs/langs/ca_ES/boxes.lang @@ -18,7 +18,7 @@ BoxLastContracts=Últims contractes BoxLastContacts=Últims contactes/adreçes BoxLastMembers=Últims membres modificats BoxCurrentAccounts=Saldos comptes corrents -BoxSalesTurnover=Volum de negoci +BoxSalesTurnover=Volum de vendes BoxTotalUnpaidCustomerBills=Total factures a clients pendents de cobrament BoxTotalUnpaidSuppliersBills=Total factures de proveïdors pendents de pagament BoxTitleLastBooks=Els %s darrers marcadors registrats @@ -40,7 +40,7 @@ BoxTitleLastProductsInContract=Els %s darrers productes/serveis contractats BoxTitleOldestUnpaidCustomerBills=Les %s factures més antigues a clients pendents de cobrament BoxTitleOldestUnpaidSupplierBills=Les %s factures més antigues de proveïdors pendents de pagament BoxTitleCurrentAccounts=Saldos dels comptes corrents -BoxTitleSalesTurnover=Volum de negoci realitzat +BoxTitleSalesTurnover=Volum de vendes realitzades BoxTitleTotalUnpaidCustomerBills=Pendent de clients BoxTitleTotalUnpaidSuppliersBills=Pendent a proveïdors BoxTitleLastModifiedContacts=Els últims %s contactes/adreçes modificades diff --git a/htdocs/langs/ca_ES/commercial.lang b/htdocs/langs/ca_ES/commercial.lang index 34ced6cc724..0c3bdfee5db 100644 --- a/htdocs/langs/ca_ES/commercial.lang +++ b/htdocs/langs/ca_ES/commercial.lang @@ -81,7 +81,7 @@ ActionAC_SUP_ORD=Enviament comanda a proveïdor per correu ActionAC_SUP_INV=Enviament factura de proveïdor per correu ActionAC_OTH=Altra Stats=Estadístiques de venda -CAOrder=Volum de negocis (Comandes validades) +CAOrder=Volum de vendes (Comandes validades) FromTo=de %s a %s MargeOrder=Marges (Comandes validades) RecapAnnee=Recapitulació de l'any diff --git a/htdocs/langs/ca_ES/compta.lang b/htdocs/langs/ca_ES/compta.lang index 9857f9fe4b6..8e77514697c 100644 --- a/htdocs/langs/ca_ES/compta.lang +++ b/htdocs/langs/ca_ES/compta.lang @@ -20,7 +20,7 @@ BillsForSuppliers=Factures de proveïdors Income=Ingressos Outcome=Despeses ReportInOut=Resultat / Exercici -ReportTurnover=Volum de negoci +ReportTurnover=Volum de vendes PaymentsNotLinkedToInvoice=Pagaments vinculats a cap factura, per la qual cosa sense tercer PaymentsNotLinkedToUser=Pagaments no vinculats a un usuari Profit=Benefici @@ -73,12 +73,12 @@ AlreadyPaid=Ja pagat AccountNumberShort=Nº de compte AccountNumber=Número de compte NewAccount=Nou compte -SalesTurnover=Volum de negoci +SalesTurnover=Volum de vendes ByThirdParties=Per tercer ByUserAuthorOfInvoice=Per autor de la factura AccountancyExport=Exportació comptabilitat ErrorWrongAccountancyCodeForCompany=Codi comptable incorrecte per a %s -SuppliersProductsSellSalesTurnover=Volum de negoci generat per la venda dels productes dels proveïdors +SuppliersProductsSellSalesTurnover=Volum de vendes generat per la venda dels productes dels proveïdors CheckReceipt=Llista de remeses CheckReceiptShort=Remeses NewCheckReceipt=Nova remesa diff --git a/htdocs/langs/ca_ES/main.lang b/htdocs/langs/ca_ES/main.lang index ac52ca2a77e..ef9175c1374 100644 --- a/htdocs/langs/ca_ES/main.lang +++ b/htdocs/langs/ca_ES/main.lang @@ -298,7 +298,7 @@ VAT=IVA VATRate=Taxa IVA Average=Mitja Sum=Suma -Delta=Divergència +Delta=Diferència Module=Mòdul Option=Opció List=Llistat diff --git a/htdocs/langs/ca_ES/members.lang b/htdocs/langs/ca_ES/members.lang index a2e7a5d2344..6b0cfd27b97 100644 --- a/htdocs/langs/ca_ES/members.lang +++ b/htdocs/langs/ca_ES/members.lang @@ -183,4 +183,4 @@ NewMemberForm=Formulari d'inscripció SubscriptionsStatistics=Estadístiques de cotitzacions NbOfSubscriptions=Nombre de cotitzacions AmountOfSubscriptions=Import de cotitzacions -TurnoverOrBudget=Volum de negoci (empresa) o Pressupost (associació o col.lectiu) \ No newline at end of file +TurnoverOrBudget=Volum de vendes (empresa) o Pressupost (associació o col.lectiu) \ No newline at end of file diff --git a/htdocs/langs/es_ES/boxes.lang b/htdocs/langs/es_ES/boxes.lang index 09b039a171c..ed931515e65 100644 --- a/htdocs/langs/es_ES/boxes.lang +++ b/htdocs/langs/es_ES/boxes.lang @@ -18,7 +18,7 @@ BoxLastContracts=Últimos contratos BoxLastContacts=Últimos contactos/direcciones BoxLastMembers=Últimos miembros modificados BoxCurrentAccounts=Saldos cuentas corrientes -BoxSalesTurnover=Volumen de negocio +BoxSalesTurnover=Volumen de ventas BoxTotalUnpaidCustomerBills=Total facturas a clientes pendientes de pago BoxTotalUnpaidSuppliersBills=Total facturas de proveedores pendientes de pago BoxTitleLastBooks=Los %s últimos marcadores registrados @@ -40,7 +40,7 @@ BoxTitleLastProductsInContract=Los %s últimos productos/servicios contratados BoxTitleOldestUnpaidCustomerBills=Las %s facturas más antiguas a clientes pendientes de cobro BoxTitleOldestUnpaidSupplierBills=Las %s facturas más antiguas de proveedores pendientes de pago BoxTitleCurrentAccounts=Saldos de las cuentas corrientes -BoxTitleSalesTurnover=Volumen de negocio realizado +BoxTitleSalesTurnover=Volumen de ventas realizado BoxTitleTotalUnpaidCustomerBills=Pendiente de clientes BoxTitleTotalUnpaidSuppliersBills=Pendiente a proveedores BoxTitleLastModifiedContacts=Los %s últimos contactos/direcciones modificadas diff --git a/htdocs/langs/es_ES/commercial.lang b/htdocs/langs/es_ES/commercial.lang index 0f8989dd165..8dbc91f6edb 100644 --- a/htdocs/langs/es_ES/commercial.lang +++ b/htdocs/langs/es_ES/commercial.lang @@ -81,7 +81,7 @@ ActionAC_SUP_ORD=Envío pedido a proveedor por correo ActionAC_SUP_INV=Envío factura de proveedor por correo ActionAC_OTH=Otra Stats=Estadísticas de venta -CAOrder=Volumen de negocios (Pedidos validados) +CAOrder=Volumen de ventas (Pedidos validados) FromTo=de %s a %s MargeOrder=Márgenes (Pedidos validados) RecapAnnee=Recapitulación del año diff --git a/htdocs/langs/es_ES/compta.lang b/htdocs/langs/es_ES/compta.lang index 8422b7ff435..5715db90057 100644 --- a/htdocs/langs/es_ES/compta.lang +++ b/htdocs/langs/es_ES/compta.lang @@ -20,7 +20,7 @@ BillsForSuppliers=Facturas de proveedores Income=Ingresos Outcome=Gastos ReportInOut=Resultado / Ejercicio -ReportTurnover=Volumen de negocio +ReportTurnover=Volumen de ventas PaymentsNotLinkedToInvoice=Pagos vinculados a ninguna factura, por lo que ninguún tercero PaymentsNotLinkedToUser=Pagos no vinculados a un usuario Profit=Beneficio @@ -73,12 +73,12 @@ AlreadyPaid=Ya pagado AccountNumberShort=Nº de cuenta AccountNumber=Número de cuenta NewAccount=Nueva cuenta -SalesTurnover=Volumen de negocio +SalesTurnover=Volumen de ventas ByThirdParties=Por tercero ByUserAuthorOfInvoice=Por autor de la factura AccountancyExport=Exportación contabilidad ErrorWrongAccountancyCodeForCompany=Código contable incorrecto para %s -SuppliersProductsSellSalesTurnover=Volumen de negocio generado por la venta de los productos de los proveedores +SuppliersProductsSellSalesTurnover=Volumen de ventas generado por la venta de los productos de los proveedores CheckReceipt=Lista de remesas CheckReceiptShort=Remesas NewCheckReceipt=Nueva remesa diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index decaa2865e0..81efeb2f7de 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -298,7 +298,7 @@ VAT=IVA VATRate=Tasa IVA Average=Media Sum=Suma -Delta=Divergencia +Delta=Diferencia Module=Módulo Option=Opción List=Listado diff --git a/htdocs/langs/es_ES/members.lang b/htdocs/langs/es_ES/members.lang index 8a3390f4c93..c18985aee58 100644 --- a/htdocs/langs/es_ES/members.lang +++ b/htdocs/langs/es_ES/members.lang @@ -183,4 +183,4 @@ NewMemberForm=Formulario de inscripción SubscriptionsStatistics=Estadísticas de cotizaciones NbOfSubscriptions=Número de cotizaciones AmountOfSubscriptions=Importe de cotizaciones -TurnoverOrBudget=Volumen de negocio (empresa) o Presupuesto (asociación o colectivo) \ No newline at end of file +TurnoverOrBudget=Volumen de ventas (empresa) o Presupuesto (asociación o colectivo) \ No newline at end of file From 47668e96b8b17534d63c7a8eca06f7d5ff00abb5 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Mon, 4 Jul 2011 15:22:37 +0000 Subject: [PATCH 23/33] Trad: Can edit options of autosubscribe form for member module --- htdocs/langs/ca_ES/admin.lang | 2 +- htdocs/langs/es_ES/admin.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/ca_ES/admin.lang b/htdocs/langs/ca_ES/admin.lang index 46500d05b06..69698125f47 100644 --- a/htdocs/langs/ca_ES/admin.lang +++ b/htdocs/langs/ca_ES/admin.lang @@ -307,7 +307,7 @@ ConnectionTimeout=Timeout de connexió ResponseTimeout=Timeout de resposta SmsTestMessage=Missatge de prova de __PHONEFROM__ per __PHONETO__ ModuleMustBeEnabledFirst=Per utilitzar aquesta funció ha d'estar activat el mòdul %s. -SecurityToken=Token de seguretat +SecurityToken=Clau per encriptar urls # Modules Module0Name=Usuaris y grups Module0Desc=Gestió d'usuaris i grups diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 1639946f4a5..21869c2e3d2 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -307,7 +307,7 @@ ConnectionTimeout=Timeout de conexión ResponseTimeout=Timeout de respuesta SmsTestMessage=Mensaje de prueba de __PHONEFROM__ para __PHONETO__ ModuleMustBeEnabledFirst=Para usar esta función debe estar activado el módulo %s. -SecurityToken=Token de seguridad +SecurityToken=Clave para encriptar urls # Modules Module0Name=Usuarios y grupos Module0Desc=Gestión de usuarios y grupos From 0adf6d37af70658f292e5090631d14e20da96ab9 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Mon, 4 Jul 2011 15:41:36 +0000 Subject: [PATCH 24/33] Trad: Can edit options of autosubscribe form for member module --- htdocs/langs/ca_ES/members.lang | 11 ++++++++--- htdocs/langs/es_ES/members.lang | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/ca_ES/members.lang b/htdocs/langs/ca_ES/members.lang index 6b0cfd27b97..50ceb4eb16c 100644 --- a/htdocs/langs/ca_ES/members.lang +++ b/htdocs/langs/ca_ES/members.lang @@ -109,7 +109,9 @@ ValidateMember=Validar un membre ConfirmValidateMember=Esteu segur de voler validar a aquest membre? FollowingLinksArePublic=Els enllaços següents són pàgines accessibles a tothom i no protegides per cap habilitació Dolibarr. PublicMemberList=Llistat públic de membres -BlankSubscriptionForm=Formulari d'inscripció +BlankSubscriptionForm=Formulari públic d'auto-inscripció +BlankSubscriptionFormDesc=Dolibarr pot proporcionar una URL de pàgina pública perquè els visitants externs demanin afiliar-se. Si es troba actiu un mòdul de pagament en línia, es proposarà automàticament un formulari de pagament. +EnablePublicSubscriptionForm=Activar el formulari públic d'auto-inscripció MemberPublicLinks=Links/pàgines públiques ExportDataset_member_1=Membres i afiliacions ImportDataset_member_1=Membres @@ -165,8 +167,8 @@ SubscriptionPayment=Pagament quota LastSubscriptionDate=Data de l'última cotització LastSubscriptionAmount=Import de l'última cotització MembersStatisticsByCountries=Estadístiques de membres per país -MembersStatisticsByState=Estadístiques de membres per departament/província/regió MembersStatisticsByState=Estadístiques de membres per població +MembersStatisticsByTown=Estadístiques de membres per població NbOfMembers=Nombre de membres NoValidatedMemberYet=Cap membre validat trobat MembersByCountryDesc=Aquesta pantalla presenta una estadística del nombre de membres per país. No obstant això, el gràfic utilitza el servei en línia de gràfics de Google i només és operatiu quan es troba disponible una connexió a Internet. @@ -183,4 +185,7 @@ NewMemberForm=Formulari d'inscripció SubscriptionsStatistics=Estadístiques de cotitzacions NbOfSubscriptions=Nombre de cotitzacions AmountOfSubscriptions=Import de cotitzacions -TurnoverOrBudget=Volum de vendes (empresa) o Pressupost (associació o col.lectiu) \ No newline at end of file +TurnoverOrBudget=Volum de vendes (empresa) o Pressupost (associació o col.lectiu) +DefaultAmount=Import per defecte cotització +CanEditAmount=El visitant pot triar/modificar l'import de la seva cotització +MEMBER_NEWFORM_PAYONLINE=Anar a la pàgina integrada de pagament en línia diff --git a/htdocs/langs/es_ES/members.lang b/htdocs/langs/es_ES/members.lang index c18985aee58..8310545495a 100644 --- a/htdocs/langs/es_ES/members.lang +++ b/htdocs/langs/es_ES/members.lang @@ -109,7 +109,9 @@ ValidateMember=Validar un miembro ConfirmValidateMember=¿Está seguro de querer validar a este miembro? FollowingLinksArePublic=Los vínculos siguientes son páginas accesibles a todos y no protegidas por ninguna habilitación Dolibarr. PublicMemberList=Listado público de miembros -BlankSubscriptionForm=Formulario de inscripción +BlankSubscriptionForm=Formulario público de auto-inscripción +BlankSubscriptionFormDesc=Dolibarr puede proporcionar una URL de página pública para que los visitantes externos soliciten afiliarse. Si se encuentra activo un módulo de pago en línea, se propondrá automáticamente un formulario de pago. +EnablePublicSubscriptionForm=Activar el formulario público de auto-inscripción MemberPublicLinks=Enlaces/páginas públicas ExportDataset_member_1=Miembros y afiliaciones ImportDataset_member_1=Miembros @@ -176,11 +178,14 @@ MembersStatisticsDesc=Elija las estadísticas que desea consultar... MenuMembersStats=Estadísticas LastMemberDate=Fecha último miembro Nature=Naturaleza -Public=Público +Public=Informació pública (no=privada) Exports=Exportaciones NewMemberbyWeb=Nuevo miembro añadido. En espera de validación NewMemberForm=Formulario de inscripción SubscriptionsStatistics=Estadísticas de cotizaciones NbOfSubscriptions=Número de cotizaciones AmountOfSubscriptions=Importe de cotizaciones -TurnoverOrBudget=Volumen de ventas (empresa) o Presupuesto (asociación o colectivo) \ No newline at end of file +TurnoverOrBudget=Volumen de ventas (empresa) o Presupuesto (asociación o colectivo) +DefaultAmount=Importe por defecto cotización +CanEditAmount=El visitante puede elegir/modificar el importe de su cotización +MEMBER_NEWFORM_PAYONLINE=Ir a la página integrada de pago en línea \ No newline at end of file From 425fe7d40eba66c934e19185623d412910b54fac Mon Sep 17 00:00:00 2001 From: cdelambert Date: Mon, 4 Jul 2011 16:39:48 +0000 Subject: [PATCH 25/33] *** empty log message *** --- htdocs/compta/paiement.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index ec6ad090caa..997745b1754 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -24,7 +24,7 @@ * \file htdocs/compta/paiement.php * \ingroup compta * \brief Page to create a payment - * \version $Id: paiement.php,v 1.108 2011/07/01 16:18:10 hregis Exp $ + * \version $Id: paiement.php,v 1.109 2011/07/04 16:39:48 cdelambert Exp $ */ require('../main.inc.php'); @@ -521,19 +521,15 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { if (! empty($conf->global->MAIN_JS_ON_PAYMENT)) { - print img_picto($langs->trans('AddRemind'),'rightarrow.png','id="calcRemind'.$i.'" onclick="calcRemind(\''.$i.'\');return false;"'); - print ''; + print img_picto($langs->trans('AddRemind'),'rightarrow.png','id="'.$objp->facid.'" "'); } - print ''; + print ''; + print ''; } else { print ''; - print ''; + print ''; } print ""; @@ -682,5 +678,5 @@ if (! GETPOST('action')) $db->close(); -llxFooter('$Date: 2011/07/01 16:18:10 $ - $Revision: 1.108 $'); +llxFooter('$Date: 2011/07/04 16:39:48 $ - $Revision: 1.109 $'); ?> From cc7707dc26cb717ce846db2ca19fc31d8335072a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jul 2011 08:08:16 +0000 Subject: [PATCH 26/33] Add translation of members types --- htdocs/adherents/class/adherent_type.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 05fbe6768ab..2549feb221b 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -23,7 +23,7 @@ * \ingroup member * \brief File of class to manage members types * \author Rodolphe Quiedeville - * \version $Id$ + * \version $Id: adherent_type.class.php,v 1.11 2011/07/05 08:08:16 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); @@ -195,12 +195,12 @@ class AdherentType extends CommonObject } /** - * \brief Return list of members' type - * \return array List of types + * Return list of members' type + * @return array List of types of members */ function liste_array() { - global $conf; + global $conf,$langs; $projets = array(); @@ -220,7 +220,7 @@ class AdherentType extends CommonObject { $obj = $this->db->fetch_object($resql); - $projets[$obj->rowid] = $obj->libelle; + $projets[$obj->rowid] = $langs->trans($obj->libelle); $i++; } } From 2ce9ccb70168b0da844614a6599f5cc026cec019 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jul 2011 08:13:31 +0000 Subject: [PATCH 27/33] Translate submit form --- htdocs/langs/en_US/members.lang | 6 +++++- htdocs/langs/fr_FR/members.lang | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index ee492c181b6..95e4eb7cddc 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -188,4 +188,8 @@ AmountOfSubscriptions=Amount of subscriptions TurnoverOrBudget=Turnover (for a company) or Budget (for a foundation) DefaultAmount=Default amount of subscription CanEditAmount=Visitor can choose/edit amount of its subscription -MEMBER_NEWFORM_PAYONLINE=Jump on integrated online payment page \ No newline at end of file +MEMBER_NEWFORM_PAYONLINE=Jump on integrated online payment page +Associations=Foundations +Collectivités=Organizations +Particuliers=Personal +Entreprises=Companies diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang index d4a3030cd43..4773e0d4b77 100644 --- a/htdocs/langs/fr_FR/members.lang +++ b/htdocs/langs/fr_FR/members.lang @@ -189,4 +189,8 @@ AmountOfSubscriptions=Montant de cotisations TurnoverOrBudget=Chiffre affaire (pour société) ou Budget (asso ou collectivité) DefaultAmount=Montant par défaut de la cotisation CanEditAmount=Le visiteur peut modifier/choisir le montant de sa cotisation -MEMBER_NEWFORM_PAYONLINE=Débrancher sur la page intégrée de paiement en ligne \ No newline at end of file +MEMBER_NEWFORM_PAYONLINE=Débrancher sur la page intégrée de paiement en ligne +Associations=Associations +Collectivités=Collectivités +Particuliers=Particuliers +Entreprises=Entreprises From c39ebce11d62a3a573e9ae5bd2a85d8cb5aa9a9d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jul 2011 08:29:53 +0000 Subject: [PATCH 28/33] Translate submit form --- htdocs/public/members/new.php | 13 +++++++----- htdocs/public/paybox/newpayment.php | 32 ++++++++++++++--------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index a7ca9ed3cb0..bab3273eb46 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -22,7 +22,7 @@ * \file htdocs/public/members/new.php * \ingroup member * \brief Example of form to add a new member - * \version $Id: new.php,v 1.37 2011/07/03 18:30:48 eldy Exp $ + * \version $Id: new.php,v 1.38 2011/07/05 08:29:53 eldy Exp $ * * Note that you can add following constant to change behaviour of page * MEMBER_NEWFORM_AMOUNT Default amount for autosubscribe form @@ -64,7 +64,7 @@ if (empty($conf->adherent->enabled)) accessforbidden('',1,1,1); if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) { - print $langs->trans("Auto subscription form for public visitors has no be enabled"); + print $langs->trans("Auto subscription form for public visitors has no been enabled"); exit; } @@ -236,11 +236,13 @@ if ($action == 'add') { $urlback=DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?source=membersubscription&ref='.$adh->ref; if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount')); + if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email')); } else if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') { $urlback=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=membersubscription&ref='.$adh->ref; if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount')); + if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email')); } else { @@ -273,7 +275,7 @@ if ($action == 'added') print $langs->trans("NewMemberbyWeb"); print ''; - llxFooterVierge('$Date: 2011/07/03 18:30:48 $ - $Revision: 1.37 $'); + llxFooterVierge('$Date: 2011/07/05 08:29:53 $ - $Revision: 1.38 $'); exit; } @@ -356,7 +358,7 @@ $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { - print ''.$langs->trans("MorPhy").' *'."\n"; + print ''.$langs->trans("MorPhy").' *'."\n"; print $html->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print ''."\n"; } @@ -450,6 +452,7 @@ if (! empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) print ' From fb112e0dd2b8c7148efbfdf0f2749c6730a4889a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 5 Jul 2011 09:30:10 +0000 Subject: [PATCH 31/33] Fix: translation --- htdocs/core/tpl/ajaxfileupload.tpl.php | 10 +++++----- htdocs/langs/en_US/other.lang | 4 ++++ htdocs/langs/fr_FR/other.lang | 4 ++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/htdocs/core/tpl/ajaxfileupload.tpl.php b/htdocs/core/tpl/ajaxfileupload.tpl.php index fcbd5318b99..f1d6026c981 100644 --- a/htdocs/core/tpl/ajaxfileupload.tpl.php +++ b/htdocs/core/tpl/ajaxfileupload.tpl.php @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: ajaxfileupload.tpl.php,v 1.5 2011/07/05 09:14:26 hregis Exp $ + * $Id: ajaxfileupload.tpl.php,v 1.6 2011/07/05 09:30:11 hregis Exp $ */ ?> @@ -26,8 +26,8 @@ ${sizef} {{if error}} - Error: - {{if error === 'maxFileSize'}}File is too big + trans('Error'); ?>: + {{if error === 'maxFileSize'}}trans('FileIsTooBig'); ?> {{else error === 'minFileSize'}}File is too small {{else error === 'acceptFileTypes'}}Filetype not allowed {{else error === 'maxNumberOfFiles'}}Max number of files exceeded @@ -48,7 +48,7 @@ ${name} ${sizef} - Error: + trans('Error'); ?>: {{if error === 1}}File exceeds upload_max_filesize (php.ini directive) {{else error === 2}}File exceeds MAX_FILE_SIZE (HTML form directive) {{else error === 3}}File was only partially uploaded @@ -56,7 +56,7 @@ {{else error === 5}}Missing a temporary folder {{else error === 6}}Failed to write file to disk {{else error === 7}}File upload stopped by extension - {{else error === 'maxFileSize'}}File is too big + {{else error === 'maxFileSize'}}trans('FileIsTooBig'); ?> {{else error === 'minFileSize'}}File is too small {{else error === 'acceptFileTypes'}}Filetype not allowed {{else error === 'maxNumberOfFiles'}}Max number of files exceeded diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 7214235b04e..25282ecea09 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -158,6 +158,10 @@ ClickHere=Click here UseAdvancedPerms=Use the advanced rights permissions in modules FileFormat=File format SelectAColor=Choose a color +AddFiles=Add Files +StartUpload=Start upload +CancelUpload=Cancel upload +FileIsTooBig=Files is too big ##### Bookmark ##### Bookmark=Bookmark diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index e762a5839c6..ace47ce6bdf 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -158,6 +158,10 @@ ClickHere=Cliquez ici UseAdvancedPerms=Utiliser les droits avancés dans les permissions des modules FileFormat=Format de fichier SelectAColor=Choisissez une couleur +AddFiles=Ajouter des fichiers +StartUpload=Transférer +CancelUpload=Annuler le transfert +FileIsTooBig=Le fichier est trop volumineux ##### Bookmark ##### Bookmark=Marque-page From 8b69d7e620147ab0a855941f39c7d576d7060311 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 5 Jul 2011 16:10:56 +0000 Subject: [PATCH 32/33] Fix: uniformize code Fix: add confirm delete file New: add upload and delete file triggers --- htdocs/adherents/document.php | 6 +- htdocs/comm/propal/document.php | 75 +++---- htdocs/commande/document.php | 189 ++++++++++-------- htdocs/compta/facture/document.php | 76 +++---- .../interface_all_Demo.class.php-NORUN | 12 +- htdocs/lib/files.lib.php | 43 +++- htdocs/societe/document.php | 83 ++++---- 7 files changed, 280 insertions(+), 204 deletions(-) diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index db31d26ed75..80f097a64c8 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -23,7 +23,7 @@ * \file htdocs/adherents/document.php * \brief Tab for documents linked to third party * \ingroup societe - * \version $Id$ + * \version $Id: document.php,v 1.7 2011/07/05 16:10:56 hregis Exp $ */ require("../main.inc.php"); @@ -194,7 +194,7 @@ if ($id > 0) print '
'; - if ($mesg) { print "$mesg
"; } + dol_htmloutput_mesg($mesg,$mesgs); /* * Confirmation suppression fichier @@ -231,6 +231,6 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/05 16:10:56 $ - $Revision: 1.7 $'); ?> diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index c6de7a48bd2..11c80c81bfd 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -23,7 +23,7 @@ * \file htdocs/comm/propal/document.php * \ingroup propale * \brief Page de gestion des documents attaches a une proposition commerciale - * \version $Id$ + * \version $Id: document.php,v 1.65 2011/07/05 16:10:56 hregis Exp $ */ require("../../main.inc.php"); @@ -35,14 +35,14 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); $langs->load('compta'); $langs->load('other'); -$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action']; - -$id = isset($_GET["id"])?$_GET["id"]:''; +$action = GETPOST('action'); +$confirm = GETPOST('confirm'); +$id = GETPOST('id'); +$ref = GETPOST('ref'); // Security check if ($user->societe_id) { - unset($_GET["action"]); $action=''; $socid = $user->societe_id; } @@ -59,6 +59,7 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; +$object = new Propal($db); /* * Actions @@ -67,13 +68,11 @@ if (! $sortfield) $sortfield="name"; // Envoi fichier if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); - - $propal = new Propal($db); - - if ($propal->fetch($id)) + if ($object->fetch($id)) { - $upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref); + $object->fetch_thirdparty(); + + $upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($object->ref); if (create_exdir($upload_dir) >= 0) { @@ -103,14 +102,13 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) } // Delete -if ($action=='delete') +if ($action == 'confirm_deletefile' && $confirm == 'yes') { - $propal = new Propal($db); - - $id=$_GET["id"]; - if ($propal->fetch($id)) + if ($object->fetch($id)) { - $upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref); + $object->fetch_thirdparty(); + + $upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($object->ref); $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). dol_delete_file($file); $mesg = '
'.$langs->trans("FileWasRemoved").'
'; @@ -126,19 +124,15 @@ llxHeader(); $html = new Form($db); -$id = $_GET["id"]; -$ref= $_GET["ref"]; if ($id > 0 || ! empty($ref)) { - $propal = new Propal($db); - if ($propal->fetch($id,$ref)) + if ($object->fetch($id,$ref)) { - $upload_dir = $conf->propale->dir_output.'/'.dol_sanitizeFileName($propal->ref); + $object->fetch_thirdparty(); + + $upload_dir = $conf->propale->dir_output.'/'.dol_sanitizeFileName($object->ref); - $societe = new Societe($db); - $societe->fetch($propal->socid); - - $head = propal_prepare_head($propal); + $head = propal_prepare_head($object); dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal'); @@ -153,11 +147,11 @@ if ($id > 0 || ! empty($ref)) print ''; - $linkback="".$langs->trans("BackToList").""; + $linkback=''.$langs->trans("BackToList").''; // Ref print ''; // Ref client @@ -167,15 +161,13 @@ if ($id > 0 || ! empty($ref)) print ''; print '
'.$langs->trans('Ref').''; - print $html->showrefnav($propal,'ref',$linkback,1,'ref','ref',''); + print $html->showrefnav($object,'ref',$linkback,1,'ref','ref',''); print '
'; print ''; - print $propal->ref_client; + print $object->ref_client; print ''; print ''; // Customer - if ( is_null($propal->client) ) - $propal->fetch_thirdparty(); print "".$langs->trans("Company").""; - print ''.$propal->client->getNomUrl(1).''; + print ''.$object->thirdparty->getNomUrl(1).''; print ''.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).''; print ''.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").''; @@ -184,16 +176,25 @@ if ($id > 0 || ! empty($ref)) print '
'; - if ($mesg) { print "$mesg
"; } + dol_htmloutput_mesg($mesg,$mesgs); + + /* + * Confirmation suppression fichier + */ + if ($action == 'delete') + { + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + if ($ret == 'html') print '
'; + } // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$propal->id,'',0,0,$user->rights->propale->creer); + $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer); // List of document - $param='&id='.$propal->id; - $formfile->list_of_documents($filearray,$propal,'propal',$param); + $param='&id='.$object->id; + $formfile->list_of_documents($filearray,$object,'propal',$param); } else @@ -208,5 +209,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/05 16:10:56 $ - $Revision: 1.65 $'); ?> diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index fbcbeab04cf..43c0b3094b3 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2011 Regis Houssin * * 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 @@ -23,7 +23,7 @@ * \file htdocs/commande/document.php * \ingroup order * \brief Page de gestion des documents attachees a une commande - * \version $Id$ + * \version $Id: document.php,v 1.33 2011/07/05 16:10:56 hregis Exp $ */ require("../main.inc.php"); @@ -32,20 +32,22 @@ require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT ."/commande/class/commande.class.php"); -if (!$user->rights->commande->lire) accessforbidden(); $langs->load('companies'); -//$langs->load("bills"); $langs->load('other'); -$id=empty($_GET['id']) ? 0 : intVal($_GET['id']); -$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action']; +$action = GETPOST('action'); +$confirm = GETPOST('confirm'); +$id = GETPOST('id'); +$ref = GETPOST('ref'); // Security check -$socid=0; -$comid = isset($_GET["id"])?$_GET["id"]:''; -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'commande',$comid,''); +if ($user->societe_id) +{ + $action=''; + $socid = $user->societe_id; +} +$result=restrictedArea($user,'commande',$id,''); // Get parameters $sortfield = GETPOST("sortfield",'alpha'); @@ -59,13 +61,7 @@ if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; -$id = GETPOST('id','int'); -$ref= $_GET['ref']; -$commande = new Commande($db); -if (! $commande->fetch($_GET['id'],$_GET['ref']) > 0) -{ - dol_print_error($db); -} +$object = new Commande($db); /* @@ -75,43 +71,51 @@ if (! $commande->fetch($_GET['id'],$_GET['ref']) > 0) // Envoi fichier if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); - - $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($commande->ref); - - if (create_exdir($upload_dir) >= 0) - { - $resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']); - if (is_numeric($resupload) && $resupload > 0) + if ($object->fetch($id)) + { + $object->fetch_thirdparty(); + + $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); + + if (create_exdir($upload_dir) >= 0) { - $mesg = '
'.$langs->trans("FileTransferComplete").'
'; - } - else - { - $langs->load("errors"); - if ($resupload < 0) // Unknown error + $resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']); + if (is_numeric($resupload) && $resupload > 0) { - $mesg = '
'.$langs->trans("ErrorFileNotUploaded").'
'; + $mesg = '
'.$langs->trans("FileTransferComplete").'
'; } - else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus + else { - $mesg = '
'.$langs->trans("ErrorFileIsInfectedWithAVirus").'
'; - } - else // Known error - { - $mesg = '
'.$langs->trans($resupload).'
'; + $langs->load("errors"); + if ($resupload < 0) // Unknown error + { + $mesg = '
'.$langs->trans("ErrorFileNotUploaded").'
'; + } + else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus + { + $mesg = '
'.$langs->trans("ErrorFileIsInfectedWithAVirus").'
'; + } + else // Known error + { + $mesg = '
'.$langs->trans($resupload).'
'; + } } } - } + } } // Delete -if ($action=='delete') +if ($action == 'confirm_deletefile' && $confirm == 'yes') { - $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($commande->ref); - $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file); - $mesg = '
'.$langs->trans("FileWasRemoved").'
'; + if ($object->fetch($id)) + { + $object->fetch_thirdparty(); + + $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); + $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + dol_delete_file($file); + $mesg = '
'.$langs->trans("FileWasRemoved").'
'; + } } @@ -125,49 +129,62 @@ $html = new Form($db); if ($id > 0 || ! empty($ref)) { - $upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($commande->ref); + if ($object->fetch($id, $ref)) + { + $object->fetch_thirdparty(); + + $upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($object->ref); - $societe = new Societe($db); - $societe->fetch($commande->socid); - - $head = commande_prepare_head($commande); - dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), 0, 'order'); - - - // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); - $totalsize=0; - foreach($filearray as $key => $file) - { - $totalsize+=$file['size']; + $head = commande_prepare_head($object); + dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), 0, 'order'); + + + // Construit liste des fichiers + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); + $totalsize=0; + foreach($filearray as $key => $file) + { + $totalsize+=$file['size']; + } + + + print ''; + + // Ref + print ''; + + print ''; + print ''; + print ''; + print "
'.$langs->trans('Ref').''; + print $html->showrefnav($object,'ref','',1,'ref','ref'); + print '
'.$langs->trans('Company').''.$object->thirdparty->getNomUrl(1).'
'.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
\n"; + print "\n"; + + dol_htmloutput_mesg($mesg,$mesgs); + + /* + * Confirmation suppression fichier + */ + if ($action == 'delete') + { + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + if ($ret == 'html') print '
'; + } + + // Affiche formulaire upload + $formfile=new FormFile($db); + $formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$object->id,'',0,0,$user->rights->commande->creer); + + + // List of document + $param='&id='.$object->id; + $formfile->list_of_documents($filearray,$object,'commande',$param); + } + else + { + dol_print_error($db); } - - - print ''; - - // Ref - print ''; - - print ''; - print ''; - print ''; - print "
'.$langs->trans('Ref').''; - print $html->showrefnav($commande,'ref','',1,'ref','ref'); - print '
'.$langs->trans('Company').''.$societe->getNomUrl(1).'
'.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
\n"; - print "\n"; - - if ($mesg) { print $mesg."
"; } - - - // Affiche formulaire upload - $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$commande->id,'',0,0,$user->rights->commande->creer); - - - // List of document - $param='&id='.$commande->id; - $formfile->list_of_documents($filearray,$commande,'commande',$param); - } else { @@ -176,5 +193,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/05 16:10:56 $ - $Revision: 1.33 $'); ?> diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 89a2e9e4227..f96fb1d4c59 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005 Regis Houssin + * Copyright (C) 2005-2011 Regis Houssin * * 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 @@ -23,7 +23,7 @@ * \file htdocs/compta/facture/document.php * \ingroup facture * \brief Page for attached files on invoices - * \version $Id$ + * \version $Id: document.php,v 1.43 2011/07/05 16:10:56 hregis Exp $ */ require("../../main.inc.php"); @@ -38,19 +38,19 @@ $langs->load('compta'); $langs->load('other'); $langs->load("bills"); -if (!$user->rights->facture->lire) -accessforbidden(); -$facid=empty($_GET['facid']) ? 0 : intVal($_GET['facid']); -$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action']; +$action = GETPOST('action'); +$confirm = GETPOST('confirm'); +$id = GETPOST('facid'); +$ref = GETPOST('ref'); // Security check -if ($user->societe_id > 0) +if ($user->societe_id) { - unset($_GET["action"]); $action=''; $socid = $user->societe_id; } +$result=restrictedArea($user,'facture',$id,''); // Get parameters $sortfield = GETPOST("sortfield",'alpha'); @@ -63,6 +63,8 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; +$object = new Facture($db); + /* * Actions @@ -71,12 +73,11 @@ if (! $sortfield) $sortfield="name"; // Envoi fichier if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); - - $facture = new Facture($db); - if ($facture->fetch($facid)) + if ($object->fetch($id)) { - $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($facture->ref); + $object->fetch_thirdparty(); + + $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); if (create_exdir($upload_dir) >= 0) { @@ -106,15 +107,13 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) } // Delete -if ($action=='delete') +if ($action == 'confirm_deletefile' && $confirm == 'yes') { - require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); - $facture = new Facture($db); - - $facid=$_GET["id"]; - if ($facture->fetch($facid)) + if ($object->fetch($id)) { - $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($facture->ref); + $object->fetch_thirdparty(); + + $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). dol_delete_file($file); $mesg = '
'.$langs->trans("FileWasRemoved").'
'; @@ -133,15 +132,13 @@ $id = $_GET['facid']?$_GET['facid']:$_GET['id']; $ref= $_GET['ref']; if ($id > 0 || ! empty($ref)) { - $facture = new Facture($db); - if ($facture->fetch($id,$ref) > 0) + if ($object->fetch($id,$ref) > 0) { - $upload_dir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($facture->ref); + $object->fetch_thirdparty(); + + $upload_dir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($object->ref); - $societe = new Societe($db); - $societe->fetch($facture->socid); - - $head = facture_prepare_head($facture); + $head = facture_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), 0, 'bill'); @@ -162,7 +159,7 @@ if ($id > 0 || ! empty($ref)) print ''; $morehtmlref=''; $discount=new DiscountAbsolute($db); - $result=$discount->fetch(0,$facture->id); + $result=$discount->fetch(0,$object->id); if ($result > 0) { $morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')'; @@ -171,28 +168,37 @@ if ($id > 0 || ! empty($ref)) { dol_print_error('',$discount->error); } - print $html->showrefnav($facture,'ref','',1,'facnumber','ref',$morehtmlref); + print $html->showrefnav($object,'ref','',1,'facnumber','ref',$morehtmlref); print ''; // Company - print ''.$langs->trans('Company').''.$societe->getNomUrl(1).''; + print ''.$langs->trans('Company').''.$object->thirdparty->getNomUrl(1).''; print ''.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).''; print ''.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").''; print "\n"; print "\n"; - if ($mesg) { print $mesg."
"; } + dol_htmloutput_mesg($mesg,$mesgs); + + /* + * Confirmation suppression fichier + */ + if ($action == 'delete') + { + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$id.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + if ($ret == 'html') print '
'; + } // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/facture/document.php?facid='.$facture->id,'',0,0,$user->rights->facture->creer); + $formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id,'',0,0,$user->rights->facture->creer); // List of document - $param='&facid='.$facture->id; - $formfile->list_of_documents($filearray,$facture,'facture',$param); + $param='&facid='.$object->id; + $formfile->list_of_documents($filearray,$object,'facture',$param); } else @@ -207,5 +213,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/05 16:10:56 $ - $Revision: 1.43 $'); ?> diff --git a/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN b/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN index d4deae9b132..eb30cc0726b 100644 --- a/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN +++ b/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN @@ -28,7 +28,7 @@ * - Le nom de la classe doit etre InterfaceMytrigger * - Le nom de la methode constructeur doit etre InterfaceMytrigger * - Le nom de la propriete name doit etre Mytrigger - * \version $Id: interface_all_Demo.class.php-NORUN,v 1.26 2011/07/04 10:35:49 hregis Exp $ + * \version $Id: interface_all_Demo.class.php-NORUN,v 1.27 2011/07/05 16:10:56 hregis Exp $ */ @@ -502,6 +502,16 @@ class InterfaceDemo dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } elseif ($action == 'SHIPPINGL_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // File + elseif ($action == 'FILE_UPLOAD') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'FILE_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } diff --git a/htdocs/lib/files.lib.php b/htdocs/lib/files.lib.php index 3eb6a794d45..35ce31d0bc8 100644 --- a/htdocs/lib/files.lib.php +++ b/htdocs/lib/files.lib.php @@ -20,7 +20,7 @@ /** * \file htdocs/lib/files.lib.php * \brief Library for file managing functions - * \version $Id$ + * \version $Id: files.lib.php,v 1.64 2011/07/05 16:10:57 hregis Exp $ */ /** @@ -454,11 +454,13 @@ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1) * @param allowoverwrite 1=Overwrite target file if it already exists * @param disablevirusscan 1=Disable virus scan * @param uploaderrorcode Value of upload error code ($_FILES['field']['error']) + * @param notrigger Disable all triggers * @return int >0 if OK, <0 or string if KO */ -function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0) +function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $notrigger=0) { - global $conf; + global $conf, $user, $langs; + global $object; $file_name = $dest_file; // If an upload error has been reported @@ -552,6 +554,19 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable { if (! empty($conf->global->MAIN_UMASK)) @chmod($file_name_osencoded, octdec($conf->global->MAIN_UMASK)); dol_syslog("Functions.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG); + + if (! $notrigger) + { + $object->src_file=$dest_file; + + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($db); + $result=$interface->run_triggers('FILE_UPLOAD',$object,$user,$langs,$conf); + if ($result < 0) { $error++; $errors=$interface->errors; } + // Fin appel triggers + } + return 1; // Success } else @@ -568,10 +583,14 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable * @param file File to delete or mask of file to delete * @param disableglob Disable usage of glob like * * @param nophperrors Disable all PHP output errors + * @param notrigger Disable all triggers * @return boolean True if file is deleted, False if error */ -function dol_delete_file($file,$disableglob=0,$nophperrors=0) +function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0) { + global $conf, $user, $langs; + global $object; + //print "x".$file." ".$disableglob; $ok=true; $file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset @@ -581,7 +600,21 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0) { if ($nophperrors) $ok=@unlink($filename); // The unlink encapsulated by dolibarr else $ok=unlink($filename); // The unlink encapsulated by dolibarr - if ($ok) dol_syslog("Removed file ".$filename,LOG_DEBUG); + if ($ok) + { + dol_syslog("Removed file ".$filename,LOG_DEBUG); + if (! $notrigger) + { + $object->src_file=$file; + + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($db); + $result=$interface->run_triggers('FILE_DELETE',$object,$user,$langs,$conf); + if ($result < 0) { $error++; $errors=$interface->errors; } + // Fin appel triggers + } + } else dol_syslog("Failed to remove file ".$filename,LOG_WARNING); } } diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index e496d064662..01edf6fc420 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -23,7 +23,7 @@ * \file htdocs/societe/document.php * \brief Tab for documents linked to third party * \ingroup societe - * \version $Id: document.php,v 1.31 2011/07/03 13:16:46 hregis Exp $ + * \version $Id: document.php,v 1.32 2011/07/05 16:10:56 hregis Exp $ */ require("../main.inc.php"); @@ -35,10 +35,13 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); $langs->load("companies"); $langs->load('other'); -$mesg = ""; +$mesg=''; + +$action = GETPOST('action'); +$confirm = GETPOST('confirm'); +$socid = (GETPOST('socid') ? GETPOST('socid') : GETPOST('id')); // Security check -$socid = (GETPOST('socid') ? GETPOST('socid') : GETPOST('id')); if ($user->societe_id > 0) { unset($_GET["action"]); @@ -70,48 +73,54 @@ $object = new Societe($db); // Envoie fichier if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - if (create_exdir($upload_dir) >= 0) + if ($object->fetch($socid)) { - $resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']); - if (is_numeric($resupload) && $resupload > 0) + if (create_exdir($upload_dir) >= 0) { - if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1) - { - // Create small thumbs for company (Ratio is near 16/9) - // Used on logon for example - $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs"); - - // Create mini thumbs for company (Ratio is near 16/9) - // Used on menu or for setup page for example - $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); - } - $mesg = '
'.$langs->trans("FileTransferComplete").'
'; - } - else - { - $langs->load("errors"); - if (is_numeric($resupload) && $resupload < 0) // Unknown error + $resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']); + if (is_numeric($resupload) && $resupload > 0) { - $mesg = '
'.$langs->trans("ErrorFileNotUploaded").'
'; + if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1) + { + // Create small thumbs for company (Ratio is near 16/9) + // Used on logon for example + $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs"); + + // Create mini thumbs for company (Ratio is near 16/9) + // Used on menu or for setup page for example + $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); + } + $mesg = '
'.$langs->trans("FileTransferComplete").'
'; } - else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus + else { - $mesg = '
'.$langs->trans("ErrorFileIsInfectedWithAVirus").'
'; - } - else // Known error - { - $mesg = '
'.$langs->trans($resupload).'
'; + $langs->load("errors"); + if (is_numeric($resupload) && $resupload < 0) // Unknown error + { + $mesg = '
'.$langs->trans("ErrorFileNotUploaded").'
'; + } + else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus + { + $mesg = '
'.$langs->trans("ErrorFileIsInfectedWithAVirus").'
'; + } + else // Known error + { + $mesg = '
'.$langs->trans($resupload).'
'; + } } } } } // Suppression fichier -if ($_REQUEST['action'] == 'confirm_deletefile' && $_REQUEST['confirm'] == 'yes') +if ($action == 'confirm_deletefile' && $confirm == 'yes') { - $file = $upload_dir . "/" . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file); - $mesg = '
'.$langs->trans("FileWasRemoved").'
'; + if ($object->fetch($socid)) + { + $file = $upload_dir . "/" . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + dol_delete_file($file); + $mesg = '
'.$langs->trans("FileWasRemoved").'
'; + } } @@ -195,15 +204,15 @@ if ($socid > 0) /* * Confirmation suppression fichier */ - if ($_GET['action'] == 'delete') + if ($action == 'delete') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$_GET["id"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$socid.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); if ($ret == 'html') print '
'; } $formfile=new FormFile($db); - if ($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) + if (1==2 && $conf->global->MAIN_USE_JQUERY_FILEUPLOAD) { $formfile->form_ajaxfileupload($object); } @@ -280,6 +289,6 @@ else $db->close(); -llxFooter('$Date: 2011/07/03 13:16:46 $ - $Revision: 1.31 $'); +llxFooter('$Date: 2011/07/05 16:10:56 $ - $Revision: 1.32 $'); ?> From e239bd457f0df7c34799a2512efe6ac330565462 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 5 Jul 2011 17:21:19 +0000 Subject: [PATCH 33/33] Fix: uniformize code Fix: add confirm delete file New: add upload and delete file triggers --- htdocs/societe/document.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 01edf6fc420..c5af4de609c 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2010 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -23,7 +23,7 @@ * \file htdocs/societe/document.php * \brief Tab for documents linked to third party * \ingroup societe - * \version $Id: document.php,v 1.32 2011/07/05 16:10:56 hregis Exp $ + * \version $Id: document.php,v 1.33 2011/07/05 17:21:19 hregis Exp $ */ require("../main.inc.php"); @@ -212,7 +212,7 @@ if ($socid > 0) $formfile=new FormFile($db); - if (1==2 && $conf->global->MAIN_USE_JQUERY_FILEUPLOAD) + if ($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) { $formfile->form_ajaxfileupload($object); } @@ -289,6 +289,6 @@ else $db->close(); -llxFooter('$Date: 2011/07/05 16:10:56 $ - $Revision: 1.32 $'); +llxFooter('$Date: 2011/07/05 17:21:19 $ - $Revision: 1.33 $'); ?>