2005-02-11 23:41:42 +00:00
< ? php
/* Copyright ( C ) 2003 - 2004 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2008-04-04 11:31:52 +00:00
* Copyright ( C ) 2004 - 2008 Laurent Destailleur < eldy @ users . sourceforge . net >
2005-02-11 23:41:42 +00:00
* Copyright ( C ) 2004 Eric Seigne < eric . seigne @ ryxeo . com >
2026-01-29 23:37:23 +00:00
* Copyright ( C ) 2024 - 2026 MDW < mdeweerd @ users . noreply . github . com >
2025-09-15 14:16:22 +00:00
* Copyright ( C ) 2025 Frédéric France < frederic . france @ free . fr >
2005-02-11 23:41:42 +00:00
*
* 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
2013-01-16 14:36:08 +00:00
* the Free Software Foundation ; either version 3 of the License , or
2005-02-11 23:41:42 +00:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2019-09-23 19:55:30 +00:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
* or see https :// www . gnu . org /
2005-02-11 23:41:42 +00:00
*/
2005-04-06 23:23:48 +00:00
/**
2011-10-24 12:11:49 +00:00
* \file htdocs / core / modules / mailings / modules_mailings . php
2010-07-21 11:57:52 +00:00
* \ingroup mailing
* \brief File with parent class of emailing target selectors modules
*/
2012-08-22 21:11:24 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php' ;
2007-09-13 18:10:51 +00:00
2005-02-11 23:41:42 +00:00
2005-04-06 23:23:48 +00:00
/**
2014-11-29 11:38:36 +00:00
* Parent class of emailing target selectors modules
2010-07-21 11:57:52 +00:00
*/
2018-08-29 20:06:05 +00:00
class MailingTargets // This can't be abstract as it is used for some method
2005-02-11 23:41:42 +00:00
{
2022-05-28 18:42:29 +00:00
/**
2024-01-13 14:50:02 +00:00
* @ var DoliDB Database handler ( result of a new DoliDB )
2022-05-28 18:42:29 +00:00
*/
2023-08-30 07:21:05 +00:00
public $db ;
2022-05-28 18:42:29 +00:00
2020-10-31 13:32:18 +00:00
/**
2018-08-22 08:37:16 +00:00
* @ var string Error code ( or message )
*/
2020-02-18 22:47:25 +00:00
public $error = '' ;
2018-09-05 16:49:06 +00:00
2023-08-29 20:58:54 +00:00
/**
2024-11-06 22:57:45 +00:00
* @ var string [] of errors
2023-08-29 20:58:54 +00:00
*/
public $errors ;
2023-08-30 07:21:05 +00:00
/**
* @ var string Condition to be enabled
*/
public $enabled ;
/**
* @ var string Name of the module
*/
public $name ;
2023-08-29 20:58:54 +00:00
2023-08-30 07:21:05 +00:00
/**
* @ var string Description of the module
*/
public $desc ;
/**
* @ var string Tooltip to show after description of the module
*/
2020-10-31 13:32:18 +00:00
public $tooltip = '' ;
2018-08-13 15:26:32 +00:00
2023-03-06 22:13:33 +00:00
/**
2023-08-30 07:21:05 +00:00
* @ var string To store the SQL string used to find the recipients
2023-03-06 22:13:33 +00:00
*/
public $sql ;
2023-04-08 15:16:22 +00:00
2024-11-08 13:43:12 +00:00
/**
* @ var int < 0 , 1 > Set this to 1 if you want to flag you also want to include email in target that has opt - out .
*/
public $evenunsubscribe = 0 ;
2023-04-08 15:16:22 +00:00
2009-01-25 22:04:55 +00:00
2020-10-31 13:32:18 +00:00
/**
2011-09-29 16:04:15 +00:00
* Constructor
*
2011-11-13 10:45:25 +00:00
* @ param DoliDB $db Database handler
2011-09-29 16:04:15 +00:00
*/
2020-10-31 13:32:18 +00:00
public function __construct ( $db )
2011-09-29 16:04:15 +00:00
{
2020-10-31 13:32:18 +00:00
$this -> db = $db ;
2011-09-29 16:04:15 +00:00
}
2020-10-31 13:32:18 +00:00
/**
* Return description of email selector
*
* @ return string Return translation of module label . Try translation of $this -> name then translation of 'MailingModuleDesc' . $this -> name , or $this -> desc if not found
*/
public function getDesc ()
{
global $langs , $form ;
2018-08-13 15:26:32 +00:00
2020-10-31 13:32:18 +00:00
$langs -> load ( " mails " );
$transstring = " MailingModuleDesc " . $this -> name ;
$s = '' ;
2017-01-29 13:53:05 +00:00
2021-02-23 21:03:23 +00:00
if ( $langs -> trans ( $this -> name ) != $this -> name ) {
$s = $langs -> trans ( $this -> name );
} elseif ( $langs -> trans ( $transstring ) != $transstring ) {
$s = $langs -> trans ( $transstring );
} else {
$s = $this -> desc ;
}
2016-11-26 11:21:50 +00:00
2021-02-23 21:03:23 +00:00
if ( $this -> tooltip && is_object ( $form )) {
2025-02-08 00:49:29 +00:00
$s .= ' ' . $form -> textwithpicto ( '' , $langs -> trans ( $this -> tooltip ), 1 , 'help' );
2021-02-23 21:03:23 +00:00
}
2020-10-31 13:32:18 +00:00
return $s ;
}
2005-02-11 23:41:42 +00:00
2020-10-31 13:32:18 +00:00
/**
2011-09-29 16:04:15 +00:00
* Return number of records for email selector
2020-10-31 13:32:18 +00:00
*
2026-04-23 12:57:54 +00:00
* @ return int Example
2020-10-31 13:32:18 +00:00
*/
public function getNbOfRecords ()
{
return 0 ;
}
2005-02-12 17:41:13 +00:00
2020-10-31 13:32:18 +00:00
/**
2026-01-29 23:37:23 +00:00
* Return the number of recipients
2020-10-31 13:32:18 +00:00
*
2026-04-23 12:57:54 +00:00
* @ param string $sql Sql request to count
* @ return int <- 1 , max > Nb of recipients , or < 0 if error
2020-10-31 13:32:18 +00:00
*/
public function getNbOfRecipients ( $sql )
{
$result = $this -> db -> query ( $sql );
2021-02-23 21:03:23 +00:00
if ( $result ) {
2023-04-08 15:16:22 +00:00
$total = 0 ;
while ( $obj = $this -> db -> fetch_object ( $result )) {
2026-04-23 12:57:54 +00:00
$total += ( int ) $obj -> nb ;
2023-04-08 15:16:22 +00:00
}
return $total ;
2020-10-31 13:32:18 +00:00
} else {
$this -> error = $this -> db -> lasterror ();
return - 1 ;
}
}
2005-02-12 17:41:13 +00:00
2020-10-31 13:32:18 +00:00
/**
2026-07-01 10:26:51 +00:00
* Displays filter form that appears on the mailing recipient selection page
2020-10-31 13:32:18 +00:00
*
2026-07-01 10:26:51 +00:00
* @ return string Returns select area
2020-10-31 13:32:18 +00:00
*/
public function formFilter ()
{
return '' ;
}
2009-01-25 22:04:55 +00:00
2020-10-31 13:32:18 +00:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
2026-01-29 23:37:23 +00:00
* Update the number of recipients
2020-10-31 13:32:18 +00:00
*
2026-01-29 23:37:23 +00:00
* @ param int $mailing_id Id of emailing
* @ return int Return integer < 0 if error , otherwise number of recipients
2020-10-31 13:32:18 +00:00
*/
public function update_nb ( $mailing_id )
{
// phpcs:enable
2026-01-29 23:37:23 +00:00
// Update the number of recipients in the mailing table
2025-01-15 07:42:14 +00:00
$sql = " SELECT COUNT(*) nb FROM " . $this -> db -> prefix () . " mailing_cibles " ;
2021-03-30 01:37:54 +00:00
$sql .= " WHERE fk_mailing = " . (( int ) $mailing_id );
2020-10-31 13:32:18 +00:00
$result = $this -> db -> query ( $sql );
2021-02-23 21:03:23 +00:00
if ( $result ) {
2020-10-31 13:32:18 +00:00
$obj = $this -> db -> fetch_object ( $result );
2025-09-15 14:16:22 +00:00
$nb = ( int ) $obj -> nb ;
2009-01-25 22:04:55 +00:00
2025-01-15 07:42:14 +00:00
$sql = " UPDATE " . $this -> db -> prefix () . " mailing " ;
2023-04-09 12:33:23 +00:00
$sql .= " SET nbemail = " . (( int ) $nb ) . " WHERE rowid = " . (( int ) $mailing_id );
2021-02-23 21:03:23 +00:00
if ( ! $this -> db -> query ( $sql )) {
2020-10-31 13:32:18 +00:00
dol_syslog ( $this -> db -> error ());
$this -> error = $this -> db -> error ();
return - 1 ;
}
} else {
return - 1 ;
}
return $nb ;
}
2005-02-12 17:41:13 +00:00
2020-10-31 13:32:18 +00:00
/**
2023-04-09 12:33:23 +00:00
* Add a list of targets into the database
2020-10-31 13:32:18 +00:00
*
* @ param int $mailing_id Id of emailing
2024-11-08 13:43:12 +00:00
* @ param 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
2023-12-06 14:46:39 +00:00
* @ return int Return integer < 0 if error , nb added if OK
2020-10-31 13:32:18 +00:00
*/
public function addTargetsToDatabase ( $mailing_id , $cibles )
{
global $conf ;
2012-05-09 14:45:15 +00:00
2020-10-31 13:32:18 +00:00
$this -> db -> begin ();
2009-01-25 22:04:55 +00:00
2024-11-08 13:43:12 +00:00
2020-10-31 13:32:18 +00:00
// Insert emailing targets from array into database
$j = 0 ;
$num = count ( $cibles );
2021-02-23 21:03:23 +00:00
foreach ( $cibles as $targetarray ) {
if ( ! empty ( $targetarray [ 'email' ])) { // avoid empty email address
2025-01-15 07:42:14 +00:00
$sql = " INSERT INTO " . $this -> db -> prefix () . " mailing_cibles " ;
2020-10-31 13:32:18 +00:00
$sql .= " (fk_mailing, " ;
$sql .= " fk_contact, " ;
$sql .= " lastname, firstname, email, other, source_url, source_id, " ;
2021-02-23 21:03:23 +00:00
$sql .= " tag, " ;
2020-10-31 13:32:18 +00:00
$sql .= " source_type) " ;
2023-04-09 12:44:22 +00:00
$sql .= " VALUES ( " . (( int ) $mailing_id ) . " , " ;
$sql .= ( empty ( $targetarray [ 'fk_contact' ]) ? '0' : ( int ) $targetarray [ 'fk_contact' ]) . " , " ;
2020-10-31 13:32:18 +00:00
$sql .= " ' " . $this -> db -> escape ( $targetarray [ 'lastname' ]) . " ', " ;
$sql .= " ' " . $this -> db -> escape ( $targetarray [ 'firstname' ]) . " ', " ;
$sql .= " ' " . $this -> db -> escape ( $targetarray [ 'email' ]) . " ', " ;
$sql .= " ' " . $this -> db -> escape ( $targetarray [ 'other' ]) . " ', " ;
$sql .= " ' " . $this -> db -> escape ( $targetarray [ 'source_url' ]) . " ', " ;
2024-11-08 13:43:12 +00:00
$sql .= ( empty ( $targetarray [ 'source_id' ]) ? 'null' : ( int ) $targetarray [ 'source_id' ]) . " , " ;
2023-05-03 12:22:30 +00:00
$sql .= " ' " . $this -> db -> escape ( dol_hash ( $conf -> file -> instance_unique_id . " ; " . $targetarray [ 'email' ] . " ; " . $targetarray [ 'lastname' ] . " ; " . (( int ) $mailing_id ) . " ; " . getDolGlobalString ( 'MAILING_EMAIL_UNSUBSCRIBE_KEY' ), 'md5' )) . " ', " ;
2020-10-31 13:32:18 +00:00
$sql .= " ' " . $this -> db -> escape ( $targetarray [ 'source_type' ]) . " ') " ;
dol_syslog ( __METHOD__ , LOG_DEBUG );
$result = $this -> db -> query ( $sql );
2021-02-23 21:03:23 +00:00
if ( $result ) {
2020-10-31 13:32:18 +00:00
$j ++ ;
} else {
2021-02-23 21:03:23 +00:00
if ( $this -> db -> errno () != 'DB_ERROR_RECORD_ALREADY_EXISTS' ) {
2020-10-31 13:32:18 +00:00
// Si erreur autre que doublon
dol_syslog ( $this -> db -> error () . ' : ' . $targetarray [ 'email' ]);
$this -> error = $this -> db -> error () . ' : ' . $targetarray [ 'email' ];
$this -> db -> rollback ();
return - 1 ;
}
}
}
}
2005-02-12 17:41:13 +00:00
2020-10-31 13:32:18 +00:00
dol_syslog ( __METHOD__ . " : mailing " . $j . " targets added " );
2005-02-12 17:41:13 +00:00
2020-10-31 13:32:18 +00:00
/*
2026-07-01 10:26:51 +00:00
//Update the status to show third-party emails that no longer wish to be contacted'
2025-01-15 07:42:14 +00:00
$sql = " UPDATE " . $this -> db -> prefix () . " mailing_cibles " ;
2021-02-23 21:03:23 +00:00
$sql .= " SET statut=3 " ;
2025-01-15 07:42:14 +00:00
$sql .= " WHERE fk_mailing = " . (( int ) $mailing_id ) . " AND email in (SELECT email FROM " . $this -> db -> prefix () . " societe where fk_stcomm=-1) " ;
2021-02-23 21:03:23 +00:00
$sql .= " AND source_type='thirdparty' " ;
2026-07-01 10:26:51 +00:00
dol_syslog ( __METHOD__ . " : mailing update status to display third-party emails that no longer wish to be contacted " );
2021-02-23 21:03:23 +00:00
$result = $this -> db -> query ( $sql );
2012-03-01 13:51:07 +00:00
2026-07-01 10:26:51 +00:00
//Update the status to show contact emails that no longer wish to be contacted'
2025-01-15 07:42:14 +00:00
$sql = " UPDATE " . $this -> db -> prefix () . " mailing_cibles " ;
2021-02-23 21:03:23 +00:00
$sql .= " SET statut=3 " ;
2025-01-15 07:42:14 +00:00
$sql .= " WHERE fk_mailing = " . (( int ) $mailing_id ) . " AND source_type='contact' AND (email in (SELECT sc.email FROM " . $this -> db -> prefix () . " socpeople AS sc " ;
$sql .= " INNER JOIN " . $this -> db -> prefix () . " societe s ON s.rowid=sc.fk_soc WHERE s.fk_stcomm=-1 OR no_email=1)) " ;
2026-07-01 10:26:51 +00:00
dol_syslog ( __METHOD__ . " : mailing update status to display contact emails that no longer wish to be contacted " , LOG_DEBUG );
2021-02-23 21:03:23 +00:00
$result = $this -> db -> query ( $sql );
2018-12-11 09:24:57 +00:00
*/
2012-04-04 12:45:48 +00:00
2023-04-09 12:33:23 +00:00
if ( empty ( $this -> evenunsubscribe )) {
2025-01-15 07:42:14 +00:00
$sql = " UPDATE " . $this -> db -> prefix () . " mailing_cibles as mc " ;
2025-03-31 23:08:31 +00:00
$sql .= " SET statut = 3 " ;
$sql .= " WHERE fk_mailing = " . (( int ) $mailing_id );
2025-01-15 07:42:14 +00:00
$sql .= " AND EXISTS (SELECT rowid FROM " . $this -> db -> prefix () . " mailing_unsubscribe as mu WHERE mu.email = mc.email and mu.entity = " . (( int ) $conf -> entity ) . " ) " ;
2018-12-11 09:24:57 +00:00
2023-04-09 12:33:23 +00:00
dol_syslog ( __METHOD__ . " :mailing update status to display emails that do not want to be contacted anymore " , LOG_DEBUG );
$result = $this -> db -> query ( $sql );
if ( ! $result ) {
dol_print_error ( $this -> db );
}
2020-10-31 13:32:18 +00:00
}
2012-03-01 13:51:07 +00:00
2023-04-09 12:33:23 +00:00
// Update nb of recipient into emailing record
2020-10-31 13:32:18 +00:00
$this -> update_nb ( $mailing_id );
2005-02-12 17:41:13 +00:00
2020-10-31 13:32:18 +00:00
$this -> db -> commit ();
2018-12-11 09:24:57 +00:00
2020-10-31 13:32:18 +00:00
return $j ;
}
2005-02-12 17:41:13 +00:00
2020-10-31 13:32:18 +00:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
2026-07-01 10:26:51 +00:00
* Deletes all recipients from the targets table
2020-10-31 13:32:18 +00:00
*
* @ param int $mailing_id Id of emailing
* @ return void
*/
public function clear_target ( $mailing_id )
{
// phpcs:enable
2025-01-15 07:42:14 +00:00
$sql = " DELETE FROM " . $this -> db -> prefix () . " mailing_cibles " ;
2021-03-30 15:53:25 +00:00
$sql .= " WHERE fk_mailing = " . (( int ) $mailing_id );
2005-02-12 17:41:13 +00:00
2021-02-23 21:03:23 +00:00
if ( ! $this -> db -> query ( $sql )) {
2020-10-31 13:32:18 +00:00
dol_syslog ( $this -> db -> error ());
}
2005-02-12 17:41:13 +00:00
2020-10-31 13:32:18 +00:00
$this -> update_nb ( $mailing_id );
}
2024-01-10 13:52:12 +00:00
/**
* Return list of widget . Function used by admin page htdoc / admin / widget .
* List is sorted by widget filename so by priority to run .
*
2024-11-08 13:43:12 +00:00
* @ param ? array < 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
2024-01-10 13:52:12 +00:00
*/
public static function getEmailingSelectorsList ( $forcedir = null )
{
global $langs , $db ;
$files = array ();
$fullpath = array ();
$relpath = array ();
$iscoreorexternal = array ();
$modules = array ();
$orders = array ();
$i = 0 ;
2024-01-11 01:47:42 +00:00
$diremailselector = array ( '/core/modules/mailings/' ); // $conf->modules_parts['emailings'] is not required
2024-01-10 13:52:12 +00:00
if ( is_array ( $forcedir )) {
2024-01-11 01:47:42 +00:00
$diremailselector = $forcedir ;
2024-01-10 13:52:12 +00:00
}
2024-01-11 01:47:42 +00:00
foreach ( $diremailselector as $reldir ) {
2024-01-10 13:52:12 +00:00
$dir = dol_buildpath ( $reldir , 0 );
$newdir = dol_osencode ( $dir );
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php at each call)
if ( ! is_dir ( $newdir )) {
continue ;
}
$handle = opendir ( $newdir );
if ( is_resource ( $handle )) {
while (( $file = readdir ( $handle )) !== false ) {
$reg = array ();
2024-01-11 01:47:42 +00:00
if ( is_readable ( $newdir . '/' . $file ) && preg_match ( '/^(.+)\.modules.php/' , $file , $reg )) {
2024-01-10 13:52:12 +00:00
if ( preg_match ( '/\.back$/' , $file ) || preg_match ( '/^(.+)\.disabled\.php/' , $file )) {
continue ;
}
$part1 = $reg [ 1 ];
2024-01-11 01:47:42 +00:00
//$modName = ucfirst($reg[1]);
$modName = 'mailing_' . $reg [ 1 ]; // name of selector submodule
//print "file=$file modName=$modName"; exit;
2024-01-10 13:52:12 +00:00
if ( in_array ( $modName , $modules )) {
$langs -> load ( " errors " );
2024-01-11 01:47:42 +00:00
print '<div class="error">' . $langs -> trans ( " Error " ) . ' : ' . $langs -> trans ( " ErrorDuplicateEmalingSelector " , $modName , " " ) . '</div>' ;
2024-01-10 13:52:12 +00:00
} else {
try {
2024-01-11 01:47:42 +00:00
//print $newdir.'/'.$file;
2024-01-10 13:52:12 +00:00
include_once $newdir . '/' . $file ;
} catch ( Exception $e ) {
print $e -> getMessage ();
}
}
$files [ $i ] = $file ;
$fullpath [ $i ] = $dir . '/' . $file ;
$relpath [ $i ] = preg_replace ( '/^\//' , '' , $reldir ) . '/' . $file ;
2024-01-11 01:47:42 +00:00
$iscoreorexternal [ $i ] = ( $reldir == '/core/modules/mailings/' ? 'internal' : 'external' );
2024-01-10 13:52:12 +00:00
$modules [ $i ] = $modName ;
$orders [ $i ] = $part1 ; // Set sort criteria value
$i ++ ;
}
}
closedir ( $handle );
}
}
//echo "<pre>";print_r($modules);echo "</pre>";
asort ( $orders );
$widget = array ();
$j = 0 ;
2024-01-11 01:47:42 +00:00
// Loop on each emailing selector
2024-01-10 13:52:12 +00:00
foreach ( $orders as $key => $value ) {
$modName = $modules [ $key ];
if ( empty ( $modName )) {
continue ;
}
if ( ! class_exists ( $modName )) {
2024-01-11 01:47:42 +00:00
print 'Error: An emailing selector file was found but its class "' . $modName . '" was not found.' . " <br> \n " ;
2024-01-10 13:52:12 +00:00
continue ;
}
$objMod = new $modName ( $db );
if ( is_object ( $objMod )) {
2024-08-18 16:16:08 +00:00
'@phan-var-force ModeleBoxes $objMod' ;
2024-01-10 13:52:12 +00:00
// Define disabledbyname and disabledbymodule
$disabledbyname = 0 ;
$disabledbymodule = 0 ; // TODO Set to 2 if module is not enabled
$module = '' ;
// Check if widget file is disabled by name
if ( preg_match ( '/NORUN$/i' , $files [ $key ])) {
$disabledbyname = 1 ;
}
2024-08-18 16:16:08 +00:00
// We set info of modules @phan-suppress-next-line PhanUndeclaredProperty
2024-01-10 13:52:12 +00:00
$widget [ $j ][ 'picto' ] = ( empty ( $objMod -> picto ) ? ( empty ( $objMod -> boximg ) ? img_object ( '' , 'generic' ) : $objMod -> boximg ) : img_object ( '' , $objMod -> picto ));
$widget [ $j ][ 'file' ] = $files [ $key ];
$widget [ $j ][ 'fullpath' ] = $fullpath [ $key ];
$widget [ $j ][ 'relpath' ] = $relpath [ $key ];
$widget [ $j ][ 'iscoreorexternal' ] = $iscoreorexternal [ $key ];
$widget [ $j ][ 'version' ] = empty ( $objMod -> version ) ? '' : $objMod -> version ;
2025-12-09 15:27:49 +00:00
$widget [ $j ][ 'status' ] = img_picto ( $langs -> trans ( " Active " ), 'tick' , 'class="pictofixedwidth"' );
2024-01-10 13:52:12 +00:00
if ( $disabledbyname > 0 || $disabledbymodule > 1 ) {
$widget [ $j ][ 'status' ] = '' ;
}
$text = '<b>' . $langs -> trans ( " Description " ) . ':</b><br>' ;
$text .= $objMod -> boxlabel . '<br>' ;
$text .= '<br><b>' . $langs -> trans ( " Status " ) . ':</b><br>' ;
if ( $disabledbymodule == 2 ) {
$text .= $langs -> trans ( " WidgetDisabledAsModuleDisabled " , $module ) . '<br>' ;
}
$widget [ $j ][ 'info' ] = $text ;
}
$j ++ ;
}
return $widget ;
}
2024-08-19 00:05:27 +00:00
/**
* 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 string [] Array with SQL requests
*/
public function getSqlArrayForStats ()
{
// Needs to be implemented in child class
$msg = get_class ( $this ) . " :: " . __FUNCTION__ . " not implemented " ;
dol_syslog ( $msg , LOG_ERR );
return array ();
}
2024-11-11 23:35:14 +00:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add destinations in the targets table
*
* @ param int $mailing_id Id of emailing
* @ return int Return integer < 0 on error , count of added when ok
*/
public function add_to_target ( $mailing_id )
{
// phpcs:enable
// Needs to be implemented in child class
$msg = get_class ( $this ) . " :: " . __FUNCTION__ . " not implemented " ;
dol_syslog ( $msg , LOG_ERR );
return - 1 ;
}
2005-02-11 23:41:42 +00:00
}