/**
  *	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.
  *
  *  @param	string	$sql		Requete sql de comptage
  *	@return		int			Nb of recipients
  */
 function getNbOfRecipients($sql = '')
 {
     $sql = "SELECT count(distinct(a.email)) as nb";
     $sql .= " FROM " . MAIN_DB_PREFIX . "adherent as a";
     $sql .= " WHERE (a.email IS NOT NULL AND a.email != '')";
     // La requete doit retourner un champ "nb" pour etre comprise
     // par parent::getNbOfRecipients
     return parent::getNbOfRecipients($sql);
 }
Beispiel #2
0
	function getNbOfRecipients()
	{
		global $conf;

		$sql = "SELECT count(distinct(u.email)) as nb";
		$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
		$sql.= " WHERE u.email != ''"; // u.email IS NOT NULL est implicite dans ce test
		$sql.= " AND u.entity IN (0,".$conf->entity.")";

		// La requete doit retourner un champ "nb" pour etre comprise
		// par parent::getNbOfRecipients
		return parent::getNbOfRecipients($sql);
	}
 /**
  * 		Return here number of distinct emails returned by your selector.
  *
  *		@param		string	$sql		Requete sql de comptage
  * 		@return		int
  */
 function getNbOfRecipients($sql = '')
 {
     global $conf;
     // We must report here number of contacts when absolutely no filter selected (so all contacts).
     // Number with a filter are show in the combo list for each filter.
     // If we want a filter "a position is defined", we must add it into formFilter
     $sql = "SELECT count(distinct(sp.email)) as nb";
     $sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as sp";
     $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = sp.fk_soc";
     $sql .= " WHERE sp.entity IN (" . getEntity('societe', 1) . ")";
     $sql .= " AND sp.email != ''";
     // Note that null != '' is false
     $sql .= " AND sp.no_email = 0";
     $sql .= " AND sp.statut = 1";
     //$sql.= " AND sp.poste != ''";
     // La requete doit retourner un champ "nb" pour etre comprise
     // par parent::getNbOfRecipients
     return parent::getNbOfRecipients($sql);
 }
 function getNbOfRecipients()
 {
     global $conf;
     $sql = "SELECT count(distinct(s.email)) as nb";
     $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
     $sql .= " WHERE s.email != ''";
     $sql .= " AND s.entity = " . $conf->entity;
     // La requete doit retourner un champ "nb" pour etre comprise
     // par parent::getNbOfRecipients
     return parent::getNbOfRecipients($sql);
 }
 /**
  *	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.
  *
  *  @param	string	$sql		Requete sql de comptage
  *	@return		int
  */
 function getNbOfRecipients($sql = '')
 {
     global $conf;
     $sql = "SELECT count(distinct(c.email)) as nb";
     $sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as c";
     $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = c.fk_soc";
     $sql .= " WHERE c.entity IN (" . getEntity('societe', 1) . ")";
     $sql .= " AND c.email != ''";
     // Note that null != '' is false
     $sql .= " AND c.no_email = 0";
     // La requete doit retourner un champ "nb" pour etre comprise
     // par parent::getNbOfRecipients
     return parent::getNbOfRecipients($sql);
 }
 /**
  *	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.
  *
  *	@param	string	$sql		SQL request to use to count
  *	@return	int					Number of recipients
  */
 function getNbOfRecipients($sql = '')
 {
     $now = dol_now();
     // Example: return parent::getNbOfRecipients("SELECT count(*) as nb from dolibarr_table");
     // Example: return 500;
     $sql = "SELECT count(*) as nb";
     $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "contrat as c";
     $sql .= ", " . MAIN_DB_PREFIX . "contratdet as cd, " . MAIN_DB_PREFIX . "product as p";
     $sql .= " WHERE s.entity IN (" . getEntity('societe', 1) . ")";
     $sql .= " AND s.rowid = c.fk_soc AND cd.fk_contrat = c.rowid AND s.email != ''";
     $sql .= " AND cd.statut= 4 AND cd.fk_product=p.rowid";
     $sql .= " AND p.ref IN ('" . join("','", $this->arrayofproducts) . "')";
     $sql .= " AND cd.date_fin_validite < '" . $this->db->idate($now) . "'";
     $a = parent::getNbOfRecipients($sql);
     return $a;
 }
Beispiel #7
0
 /**
  *		Return here number of distinct emails returned by your selector.
  *
  *		@param	string	$sql		Requete sql de comptage
  *		@return		int		Number of recipients
  */
 function getNbOfRecipients($sql = '')
 {
     global $conf;
     // We must report here number of contacts when absolutely no filter selected (so all contacts).
     // Number with a filter are show in the combo list for each filter.
     // If we want a filter "is inside at least one category", we must add it into formFilter
     $sql = "SELECT count(distinct(c.email)) as nb";
     $sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as c";
     $sql .= " WHERE c.entity IN (" . getEntity('societe', 1) . ")";
     $sql .= " AND c.email != ''";
     // Note that null != '' is false
     $sql .= " AND c.no_email = 0";
     /*
         	$sql = "SELECT count(distinct(sp.email)) as nb";
     $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
     $sql.= " ".MAIN_DB_PREFIX."societe as s,";
     $sql.= " ".MAIN_DB_PREFIX."categorie as c,";
     $sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs";
     $sql.= " WHERE s.rowid = sp.fk_soc";
     $sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
     $sql.= " AND sp.email != ''"; // Note that null != '' is false
     $sql.= " AND cs.fk_categorie = c.rowid";
     $sql.= " AND cs.fk_societe = sp.fk_soc";
     */
     // La requete doit retourner un champ "nb" pour etre comprise
     // par parent::getNbOfRecipients
     return parent::getNbOfRecipients($sql);
 }
	/**
	 *		\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
	 */
	function getNbOfRecipients()
	{
		global $conf;

		$sql  = "SELECT count(distinct(c.email)) as nb";
		$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
		$sql .= " ".MAIN_DB_PREFIX."societe as s";
		$sql .= " WHERE s.rowid = c.fk_soc";
		$sql .= " AND c.entity = ".$conf->entity;
		$sql .= " AND s.entity = ".$conf->entity;
		$sql .= " AND c.email != ''"; // Note that null != '' is false

		// La requete doit retourner un champ "nb" pour etre comprise
		// par parent::getNbOfRecipients
		return parent::getNbOfRecipients($sql);
	}
	/**
	*		\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
	*/
	function getNbOfRecipients($filter=1,$option='')
	{
        $now=dol_now();

        // Example: return parent::getNbOfRecipients("SELECT count(*) as nb from dolibarr_table");
		// Example: return 500;
		$sql = " select count(*) as nb";
		$sql.= " from ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c,";
		$sql.= " ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p";
		$sql.= " where s.rowid = c.fk_soc AND cd.fk_contrat = c.rowid AND s.email != ''";
		$sql.= " AND cd.statut= 4 AND cd.fk_product=p.rowid";
		$sql.= " AND p.ref in ('".join("','",$this->arrayofproducts)."')";
		$sql.= " AND cd.date_fin_validite < '".$this->db->idate($now)."'";
		//print $sql;
		$a=parent::getNbOfRecipients($sql);

		return $a;
	}