class mailing_contacts1 extends MailingTargets (View source)

Class to offer a selector of emailing targets from contacts

Properties

DoliDB $db from  MailingTargets
string $error from  MailingTargets
string[] $errors from  MailingTargets
string $enabled
$name
$desc
string $tooltip from  MailingTargets
string $sql from  MailingTargets
int<0, 1> $evenunsubscribe from  MailingTargets
string[] $require_module
int<0, 1> $require_admin
string $picto

Methods

__construct($db)

Constructor

string
getDesc()

Return description of email selector

getNbOfRecords()

Return number of records for email selector

int|string
getNbOfRecipients(string $sql = '')

Return here number of distinct emails returned by your selector.

string
formFilter()

Affiche formulaire de filtre qui apparait dans page de selection des destinataires de mailings

int
update_nb(int $mailing_id)

Met a jour nombre de destinataires

int
addTargetsToDatabase(int $mailing_id, array<array{fk_contact?: int, lastname: string, firstname: string, email: string, other: string, source_url: string, source_id?: int, source_type: string, id?: int}> $cibles)

Add a list of targets into the database

void
clear_target($mailing_id)

Supprime tous les destinataires de la table des cibles

static 
getEmailingSelectorsList(?string[] $forcedir = null)

Return list of widget. Function used by admin page htdoc/admin/widget.

string[]
getSqlArrayForStats()

On the main mailing area, there is a box with statistics.

int
add_to_target($mailing_id)

Add some recipients into target table

string
url($id)

Provide the URL to the car of the source information of the recipient for the mailing

Details

__construct($db)

Constructor

@param DoliDB $db Database handler

Parameters

$db

string getDesc()

Return description of email selector

Return Value

string

Return translation of module label. Try translation of $this->name then translation of 'MailingModuleDesc'.$this->name, or $this->desc if not found

getNbOfRecords()

Return number of records for email selector

@return integer Example

int|string getNbOfRecipients(string $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.

Parameters

string $sql

Sql request to count

Return Value

int|string

Nb of recipient, or <0 if error, or '' if NA

string formFilter()

Affiche formulaire de filtre qui apparait dans page de selection des destinataires de mailings

@return string Retourne zone select

Return Value

string

Retourne zone select

int update_nb(int $mailing_id)

Met a jour nombre de destinataires

Parameters

int $mailing_id

Id of emailing

Return Value

int

Return integer < 0 si erreur, nb destinataires si ok

int addTargetsToDatabase(int $mailing_id, array<array{fk_contact?: int, lastname: string, firstname: string, email: string, other: string, source_url: string, source_id?: int, source_type: string, id?: int}> $cibles)

Add a list of targets into the database

Parameters

int $mailing_id

Id of emailing

array<array{fk_contact?: int, lastname: string, firstname: string, email: string, other: string, source_url: string, source_id?: int, source_type: string, id?: int}> $cibles

Array with targets

Return Value

int

Return integer < 0 if error, nb added if OK

void clear_target($mailing_id)

Supprime tous les destinataires de la table des cibles

@param int $mailing_id Id of emailing

Parameters

$mailing_id

Return Value

void

static getEmailingSelectorsList(?string[] $forcedir = null)

Return list of widget. Function used by admin page htdoc/admin/widget.

List is sorted by widget filename so by priority to run.

Parameters

?string[] $forcedir

null=All default directories. This parameter is used by modulebuilder module only. @return array<array{picto:string,file:string,fullpath:string,relpath:string,iscoreorexternal:'external'|'internal',version:string,status:string,info:string}> Array list of widgets

string[] getSqlArrayForStats()

On the main mailing area, there is a box with statistics.

If you want to add a line in this report you must provide an array of SQL request that returns two field: One called "label", One called "nb".

Return Value

string[]

Array with SQL requests

int add_to_target($mailing_id)

Add some recipients into target table

@param int $mailing_id Id of emailing

Parameters

$mailing_id

Return Value

int

Return integer < 0 on error, count of added when ok

string url($id)

Provide the URL to the car of the source information of the recipient for the mailing

@param int $id ID

Parameters

$id

Return Value

string

URL link