From 857a11f508e16f66c20324251a323d72ed3c1e65 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Aug 2012 20:21:53 +0200 Subject: [PATCH] New: Can select thirdparties into emailing targets, even if module category is not enabled. --- ChangeLog | 1 + .../modules/mailings/thirdparties.modules.php | 24 +++++++++---------- .../thirdparties_services_expired.modules.php | 3 +-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d51bd475ac..f22a34a385a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -39,6 +39,7 @@ For users: - New: [ task #326 ]: Add a numbering module to suggest automatically a product ref - New: Add conditional substitution IF/ELSEIF/ENDIF for ODT templates - New: Add unit foot2, inch2, foot3 and inch3 for surface and volumes. +- New: Can select thirdparties into emailing targets, even if module category is not enabled. - Fix: [ bug #499 ]: Supplier order input method not translated - Fix: No images into product description lines as PDF generation does not work with this. diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 33c59091a3d..6c6bdcf61e0 100755 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -19,20 +19,15 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; /** - * \class mailing_thirdparties - * \brief Class to manage a list of personalised recipients for mailing feature + * Class to manage a list of personalised recipients for mailing feature */ class mailing_thirdparties extends MailingTargets { - // CHANGE THIS: Put here a name not already used var $name='ContactsCategories'; - // CHANGE THIS: Put here a description of your selector module. - // This label is used if no translation found for key MailingModuleDescXXX where XXX=name is found var $desc="Third parties (by categories)"; - // CHANGE THIS: Set to 1 if selector is available for admin users only var $require_admin=0; - var $require_module=array("categorie","societe"); + var $require_module=array("societe"); // This module allows to select by categories must be also enabled if category module is not activated var $picto='company'; var $db; @@ -44,6 +39,8 @@ class mailing_thirdparties extends MailingTargets */ function __construct($db) { + global $conf; + $this->db=$db; } @@ -151,11 +148,12 @@ class mailing_thirdparties extends MailingTargets } - /* - * \brief Return here number of distinct emails returned by your selector. - * For example if this selector is used to extract 500 different - * emails from a text file, this function must return 500. - * \return int + /** + * Return here number of distinct emails returned by your selector. + * For example if this selector is used to extract 500 different + * emails from a text file, this function must return 500. + * + * @return int Nb of recipients */ function getNbOfRecipients() { @@ -200,6 +198,8 @@ class mailing_thirdparties extends MailingTargets { $num = $this->db->num_rows($resql); + if (empty($conf->categorie->enabled)) $num=0; // Force empty list if category module is not enabled + if ($num) $s.=''; else $s.=''; diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 46cc1d0a6b4..15b3ad6f0d4 100755 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -18,8 +18,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; /** - * \class mailing_thirdparties_services_expired - * \brief Class to offer a selector of emailing targets with Rule 'services expired'. + * Class to offer a selector of emailing targets with Rule 'services expired'. */ class mailing_thirdparties_services_expired extends MailingTargets {