23include_once DOL_DOCUMENT_ROOT.
'/core/modules/mailings/modules_mailings.php';
32 public $name =
'AttendeesOfOrganizedEvent';
33 public $desc =
"Attendees of an organized event";
38 public $require_admin = 0;
43 public $require_module = array();
48 public $picto =
'conferenceorbooth';
53 public $enabled =
'isModEnabled("eventorganization")';
64 $langs->load(
'companies');
85 $sql =
"SELECT p.ref, p.entity, e.rowid as id, e.fk_project, e.email as email, e.email_company as company_name, e.firstname as firstname, e.lastname as lastname,";
86 $sql .=
" 'eventorganizationattendee' as source";
87 $sql .=
" FROM ".MAIN_DB_PREFIX.
"eventorganization_conferenceorboothattendee as e,";
88 $sql .=
" ".MAIN_DB_PREFIX.
"projet as p";
89 $sql .=
" WHERE e.email <> ''";
90 $sql .=
" AND e.fk_project = p.rowid";
91 $sql .=
" AND p.entity IN (".getEntity(
'project').
")";
92 $sql .=
" AND e.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX.
"mailing_cibles WHERE fk_mailing=".((int) $mailing_id).
")";
93 if (
GETPOSTINT(
'filter_eventorganization') > 0) {
94 $sql .=
" AND e.fk_project = ".(GETPOSTINT(
'filter_eventorganization'));
97 $sql .=
" ORDER BY e.email";
100 $result = $this->db->query($sql);
102 $num = $this->db->num_rows($result);
106 dol_syslog(get_class($this).
"::add_to_target mailing ".$num.
" targets found");
110 $obj = $this->db->fetch_object($result);
111 if ($old != $obj->email) {
112 $otherTxt = ($obj->ref ? $langs->transnoentities(
"Project").
'='.$obj->ref :
'');
113 if (strlen($addDescription) > 0 && strlen($otherTxt) > 0) {
116 $otherTxt .= $addDescription;
118 'email' => $obj->email,
119 'fk_project' => (
int) $obj->fk_project,
120 'lastname' => $obj->lastname,
121 'firstname' => $obj->firstname,
122 'other' => $otherTxt,
123 'source_url' => $this->url($obj->id, $obj->source),
124 'source_id' => (
int) $obj->id,
125 'source_type' => $obj->source
135 $this->error = $this->db->error();
139 return parent::addTargetsToDatabase($mailing_id, $cibles);
171 $sql =
"SELECT COUNT(DISTINCT(e.email)) as nb";
172 $sql .=
" FROM ".MAIN_DB_PREFIX.
"eventorganization_conferenceorboothattendee as e, ";
173 $sql .=
" ".MAIN_DB_PREFIX.
"projet as p";
174 $sql .=
" WHERE e.email <> ''";
175 $sql .=
" AND e.fk_project = p.rowid";
176 $sql .=
" AND p.entity IN (".getEntity(
'project').
")";
182 return parent::getNbOfRecipients($sql);
193 global
$conf, $langs;
195 $langs->load(
"companies");
197 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
200 $s =
img_picto($langs->trans(
"OrganizedEvent"),
'project',
'class="pictofixedwidth"');
201 $s .= $formproject->select_projects(-1,
'0',
"filter_eventorganization", 0, 0, $langs->trans(
"OrganizedEvent"), 1, 0, 0, 0,
'', 1, 0,
'',
'',
'usage_organize_event=1');
214 public function url(
$id, $sourcetype =
'thirdparty')
216 if ($sourcetype ==
'project') {
217 return '<a href="'.DOL_URL_ROOT.
'/eventorganization/conferenceorboothattendee_card.php?id='.((int)
$id).
'">'.
img_object(
'',
"eventorganization").
'</a>';
$id
Support class for third parties, contacts, members, users or resources.
Parent class of emailing target selectors modules.
getSqlToExcludeUnsubscribed($emailfield)
Return the SQL fragment that excludes email addresses which opted out of emailings for the current en...
Class to manage a list of personalised recipients for mailing feature.
add_to_target($mailing_id)
This is the main function that returns the array of emails.
__construct($db)
Constructor.
getSqlArrayForStats()
On the main mailing area, there is a box with statistics.
getNbOfRecipients($sql='')
Return here number of distinct emails returned by your selector.
formFilter()
This is to add a form filter to provide variant of selector If used, the HTML select must be called "...
url($id, $sourcetype='thirdparty')
Can include an URL link on each record provided by selector shown on target page.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)