From c338db6c367be395ae2f8df826875adeb0475281 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Oct 2019 19:16:36 +0200 Subject: [PATCH 1/2] Fix unlink picto --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a17b3c19c5f..1aee5e67cd5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3135,7 +3135,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $marginleftonlyshort=0; } elseif ($pictowithouttext == 'unlink') { - $fakey = 'fa-chain-broken'; + $fakey = 'fa-unlink'; $facolor = '#555'; } elseif ($pictowithouttext == 'playdisabled') { @@ -3169,6 +3169,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ //$facolor = '#444'; $marginleftonlyshort=0; } + //this snippet only needed since function img_edit accepts only one additional parameter: no separate one for css only. //class/style need to be extracted to avoid duplicate class/style validation errors when $moreatt is added to the end of the attributes $reg=array(); From 33f620603107909a180a3c5293022ca2b33088a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Oct 2019 20:12:24 +0200 Subject: [PATCH 2/2] NEW Add link to export target of emailings into a CSV file. --- htdocs/comm/mailing/cibles.php | 76 +++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 1e467331d90..4ca8b75af31 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -54,16 +54,17 @@ if (! $sortorder) $sortorder="ASC"; $id=GETPOST('id', 'int'); $rowid=GETPOST('rowid', 'int'); $action=GETPOST('action', 'aZ09'); -$search_lastname=GETPOST("search_lastname"); -$search_firstname=GETPOST("search_firstname"); -$search_email=GETPOST("search_email"); -$search_other=GETPOST("search_other"); -$search_dest_status=GETPOST('search_dest_status'); +$search_lastname=GETPOST("search_lastname", 'alphanohtml'); +$search_firstname=GETPOST("search_firstname", 'alphanohtml'); +$search_email=GETPOST("search_email", 'alphanohtml'); +$search_other=GETPOST("search_other", 'alphanohtml'); +$search_dest_status=GETPOST('search_dest_status', 'alphanohtml'); // Search modules dirs $modulesdir = dolGetModulesDirs('/mailings'); $object = new Mailing($db); +$result=$object->fetch($id); /* @@ -112,7 +113,7 @@ if ($action == 'add') } } -if (GETPOST('clearlist')) +if (GETPOST('clearlist', 'int')) { // Loading Class $obj = new MailingTargets($db); @@ -123,6 +124,50 @@ if (GETPOST('clearlist')) */ } +if (GETPOST('exportcsv', 'int')) +{ + $completefilename = 'targets_emailing'.$object->id.'_'.dol_print_date(dol_now(), 'dayhourlog').'csv'; + header('Content-Type: text/csv'); + header('Content-Disposition: attachment;filename=' . $completefilename); + + // List of selected targets + $sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms,"; + $sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text"; + $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; + $sql .= " WHERE mc.fk_mailing=".$object->id; + $sql .= $db->order($sortfield, $sortorder); + + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $sep = ','; + + while ($obj = $db->fetch_object($resql)) + { + print $obj->rowid . $sep; + print $obj->lastname . $sep; + print $obj->firstname . $sep; + print $obj->email . $sep; + print $obj->other . $sep; + print $obj->date_envoi . $sep; + print $obj->tms . $sep; + print $obj->source_url . $sep; + print $obj->source_id . $sep; + print $obj->source_type . $sep; + print $obj->error_text . $sep; + print "\n"; + } + + exit; + } + else + { + dol_print_error($db); + } + exit; +} + if ($action == 'delete') { // Ici, rowid indique le destinataire et id le mailing @@ -437,10 +482,11 @@ if ($object->fetch($id) >= 0) $param = "&id=".$object->id; //if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - 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); + 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); + if ($page) $param.= "&page=".urlencode($page); print '
'; print ''; @@ -449,11 +495,12 @@ if ($object->fetch($id) >= 0) print ''; print ''; - $cleartext=''; + $morehtmlcenter=''; if ($allowaddtarget) { - $cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'id.'" class="button reposition">'.$langs->trans("TargetsReset").''; + $morehtmlcenter=''.$langs->trans("ToClearAllRecipientsClickHere").' id.'" class="button reposition">'.$langs->trans("TargetsReset").''; } - print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $cleartext, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit); + $morehtmlcenter.=' id.'">'.$langs->trans("Download").''; + print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit); print '
'; @@ -466,9 +513,6 @@ if ($object->fetch($id) >= 0) print ''; print ''; - - if ($page) $param.= "&page=".$page; - print '
'; print '';