From 5d89d5d734a42badf043d7d3d41f6dfcdf96b421 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 16 Feb 2012 11:52:38 +0100 Subject: [PATCH 1/8] Fix: add warning message for sandbox mode --- htdocs/langs/en_US/paypal.lang | 3 ++- htdocs/langs/fr_FR/paypal.lang | 3 ++- htdocs/paypal/admin/paypal.php | 8 ++++---- htdocs/paypal/lib/paypal.lib.php | 32 ++++++++++++++++++++++++++--- htdocs/public/paypal/newpayment.php | 10 ++++++--- 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang index 61a92f21960..9dad0e3b14e 100644 --- a/htdocs/langs/en_US/paypal.lang +++ b/htdocs/langs/en_US/paypal.lang @@ -15,4 +15,5 @@ ThisIsTransactionId=This is id of transaction: %s PAYPAL_ADD_PAYMENT_URL=Add the url of Paypal payment when you send a document by mail PAYPAL_IPN_MAIL_ADDRESS=E-mail address for the instant notification of payment (IPN) PredefinedMailContentSendOrderWithPaypalLink=You will find here the order __ORDERREF__\n\nYou can click on the secure link below to make your payment via PayPal\n\n%s\n\nSincerely\n\n -PredefinedMailContentSendInvoiceWithPaypalLink=You will find here the invoice __FACREF__\n\nYou can click on the secure link below to make your payment via PayPal\n\n%s\n\nSincerely\n\n \ No newline at end of file +PredefinedMailContentSendInvoiceWithPaypalLink=You will find here the invoice __FACREF__\n\nYou can click on the secure link below to make your payment via PayPal\n\n%s\n\nSincerely\n\n +YouAreCurrentlyInSandboxMode=You are currently in the "sandbox" mode \ No newline at end of file diff --git a/htdocs/langs/fr_FR/paypal.lang b/htdocs/langs/fr_FR/paypal.lang index a55313f69db..3d60d57c104 100644 --- a/htdocs/langs/fr_FR/paypal.lang +++ b/htdocs/langs/fr_FR/paypal.lang @@ -15,4 +15,5 @@ ThisIsTransactionId=Voici l'identifiant de la transaction: %s PAYPAL_ADD_PAYMENT_URL=Ajouter l'url de paiement Paypal lors de l'envoi d'un document par mail PAYPAL_IPN_MAIL_ADDRESS=Adresse e-mail pour les notifications instantanées de paiement (IPN) PredefinedMailContentSendOrderWithPaypalLink=Bonjour\nVeuillez trouver ci-joint la commande __ORDERREF__\n\nVous pouvez cliquer sur le lien sécurisé ci-dessous pour effectuer votre paiement via Paypal\n\n%s\n\nCordialement\n\n -PredefinedMailContentSendInvoiceWithPaypalLink=Bonjour\nVeuillez trouver ci-joint la facture __FACREF__\n\nVous pouvez cliquer sur le lien sécurisé ci-dessous pour effectuer votre paiement via Paypal\n\n%s\n\nCordialement\n\n \ No newline at end of file +PredefinedMailContentSendInvoiceWithPaypalLink=Bonjour\nVeuillez trouver ci-joint la facture __FACREF__\n\nVous pouvez cliquer sur le lien sécurisé ci-dessous pour effectuer votre paiement via Paypal\n\n%s\n\nCordialement\n\n +YouAreCurrentlyInSandboxMode=Vous êtes actuellement dans le mode "sandbox" \ No newline at end of file diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index e54ad7f30c8..cf254f1de30 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -1,8 +1,8 @@ - * Copyright (C) 2005-2011 Laurent Destailleur - * Copyright (C) 2011 Regis Houssin - * Copyright (C) 2011 Juanjo Menent +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2005-2011 Laurent Destailleur + * Copyright (C) 2011-2012 Regis Houssin + * Copyright (C) 2011 Juanjo Menent * * 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 diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index fd68f7f274d..02100b3c3da 100755 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2011 Regis Houssin +/* Copyright (C) 2008-2012 Laurent Destailleur + * Copyright (C) 2011-2012 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 @@ -55,6 +55,28 @@ function llxHeaderPaypal($title, $head = "") print '.CTableRow2 { margin: 1px; padding: 3px; font: 12px verdana,arial; background: #FFFFFF; color: #000000; -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; -moz-border-radius-bottomleft:6px; -moz-border-radius-bottomright:6px;}'; print ''; } + + if ($conf->use_javascript_ajax) + { + print ''."\n"; + print ''."\n"; // JNotify + + // Output standard javascript links + $ext='.js'; + if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) { + $ext='.jgz'; + } // mini='_mini', ext='.gz' + + // JQuery. Must be before other includes + print ''."\n"; + print ''."\n"; + // jQuery jnotify + if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY)) + { + print ''."\n"; + print ''."\n"; + } + } print "\n"; print ''."\n"; } @@ -207,7 +229,11 @@ function getPaypalPaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f if ($type == 'free') { $out=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?amount='.($mode?'':'').$amount.($mode?'':'').'&tag='.($mode?'':'').$freetag.($mode?'':''); - if (! empty($conf->global->PAYPAL_SECURITY_TOKEN)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; + if (! empty($conf->global->PAYPAL_SECURITY_TOKEN)) + { + if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; + else $out.='&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); + } } if ($type == 'order') { diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index 714b89e39b6..a3a82583bcd 100755 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -1,7 +1,7 @@ - * Copyright (C) 2006-2011 Laurent Destailleur - * Copyright (C) 2009-2011 Regis Houssin +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2009-2012 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 @@ -236,6 +236,10 @@ if (GETPOST("action") == 'dopayment') llxHeaderPaypal($langs->trans("PaymentForm")); +if (! empty($PAYPAL_API_SANDBOX)) +{ + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning'); +} // Common variables $creditor=$mysoc->name; From 70bd56bea88b5ca9fa11763882e8f9ba346f9156 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 16 Feb 2012 16:26:55 +0100 Subject: [PATCH 2/8] Fix: remove alias --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d6495ce24fd..b63dbdc9dbb 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1022,7 +1022,7 @@ class Product extends CommonObject if ($id) $sql.= " WHERE rowid = '".$id."'"; else { - $sql.= " WHERE p.entity IN (".getEntity($this->element, 1).")"; + $sql.= " WHERE entity IN (".getEntity($this->element, 1).")"; if ($ref) $sql.= " AND ref = '".$this->db->escape($ref)."'"; else if ($ref_ext) $sql.= " AND ref_ext = '".$this->db->escape($ref_ext)."'"; } From 446cfff515b24f8af77e48bd33705739631ad707 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 16 Feb 2012 17:21:59 +0100 Subject: [PATCH 3/8] Fix: wrong alias --- htdocs/commande/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index a3978f8b099..94946d75c65 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2012 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 @@ -78,14 +78,14 @@ print "
\n"; * Statistics */ -$sql = "SELECT count(cf.rowid), c.fk_statut, c.facture"; +$sql = "SELECT count(c.rowid), c.fk_statut, c.facture"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; -if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND c.entity = ".$conf->entity; if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id; -if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; +if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY c.fk_statut, c.facture"; $resql = $db->query($sql); if ($resql) From 0a17345415b216d2a1c76866dd99d49f35505122 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Feb 2012 18:39:22 +0100 Subject: [PATCH 4/8] Doxygen --- htdocs/comm/mailing/class/mailing.class.php | 9 +-- htdocs/contrat/class/contrat.class.php | 6 +- .../smartphone/smartphone_backoffice.php | 12 ++-- .../menus/standard/auguria_backoffice.php | 12 ++-- .../menus/standard/auguria_frontoffice.php | 12 ++-- .../core/menus/standard/eldy_backoffice.php | 9 ++- .../core/menus/standard/eldy_frontoffice.php | 15 ++--- .../commande/doc/pdf_edison.modules.php | 8 +-- .../modules/dons/html_cerfafr.modules.php | 30 +++++----- htdocs/core/modules/dons/modules_don.php | 59 +++++++++++-------- htdocs/core/modules/fichinter/mod_arctic.php | 46 +++++++++------ htdocs/core/modules/fichinter/mod_pacific.php | 43 ++++++++------ .../modules/import/import_csv.modules.php | 6 +- htdocs/core/modules/import/modules_import.php | 2 +- .../modules/project/mod_project_simple.php | 41 +++++++------ .../modules/project/mod_project_universal.php | 32 +++++----- .../core/modules/project/modules_project.php | 56 ++++++++++-------- .../doc/doc_generic_proposal_odt.modules.php | 3 +- .../modules/rapport/pdf_paiement.class.php | 27 +++++---- 19 files changed, 246 insertions(+), 182 deletions(-) diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 60fe869aa97..489a7b8398f 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -61,12 +61,13 @@ class Mailing extends CommonObject /** - * \brief Constructeur de la classe - * \param DB handler acces base de donnees + * Constructor + * + * @param DoliDb $db Database handler */ - function Mailing($DB) + function Mailing($db) { - $this->db = $DB ; + $this->db = $db; // List of language codes for status $this->statuts[0] = 'MailingStatusDraft'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 96060d6f3fb..b2e6162c333 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1559,9 +1559,9 @@ class ContratLigne /** - * Constructeur d'objets ligne de contrat - * - * @param DoliDB $db Database access handler + * Constructor + * + * @param DoliDb $db Database handler */ function ContratLigne($db) { diff --git a/htdocs/core/menus/smartphone/smartphone_backoffice.php b/htdocs/core/menus/smartphone/smartphone_backoffice.php index 9cf2c1ab7db..d1cb1feb89b 100755 --- a/htdocs/core/menus/smartphone/smartphone_backoffice.php +++ b/htdocs/core/menus/smartphone/smartphone_backoffice.php @@ -23,8 +23,7 @@ /** - * \class MenuSmart - * \brief Class to manage smartphone menu smartphone (for internal users) + * Class to manage smartphone menu smartphone (for internal users) */ class MenuSmart { @@ -35,8 +34,9 @@ class MenuSmart { /** - * Constructeur - * @param db Database handler + * Constructor + * + * @param DoliDb $db Database handler */ function MenuSmart($db) { @@ -46,7 +46,9 @@ class MenuSmart { /** * Show menu - * @param limitmenuto To limit menu to a top or left menu value + * + * @param string $limitmenuto To limit menu to a top or left menu value + * @return void */ function showmenu($limitmenuto) { diff --git a/htdocs/core/menus/standard/auguria_backoffice.php b/htdocs/core/menus/standard/auguria_backoffice.php index f23153e04ef..acf85d3b51e 100644 --- a/htdocs/core/menus/standard/auguria_backoffice.php +++ b/htdocs/core/menus/standard/auguria_backoffice.php @@ -42,8 +42,9 @@ class MenuTop { /** - * Constructeur - * @param db Database access handler + * Constructor + * + * @param DoliDb $db Database handler */ function MenuTop($db) { @@ -52,7 +53,9 @@ class MenuTop { /** - * Show menu + * Show menu + * + * @return void */ function showmenu() { @@ -65,8 +68,7 @@ class MenuTop { /** - * \class MenuLeft - * \brief Classe permettant la gestion du menu du gauche Auguria + * Classe permettant la gestion du menu du gauche Auguria */ class MenuLeft { diff --git a/htdocs/core/menus/standard/auguria_frontoffice.php b/htdocs/core/menus/standard/auguria_frontoffice.php index e1197a10439..04084ab3849 100644 --- a/htdocs/core/menus/standard/auguria_frontoffice.php +++ b/htdocs/core/menus/standard/auguria_frontoffice.php @@ -42,8 +42,9 @@ class MenuTop { /** - * \brief Constructeur - * \param db Database access handler + * Constructor + * + * @param DoliDb $db Database handler */ function MenuTop($db) { @@ -53,7 +54,9 @@ class MenuTop { /** - * Show menu + * Show menu + * + * @return void */ function showmenu() { @@ -66,8 +69,7 @@ class MenuTop { /** - * \class MenuLeft - * \brief Classe permettant la gestion du menu du gauche Auguria + * Classe permettant la gestion du menu du gauche Auguria */ class MenuLeft { diff --git a/htdocs/core/menus/standard/eldy_backoffice.php b/htdocs/core/menus/standard/eldy_backoffice.php index 2785e75520f..a825d5293f0 100644 --- a/htdocs/core/menus/standard/eldy_backoffice.php +++ b/htdocs/core/menus/standard/eldy_backoffice.php @@ -40,8 +40,9 @@ class MenuTop { /** - * Constructeur - * @param db Handler d'acces base de donnee + * Constructor + * + * @param DoliDb $db Database handler */ function MenuTop($db) { @@ -50,7 +51,9 @@ class MenuTop { /** - * Show menu + * Show menu + * + * @return void */ function showmenu() { diff --git a/htdocs/core/menus/standard/eldy_frontoffice.php b/htdocs/core/menus/standard/eldy_frontoffice.php index 52366e88a9d..4b01b9fb74f 100644 --- a/htdocs/core/menus/standard/eldy_frontoffice.php +++ b/htdocs/core/menus/standard/eldy_frontoffice.php @@ -28,8 +28,7 @@ /** - * \class MenuTop - * \brief Class to manage top menu Eldy (for external users) + * Class to manage top menu Eldy (for external users) */ class MenuTop { @@ -40,8 +39,9 @@ class MenuTop { /** - * Constructeur - * @param db Handler d'acces base de donnee + * Constructor + * + * @param DoliDb $db Database handler */ function MenuTop($db) { @@ -50,7 +50,9 @@ class MenuTop { /** - * Show menu + * Show menu + * + * @return void */ function showmenu() { @@ -63,8 +65,7 @@ class MenuTop { /** - * \class MenuLeft - * \brief Classe permettant la gestion du menu du gauche Eldy + * Classe permettant la gestion du menu du gauche Eldy */ class MenuLeft { diff --git a/htdocs/core/modules/commande/doc/pdf_edison.modules.php b/htdocs/core/modules/commande/doc/pdf_edison.modules.php index c4b28610136..347fdb934cf 100644 --- a/htdocs/core/modules/commande/doc/pdf_edison.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_edison.modules.php @@ -30,18 +30,16 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'); /** - * \class pdf_edison - * \brief Classe permettant de generer les commandes au modele Edison + * Classe permettant de generer les commandes au modele Edison */ - class pdf_edison extends ModelePDFCommandes { var $emetteur; // Objet societe qui emet /** - * Constructeur + * Constructor * - * @param DoliDb $db Database access handler + * @param DoliDb $db Database access handler */ function pdf_edison($db=0) { diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 14bb9dc0846..f58b09c0ad7 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -27,15 +27,15 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"); /** - \class html_cerfafr - \brief Classe permettant de generer les propales au modele Azur -*/ + * Class to generate document for subscriptions + */ class html_cerfafr extends ModeleDon { /** - \brief Constructeur - \param db Handler acces base de donnees - */ + * Constructor + * + * @param DoliDb $db Database handler + */ function html_cerfafr($db) { global $conf,$langs; @@ -49,9 +49,11 @@ class html_cerfafr extends ModeleDon } - /** \brief Return if a module can be used or not - * \return boolean true if module can be used - */ + /** + * Return if a module can be used or not + * + * @return boolean true if module can be used + */ function isEnabled() { return true; @@ -60,9 +62,10 @@ class html_cerfafr extends ModeleDon /** * Write the object to document file to disk - * @param don Donation object - * @param outputlangs Lang object for output language - * @return int >0 if OK, <0 if KO + * + * @param Don $don Donation object + * @param Translate $outputlangs Lang object for output language + * @return int >0 if OK, <0 if KO */ function write_file($don,$outputlangs) { @@ -155,10 +158,7 @@ class html_cerfafr extends ModeleDon } $this->error=$langs->trans("ErrorUnknown"); return 0; // Erreur par defaut - } - } - ?> diff --git a/htdocs/core/modules/dons/modules_don.php b/htdocs/core/modules/dons/modules_don.php index 4bda754c752..12dff1b3592 100644 --- a/htdocs/core/modules/dons/modules_don.php +++ b/htdocs/core/modules/dons/modules_don.php @@ -30,8 +30,7 @@ require_once(DOL_DOCUMENT_ROOT."/compta/dons/class/don.class.php"); /** - * \class ModeleDon - * \brief Classe mere des modeles de dons + * Parent class of subscription templates */ abstract class ModeleDon extends CommonDocGenerator { @@ -59,23 +58,26 @@ abstract class ModeleDon extends CommonDocGenerator /** - * \class ModeleNumRefDons - * \brief Classe mere des modeles de numerotation des references des dons + * Parent class of donation numbering templates */ abstract class ModeleNumRefDons { var $error=''; - /** \brief Return if a module can be used or not - * \return boolean true if module can be used + /** + * Return if a module can be used or not + * + * @return boolean true if module can be used */ function isEnabled() { return true; } - /** \brief Renvoi la description par defaut du modele de num�rotation - * \return string Texte descripif + /** + * Renvoi la description par defaut du modele de numerotation + * + * @return string Texte descripif */ function info() { @@ -84,8 +86,10 @@ abstract class ModeleNumRefDons return $langs->trans("NoDescription"); } - /** \brief Renvoi un exemple de numerotation - * \return string Example + /** + * Renvoi un exemple de numerotation + * + * @return string Example */ function getExample() { @@ -94,17 +98,21 @@ abstract class ModeleNumRefDons return $langs->trans("NoExample"); } - /** \brief Test si les numeros deja en vigueur dans la base ne provoquent pas d - * de conflits qui empechera cette numerotation de fonctionner. - * \return boolean false si conflit, true si ok + /** + * Test si les numeros deja en vigueur dans la base ne provoquent pas d + * de conflits qui empechera cette numerotation de fonctionner. + * + * @return boolean false si conflit, true si ok */ function canBeActivated() { return true; } - /** \brief Renvoi prochaine valeur attribuee - * \return string Valeur + /** + * Renvoi prochaine valeur attribuee + * + * @return string Valeur */ function getNextValue() { @@ -112,8 +120,10 @@ abstract class ModeleNumRefDons return $langs->trans("NotAvailable"); } - /** \brief Renvoi version du module numerotation - * \return string Valeur + /** + * Renvoi version du module numerotation + * + * @return string Valeur */ function getVersion() { @@ -129,13 +139,14 @@ abstract class ModeleNumRefDons /** - * \brief Cree un don sur disque en fonction du modele de DON_ADDON_PDF - * \param db objet base de donnee - * \param id id du don e creer - * \param message message - * \param modele force le modele a utiliser ('' par defaut) - * \param outputlangs objet lang a utiliser pour traduction - * \return int 0 si KO, 1 si OK + * Cree un don sur disque en fonction du modele de DON_ADDON_PDF + * + * @param DoliDB $db Databse handler + * @param int $id Id donation + * @param string $message Message + * @param string $modele Force le modele a utiliser ('' par defaut) + * @param Translate $outputlangs Object langs + * @return int 0 if KO, 1 if OK */ function don_create($db, $id, $message, $modele, $outputlangs) { diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index 0616a58f070..102adb29f46 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -27,8 +27,7 @@ require_once(DOL_DOCUMENT_ROOT ."/core/modules/fichinter/modules_fichinter.php"); /** - * \class mod_arctic - * \brief Class to manage numbering of intervention cards with rule Artic. + * Class to manage numbering of intervention cards with rule Artic. */ class mod_arctic extends ModeleNumRefFicheinter { @@ -36,15 +35,20 @@ class mod_arctic extends ModeleNumRefFicheinter var $error = ''; var $nom = 'Artic'; - /** \brief Constructeur - */ + /** + * Constructor + * + * @param DoliDb $db Database handler + */ function mod_arctic() { $this->nom = "arctic"; } - /** \brief Renvoi la description du modele de numerotation - * \return string Texte descripif + /** + * Renvoi la description du modele de numerotation + * + * @return string Texte descripif */ function info() { @@ -81,8 +85,10 @@ class mod_arctic extends ModeleNumRefFicheinter return $texte; } - /** \brief Renvoi un exemple de numerotation - * \return string Example + /** + * Renvoi un exemple de numerotation + * + * @return string Example */ function getExample() { @@ -100,11 +106,13 @@ class mod_arctic extends ModeleNumRefFicheinter return $numExample; } - /** \brief Renvoi prochaine valeur attribuee - * \param objsoc Objet societe - * \param ficheinter Object ficheinter - * \return string Valeur - */ + /** + * Renvoi prochaine valeur attribuee + * + * @param Societe $objsoc Objet societe + * @param Ficheinter $object Object ficheinter + * @return string Valeur + */ function getNextValue($objsoc=0,$object='') { global $db,$conf; @@ -126,11 +134,13 @@ class mod_arctic extends ModeleNumRefFicheinter } - /** \brief Return next free value - * \param objsoc Object third party - * \param objforref Object for number to search - * \return string Next free value - */ + /** + * Return next free value + * + * @param Societe $objsoc Object third party + * @param Object $objforref Object for number to search + * @return string Next free value + */ function getNumRef($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php index 6102a682532..feaffc5962c 100644 --- a/htdocs/core/modules/fichinter/mod_pacific.php +++ b/htdocs/core/modules/fichinter/mod_pacific.php @@ -25,8 +25,7 @@ require_once(DOL_DOCUMENT_ROOT ."/core/modules/fichinter/modules_fichinter.php"); /** - * \class mod_pacific - * \brief Class to manage numbering of intervention cards with rule Pacific. + * Class to manage numbering of intervention cards with rule Pacific. */ class mod_pacific extends ModeleNumRefFicheinter { @@ -36,8 +35,10 @@ class mod_pacific extends ModeleNumRefFicheinter var $nom = 'pacific'; - /** \brief Return description of numbering module - * \return string Text with description + /** + * Return description of numbering module + * + * @return string Text with description */ function info() { @@ -45,17 +46,21 @@ class mod_pacific extends ModeleNumRefFicheinter return $langs->trans("SimpleNumRefModelDesc",$this->prefix); } - /** \brief Renvoi un exemple de numerotation - * \return string Example + /** + * Renvoi un exemple de numerotation + * + * @return string Example */ function getExample() { return $this->prefix."0501-0001"; } - /** \brief Test si les numeros deja en vigueur dans la base ne provoquent pas de - * de conflits qui empechera cette numerotation de fonctionner. - * \return boolean false si conflit, true si ok + /** + * Test si les numeros deja en vigueur dans la base ne provoquent pas de + * de conflits qui empechera cette numerotation de fonctionner. + * + * @return boolean false si conflit, true si ok */ function canBeActivated() { @@ -89,10 +94,12 @@ class mod_pacific extends ModeleNumRefFicheinter } } - /** \brief Renvoi prochaine valeur attribuee - * \param objsoc Objet societe - * \param ficheinter Object ficheinter - * \return string Valeur + /** + * Renvoi prochaine valeur attribuee + * + * @param objsoc Objet societe + * @param ficheinter Object ficheinter + * @return string Valeur */ function getNextValue($objsoc=0,$object='') { @@ -121,10 +128,12 @@ class mod_pacific extends ModeleNumRefFicheinter return $this->prefix.$yymm."-".$num; } - /** \brief Return next free value - * \param objsoc Object third party - * \param objforref Object for number to search - * \return string Next free value + /** + * Return next free value + * + * @param Societe $objsoc Object third party + * @param Object $objforref Object for number to search + * @return string Next free value */ function getNumRef($objsoc,$objforref) { diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index d45f183faa2..b6afe2b8e42 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -27,8 +27,7 @@ require_once(DOL_DOCUMENT_ROOT ."/core/modules/import/modules_import.php"); /** - * \class ImportCsv - * \brief Class to import CSV files + * Class to import CSV files */ class ImportCsv extends ModeleImports { @@ -529,6 +528,9 @@ class ImportCsv extends ModeleImports /** * Clean a string from separator + * + * @param string $value Remove separator + * @return string String without separator */ function cleansep($value) { diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index 3322c6586ea..171a6f91edf 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -42,7 +42,7 @@ class ModeleImports /** - * \brief Constructeur + * Constructor */ function ModeleImports() { diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index 4547fb3a8a9..3f0cc82c91b 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -27,8 +27,7 @@ require_once(DOL_DOCUMENT_ROOT ."/core/modules/project/modules_project.php"); /** - * \class mod_project_simple - * \brief Class to manage the numbering module Simple for project references + * Class to manage the numbering module Simple for project references */ class mod_project_simple extends ModeleNumRefProjects { @@ -38,8 +37,10 @@ class mod_project_simple extends ModeleNumRefProjects var $nom = "Simple"; - /** \brief Return description of numbering module - * \return string Text with description + /** + * Return description of numbering module + * + * @return string Text with description */ function info() { @@ -48,8 +49,10 @@ class mod_project_simple extends ModeleNumRefProjects } - /** \brief Return an example of numbering module values - * \return string Example + /** + * Return an example of numbering module values + * + * @return string Example */ function getExample() { @@ -57,9 +60,10 @@ class mod_project_simple extends ModeleNumRefProjects } - /** \brief Test si les numeros deja en vigueur dans la base ne provoquent pas de - * de conflits qui empechera cette numerotation de fonctionner. - * \return boolean false si conflit, true si ok + /** Test si les numeros deja en vigueur dans la base ne provoquent pas de + * de conflits qui empechera cette numerotation de fonctionner. + * + * @return boolean false si conflit, true si ok */ function canBeActivated() { @@ -92,10 +96,11 @@ class mod_project_simple extends ModeleNumRefProjects /** - * \brief Return next value - * \param objsoc Object third party - * \param project Object project - * \return string Value if OK, 0 if KO + * Return next value + * + * @param Societe $objsoc Object third party + * @param Project $project Object project + * @return string Value if OK, 0 if KO */ function getNextValue($objsoc=0,$project='') { @@ -132,10 +137,12 @@ class mod_project_simple extends ModeleNumRefProjects } - /** \brief Return next reference not yet used as a reference - * \param objsoc Object third party - * \param project Object project - * \return string Next not used reference + /** + * Return next reference not yet used as a reference + * + * @param Societe $objsoc Object third party + * @param Project $project Object project + * @return string Next not used reference */ function project_get_num($objsoc=0,$project='') { diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index 0aaf3629dee..72d235cb3e1 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -26,8 +26,7 @@ require_once(DOL_DOCUMENT_ROOT ."/core/modules/project/modules_project.php"); /** - * \class mod_project_universal - * \brief Classe du modele de numerotation de reference de projet Universal + * Classe du modele de numerotation de reference de projet Universal */ class mod_project_universal extends ModeleNumRefProjects { @@ -37,8 +36,9 @@ class mod_project_universal extends ModeleNumRefProjects /** - * \brief Renvoi la description du modele de numerotation - * \return string Texte descripif + * Renvoi la description du modele de numerotation + * + * @return string Texte descripif */ function info() { @@ -77,8 +77,9 @@ class mod_project_universal extends ModeleNumRefProjects } /** - * \brief Renvoi un exemple de numerotation - * \return string Example + * Renvoi un exemple de numerotation + * + * @return string Example */ function getExample() { @@ -97,10 +98,11 @@ class mod_project_universal extends ModeleNumRefProjects } /** - * \brief Return next value - * \param objsoc Object third party - * \param project Object project - * \return string Value if OK, 0 if KO + * Return next value + * + * @param Societe $objsoc Object third party + * @param Project $project Object project + * @return string Value if OK, 0 if KO */ function getNextValue($objsoc=0,$project='') { @@ -124,10 +126,12 @@ class mod_project_universal extends ModeleNumRefProjects } - /** \brief Return next reference not yet used as a reference - * \param objsoc Object third party - * \param project Object project - * \return string Next not used reference + /** + * Return next reference not yet used as a reference + * + * @param Societe $objsoc Object third party + * @param Project $project Object project + * @return string Next not used reference */ function project_get_num($objsoc=0,$project='') { diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php index 412b18af406..53698bdffe1 100644 --- a/htdocs/core/modules/project/modules_project.php +++ b/htdocs/core/modules/project/modules_project.php @@ -26,8 +26,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commondocgenerator.class.php"); /** - * \class ModelePDFProjects - * \brief Parent class for projects models + * Parent class for projects models */ abstract class ModelePDFProjects extends CommonDocGenerator { @@ -35,8 +34,9 @@ abstract class ModelePDFProjects extends CommonDocGenerator /** - * \brief Return list of active generation modules - * \param $db Database handler + * Return list of active generation modules + * + * @param DoliDB $db Database handler */ function liste_modeles($db) { @@ -55,16 +55,16 @@ abstract class ModelePDFProjects extends CommonDocGenerator /** - * \class ModeleNumRefProjects - * \brief Classe mere des modeles de numerotation des references de projets + * Classe mere des modeles de numerotation des references de projets */ abstract class ModeleNumRefProjects { var $error=''; /** - * \brief Return if a module can be used or not - * \return boolean true if module can be used + * Return if a module can be used or not + * + * @return boolean true if module can be used */ function isEnabled() { @@ -72,8 +72,9 @@ abstract class ModeleNumRefProjects } /** - * \brief Renvoi la description par defaut du modele de numerotation - * \return string Texte descripif + * Renvoi la description par defaut du modele de numerotation + * + * @return string Texte descripif */ function info() { @@ -83,8 +84,9 @@ abstract class ModeleNumRefProjects } /** - * \brief Renvoi un exemple de numerotation - * \return string Example + * Renvoi un exemple de numerotation + * + * @return string Example */ function getExample() { @@ -94,9 +96,10 @@ abstract class ModeleNumRefProjects } /** - * \brief Test si les numeros deja en vigueur dans la base ne provoquent pas de - * de conflits qui empechera cette numerotation de fonctionner. - * \return boolean false si conflit, true si ok + * Test si les numeros deja en vigueur dans la base ne provoquent pas de + * de conflits qui empechera cette numerotation de fonctionner. + * + * @return boolean false si conflit, true si ok */ function canBeActivated() { @@ -104,8 +107,9 @@ abstract class ModeleNumRefProjects } /** - * \brief Renvoi prochaine valeur attribuee - * \return string Valeur + * Renvoi prochaine valeur attribuee + * + * @return string Valeur */ function getNextValue() { @@ -114,8 +118,9 @@ abstract class ModeleNumRefProjects } /** - * \brief Renvoi version du module numerotation - * \return string Valeur + * Renvoi version du module numerotation + * + * @return string Valeur */ function getVersion() { @@ -131,12 +136,13 @@ abstract class ModeleNumRefProjects /** - * Create object on disk - * @param db objet base de donnee - * @param object object project - * @param model force le modele a utiliser ('' to not force) - * @param outputlangs objet lang a utiliser pour traduction - * @return int 0 si KO, 1 si OK + * Create object on disk + * + * @param DoliDB $db objet base de donnee + * @param Object $object object project + * @param string $model force le modele a utiliser ('' to not force) + * @param Translate $outputlangs objet lang a utiliser pour traduction + * @return int 0 if KO, 1 if OK */ function project_pdf_create($db, $object, $model,$outputlangs) { diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 92af7983233..1a7afb298cc 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -31,8 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); /** - * \class doc_generic_iproposal_odt - * \brief Class to build documents using ODF templates generator + * Class to build documents using ODF templates generator */ class doc_generic_proposal_odt extends ModelePDFPropales { diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index c6c083c7efd..8a1dafdad35 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -27,14 +27,14 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"); /** - * \class pdf_paiement - * \brief Classe permettant de generer les rapports de paiement + * Classe permettant de generer les rapports de paiement */ class pdf_paiement { /** - * \brief Constructeur - * \param db handler acces base de donnee + * Constructor + * + * @param DoliDb $db Database handler */ function pdf_paiement($db) { @@ -66,11 +66,12 @@ class pdf_paiement /** - * \brief Fonction generant le rapport sur le disque - * \param _dir repertoire - * \param month mois du rapport - * \param year annee du rapport - * \param outputlangs Lang output object + * Fonction generant la rapport sur le disque + * + * @param string $_dir repertoire + * @param int $month mois du rapport + * @param int $year annee du rapport + * @param string $outputlangs Lang output object */ function write_file($_dir, $month, $year, $outputlangs) { @@ -127,7 +128,7 @@ class pdf_paiement $sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'"; $sql.= " ORDER BY p.datep ASC, pf.fk_paiement ASC"; - dol_syslog("pdf_paiement::write_file sql=".$sql); + dol_syslog(get_class($this)."::write_file sql=".$sql); $result = $this->db->query($sql); if ($result) { @@ -263,7 +264,13 @@ class pdf_paiement /** + * Output body * + * @param PDF &$pdf PDF object + * @param string $page Page + * @param array $lines Array of lines + * @param Translate $langs Object langs + * @return void */ function Body(&$pdf, $page, $lines, $outputlangs) { From 20c85b9ca87cf40a2a385dd31abdad4030dceca9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Feb 2012 18:52:07 +0100 Subject: [PATCH 5/8] Avoid duplicate messages during upgrade --- htdocs/install/upgrade2.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index a9ed6be5a45..c57a28febf1 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -3285,6 +3285,7 @@ function migrate_mode_reglement($db,$langs,$conf) 'code' => array('VAD','TRA','LCR','FAC','PRO'), 'tables' => array('commande_fournisseur','commande','facture_rec','facture','propal') ); + $count=0; foreach($elements['old_id'] as $key => $old_id) { @@ -3303,6 +3304,8 @@ function migrate_mode_reglement($db,$langs,$conf) $num = $db->num_rows($resql); if ($num) { + $count++; + $db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."c_paiement SET "; @@ -3344,13 +3347,12 @@ function migrate_mode_reglement($db,$langs,$conf) $db->rollback(); } } - else - { - print $langs->trans('AlreadyDone')."
\n"; - } } } + if ($count == 0) print $langs->trans('AlreadyDone')."
\n"; + + print ''; } From a829b10190c3d236043818cdfc37aa714236f20f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Feb 2012 19:08:04 +0100 Subject: [PATCH 6/8] Fix: Autoselect current year if not defined --- htdocs/comm/propal/stats/index.php | 2 ++ htdocs/commande/stats/index.php | 2 ++ htdocs/compta/deplacement/stats/index.php | 2 ++ htdocs/compta/facture/stats/index.php | 2 ++ 4 files changed, 8 insertions(+) diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index db16872b767..b7e2c0b3ca9 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -240,6 +240,8 @@ print $form->select_users($userid,'userid',1); print ''; // Year print ''.$langs->trans("Year").''; +if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; +arsort($arrayyears); print $form->selectarray('year',$arrayyears,$year,0); print ''; print ''; diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index fa1ff9f65a9..d457cc874ba 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -260,6 +260,8 @@ print $form->select_users($userid,'userid',1); print ''; // Year print ''.$langs->trans("Year").''; +if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; +arsort($arrayyears); print $form->selectarray('year',$arrayyears,$year,0); print ''; print ''; diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 6a6a8d1016a..9d8c6e16c11 100755 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -224,6 +224,8 @@ print $form->select_users($userid,'userid',1); print ''; // Year print ''.$langs->trans("Year").''; +if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; +arsort($arrayyears); print $form->selectarray('year',$arrayyears,$year,0); print ''; print ''; diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 3092ad970f3..023dddc0999 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -239,6 +239,8 @@ print $form->select_users($userid,'userid',1); print ''; // Year print ''.$langs->trans("Year").''; +if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; +arsort($arrayyears); print $form->selectarray('year',$arrayyears,$year,0); print ''; print ''; From daaf909c025ef6704e275ea991c973f59be93238 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Feb 2012 01:33:59 +0100 Subject: [PATCH 7/8] Fix: Bad check of idprof2 --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f667a1d3bad..12aa8d09dc9 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2019,7 +2019,7 @@ class Societe extends CommonObject // Verifie SIRET si pays FR if ($idprof == 2 && $soc->country_code == 'FR') { - $chaine=trim($this->idprof1); + $chaine=trim($this->idprof2); $chaine=preg_replace('/(\s)/','',$chaine); if (dol_strlen($chaine) != 14) return -1; From dd491a51976f8a7bb41b69055b75283d40bcb8cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Feb 2012 01:41:58 +0100 Subject: [PATCH 8/8] Add more phpunit --- test/phpunit/SocieteTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 050488a6e65..2bf78f5878c 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -266,6 +266,24 @@ class SocieteTest extends PHPUnit_Framework_TestCase print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n"; $this->assertNotEquals($localobject->date_creation, ''); + $localobject->idprof1=493861496; + $localobject->idprof2=49386149600021; + $result=$localobject->id_prof_check(1,$localobject); + print __METHOD__." result=".$result."\n"; + $this->assertLessThan($result, 0); + $result=$localobject->id_prof_check(2,$localobject); + print __METHOD__." result=".$result."\n"; + $this->assertLessThan($result, 0); + + $localobject->idprof1='id1ko'; + $localobject->idprof2='id2ko'; + $result=$localobject->id_prof_check(1,$localobject); + print __METHOD__." result=".$result."\n"; + $this->assertGreaterThan($result, 0); + $result=$localobject->id_prof_check(2,$localobject); + print __METHOD__." result=".$result."\n"; + $this->assertGreaterThan($result, 0); + return $localobject->id; }