123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576 |
- <?php
- /* Copyright (C) 2005-2023 Laurent Destailleur <eldy@users.sourceforge.net>
- * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
- *
- * 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
- * the Free Software Foundation; either version 3 of the License, or
- * (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
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
- /**
- * \file htdocs/comm/mailing/list.php
- * \ingroup mailing
- * \brief Liste des mailings
- */
- // Load Dolibarr environment
- require '../../main.inc.php';
- require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
- // Load translation files required by the page
- $langs->load('mails');
- // Get Parameters
- $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
- $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
- $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
- $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
- $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
- $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
- $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
- $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
- $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
- $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
- // Load variable for pagination
- $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
- $sortfield = GETPOST('sortfield', 'aZ09comma');
- $sortorder = GETPOST('sortorder', 'aZ09comma');
- $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
- if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
- // If $page is not defined, or '' or -1 or if we click on clear filters
- $page = 0;
- }
- $offset = $limit * $page;
- $pageprev = $page - 1;
- $pagenext = $page + 1;
- // Search Fields
- $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
- $search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha");
- $filteremail = GETPOST('filteremail', 'alpha');
- // Initialize technical objects
- $object = new Mailing($db);
- $extrafields = new ExtraFields($db);
- $hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
- // Fetch optionals attributes and labels
- $extrafields->fetch_name_optionals_label($object->table_element);
- $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
- // Default sort order (if not yet defined by previous GETPOST)
- if (!$sortorder) {
- $sortorder = "DESC";
- }
- if (!$sortfield) {
- $sortfield = "m.date_creat";
- }
- // List of fields to search into when doing a "search in all"
- $fieldstosearchall = array(
- 'm.titre'=>'Ref',
- );
- $permissiontoread = $user->hasRight('mailing', 'lire');
- $permissiontoadd = $user->hasRight('mailing', 'creer');
- $permissiontodelete = $user->hasRight('mailing', 'delete');
- // Security check
- if (!$user->hasRight('mailing', 'lire') || (!getDolGlobalString('EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) {
- accessforbidden();
- }
- //$result = restrictedArea($user, 'mailing');
- /*
- * Actions
- */
- if (GETPOST('cancel', 'alpha')) {
- $action = 'list';
- $massaction = '';
- }
- if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
- $massaction = '';
- }
- $parameters = array();
- $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
- if ($reshook < 0) {
- setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
- }
- if (empty($reshook)) {
- // Selection of new fields
- include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
- // Purge search criteria
- 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
- /*foreach($object->fields as $key => $val)
- {
- $search[$key]='';
- }*/
- $search_ref = '';
- $search_all = '';
- $toselect = array();
- $search_array_options = array();
- }
- if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
- || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
- $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
- }
- // Mass actions
- $objectclass = 'Mailing';
- $objectlabel = 'Mailing';
- $uploaddir = $conf->mailing->dir_output;
- include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
- }
- /*
- * View
- */
- $form = new Form($db);
- $now = dol_now();
- $help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
- $title = $langs->trans("Mailing");
- $morejs = array();
- $morecss = array();
- // Build and execute select
- // --------------------------------------------------------------------
- if ($filteremail) {
- $sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi,";
- $sql .= " mc.statut as sendstatut";
- $sqlfields = $sql; // $sql fields to remove for count total
- $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc";
- $sql .= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity;
- $sql .= " AND mc.email = '".$db->escape($filteremail)."'";
- if ($search_ref) {
- $sql .= " AND m.rowid = '".$db->escape($search_ref)."'";
- }
- if ($search_all) {
- $sql .= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')";
- }
- if (!$sortorder) {
- $sortorder = "ASC";
- }
- if (!$sortfield) {
- $sortfield = "m.rowid";
- }
- } else {
- $sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi";
- $sqlfields = $sql; // $sql fields to remove for count total
- $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
- $sql .= " WHERE m.entity = ".$conf->entity;
- if ($search_ref) {
- $sql .= " AND m.rowid = '".$db->escape($search_ref)."'";
- }
- if ($search_all) {
- $sql .= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')";
- }
- if (!$sortorder) {
- $sortorder = "ASC";
- }
- if (!$sortfield) {
- $sortfield = "m.rowid";
- }
- }
- if ($search_all) {
- $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
- }
- //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
- // Add where from extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
- // Add where from hooks
- $parameters = array();
- $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- $sql .= $hookmanager->resPrint;
- // Count total nb of records
- $nbtotalofrecords = '';
- if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
- /* The fast and low memory method to get and count full list converts the sql into a sql count */
- $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
- $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
- $resql = $db->query($sqlforcount);
- if ($resql) {
- $objforcount = $db->fetch_object($resql);
- $nbtotalofrecords = $objforcount->nbtotalofrecords;
- } else {
- dol_print_error($db);
- }
- if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
- $page = 0;
- $offset = 0;
- }
- $db->free($resql);
- }
- // Complete request and execute it with limit
- $sql .= $db->order($sortfield, $sortorder);
- if ($limit) {
- $sql .= $db->plimit($limit + 1, $offset);
- }
- $resql = $db->query($sql);
- if (!$resql) {
- dol_print_error($db);
- exit;
- }
- $num = $db->num_rows($resql);
- // Direct jump if only one record found
- if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
- $obj = $db->fetch_object($resql);
- $id = $obj->rowid;
- header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$id);
- exit;
- }
- // Output page
- // --------------------------------------------------------------------
- $title = $langs->trans("EMailings");
- if ($filteremail) {
- $title .= ' ('.$langs->trans("SentTo", $filteremail).')';
- }
- llxHeader('', $title, $help_url);
- $arrayofselected = is_array($toselect) ? $toselect : array();
- $param = "&search_all=".urlencode($search_all);
- if (!empty($mode)) {
- $param .= '&mode='.urlencode($mode);
- }
- if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
- $param .= '&contextpage='.urlencode($contextpage);
- }
- if ($limit > 0 && $limit != $conf->liste_limit) {
- $param .= '&limit='.((int) $limit);
- }
- if ($optioncss != '') {
- $param .= '&optioncss='.urlencode($optioncss);
- }
- if ($filteremail) {
- $param .= '&filteremail='.urlencode($filteremail);
- }
- // Add $param from extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
- // Add $param from hooks
- $parameters = array();
- $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
- $param .= $hookmanager->resPrint;
- // List of mass actions available
- $arrayofmassactions = array(
- //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
- //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
- //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
- //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
- );
- if (!empty($permissiontodelete)) {
- $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
- }
- if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
- $arrayofmassactions = array();
- }
- $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
- print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
- if ($optioncss != '') {
- print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
- }
- print '<input type="hidden" name="token" value="'.newToken().'">';
- print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
- print '<input type="hidden" name="action" value="list">';
- print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
- print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
- print '<input type="hidden" name="page" value="'.$page.'">';
- print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
- print '<input type="hidden" name="page_y" value="">';
- print '<input type="hidden" name="mode" value="'.$mode.'">';
- $newcardbutton = '';
- if ($user->hasRight('mailing', 'creer')) {
- $newcardbutton .= dolGetButtonTitle($langs->trans('NewMailing'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/mailing/card.php?action=create');
- }
- print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_email', 0, $newcardbutton, '', $limit, 0, 0, 1);
- // Add code for pre mass action (confirmation or email presend form)
- $topicmail = "SendMailingRef";
- $modelmail = "mailing";
- $objecttmp = new Mailing($db);
- $trackid = 'mailing'.$object->id;
- include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
- if ($search_all) {
- $setupstring = '';
- foreach ($fieldstosearchall as $key => $val) {
- $fieldstosearchall[$key] = $langs->trans($val);
- $setupstring .= $key."=".$val.";";
- }
- print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
- print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
- }
- $moreforfilter = '';
- $parameters = array();
- $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- if (empty($reshook)) {
- $moreforfilter .= $hookmanager->resPrint;
- } else {
- $moreforfilter = $hookmanager->resPrint;
- }
- if (!empty($moreforfilter)) {
- print '<div class="liste_titre liste_titre_bydiv centpercent">';
- print $moreforfilter;
- $parameters = array('type'=>$type);
- $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- print '</div>';
- }
- $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
- $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
- $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
- print '<div class="div-table-responsive">';
- print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
- // Fields title search
- // --------------------------------------------------------------------
- print '<tr class="liste_titre_filter">';
- // Action column
- if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print '<td class="liste_titre maxwidthsearch center">';
- $searchpicto = $form->showFilterButtons('left');
- print $searchpicto;
- print '</td>';
- }
- print '<td class="liste_titre">';
- print '<input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
- print '</td>';
- // Title
- print '<td class="liste_titre">';
- print '<input type="text" class="flat maxwidth100 maxwidth50onsmartphone" name="search_all" value="'.dol_escape_htmltag($search_all).'">';
- print '</td>';
- print '<td class="liste_titre"> </td>';
- if (!$filteremail) {
- print '<td class="liste_titre"> </td>';
- }
- print '<td class="liste_titre"> </td>';
- print '<td class="liste_titre"> </td>';
- // Extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
- // Fields from hook
- $parameters = array('arrayfields'=>$arrayfields);
- $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- // Action column
- if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print '<td class="liste_titre center maxwidthsearch">';
- $searchpicto = $form->showFilterButtons();
- print $searchpicto;
- print '</td>';
- }
- print '</tr>'."\n";
- $totalarray = array();
- $totalarray['nbfield'] = 0;
- // Fields title label
- // --------------------------------------------------------------------
- print '<tr class="liste_titre">';
- if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
- $totalarray['nbfield']++;
- }
- print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "m.rowid", $param, "", "", $sortfield, $sortorder);
- $totalarray['nbfield']++;
- print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "m.titre", $param, "", "", $sortfield, $sortorder);
- $totalarray['nbfield']++;
- print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "m.date_creat", $param, "", 'align="center"', $sortfield, $sortorder);
- $totalarray['nbfield']++;
- if (!$filteremail) {
- print_liste_field_titre("NbOfEMails", $_SERVER["PHP_SELF"], "m.nbemail", $param, "", 'align="center"', $sortfield, $sortorder);
- $totalarray['nbfield']++;
- }
- if (!$filteremail) {
- print_liste_field_titre("DateLastSend", $_SERVER["PHP_SELF"], "m.date_envoi", $param, "", 'align="center"', $sortfield, $sortorder);
- $totalarray['nbfield']++;
- } else {
- print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, "", 'align="center"', $sortfield, $sortorder);
- $totalarray['nbfield']++;
- }
- // Extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
- // Hook fields
- $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
- $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- print_liste_field_titre("Status", $_SERVER["PHP_SELF"], ($filteremail ? "mc.statut" : "m.statut"), $param, "", '', $sortfield, $sortorder, 'center ');
- $totalarray['nbfield']++;
- // Action column
- if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
- $totalarray['nbfield']++;
- }
- print '</tr>'."\n";
- $totalarray = array();
- $totalarray['nbfield'] = 0;
- // Loop on record
- // --------------------------------------------------------------------
- $i = 0;
- $savnbfield = $totalarray['nbfield'];
- $totalarray = array();
- $totalarray['nbfield'] = 0;
- $imaxinloop = ($limit ? min($num, $limit) : $num);
- while ($i < $imaxinloop) {
- $obj = $db->fetch_object($resql);
- if (empty($obj)) {
- break; // Should not happen
- }
- $object->id = $obj->rowid;
- $object->ref = $obj->rowid;
- // Show here line of result
- $j = 0;
- print '<tr data-rowid="'.$object->id.'" class="oddeven">';
- // Action column
- if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print '<td class="nowrap center">';
- 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($object->id, $arrayofselected)) {
- $selected = 1;
- }
- print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
- }
- print '</td>';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- print '<td>';
- print $object->getNomUrl(1);
- print '</td>';
- // Title
- print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">'.dol_escape_htmltag($obj->title).'</td>';
- // Date creation
- print '<td class="center">';
- print dol_print_date($db->jdate($obj->datec), 'day');
- print '</td>';
- // Nb of email
- if (!$filteremail) {
- print '<td class="center nowraponall">';
- $nbemail = $obj->nbemail;
- /*if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
- {
- $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
- print $form->textwithpicto($nbemail,$text,1,'warning');
- }
- else
- {
- print $nbemail;
- }*/
- print $nbemail;
- print '</td>';
- }
- // Last send
- print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->date_envoi), 'day').'</td>';
- print '</td>';
- // Status
- print '<td class="nowrap center">';
- if ($filteremail) {
- print $object::libStatutDest($obj->sendstatut, 2);
- } else {
- print $object->LibStatut($obj->statut, 5);
- }
- print '</td>';
- // Action column
- if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print '<td class="nowrap center">';
- 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($object->id, $arrayofselected)) {
- $selected = 1;
- }
- print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
- }
- print '</td>';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- print '</tr>'."\n";
- $i++;
- }
- // Show total line
- include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
- // If no record found
- if (empty($num)) {
- $colspan = 6;
- if (!$filteremail) {
- $colspan++;
- }
- print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
- }
- $db->free($resql);
- $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
- $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- print '</table>'."\n";
- print '</div>'."\n";
- print '</form>'."\n";
- // End of page
- llxFooter();
- $db->close();
|