2012-08-22 21:27:53 +00:00
< ? php
2006-10-29 19:09:49 +00:00
/* Copyright ( C ) 2004 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2024-06-18 10:47:02 +00:00
* Copyright ( C ) 2005 - 2024 Laurent Destailleur < eldy @ users . sourceforge . net >
2018-10-27 12:43:12 +00:00
* Copyright ( C ) 2005 - 2010 Regis Houssin < regis . houssin @ inodbox . com >
2024-06-18 10:47:02 +00:00
* Copyright ( C ) 2014 Florian Henry < florian . henry @ open - concept . pro >
2026-04-27 12:52:01 +00:00
* Copyright ( C ) 2024 - 2026 MDW < mdeweerd @ users . noreply . github . com >
2026-04-07 01:27:23 +00:00
* Copyright ( C ) 2024 - 2026 Frédéric France < frederic . france @ free . fr >
2005-01-05 15:26:05 +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-01-05 15:26:05 +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 />.
2005-01-05 15:26:05 +00:00
*/
2005-04-06 23:23:01 +00:00
/**
2025-03-25 12:35:55 +00:00
* \file htdocs / comm / mailing / targetemailing . php
2009-01-25 22:04:55 +00:00
* \ingroup mailing
2024-06-18 10:47:02 +00:00
* \brief Page to define or view emailing targets
2009-01-25 22:04:55 +00:00
*/
2005-01-14 19:24:00 +00:00
2022-09-07 18:08:59 +00:00
// Load Dolibarr environment
2012-08-22 21:24:21 +00:00
require '../../main.inc.php' ;
2024-11-04 22:53:20 +00:00
/**
* @ var Conf $conf
* @ var DoliDB $db
* @ var HookManager $hookmanager
* @ var Translate $langs
* @ var User $user
*/
2026-03-03 20:05:07 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/modules/mailings/modules_mailings.php' ;
require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/mailing.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmailing.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/emailing.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php' ;
2024-11-04 22:53:20 +00:00
2018-05-26 18:32:23 +00:00
// Load translation files required by the page
2023-04-23 23:03:43 +00:00
$langs -> loadLangs ( array ( " mails " , " admin " ));
2005-01-14 19:24:00 +00:00
2024-11-09 15:18:54 +00:00
$action = GETPOST ( 'action' , 'aZ09' );
2025-09-18 09:40:56 +00:00
$toselect = GETPOST ( 'toselect' , 'array:int' ); // Array of ids of elements selected into a list
2026-03-03 20:05:07 +00:00
$contextpage = GETPOST ( 'contextpage' , 'aZ' );
2024-11-09 15:18:54 +00:00
$massaction = GETPOST ( 'massaction' , 'alpha' ); // The bulk action (combo box choice into lists)
$mode = GETPOST ( 'mode' , 'aZ' ); // The display mode ('list', 'kanban', 'hierarchy', 'calendar', 'gantt', ...)
2016-11-11 13:03:57 +00:00
// Load variable for pagination
2024-03-16 10:41:00 +00:00
$limit = GETPOSTINT ( 'limit' ) ? GETPOSTINT ( 'limit' ) : $conf -> liste_limit ;
2020-09-18 15:13:01 +00:00
$sortfield = GETPOST ( 'sortfield' , 'aZ09comma' );
2020-09-17 12:31:25 +00:00
$sortorder = GETPOST ( 'sortorder' , 'aZ09comma' );
2024-03-01 00:52:40 +00:00
$page = GETPOSTISSET ( 'pageplusone' ) ? ( GETPOSTINT ( 'pageplusone' ) - 1 ) : GETPOSTINT ( " page " );
2021-02-23 17:59:19 +00:00
if ( empty ( $page ) || $page == - 1 ) {
$page = 0 ;
} // If $page is not defined, or '' or -1
2016-02-12 12:58:24 +00:00
$offset = $limit * $page ;
2010-11-20 13:08:44 +00:00
$pageprev = $page - 1 ;
$pagenext = $page + 1 ;
2021-02-23 17:59:19 +00:00
if ( ! $sortfield ) {
$sortfield = " mc.statut,email " ;
}
if ( ! $sortorder ) {
$sortorder = " DESC,ASC " ;
}
2019-11-13 18:35:02 +00:00
Fix: GETPOST(...,'int') to GETPOSTINT(...) (#28448)
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: Update spelling exceptions
* Qual: Ignore Phan Notice
2024-02-27 13:05:53 +00:00
$id = GETPOSTINT ( 'id' );
$rowid = GETPOSTINT ( 'rowid' );
2019-11-13 18:35:02 +00:00
$search_lastname = GETPOST ( " search_lastname " , 'alphanohtml' );
$search_firstname = GETPOST ( " search_firstname " , 'alphanohtml' );
$search_email = GETPOST ( " search_email " , 'alphanohtml' );
$search_other = GETPOST ( " search_other " , 'alphanohtml' );
2024-04-19 11:34:48 +00:00
$search_dest_status = GETPOST ( 'search_dest_status' , 'int' );
2012-01-26 22:05:59 +00:00
// Search modules dirs
2012-05-09 14:40:54 +00:00
$modulesdir = dolGetModulesDirs ( '/mailings' );
2012-01-26 22:05:59 +00:00
2012-06-13 19:45:47 +00:00
$object = new Mailing ( $db );
2019-11-13 18:35:02 +00:00
$result = $object -> fetch ( $id );
2012-06-13 19:45:47 +00:00
2024-06-30 19:02:50 +00:00
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
2021-05-18 12:58:46 +00:00
$hookmanager -> initHooks ( array ( 'ciblescard' , 'globalcard' ));
2005-02-15 21:18:35 +00:00
2023-04-23 19:42:05 +00:00
$sqlmessage = '' ;
2024-11-11 23:35:14 +00:00
$mesgs = array ();
2023-04-23 19:42:05 +00:00
// List of sending methods
$listofmethods = array ();
//$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup');
$listofmethods [ 'mail' ] = 'PHP mail function' ;
//$listofmethods['simplemail']='Simplemail class';
$listofmethods [ 'smtps' ] = 'SMTP/SMTPS socket library' ;
if ( version_compare ( phpversion (), '7.0' , '>=' )) {
$listofmethods [ 'swiftmailer' ] = 'Swift Mailer socket library' ;
}
2026-03-05 10:40:00 +00:00
$arrayfields = array ();
2021-03-29 20:43:39 +00:00
// Security check
2023-11-27 10:39:32 +00:00
if ( ! $user -> hasRight ( 'mailing' , 'lire' ) || ( ! getDolGlobalString ( 'EXTERNAL_USERS_ARE_AUTHORIZED' ) && $user -> socid > 0 )) {
2021-03-29 20:43:39 +00:00
accessforbidden ();
}
2024-06-12 12:56:45 +00:00
if ( empty ( $action ) && empty ( $object -> id )) {
accessforbidden ( 'Object not found' );
}
2025-09-04 12:08:37 +00:00
$permissiontoread = $user -> hasRight ( 'mailing' , 'lire' );
2024-06-12 12:56:45 +00:00
$permissiontocreate = $user -> hasRight ( 'mailing' , 'creer' );
$permissiontovalidatesend = $user -> hasRight ( 'mailing' , 'valider' );
$permissiontodelete = $user -> hasRight ( 'mailing' , 'supprimer' );
2021-03-29 20:43:39 +00:00
2005-02-11 23:41:42 +00:00
/*
* Actions
*/
2024-08-21 13:28:23 +00:00
if ( GETPOST ( 'cancel' , 'alpha' )) {
$action = 'list' ;
$massaction = '' ;
}
if ( ! GETPOST ( 'confirmmassaction' , 'alpha' )) {
$massaction = '' ;
}
2009-08-12 12:59:14 +00:00
2024-06-12 12:56:45 +00:00
if ( $action == 'add' && $permissiontocreate ) { // Add recipients
2019-11-13 18:35:02 +00:00
$module = GETPOST ( " module " , 'alpha' );
$result = - 1 ;
2024-09-18 01:27:25 +00:00
$obj = null ;
2009-01-26 21:57:14 +00:00
2021-02-23 17:59:19 +00:00
foreach ( $modulesdir as $dir ) {
2020-10-31 13:32:18 +00:00
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
dol_syslog ( " Scan directory " . $dir . " for modules " );
2009-01-26 21:57:14 +00:00
2020-10-31 13:32:18 +00:00
// Loading Class
$file = $dir . " / " . $module . " .modules.php " ;
$classname = " mailing_ " . $module ;
2009-01-26 21:57:14 +00:00
2021-02-23 17:59:19 +00:00
if ( file_exists ( $file )) {
2023-04-08 15:16:22 +00:00
include_once $file ;
2009-01-26 21:57:14 +00:00
2012-01-26 22:05:59 +00:00
// Add targets into database
2023-04-08 15:16:22 +00:00
dol_syslog ( " Call add_to_target() on class " . $classname . " evenunsubscribe= " . $object -> evenunsubscribe );
2023-03-06 22:13:33 +00:00
2024-09-18 01:27:25 +00:00
$obj = null ;
2023-04-08 15:16:22 +00:00
if ( class_exists ( $classname )) {
$obj = new $classname ( $db );
2024-09-18 01:27:25 +00:00
'@phan-var-force MailingTargets $obj' ;
2023-04-08 15:16:22 +00:00
$obj -> evenunsubscribe = $object -> evenunsubscribe ;
$result = $obj -> add_to_target ( $id );
$sqlmessage = $obj -> sql ;
} else {
$result = - 1 ;
break ;
}
2009-01-26 21:57:14 +00:00
}
}
2021-02-23 17:59:19 +00:00
if ( $result > 0 ) {
2024-02-09 14:58:49 +00:00
// If status of emailing is sent completely, change to to send partially
if ( $object -> status == $object :: STATUS_SENTCOMPLETELY ) {
$object -> setStatut ( $object :: STATUS_SENTPARTIALY );
}
2019-01-27 10:55:16 +00:00
setEventMessages ( $langs -> trans ( " XTargetsAdded " , $result ), null , 'mesgs' );
2021-04-12 12:26:09 +00:00
$action = '' ;
2009-01-26 21:57:14 +00:00
}
2021-02-23 17:59:19 +00:00
if ( $result == 0 ) {
2015-11-06 08:36:16 +00:00
setEventMessages ( $langs -> trans ( " WarningNoEMailsAdded " ), null , 'warnings' );
2009-01-26 21:57:14 +00:00
}
2024-09-18 01:27:25 +00:00
if ( $result < 0 && is_object ( $obj )) {
2019-11-13 18:35:02 +00:00
setEventMessages ( $langs -> trans ( " Error " ) . ( $obj -> error ? ' ' . $obj -> error : '' ), null , 'errors' );
2009-01-26 21:57:14 +00:00
}
2005-01-05 15:26:05 +00:00
}
2024-06-12 12:56:45 +00:00
if ( GETPOSTINT ( 'clearlist' ) && $permissiontocreate ) {
2015-11-06 08:36:16 +00:00
// Loading Class
2015-02-10 10:38:13 +00:00
$obj = new MailingTargets ( $db );
2012-01-26 22:05:59 +00:00
$obj -> clear_target ( $id );
2016-06-19 09:59:55 +00:00
/* Avoid this to allow reposition
2012-08-31 03:58:38 +00:00
header ( " Location: " . $_SERVER [ 'PHP_SELF' ] . " ?id= " . $id );
2009-01-26 21:57:14 +00:00
exit ;
2016-06-19 09:59:55 +00:00
*/
2005-02-12 17:41:13 +00:00
}
2025-09-04 12:08:37 +00:00
if ( GETPOSTINT ( 'exportcsv' ) && $permissiontoread ) { // @phpstan-ignore-line
2019-10-13 13:00:07 +00:00
$completefilename = 'targets_emailing' . $object -> id . '_' . dol_print_date ( dol_now (), 'dayhourlog' ) . '.csv' ;
2019-10-12 18:12:24 +00:00
header ( 'Content-Type: text/csv' );
2019-11-13 18:35:02 +00:00
header ( 'Content-Disposition: attachment;filename=' . $completefilename );
2019-10-12 18:12:24 +00:00
// List of selected targets
2020-12-29 01:20:10 +00:00
$sql = " SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut as status, mc.date_envoi, mc.tms, " ;
$sql .= " mc.source_id, mc.source_type, mc.error_text " ;
2019-10-12 18:12:24 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " mailing_cibles as mc " ;
2022-05-28 18:42:29 +00:00
$sql .= " WHERE mc.fk_mailing = " . (( int ) $object -> id );
2019-10-12 18:12:24 +00:00
$sql .= $db -> order ( $sortfield , $sortorder );
2019-11-13 18:35:02 +00:00
$resql = $db -> query ( $sql );
2021-02-23 17:59:19 +00:00
if ( $resql ) {
2019-10-12 18:12:24 +00:00
$num = $db -> num_rows ( $resql );
$sep = ',' ;
2021-02-23 17:59:19 +00:00
while ( $obj = $db -> fetch_object ( $resql )) {
2019-11-13 18:35:02 +00:00
print $obj -> rowid . $sep ;
2020-12-29 01:20:10 +00:00
print '"' . $obj -> lastname . '"' . $sep ;
print '"' . $obj -> firstname . '"' . $sep ;
2019-11-13 18:35:02 +00:00
print $obj -> email . $sep ;
print $obj -> other . $sep ;
print $obj -> tms . $sep ;
print $obj -> source_type . $sep ;
2020-12-29 01:20:10 +00:00
print $obj -> source_id . $sep ;
print $obj -> date_envoi . $sep ;
print $obj -> status . $sep ;
print '"' . $obj -> error_text . '"' . $sep ;
2019-10-12 18:12:24 +00:00
print " \n " ;
}
exit ;
2020-05-21 13:05:19 +00:00
} else {
2019-10-12 18:12:24 +00:00
dol_print_error ( $db );
}
exit ;
}
2024-06-12 12:56:45 +00:00
if ( $action == 'delete' && $permissiontocreate ) {
2009-01-26 21:57:14 +00:00
// Ici, rowid indique le destinataire et id le mailing
2021-04-24 18:18:11 +00:00
$sql = " DELETE FROM " . MAIN_DB_PREFIX . " mailing_cibles WHERE rowid = " . (( int ) $rowid );
2019-11-13 18:35:02 +00:00
$resql = $db -> query ( $sql );
2021-02-23 17:59:19 +00:00
if ( $resql ) {
if ( ! empty ( $id )) {
2015-02-10 10:38:13 +00:00
$obj = new MailingTargets ( $db );
2012-06-15 09:20:09 +00:00
$obj -> update_nb ( $id );
2012-11-16 23:58:43 +00:00
2019-05-21 19:47:25 +00:00
setEventMessages ( $langs -> trans ( " RecordDeleted " ), null , 'mesgs' );
2020-05-21 13:05:19 +00:00
} else {
2014-09-18 18:33:37 +00:00
header ( " Location: list.php " );
2012-05-21 14:16:24 +00:00
exit ;
}
2020-05-21 13:05:19 +00:00
} else {
2009-02-20 22:53:15 +00:00
dol_print_error ( $db );
2009-01-26 21:57:14 +00:00
}
2005-04-20 18:47:41 +00:00
}
2005-01-14 19:24:00 +00:00
2024-08-21 13:28:23 +00:00
if ( $action == " confirm_reset_target " && $permissiontocreate ) {
if ( $object -> id > 0 ) {
$db -> begin ();
$nbok = 0 ;
$error = 0 ;
foreach ( $toselect as $toselectid ) {
$result = $object -> resetTargetErrorStatus ( $user , $toselectid );
if ( $result < 0 ) {
setEventMessages ( $object -> error , $object -> errors , 'errors' );
$error ++ ;
break ;
} elseif ( $result > 0 ) {
$nbok ++ ;
} else {
setEventMessages ( $object -> error , $object -> errors , 'errors' );
$error ++ ;
}
}
if ( ! $error ) {
setEventMessages ( $langs -> trans ( " RecordsModified " , $nbok ), null , 'mesgs' );
$db -> commit ();
} else {
$db -> rollback ();
}
}
}
2017-08-25 19:12:22 +00:00
// Purge search criteria
2021-02-23 17:59:19 +00:00
if ( GETPOST ( 'button_removefilter_x' , 'alpha' ) || GETPOST ( 'button_removefilter.x' , 'alpha' ) || GETPOST ( 'button_removefilter' , 'alpha' )) { // All tests are required to be compatible with all browsers
2019-11-13 18:35:02 +00:00
$search_lastname = '' ;
$search_firstname = '' ;
$search_email = '' ;
$search_other = '' ;
$search_dest_status = '' ;
2024-08-21 13:28:23 +00:00
$toselect = array ();
2008-04-04 11:31:52 +00:00
}
2005-02-11 23:41:42 +00:00
2023-04-08 15:16:22 +00:00
// Action update description of emailing
2026-04-07 01:27:23 +00:00
if (( $action == 'settitle' || $action == 'setemail_from' || $action == 'setemail_replyto' || $action == 'setemail_errorsto' || $action == 'setevenunsubscribe' ) && $permissiontocreate ) {
2025-09-26 22:08:56 +00:00
$upload_dir = $conf -> mailing -> dir_output . " / " . get_exdir ( $object -> id , getDolGlobalInt ( 'MAILING_USE_NEW_PATH_FOR_FILES' ) ? 0 : 2 , 0 , 1 , $object , 'mailing' );
2023-04-08 15:16:22 +00:00
2026-04-03 19:43:29 +00:00
$mesg = '' ;
2024-08-31 15:23:13 +00:00
if ( $action == 'settitle' ) { // Test on permission already done
2023-04-08 15:16:22 +00:00
$object -> title = trim ( GETPOST ( 'title' , 'alpha' ));
2024-08-31 15:23:13 +00:00
} elseif ( $action == 'setemail_from' ) { // Test on permission already done
2023-04-08 15:16:22 +00:00
$object -> email_from = trim ( GETPOST ( 'email_from' , 'alphawithlgt' )); // Must allow 'name <email>'
2024-08-31 15:23:13 +00:00
} elseif ( $action == 'setemail_replyto' ) { // Test on permission already done
2023-04-08 15:16:22 +00:00
$object -> email_replyto = trim ( GETPOST ( 'email_replyto' , 'alphawithlgt' )); // Must allow 'name <email>'
2024-08-31 15:23:13 +00:00
} elseif ( $action == 'setemail_errorsto' ) { // Test on permission already done
2023-04-08 15:16:22 +00:00
$object -> email_errorsto = trim ( GETPOST ( 'email_errorsto' , 'alphawithlgt' )); // Must allow 'name <email>'
2024-08-31 15:23:13 +00:00
} elseif ( $action == 'setevenunsubscribe' ) { // Test on permission already done
2023-04-08 15:16:22 +00:00
$object -> evenunsubscribe = ( GETPOST ( 'evenunsubscribe' ) ? 1 : 0 );
}
2026-04-07 01:27:23 +00:00
if ( $action == 'settitle' && empty ( $object -> title )) { // Test on permission already done
$mesg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " MailTitle " ));
}
if ( $action == 'setemail_from' && empty ( $object -> email_from )) { // Test on permission already done
$mesg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " MailFrom " ));
}
2023-04-08 15:16:22 +00:00
if ( ! $mesg ) {
$result = $object -> update ( $user );
if ( $result >= 0 ) {
header ( " Location: " . $_SERVER [ 'PHP_SELF' ] . " ?id= " . $object -> id );
exit ;
}
$mesg = $object -> error ;
}
2024-06-12 12:56:45 +00:00
setEventMessages ( $mesg , $mesgs , 'errors' );
2023-04-08 15:16:22 +00:00
$action = " " ;
}
2008-08-01 20:59:33 +00:00
2005-01-05 15:26:05 +00:00
/*
2009-08-12 12:59:14 +00:00
* View
2005-01-05 15:26:05 +00:00
*/
2018-01-29 11:58:33 +00:00
2011-11-08 09:18:45 +00:00
$form = new Form ( $db );
2014-05-29 12:26:27 +00:00
$formmailing = new FormMailing ( $db );
2025-03-25 12:35:55 +00:00
2025-04-22 13:51:11 +00:00
$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing' ;
llxHeader ( '' , $langs -> trans ( " Mailing " ), $help_url );
2024-08-21 13:28:23 +00:00
$arrayofselected = is_array ( $toselect ) ? $toselect : array ();
2024-11-10 10:16:23 +00:00
$totalarray = [
'nbfield' => 0 ,
];
2009-07-29 18:41:39 +00:00
2021-02-23 17:59:19 +00:00
if ( $object -> fetch ( $id ) >= 0 ) {
2012-06-13 19:45:47 +00:00
$head = emailing_prepare_head ( $object );
2009-01-25 22:04:55 +00:00
2025-08-07 11:42:11 +00:00
print dol_get_fiche_head ( $head , 'targets' , $langs -> trans ( " Mailing " ), - 1 , $object -> picto );
2009-01-25 22:04:55 +00:00
2019-12-05 14:22:06 +00:00
$linkback = '<a href="' . DOL_URL_ROOT . '/comm/mailing/list.php?restore_lastsearch_values=1">' . $langs -> trans ( " BackToList " ) . '</a>' ;
2012-07-28 19:49:47 +00:00
2023-02-23 11:08:43 +00:00
$morehtmlref = '<div class="refidno">' ;
// Ref customer
$morehtmlref .= $form -> editfieldkey ( " " , 'title' , $object -> title , $object , 0 , 'string' , '' , 0 , 1 );
$morehtmlref .= $form -> editfieldval ( " " , 'title' , $object -> title , $object , 0 , 'string' , '' , null , null , '' , 1 );
$morehtmlref .= '</div>' ;
2024-03-12 18:49:55 +00:00
$morehtmlstatus = '' ;
2018-01-29 11:46:07 +00:00
$nbtry = $nbok = 0 ;
2024-02-09 14:58:49 +00:00
if ( $object -> status == $object :: STATUS_SENTPARTIALY || $object -> status == $object :: STATUS_SENTCOMPLETELY ) {
2018-01-29 11:46:07 +00:00
$nbtry = $object -> countNbOfTargets ( 'alreadysent' );
$nbko = $object -> countNbOfTargets ( 'alreadysentko' );
2019-12-13 14:52:08 +00:00
$nbok = ( $nbtry - $nbko );
2018-01-29 11:46:07 +00:00
2024-03-12 18:49:55 +00:00
$morehtmlstatus .= ' (' . $nbtry . '/' . $object -> nbemail ;
2021-02-23 17:59:19 +00:00
if ( $nbko ) {
2024-03-12 18:49:55 +00:00
$morehtmlstatus .= ' - ' . $nbko . ' ' . $langs -> trans ( " Error " );
2021-02-23 17:59:19 +00:00
}
2024-03-12 18:49:55 +00:00
$morehtmlstatus .= ') ' ;
2018-01-29 11:46:07 +00:00
}
2017-08-02 11:31:53 +00:00
2024-03-12 18:49:55 +00:00
dol_banner_tab ( $object , 'id' , $linkback , 1 , 'rowid' , 'ref' , $morehtmlref , '' , 0 , '' , $morehtmlstatus );
2016-11-11 00:55:53 +00:00
2017-04-17 11:02:40 +00:00
print '<div class="fichecenter">' ;
2023-04-08 15:16:22 +00:00
print '<div class="fichehalfleft">' ;
2016-11-11 00:55:53 +00:00
print '<div class="underbanner clearboth"></div>' ;
2017-08-02 11:31:53 +00:00
2025-04-22 13:51:11 +00:00
print '<table class="border centpercent tableforfield">' . " \n " ;
2017-04-17 11:02:40 +00:00
2024-06-12 12:56:45 +00:00
// From
2025-04-22 13:51:11 +00:00
print '<tr><td class="titlefield">' ;
print $langs -> trans ( " MailFrom " ) . '</td><td>' ;
2019-12-13 14:52:08 +00:00
$emailarray = CMailFile :: getArrayAddress ( $object -> email_from );
2019-12-16 12:06:25 +00:00
foreach ( $emailarray as $email => $name ) {
2019-12-13 14:52:08 +00:00
if ( $name && $name != $email ) {
print dol_escape_htmltag ( $name ) . ' <' . $email ;
print '>' ;
if ( ! isValidEmail ( $email )) {
$langs -> load ( " errors " );
print img_warning ( $langs -> trans ( " ErrorBadEMail " , $email ));
}
} else {
print dol_print_email ( $object -> email_from , 0 , 0 , 0 , 0 , 1 );
}
}
2024-11-10 10:16:23 +00:00
2019-12-13 14:52:08 +00:00
print '</td></tr>' ;
2009-07-29 18:41:39 +00:00
// Errors to
2024-02-09 14:58:49 +00:00
if ( $object -> messtype != 'sms' ) {
print '<tr><td>' . $langs -> trans ( " MailErrorsTo " ) . '</td><td>' ;
$emailarray = CMailFile :: getArrayAddress ( $object -> email_errorsto );
foreach ( $emailarray as $email => $name ) {
if ( $name != $email ) {
2025-03-12 19:41:50 +00:00
print dol_escape_htmltag (( string ) $name ) . ' <' . $email ;
2024-02-09 14:58:49 +00:00
print '>' ;
2024-06-12 12:56:45 +00:00
if ( $email && ! isValidEmail ( $email )) {
2024-02-09 14:58:49 +00:00
$langs -> load ( " errors " );
print img_warning ( $langs -> trans ( " ErrorBadEMail " , $email ));
2024-06-12 12:56:45 +00:00
} elseif ( $email && ! isValidMailDomain ( $email )) {
$langs -> load ( " errors " );
print img_warning ( $langs -> trans ( " ErrorBadMXDomain " , $email ));
2024-02-09 14:58:49 +00:00
}
} else {
print dol_print_email ( $object -> email_errorsto , 0 , 0 , 0 , 0 , 1 );
2019-12-13 14:52:08 +00:00
}
}
2024-02-09 14:58:49 +00:00
print '</td></tr>' ;
2019-12-13 14:52:08 +00:00
}
2009-07-29 18:41:39 +00:00
2024-06-12 12:56:45 +00:00
// Reply to
if ( $object -> messtype != 'sms' ) {
print '<tr><td>' ;
2025-03-12 19:41:50 +00:00
print $form -> editfieldkey ( " MailReply " , 'email_replyto' , $object -> email_replyto , $object , ( int ) ( $user -> hasRight ( 'mailing' , 'creer' ) && $object -> status < $object :: STATUS_SENTCOMPLETELY ), 'string' );
2024-06-12 12:56:45 +00:00
print '</td><td>' ;
print $form -> editfieldval ( " MailReply " , 'email_replyto' , $object -> email_replyto , $object , $user -> hasRight ( 'mailing' , 'creer' ) && $object -> status < $object :: STATUS_SENTCOMPLETELY , 'string' );
$email = CMailFile :: getValidAddress ( $object -> email_replyto , 2 );
if ( $action != 'editemail_replyto' ) {
if ( $email && ! isValidEmail ( $email )) {
$langs -> load ( " errors " );
print img_warning ( $langs -> trans ( " ErrorBadEMail " , $email ));
} elseif ( $email && ! isValidMailDomain ( $email )) {
$langs -> load ( " errors " );
print img_warning ( $langs -> trans ( " ErrorBadMXDomain " , $email ));
}
}
print '</td></tr>' ;
}
2023-04-08 15:16:22 +00:00
print '</table>' ;
print '</div>' ;
print '<div class="fichehalfright">' ;
print '<div class="underbanner clearboth"></div>' ;
print '<table class="border centpercent tableforfield">' ;
2023-04-09 11:09:39 +00:00
// Number of distinct emails
2024-02-09 14:58:49 +00:00
print '<tr><td>' ;
2009-08-26 09:50:00 +00:00
print $langs -> trans ( " TotalNbOfDistinctRecipients " );
2023-04-09 11:09:39 +00:00
print '</td><td>' ;
2019-11-13 18:35:02 +00:00
$nbemail = ( $object -> nbemail ? $object -> nbemail : 0 );
2021-02-23 17:59:19 +00:00
if ( is_numeric ( $nbemail )) {
2025-04-22 13:51:11 +00:00
$htmltooltip = '' ;
2024-06-12 12:56:45 +00:00
if (( getDolGlobalString ( 'MAILING_LIMIT_SENDBYWEB' ) && getDolGlobalInt ( 'MAILING_LIMIT_SENDBYWEB' ) < $nbemail ) && ( $object -> status == 1 || ( $object -> status == 2 && $nbtry < $nbemail ))) {
2023-11-27 11:24:18 +00:00
if ( getDolGlobalInt ( 'MAILING_LIMIT_SENDBYWEB' ) > 0 ) {
2025-04-22 13:51:11 +00:00
$htmltooltip .= $langs -> trans ( 'LimitSendingEmailing' , getDolGlobalString ( 'MAILING_LIMIT_SENDBYWEB' ));
2020-05-21 13:05:19 +00:00
} else {
2025-04-22 13:51:11 +00:00
$htmltooltip .= $langs -> trans ( 'SendingFromWebInterfaceIsNotAllowed' );
2018-01-26 14:12:40 +00:00
}
}
2021-02-23 17:59:19 +00:00
if ( empty ( $nbemail )) {
2023-04-09 11:00:34 +00:00
$nbemail .= ' ' . img_warning ( $langs -> trans ( 'ToAddRecipientsChooseHere' )); //.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
2021-02-23 17:59:19 +00:00
}
2025-04-22 13:51:11 +00:00
if ( $htmltooltip ) {
2025-05-31 10:39:55 +00:00
print $form -> textwithpicto ( $nbemail , $htmltooltip , 1 , 'info' );
2020-05-21 13:05:19 +00:00
} else {
2018-01-26 14:12:40 +00:00
print $nbemail ;
}
2009-08-26 09:50:00 +00:00
}
print '</td></tr>' ;
2009-07-29 18:41:39 +00:00
2023-04-23 19:42:05 +00:00
print '<tr><td>' ;
print $langs -> trans ( " MAIN_MAIL_SENDMODE " );
print '</td><td>' ;
2024-06-12 12:56:45 +00:00
if ( $object -> messtype != 'sms' ) {
if ( getDolGlobalString ( 'MAIN_MAIL_SENDMODE_EMAILING' ) && getDolGlobalString ( 'MAIN_MAIL_SENDMODE_EMAILING' ) != 'default' ) {
$text = $listofmethods [ getDolGlobalString ( 'MAIN_MAIL_SENDMODE_EMAILING' )];
} elseif ( getDolGlobalString ( 'MAIN_MAIL_SENDMODE' )) {
$text = $listofmethods [ getDolGlobalString ( 'MAIN_MAIL_SENDMODE' )];
} else {
$text = $listofmethods [ 'mail' ];
}
print $text ;
if ( getDolGlobalString ( 'MAIN_MAIL_SENDMODE_EMAILING' ) != 'default' ) {
2025-04-22 13:51:11 +00:00
if ( getDolGlobalString ( 'MAIN_MAIL_SENDMODE_EMAILING' ) != 'mail' ) {
2024-06-12 12:56:45 +00:00
print ' <span class="opacitymedium">(' . getDolGlobalString ( 'MAIN_MAIL_SMTP_SERVER_EMAILING' , getDolGlobalString ( 'MAIN_MAIL_SMTP_SERVER' )) . ')</span>' ;
}
} elseif ( getDolGlobalString ( 'MAIN_MAIL_SENDMODE' ) != 'mail' && getDolGlobalString ( 'MAIN_MAIL_SMTP_SERVER' )) {
print ' <span class="opacitymedium">(' . getDolGlobalString ( 'MAIN_MAIL_SMTP_SERVER' ) . ')</span>' ;
2023-04-23 19:42:05 +00:00
}
2024-06-12 12:56:45 +00:00
} else {
print 'SMS ' ;
2023-04-23 19:42:05 +00:00
print ' <span class="opacitymedium">(' . getDolGlobalString ( 'MAIN_MAIL_SMTP_SERVER' ) . ')</span>' ;
}
print '</td></tr>' ;
2023-04-08 15:16:22 +00:00
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php' ;
2009-01-26 21:57:14 +00:00
print '</table>' ;
2023-04-08 15:16:22 +00:00
print '</div>' ;
print '</div>' ;
2009-01-26 21:57:14 +00:00
2023-04-08 15:16:22 +00:00
print '<div class="clearboth"></div>' ;
2009-01-26 21:57:14 +00:00
2020-10-27 17:19:31 +00:00
print dol_get_fiche_end ();
2017-08-02 11:31:53 +00:00
2009-01-26 21:57:14 +00:00
2024-02-09 14:58:49 +00:00
$newcardbutton = '' ;
$allowaddtarget = ( $object -> status == $object :: STATUS_DRAFT );
if ( GETPOST ( 'allowaddtarget' )) {
$allowaddtarget = 1 ;
}
if ( ! $allowaddtarget ) {
$newcardbutton .= dolGetButtonTitle ( $langs -> trans ( 'New' ), '' , 'fa fa-plus-circle' , $_SERVER [ " PHP_SELF " ] . '?id=' . $object -> id . '&allowaddtarget=1' , '' , $user -> hasRight ( 'mailing' , 'creer' ));
}
2013-06-12 20:12:06 +00:00
2010-12-13 18:40:04 +00:00
// Show email selectors
2023-10-10 07:14:30 +00:00
if ( $allowaddtarget && $user -> hasRight ( 'mailing' , 'creer' )) {
2026-07-24 03:41:18 +00:00
print '<div class="info">' ;
print $langs -> trans ( " ToAddRecipientsChooseHere " ) . '...' ;
//print ($user->admin ? info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"), 1) : '');
print '</div>' ;
2009-07-29 18:41:39 +00:00
2022-01-31 11:02:48 +00:00
print '<div class="div-table-responsive">' ;
2023-06-04 17:06:32 +00:00
print '<div class="tagtable centpercentwithout1imp liste_titre_bydiv borderbottom" id="tablelines">' ;
2017-08-02 11:31:53 +00:00
2016-11-26 11:21:50 +00:00
print '<div class="tagtr liste_titre">' ;
2023-02-25 01:43:37 +00:00
print '<div class="tagtd"></div>' ;
2026-07-24 03:41:18 +00:00
print '<div class="tagtd">' . $langs -> trans ( " RecipientSelectionModules " );
print ( $user -> admin ? info_admin ( $langs -> trans ( " YouCanAddYourOwnPredefindedListHere " ), 1 ) : '' );
print '</div>' ;
2024-02-09 14:58:49 +00:00
print '<div class="tagtd center maxwidth150">' ;
if ( $object -> messtype != 'sms' ) {
print $langs -> trans ( " NbOfUniqueEMails " );
} else {
print $langs -> trans ( " NbOfUniquePhones " );
}
2023-04-09 11:00:34 +00:00
print '</div>' ;
2024-02-09 14:58:49 +00:00
print '<div class="tagtd left"><div class="inline-block">' . $langs -> trans ( " Filters " ) . '</div>' ;
if ( $object -> messtype != 'sms' ) {
2025-03-25 12:35:55 +00:00
print ' <div class="inline-block valignmiddle">' . $langs -> trans ( " EvenUnsubscribe " ) . ' ' ;
2026-07-24 03:41:18 +00:00
print ajax_object_onoff ( $object , 'evenunsubscribe' , 'evenunsubscribe' , 'EvenUnsubscribe:switch_on:warning' , 'EvenUnsubscribe' , array (), 'small valignmiddle reposition' , '' , 1 , 'allowaddtarget=1' );
2024-02-09 14:58:49 +00:00
print '</div>' ;
}
2023-04-09 11:00:34 +00:00
print '</div>' ;
2016-11-26 11:21:50 +00:00
print '<div class="tagtd"> </div>' ;
2022-01-31 11:02:48 +00:00
print '</div>' ; // End tr
2017-08-02 11:31:53 +00:00
2009-01-26 21:57:14 +00:00
clearstatcache ();
2008-12-07 19:19:32 +00:00
2021-02-23 17:59:19 +00:00
foreach ( $modulesdir as $dir ) {
2020-10-31 13:32:18 +00:00
$modulenames = array ();
2009-01-25 22:04:55 +00:00
2020-10-31 13:32:18 +00:00
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
dol_syslog ( " Scan directory " . $dir . " for modules " );
$handle = @ opendir ( $dir );
2021-02-23 17:59:19 +00:00
if ( is_resource ( $handle )) {
while (( $file = readdir ( $handle )) !== false ) {
2023-12-27 11:12:20 +00:00
if ( substr ( $file , 0 , 1 ) != '.' && substr ( $file , 0 , 3 ) != 'CVS' ) {
2021-07-31 15:20:48 +00:00
$reg = array ();
2021-02-23 17:59:19 +00:00
if ( preg_match ( " /(.*) \ .modules \ .php $ /i " , $file , $reg )) {
if ( $reg [ 1 ] == 'example' ) {
continue ;
}
2019-11-13 18:35:02 +00:00
$modulenames [] = $reg [ 1 ];
2009-01-26 21:57:14 +00:00
}
}
2012-01-26 22:05:59 +00:00
}
closedir ( $handle );
}
// Sort $modulenames
2012-01-26 22:08:20 +00:00
sort ( $modulenames );
2012-01-26 22:05:59 +00:00
// Loop on each submodule
2021-02-23 17:59:19 +00:00
foreach ( $modulenames as $modulename ) {
2015-11-06 08:46:18 +00:00
// Loading Class
2012-01-26 22:05:59 +00:00
$file = $dir . $modulename . " .modules.php " ;
$classname = " mailing_ " . $modulename ;
2012-08-22 21:11:24 +00:00
require_once $file ;
2012-01-26 22:05:59 +00:00
$obj = new $classname ( $db );
2024-09-18 01:27:25 +00:00
'@phan-var-force MailingTargets $obj' ;
2012-01-26 22:05:59 +00:00
2022-05-28 18:42:29 +00:00
// Check if qualified
2025-11-06 12:15:03 +00:00
$qualified = ( is_null ( $obj -> enabled ) ? 1 : ( int ) dol_eval (( string ) $obj -> enabled , 1 ));
2022-05-28 18:42:29 +00:00
2014-11-29 11:40:45 +00:00
// Check dependencies
2021-02-23 17:59:19 +00:00
foreach ( $obj -> require_module as $key ) {
2022-05-28 18:42:29 +00:00
if ( empty ( $conf -> $key -> enabled ) || ( empty ( $user -> admin ) && $obj -> require_admin )) {
2019-11-13 18:35:02 +00:00
$qualified = 0 ;
2012-01-26 22:05:59 +00:00
//print "Les prerequis d'activation du module mailing ne sont pas respectes. Il ne sera pas actif";
break ;
}
}
2022-05-28 18:42:29 +00:00
// If module is qualified
2021-02-23 17:59:19 +00:00
if ( $qualified ) {
if ( $allowaddtarget ) {
2025-03-25 11:42:51 +00:00
print '<form class="oddeven trforbreakperms trforbreaknobg impair tagtr" name="' . $modulename . '" action="' . $_SERVER [ 'PHP_SELF' ] . '?id=' . $object -> id . '&module=' . $modulename . '" method="POST" enctype="multipart/form-data">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2023-04-08 15:16:22 +00:00
print '<input type="hidden" name="action" value="add">' ;
2022-06-22 20:14:08 +00:00
print '<input type="hidden" name="page_y" value="' . newToken () . '">' ;
2026-07-24 03:41:18 +00:00
//print '<input type="hidden" name="allowaddtarget" value="1">';
2020-05-21 13:05:19 +00:00
} else {
2025-03-25 11:42:51 +00:00
print '<div class="oddeven trforbreakperms trforbreaknobg impair tagtr">' ;
2016-11-26 11:21:50 +00:00
}
2012-01-26 22:05:59 +00:00
2025-03-25 12:35:55 +00:00
print '<div class="tagtd paddingleftlarge marginleftonly paddingrightlarge marginrightonly valignmiddle center">' ;
2021-02-23 17:59:19 +00:00
if ( empty ( $obj -> picto )) {
$obj -> picto = 'generic' ;
}
2023-02-25 01:43:37 +00:00
print img_object ( $langs -> trans ( " EmailingTargetSelector " ) . ': ' . get_class ( $obj ), $obj -> picto , 'class="valignmiddle width25 size15x"' );
print '</div>' ;
print '<div class="tagtd valignmiddle">' ; // style="height: 4em"
2016-11-26 11:21:50 +00:00
print $obj -> getDesc ();
print '</div>' ;
2017-08-02 11:31:53 +00:00
2024-09-18 01:27:25 +00:00
$nbofrecipient = - 1 ;
2014-08-25 17:32:36 +00:00
try {
2023-04-08 15:16:22 +00:00
$obj -> evenunsubscribe = $object -> evenunsubscribe ; // Set flag to include/exclude email that has opt-out.
2019-11-13 18:35:02 +00:00
$nbofrecipient = $obj -> getNbOfRecipients ( '' );
2021-02-23 17:59:19 +00:00
} catch ( Exception $e ) {
2014-08-25 17:32:36 +00:00
dol_syslog ( $e -> getMessage (), LOG_ERR );
}
2023-02-25 01:43:37 +00:00
print '<div class="tagtd center valignmiddle">' ;
2022-05-29 07:58:36 +00:00
if ( $nbofrecipient === '' || $nbofrecipient >= 0 ) {
2026-03-03 19:58:33 +00:00
if ( $nbofrecipient !== '' ) {
print '<span class="badge badge-info">' . $nbofrecipient . '</span>' ;
}
2020-05-21 13:05:19 +00:00
} else {
2012-01-26 22:05:59 +00:00
print $langs -> trans ( " Error " ) . ' ' . img_error ( $obj -> error );
}
2016-11-26 11:21:50 +00:00
print '</div>' ;
2017-08-02 11:31:53 +00:00
2023-02-25 01:43:37 +00:00
print '<div class="tagtd left valignmiddle">' ;
2021-02-23 17:59:19 +00:00
if ( $allowaddtarget ) {
2026-04-27 12:52:01 +00:00
$filter = false ;
2020-10-31 13:32:18 +00:00
try {
$filter = $obj -> formFilter ();
2021-02-23 17:59:19 +00:00
} catch ( Exception $e ) {
2020-10-31 13:32:18 +00:00
dol_syslog ( $e -> getMessage (), LOG_ERR );
}
2021-02-23 17:59:19 +00:00
if ( $filter ) {
print $filter ;
} else {
print $langs -> trans ( " None " );
}
2014-08-25 17:32:36 +00:00
}
2016-11-26 11:21:50 +00:00
print '</div>' ;
2017-08-02 11:31:53 +00:00
2023-02-25 01:43:37 +00:00
print '<div class="tagtd right valignmiddle">' ;
2021-02-23 17:59:19 +00:00
if ( $allowaddtarget ) {
2022-06-22 20:14:08 +00:00
print '<input type="submit" class="button button-add small reposition" name="button_' . $modulename . '" value="' . $langs -> trans ( " Add " ) . '">' ;
2020-05-21 13:05:19 +00:00
} else {
2022-01-31 11:02:48 +00:00
print '<input type="submit" class="button small disabled" disabled="disabled" name="button_' . $modulename . '" value="' . $langs -> trans ( " Add " ) . '">' ;
2012-01-26 22:05:59 +00:00
//print $langs->trans("MailNoChangePossible");
print " " ;
}
2016-11-26 11:21:50 +00:00
print '</div>' ;
2017-08-02 11:31:53 +00:00
2021-02-23 17:59:19 +00:00
if ( $allowaddtarget ) {
print '</form>' ;
} else {
print '</div>' ;
}
2008-12-04 17:52:32 +00:00
}
2009-01-26 21:57:14 +00:00
}
} // End foreach dir
2009-01-25 22:04:55 +00:00
2021-05-18 12:58:46 +00:00
$parameters = array ();
2026-03-24 09:34:46 +00:00
$hookmanager -> executeHooks ( 'formObjectOptions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
2021-05-18 12:58:46 +00:00
2022-01-31 11:02:48 +00:00
print '</div>' ; // End table
2016-11-26 11:21:50 +00:00
print '</div>' ;
2017-08-02 11:31:53 +00:00
2023-03-06 22:13:33 +00:00
print '<br>' ;
if ( $sqlmessage && $user -> admin ) {
2024-09-06 12:02:53 +00:00
print info_admin ( $langs -> trans ( " SQLUsedForExport " ) . ':<br> ' . $sqlmessage , 0 , 0 , '1' , '' , 'TechnicalInformation' );
2023-03-06 22:13:33 +00:00
print '<br>' ;
}
2025-01-23 00:35:52 +00:00
print '<br><br>' ;
2009-01-26 21:57:14 +00:00
}
2009-01-25 22:04:55 +00:00
2025-03-25 12:35:55 +00:00
2009-01-26 21:57:14 +00:00
// List of selected targets
2024-03-03 20:12:11 +00:00
$sql = " SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut as status, mc.date_envoi, mc.tms, " ;
2023-04-08 15:16:22 +00:00
$sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text, " ;
$sql .= " COUNT(mu.rowid) as nb " ;
2009-01-26 21:57:14 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " mailing_cibles as mc " ;
2023-04-08 15:16:22 +00:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " mailing_unsubscribe as mu ON mu.email = mc.email " ;
2021-08-27 14:33:03 +00:00
$sql .= " WHERE mc.fk_mailing= " . (( int ) $object -> id );
2020-12-24 11:32:34 +00:00
$asearchcriteriahasbeenset = 0 ;
2021-02-23 17:59:19 +00:00
if ( $search_lastname ) {
2020-12-24 11:32:34 +00:00
$sql .= natural_search ( " mc.lastname " , $search_lastname );
$asearchcriteriahasbeenset ++ ;
}
if ( $search_firstname ) {
$sql .= natural_search ( " mc.firstname " , $search_firstname );
$asearchcriteriahasbeenset ++ ;
}
2021-02-23 17:59:19 +00:00
if ( $search_email ) {
2020-12-24 11:32:34 +00:00
$sql .= natural_search ( " mc.email " , $search_email );
$asearchcriteriahasbeenset ++ ;
}
2021-02-23 17:59:19 +00:00
if ( $search_other ) {
2020-12-24 11:32:34 +00:00
$sql .= natural_search ( " mc.other " , $search_other );
$asearchcriteriahasbeenset ++ ;
}
2024-03-03 20:10:31 +00:00
if ( $search_dest_status != '' && ( int ) $search_dest_status >= - 1 ) {
2021-08-23 15:41:11 +00:00
$sql .= " AND mc.statut = " . (( int ) $search_dest_status );
2020-12-24 11:32:34 +00:00
$asearchcriteriahasbeenset ++ ;
}
2023-04-08 15:16:22 +00:00
$sql .= ' GROUP BY mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms, mc.source_url, mc.source_id, mc.source_type, mc.error_text' ;
2019-01-27 10:55:16 +00:00
$sql .= $db -> order ( $sortfield , $sortorder );
2016-02-12 12:58:24 +00:00
2023-04-08 15:16:22 +00:00
2016-02-12 13:21:44 +00:00
// Count total nb of records
2017-01-15 19:49:20 +00:00
$nbtotalofrecords = '' ;
2023-04-28 14:05:25 +00:00
if ( ! getDolGlobalInt ( 'MAIN_DISABLE_FULL_SCANLIST' )) {
2021-02-23 17:59:19 +00:00
$result = $db -> query ( $sql );
$nbtotalofrecords = $db -> num_rows ( $result );
2025-07-31 20:13:45 +00:00
if (( $page * $limit ) > ( int ) $nbtotalofrecords ) { // if total resultset is smaller then paging size (filtering), goto and load page 0
2021-02-23 17:59:19 +00:00
$page = 0 ;
$offset = 0 ;
}
// Fix/update nbemail on emailing record if it differs (may happen if user edit lines from database directly)
if ( empty ( $asearchcriteriahasbeenset )) {
if ( $nbtotalofrecords != $object -> nbemail ) {
dol_syslog ( " We found a difference in nb of record in target table and the property ->nbemail, we fix ->nbemail " );
//print "nbemail=".$object->nbemail." nbtotalofrecords=".$nbtotalofrecords;
$resultrefresh = $object -> refreshNbOfTargets ();
if ( $resultrefresh < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
}
}
}
2016-02-12 13:21:44 +00:00
}
2018-04-24 09:37:57 +00:00
2016-02-12 13:21:44 +00:00
//$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets
2019-11-13 18:35:02 +00:00
$sql .= $db -> plimit ( $limit + 1 , $offset );
2017-08-02 11:31:53 +00:00
2019-11-13 18:35:02 +00:00
$resql = $db -> query ( $sql );
2021-02-23 17:59:19 +00:00
if ( $resql ) {
2009-01-26 21:57:14 +00:00
$num = $db -> num_rows ( $resql );
2019-11-01 22:58:14 +00:00
$param = " &id= " . $object -> id ;
2022-08-31 20:14:20 +00:00
//if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
2021-02-23 17:59:19 +00:00
if ( $limit > 0 && $limit != $conf -> liste_limit ) {
2023-04-07 23:43:21 +00:00
$param .= '&limit=' . (( int ) $limit );
2021-02-23 17:59:19 +00:00
}
if ( $search_lastname ) {
$param .= " &search_lastname= " . urlencode ( $search_lastname );
}
if ( $search_firstname ) {
$param .= " &search_firstname= " . urlencode ( $search_firstname );
}
if ( $search_email ) {
$param .= " &search_email= " . urlencode ( $search_email );
}
if ( $search_other ) {
$param .= " &search_other= " . urlencode ( $search_other );
}
2013-04-10 16:34:19 +00:00
2025-10-17 00:31:07 +00:00
print '<form method="POST" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2013-06-12 20:12:06 +00:00
print '<input type="hidden" name="sortfield" value="' . $sortfield . '">' ;
print '<input type="hidden" name="sortorder" value="' . $sortorder . '">' ;
2020-10-31 13:32:18 +00:00
print '<input type="hidden" name="page" value="' . $page . '">' ;
2013-06-12 20:12:06 +00:00
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2024-01-23 10:39:38 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2013-06-12 20:12:06 +00:00
2019-11-13 18:35:02 +00:00
$morehtmlcenter = '' ;
2024-08-21 13:28:23 +00:00
$arrayofmassactions = array ();
if ( $permissiontocreate ) {
$arrayofmassactions [ 'reset_target' ] = img_picto ( '' , 'refresh' , 'class="pictofixedwidth"' ) . $langs -> trans ( " ResetMailingTargetMassaction " );
}
$massactionbutton = $form -> selectMassAction ( '' , $arrayofmassactions );
$morehtmlcenter .= $massactionbutton . '<br>' ;
2024-02-09 14:58:49 +00:00
if ( $object -> status == $object :: STATUS_DRAFT ) {
2022-01-31 11:02:48 +00:00
$morehtmlcenter = '<span class="opacitymedium hideonsmartphone">' . $langs -> trans ( " ToClearAllRecipientsClickHere " ) . '</span> <a href="' . $_SERVER [ " PHP_SELF " ] . '?clearlist=1&id=' . $object -> id . '" class="button reposition smallpaddingimp">' . $langs -> trans ( " TargetsReset " ) . '</a>' ;
2014-05-29 12:26:27 +00:00
}
2026-03-03 20:05:07 +00:00
2026-03-05 10:40:00 +00:00
$morehtmlrightbeforearrow = '<a class="reposition marginrightonly" href="' . $_SERVER [ " PHP_SELF " ] . '?action=exportcsv&token=' . newToken () . '&exportcsv=1&id=' . $object -> id . '">' . img_picto ( '' , 'download' , 'class="pictofixedwidth"' ) . $langs -> trans ( " Download " ) . '</a> ' ;
2019-11-01 22:58:14 +00:00
2013-06-12 20:12:06 +00:00
print '</form>' ;
2025-09-04 15:32:04 +00:00
print " \n <!-- List of selected targets --> \n " ;
2025-10-17 00:31:07 +00:00
print '<form method="POST" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2013-06-12 20:36:30 +00:00
print '<input type="hidden" name="sortfield" value="' . $sortfield . '">' ;
print '<input type="hidden" name="sortorder" value="' . $sortorder . '">' ;
2020-10-31 13:32:18 +00:00
print '<input type="hidden" name="page" value="' . $page . '">' ;
2013-06-12 20:36:30 +00:00
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2016-02-12 12:58:24 +00:00
print '<input type="hidden" name="limit" value="' . $limit . '">' ;
2023-02-20 15:07:28 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2017-08-02 11:31:53 +00:00
2024-08-21 13:28:23 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2026-03-05 10:40:00 +00:00
print_barre_liste ( $langs -> trans ( " MailSelectedRecipients " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $morehtmlcenter , $num , $nbtotalofrecords , 'generic' , 0 , $newcardbutton , '' , $limit , 0 , 0 , 1 , $morehtmlrightbeforearrow );
2024-08-21 13:28:23 +00:00
if ( $massaction == 'reset_target' ) {
// Confirm reset
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . " ?id= " . $object -> id , $langs -> trans ( " ConfirmResetMailingTargetMassaction " ), $langs -> trans ( " ConfirmResetMailingTargetMassactionQuestion " ), " confirm_reset_target " , null , '' , 0 , 0 , 500 , 1 );
}
2024-11-10 10:16:23 +00:00
$varpage = empty ( $contextpage ) ? $_SERVER [ " PHP_SELF " ] : $contextpage ;
2025-02-13 14:36:39 +00:00
$htmlofselectarray = $form -> multiSelectArrayWithCheckbox ( 'selectedfields' , $arrayfields , $varpage , $conf -> main_checkbox_left_column ? 'left' : '' ); // This also change content of $arrayfields with user setup
2024-11-09 15:18:54 +00:00
$selectedfields = ( $mode != 'kanban' ? $htmlofselectarray : '' );
$selectedfields .= ( count ( $arrayofmassactions ) ? $form -> showCheckAddButtons ( 'checkforselect' , 1 ) : '' );
2018-01-12 13:41:57 +00:00
print '<div class="div-table-responsive">' ;
2019-05-21 19:36:48 +00:00
print '<table class="noborder centpercent">' ;
2017-08-02 11:31:53 +00:00
2025-03-25 12:35:55 +00:00
// Line of filters
2017-05-04 11:41:37 +00:00
print '<tr class="liste_titre_filter">' ;
2023-04-09 12:52:36 +00:00
// Action column
2024-11-09 15:18:54 +00:00
if ( $conf -> main_checkbox_left_column ) {
2023-04-09 12:52:36 +00:00
print '<td class="liste_titre maxwidthsearch">' ;
2024-11-09 15:18:54 +00:00
$searchpicto = $form -> showFilterButtons ( 'left' );
2023-04-09 12:52:36 +00:00
print $searchpicto ;
print '</td>' ;
}
2009-01-26 21:57:14 +00:00
// EMail
print '<td class="liste_titre">' ;
2019-08-28 17:48:20 +00:00
print '<input class="flat maxwidth75" type="text" name="search_email" value="' . dol_escape_htmltag ( $search_email ) . '">' ;
2009-01-26 21:57:14 +00:00
print '</td>' ;
// Name
print '<td class="liste_titre">' ;
2019-08-28 17:48:20 +00:00
print '<input class="flat maxwidth50" type="text" name="search_lastname" value="' . dol_escape_htmltag ( $search_lastname ) . '">' ;
2009-01-26 21:57:14 +00:00
print '</td>' ;
// Firstname
print '<td class="liste_titre">' ;
2019-08-28 17:48:20 +00:00
print '<input class="flat maxwidth50" type="text" name="search_firstname" value="' . dol_escape_htmltag ( $search_firstname ) . '">' ;
2009-01-26 21:57:14 +00:00
print '</td>' ;
// Other
print '<td class="liste_titre">' ;
2017-08-25 17:26:48 +00:00
print '<input class="flat maxwidth100" type="text" name="search_other" value="' . dol_escape_htmltag ( $search_other ) . '">' ;
2009-01-26 21:57:14 +00:00
print '</td>' ;
2010-12-28 02:04:41 +00:00
// Source
2014-05-29 12:26:27 +00:00
print '<td class="liste_titre">' ;
2021-02-07 18:05:10 +00:00
print ' ' ;
2014-05-29 12:26:27 +00:00
print '</td>' ;
2017-08-02 11:31:53 +00:00
2019-08-28 16:12:02 +00:00
// Date last update
print '<td class="liste_titre">' ;
2021-02-07 18:05:10 +00:00
print ' ' ;
2019-08-28 16:12:02 +00:00
print '</td>' ;
2014-05-29 12:26:27 +00:00
// Date sending
print '<td class="liste_titre">' ;
2021-02-07 18:05:10 +00:00
print ' ' ;
2014-05-29 12:26:27 +00:00
print '</td>' ;
2019-08-28 16:12:02 +00:00
2024-01-23 10:39:38 +00:00
// Status
2023-09-21 08:36:17 +00:00
print '<td class="liste_titre center parentonrightofpage">' ;
print $formmailing -> selectDestinariesStatus ( $search_dest_status , 'search_dest_status' , 1 , 'width100 onrightofpage' );
2014-05-29 12:26:27 +00:00
print '</td>' ;
2023-09-21 08:36:17 +00:00
2016-11-11 13:03:57 +00:00
// Action column
2025-08-14 11:50:53 +00:00
if ( ! $conf -> main_checkbox_left_column ) {
2023-04-09 12:52:36 +00:00
print '<td class="liste_titre maxwidthsearch">' ;
2024-11-09 15:18:54 +00:00
$searchpicto = $form -> showFilterButtons ();
2023-04-09 12:52:36 +00:00
print $searchpicto ;
print '</td>' ;
}
2006-10-29 19:09:49 +00:00
print '</tr>' ;
2017-08-02 11:31:53 +00:00
2021-02-23 17:59:19 +00:00
if ( $page ) {
2024-03-08 01:48:51 +00:00
$param .= " &page= " . urlencode (( string ) ( $page ));
2021-02-23 17:59:19 +00:00
}
2019-11-01 22:58:14 +00:00
2017-05-04 11:41:37 +00:00
print '<tr class="liste_titre">' ;
2023-04-09 12:52:36 +00:00
// Action column
2024-11-09 15:18:54 +00:00
if ( $conf -> main_checkbox_left_column ) {
print getTitleFieldOfList ( $selectedfields , 0 , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , $sortfield , $sortorder , 'center maxwidthsearch ' ) . " \n " ;
$totalarray [ 'nbfield' ] ++ ;
2023-04-09 12:52:36 +00:00
}
2025-10-14 13:03:44 +00:00
print_liste_field_titre ( " EMail " , $_SERVER [ " PHP_SELF " ], " mc.email " , '' , $param , " " , $sortfield , $sortorder );
print_liste_field_titre ( " Lastname " , $_SERVER [ " PHP_SELF " ], " mc.lastname " , '' , $param , " " , $sortfield , $sortorder );
print_liste_field_titre ( " Firstname " , $_SERVER [ " PHP_SELF " ], " mc.firstname " , '' , $param , " " , $sortfield , $sortorder );
2025-11-14 14:55:35 +00:00
print_liste_field_titre ( " OtherInformations " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , " " , $sortfield , $sortorder );
print_liste_field_titre ( " Source " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , 'center ' );
2019-08-28 16:12:02 +00:00
// Date last update
2025-10-14 13:03:44 +00:00
print_liste_field_titre ( " DateLastModification " , $_SERVER [ " PHP_SELF " ], " mc.tms " , '' , $param , '' , $sortfield , $sortorder , 'center ' );
2017-05-04 11:41:37 +00:00
// Date sending
2025-10-14 13:03:44 +00:00
print_liste_field_titre ( " DateSending " , $_SERVER [ " PHP_SELF " ], " mc.date_envoi " , '' , $param , '' , $sortfield , $sortorder , 'center ' );
print_liste_field_titre ( " Status " , $_SERVER [ " PHP_SELF " ], " mc.statut " , '' , $param , '' , $sortfield , $sortorder , 'center ' );
2023-04-09 12:52:36 +00:00
// Action column
2024-11-09 15:18:54 +00:00
if ( ! $conf -> main_checkbox_left_column ) {
print getTitleFieldOfList ( $selectedfields , 0 , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , $sortfield , $sortorder , 'center maxwidthsearch ' ) . " \n " ;
$totalarray [ 'nbfield' ] ++ ;
2023-04-09 12:52:36 +00:00
}
2017-05-04 11:41:37 +00:00
print '</tr>' ;
2009-01-25 22:04:55 +00:00
2009-01-26 21:57:14 +00:00
$i = 0 ;
2021-02-23 17:59:19 +00:00
if ( $num ) {
2019-05-21 19:47:25 +00:00
include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php' ;
include_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php' ;
include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php' ;
include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php' ;
2022-11-23 20:28:33 +00:00
include_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorboothattendee.class.php' ;
2024-03-03 20:12:11 +00:00
2019-11-13 18:35:02 +00:00
$objectstaticmember = new Adherent ( $db );
$objectstaticuser = new User ( $db );
$objectstaticcompany = new Societe ( $db );
$objectstaticcontact = new Contact ( $db );
2022-11-23 20:28:33 +00:00
$objectstaticeventorganization = new ConferenceOrBoothAttendee ( $db );
2019-05-21 19:47:25 +00:00
2021-02-23 17:59:19 +00:00
while ( $i < min ( $num , $limit )) {
2009-01-26 21:57:14 +00:00
$obj = $db -> fetch_object ( $resql );
2016-11-11 13:03:57 +00:00
2017-04-14 09:22:48 +00:00
print '<tr class="oddeven">' ;
2023-04-08 15:16:22 +00:00
2023-04-09 12:52:36 +00:00
// Action column
2025-08-14 11:50:53 +00:00
if ( $conf -> main_checkbox_left_column ) {
2024-12-06 15:08:43 +00:00
print '<td class="center nowraponall">' ;
2023-04-09 12:52:36 +00:00
print '<!-- ID mailing_cibles = ' . $obj -> rowid . ' -->' ;
2024-08-21 13:28:23 +00:00
if ( $massactionbutton || $massaction ) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0 ;
if ( in_array ( $obj -> rowid , $arrayofselected )) {
$selected = 1 ;
}
print '<input id="cb' . $obj -> rowid . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $obj -> rowid . '"' . ( $selected ? ' checked="checked"' : '' ) . '>' ;
}
2024-02-09 14:58:49 +00:00
if ( $obj -> status == $object :: STATUS_DRAFT ) { // Not sent yet
2023-10-10 07:14:30 +00:00
if ( $user -> hasRight ( 'mailing' , 'creer' )) {
2024-12-06 15:08:43 +00:00
print '<a class="reposition marginleftonly" href="' . $_SERVER [ 'PHP_SELF' ] . '?action=delete&token=' . newToken () . '&rowid=' . (( int ) $obj -> rowid ) . $param . '">' . img_delete ( $langs -> trans ( " RemoveRecipient " )) . '</a>' ;
2023-04-09 12:52:36 +00:00
}
}
2024-02-09 14:58:49 +00:00
/* if ( $obj -> status == - 1 ) // Sent with error
2023-04-09 12:52:36 +00:00
{
print '<a href="' . $_SERVER [ 'PHP_SELF' ] . '?action=retry&rowid=' . $obj -> rowid . $param . '">' . $langs -> trans ( " Retry " ) . '</a>' ;
} */
print '</td>' ;
}
2023-04-08 15:16:22 +00:00
print '<td class="tdoverflowmax150">' ;
print img_picto ( $obj -> email , 'email' , 'class="paddingright"' );
if ( $obj -> nb > 0 ) {
print img_warning ( $langs -> trans ( " EmailOptedOut " ), 'warning' , 'pictofixedwidth' );
}
2025-03-26 13:39:42 +00:00
print dolPrintHTML ( $obj -> email );
2023-04-08 15:16:22 +00:00
print '</td>' ;
2025-03-26 13:39:42 +00:00
print '<td class="tdoverflowmax150" title="' . dolPrintHTMLForAttribute ( $obj -> lastname ) . '">' . dolPrintHTML ( $obj -> lastname ) . '</td>' ;
2023-04-08 15:16:22 +00:00
2025-03-26 13:39:42 +00:00
print '<td class="tdoverflowmax150" title="' . dolPrintHTMLForAttribute ( $obj -> firstname ) . '">' . dolPrintHTML ( $obj -> firstname ) . '</td>' ;
2023-04-08 15:16:22 +00:00
2025-03-26 13:39:42 +00:00
print '<td class="tdoverflowmax300" title="' . dolPrintHTMLForAttribute ( $obj -> other ) . '"><span class="small">' . dolPrintHTML ( $obj -> other ) . '</small></td>' ;
2023-04-08 15:16:22 +00:00
2021-09-01 19:34:59 +00:00
print '<td class="center tdoverflowmax150">' ;
2021-02-23 17:59:19 +00:00
if ( empty ( $obj -> source_id ) || empty ( $obj -> source_type )) {
2020-10-31 13:32:18 +00:00
print empty ( $obj -> source_url ) ? '' : $obj -> source_url ; // For backward compatibility
} else {
2021-02-23 17:59:19 +00:00
if ( $obj -> source_type == 'member' ) {
2019-05-21 19:47:25 +00:00
$objectstaticmember -> fetch ( $obj -> source_id );
2020-10-31 13:32:18 +00:00
print $objectstaticmember -> getNomUrl ( 1 );
2021-02-23 17:59:19 +00:00
} elseif ( $obj -> source_type == 'user' ) {
2019-05-21 19:47:25 +00:00
$objectstaticuser -> fetch ( $obj -> source_id );
2020-10-31 13:32:18 +00:00
print $objectstaticuser -> getNomUrl ( 1 );
2021-02-23 17:59:19 +00:00
} elseif ( $obj -> source_type == 'thirdparty' ) {
2019-05-21 19:47:25 +00:00
$objectstaticcompany -> fetch ( $obj -> source_id );
2020-10-31 13:32:18 +00:00
print $objectstaticcompany -> getNomUrl ( 1 );
2021-02-23 17:59:19 +00:00
} elseif ( $obj -> source_type == 'contact' ) {
2020-10-31 13:32:18 +00:00
$objectstaticcontact -> fetch ( $obj -> source_id );
print $objectstaticcontact -> getNomUrl ( 1 );
2022-11-23 20:28:33 +00:00
} elseif ( $obj -> source_type == 'eventorganizationattendee' ) {
$objectstaticeventorganization -> fetch ( $obj -> source_id );
print $objectstaticeventorganization -> getNomUrl ( 1 );
2020-10-31 13:32:18 +00:00
} else {
print $obj -> source_url ;
}
}
2010-12-28 02:04:41 +00:00
print '</td>' ;
2009-01-26 21:57:14 +00:00
2019-08-28 16:12:02 +00:00
// Date last update
2021-04-12 11:02:34 +00:00
print '<td class="center nowraponall">' ;
2024-12-06 15:12:13 +00:00
print dol_print_date ( $db -> jdate ( $obj -> tms ), 'dayhour' , 'tzuserrel' );
2019-08-28 16:12:02 +00:00
print '</td>' ;
2023-09-21 08:36:17 +00:00
// Date sent
print '<td class="center nowraponall">' ;
2024-06-18 10:47:02 +00:00
if ( $obj -> status != $object :: STATUS_DRAFT ) { // If status of target line is not draft
2019-08-28 16:12:02 +00:00
// Date sent
2024-12-06 15:12:13 +00:00
print dol_print_date ( $db -> jdate ( $obj -> date_envoi ), 'dayhour' , 'tzuserrel' ); // @TODO Must store date in date format
2023-09-21 08:36:17 +00:00
}
print '</td>' ;
2019-08-28 16:12:02 +00:00
2023-09-21 08:36:17 +00:00
// Status of recipient sending email (Warning != status of emailing)
print '<td class="nowrap center">' ;
2024-06-18 10:47:02 +00:00
if ( $obj -> status == $object :: STATUS_DRAFT ) { // If status of target line is not draft
print $object :: libStatutDest (( int ) $obj -> status , 2 , '' );
2020-05-21 13:05:19 +00:00
} else {
2024-06-18 10:47:02 +00:00
print $object :: libStatutDest (( int ) $obj -> status , 2 , $obj -> error_text );
2009-01-26 21:57:14 +00:00
}
2023-09-21 08:36:17 +00:00
print '</td>' ;
2014-08-25 17:32:36 +00:00
2023-04-09 12:52:36 +00:00
// Action column
2025-08-14 11:50:53 +00:00
if ( ! $conf -> main_checkbox_left_column ) {
2024-12-06 15:08:43 +00:00
print '<td class="center nowraponall">' ;
2023-04-09 12:52:36 +00:00
print '<!-- ID mailing_cibles = ' . $obj -> rowid . ' -->' ;
2024-06-18 10:47:02 +00:00
if ( $obj -> status == $object :: STATUS_DRAFT ) { // If status of target line is not sent yet
2023-10-10 07:14:30 +00:00
if ( $user -> hasRight ( 'mailing' , 'creer' )) {
2024-12-06 15:08:43 +00:00
print '<a class="reposition marginleftonly" href="' . $_SERVER [ 'PHP_SELF' ] . '?action=delete&token=' . newToken () . '&rowid=' . (( int ) $obj -> rowid ) . $param . '">' . img_delete ( $langs -> trans ( " RemoveRecipient " )) . '</a>' ;
2023-04-09 12:52:36 +00:00
}
2015-07-04 01:28:52 +00:00
}
2024-02-09 14:58:49 +00:00
/* if ( $obj -> status == - 1 ) // Sent with error
2023-04-09 12:52:36 +00:00
{
print '<a href="' . $_SERVER [ 'PHP_SELF' ] . '?action=retry&rowid=' . $obj -> rowid . $param . '">' . $langs -> trans ( " Retry " ) . '</a>' ;
} */
print '</td>' ;
2015-07-04 01:28:52 +00:00
}
2009-01-26 21:57:14 +00:00
print '</tr>' ;
$i ++ ;
}
2020-05-21 13:05:19 +00:00
} else {
2024-02-09 14:58:49 +00:00
if ( $object -> status < $object :: STATUS_SENTPARTIALY ) {
2023-02-27 03:24:12 +00:00
print '<tr><td colspan="9">' ;
print '<span class="opacitymedium">' . $langs -> trans ( " NoTargetYet " ) . '</span>' ;
print '</td></tr>' ;
} else {
print '<tr><td colspan="9">' ;
print '<span class="opacitymedium">' . $langs -> trans ( " NoRecordFound " ) . '</span>' ;
2020-10-31 13:32:18 +00:00
print '</td></tr>' ;
2016-02-12 13:21:44 +00:00
}
2009-01-26 21:57:14 +00:00
}
print " </table><br> " ;
2018-01-12 13:41:57 +00:00
print '</div>' ;
2009-01-26 21:57:14 +00:00
2013-06-12 20:36:30 +00:00
print '</form>' ;
2013-06-12 20:12:06 +00:00
2009-01-26 21:57:14 +00:00
$db -> free ( $resql );
2020-05-21 13:05:19 +00:00
} else {
2009-02-20 22:53:15 +00:00
dol_print_error ( $db );
2009-01-26 21:57:14 +00:00
}
2025-03-25 12:35:55 +00:00
print " \n <!-- End list of selected targets --> \n " ;
2005-01-05 15:26:05 +00:00
}
2009-01-25 22:04:55 +00:00
2018-07-29 15:17:29 +00:00
// End of page
2011-08-27 14:24:16 +00:00
llxFooter ();
2012-01-26 22:05:59 +00:00
$db -> close ();