From 2da16ade6c722e1464a6c8f571beaba150f194d9 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 8 Oct 2021 17:24:52 +0200 Subject: [PATCH 01/16] FIX: consistent UX when calling a tab from the invoice card with empty ref / id --- htdocs/compta/facture/card.php | 11 +++++++++++ htdocs/compta/facture/contact.php | 11 +++++++++++ htdocs/compta/facture/document.php | 11 +++++++++++ htdocs/compta/facture/info.php | 11 +++++++++++ htdocs/compta/facture/note.php | 11 +++++++++++ 5 files changed, 55 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index e15b2722800..ab568332dd8 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2756,6 +2756,17 @@ if (empty($reshook)) * View */ +if (empty($object->id)) { + llxHeader(); + $head = facture_prepare_head($object); + $langs->load('errors'); + echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'), + '
' . $langs->trans("ErrorRecordNotFound") . '
'; + llxFooter(); + dol_shutdown(); + exit; +} + $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index c340d68242e..c0e0a40c2c5 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -118,6 +118,17 @@ elseif ($action == 'deletecontact' && $user->rights->facture->creer) * View */ +if (empty($object->id)) { + llxHeader(); + $head = facture_prepare_head($object); + $langs->load('errors'); + echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'), + '
' . $langs->trans("ErrorRecordNotFound") . '
'; + llxFooter(); + dol_shutdown(); + exit; +} + $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses'); $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $helpurl); diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index e880d77db74..64ebed251d3 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -85,6 +85,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; * View */ +if (empty($object->id)) { + llxHeader(); + $head = facture_prepare_head($object); + $langs->load('errors'); + echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'), + '
' . $langs->trans("ErrorRecordNotFound") . '
'; + llxFooter(); + dol_shutdown(); + exit; +} + $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents'); $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $helpurl); diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index bad63cf1f61..9e40fd8b5a8 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -43,6 +43,17 @@ $ref = GETPOST("ref", 'alpha'); * View */ +if (empty($object->id)) { + llxHeader(); + $head = facture_prepare_head($object); + $langs->load('errors'); + echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'), + '
' . $langs->trans("ErrorRecordNotFound") . '
'; + llxFooter(); + dol_shutdown(); + exit; +} + $form = new Form($db); $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info'); diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 07084a0cf2c..428383b4907 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -64,6 +64,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, * View */ +if (empty($object->id)) { + llxHeader(); + $head = facture_prepare_head($object); + $langs->load('errors'); + echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'), + '
' . $langs->trans("ErrorRecordNotFound") . '
'; + llxFooter(); + dol_shutdown(); + exit; +} + $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes'); $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $helpurl); From 57052e2fbabffa16b25a25fe02a1966e117d09db Mon Sep 17 00:00:00 2001 From: atm-florian Date: Mon, 11 Oct 2021 11:10:14 +0200 Subject: [PATCH 02/16] FIX PR#18931 Remove useless explicit call to dol_shutdown --- htdocs/compta/facture/card.php | 1 - htdocs/compta/facture/contact.php | 1 - htdocs/compta/facture/document.php | 1 - htdocs/compta/facture/info.php | 1 - htdocs/compta/facture/note.php | 1 - 5 files changed, 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ab568332dd8..c772fd0ad7b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2763,7 +2763,6 @@ if (empty($object->id)) { echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'), '
' . $langs->trans("ErrorRecordNotFound") . '
'; llxFooter(); - dol_shutdown(); exit; } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index c0e0a40c2c5..7177463c30e 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -125,7 +125,6 @@ if (empty($object->id)) { echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'), '
' . $langs->trans("ErrorRecordNotFound") . '
'; llxFooter(); - dol_shutdown(); exit; } diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 64ebed251d3..0818b944705 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -92,7 +92,6 @@ if (empty($object->id)) { echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'), '
' . $langs->trans("ErrorRecordNotFound") . '
'; llxFooter(); - dol_shutdown(); exit; } diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 9e40fd8b5a8..955c41693c0 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -50,7 +50,6 @@ if (empty($object->id)) { echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'), '
' . $langs->trans("ErrorRecordNotFound") . '
'; llxFooter(); - dol_shutdown(); exit; } diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 428383b4907..dadb61b551d 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -71,7 +71,6 @@ if (empty($object->id)) { echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'), '
' . $langs->trans("ErrorRecordNotFound") . '
'; llxFooter(); - dol_shutdown(); exit; } From bd52613331d59d0d3cf8f08872319ce6c1312ea2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Oct 2021 17:06:10 +0200 Subject: [PATCH 03/16] Fix phpcs --- htdocs/compta/facture/stats/index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 03fcf5b37d0..c8961762a81 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -109,7 +109,6 @@ if ($mode == 'supplier') { $stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cat ON (f.fk_soc = cat.fk_soc)'; $stats->where .= ' AND cat.fk_categorie IN ('.implode(',', $custcats).')'; } - } // Build graphic number of object From 17773f84143a13419edef2c48b40b88ba5c598fe Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 22 Oct 2021 18:26:23 +0200 Subject: [PATCH 04/16] FIX tcpdf vulnerability to roman numeral bomb, cf. tecnickom/TCPDF issue #315 --- dev/dolibarr_changes.txt | 12 ++++++++++++ .../tecnickcom/tcpdf/include/tcpdf_static.php | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index ecd25ce692b..8cb0e002d16 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -175,6 +175,18 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php - protected $default_monospaced_font = 'courier'; + protected $default_monospaced_font = 'freemono'; +* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning + of the function, replace: + + $roman = ''; + +with: + + $roman = ''; + if ($number >= 4000) { + // do not represent numbers above 4000 in Roman numerals + return strval($number); + } diff --git a/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_static.php b/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_static.php index 67bb255d187..9ed6233b46c 100644 --- a/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_static.php +++ b/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_static.php @@ -1440,6 +1440,10 @@ class TCPDF_STATIC { */ public static function intToRoman($number) { $roman = ''; + if ($number >= 4000) { + // do not represent numbers above 4000 in Roman numerals + return strval($number); + } while ($number >= 1000) { $roman .= 'M'; $number -= 1000; From 00b617d17fee7ea93897da8f7dd958e08c785506 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 23 Oct 2021 22:22:45 +0200 Subject: [PATCH 05/16] Fix #18961 : no_email field has been replaced by mailing_unsubscribe table --- htdocs/contact/list.php | 20 ++++++++----- .../modules/mailings/contacts1.modules.php | 30 ++++++++----------- .../modules/mailings/modules_mailings.php | 18 ----------- .../public/emailing/mailing-unsubscribe.php | 14 --------- 4 files changed, 24 insertions(+), 58 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 295e63c9606..935e90e6085 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -175,7 +175,7 @@ $arrayfields = array( 'p.phone_mobile'=>array('label'=>"PhoneMobile", 'position'=>32, 'checked'=>1), 'p.fax'=>array('label'=>"Fax", 'position'=>33, 'checked'=>0), 'p.email'=>array('label'=>"EMail", 'position'=>40, 'checked'=>1), - 'p.no_email'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))), + 'mu.rowid'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))), 'p.thirdparty'=>array('label'=>"ThirdParty", 'position'=>50, 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)), 'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200), 'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500), @@ -298,7 +298,7 @@ $contactstatic = new Contact($db); $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); $sql = "SELECT s.rowid as socid, s.nom as name,"; -$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email,"; +$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email,"; $sql .= " p.socialnetworks, p.photo,"; $sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,"; $sql .= " co.label as country, co.code as country_code"; @@ -306,6 +306,9 @@ $sql .= " co.label as country, co.code as country_code"; if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); } +if(!empty($conf->mailing->enabled)) { + $sql .= ", mu.rowid as no_email"; +} // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook @@ -318,6 +321,7 @@ if (!empty($search_categ)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_conta if (!empty($search_categ_thirdparty)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ if (!empty($search_categ_supplier)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; +if(!empty($conf->mailing->enabled)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mailing_unsubscribe as mu ON mu.email = p.email"; $sql .= ' WHERE p.entity IN ('.getEntity('socpeople').')'; if (!$user->rights->societe->client->voir && !$socid) //restriction { @@ -374,8 +378,8 @@ if (strlen($search_town)) $sql .= natural_search("p.town", $search_town); if (count($search_roles) > 0) { $sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".implode(',', $search_roles)."))"; } - -if ($search_no_email != '' && $search_no_email >= 0) $sql .= " AND p.no_email = ".$db->escape($search_no_email); +if ($search_no_email != -1 && $search_no_email > 0) $sql .= " AND mu.rowid IS NOT NULL"; +if ($search_no_email != -1 && $search_no_email == 0) $sql .= " AND mu.rowid IS NULL"; if ($search_status != '' && $search_status >= 0) $sql .= " AND p.statut = ".$db->escape($search_status); if ($search_import_key) $sql .= natural_search("p.import_key", $search_import_key); if ($type == "o") // filtre sur type @@ -662,7 +666,7 @@ if (!empty($arrayfields['p.email']['checked'])) print ''; print ''; } -if (!empty($arrayfields['p.no_email']['checked'])) +if (!empty($arrayfields['mu.rowid']['checked'])) { print ''; print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email); @@ -751,7 +755,7 @@ if (!empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_ if (!empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'], $_SERVER["PHP_SELF"], "p.phone_mobile", $begin, $param, '', $sortfield, $sortorder); if (!empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder); if (!empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder); -if (!empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['mu.rowid']['checked'])) print_liste_field_titre($arrayfields['mu.rowid']['label'], $_SERVER["PHP_SELF"], "mu.rowid", $begin, $param, '', $sortfield, $sortorder, 'center '); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) { @@ -905,9 +909,9 @@ while ($i < min($num, $limit)) if (!$i) $totalarray['nbfield']++; } // No EMail - if (!empty($arrayfields['p.no_email']['checked'])) + if (!empty($arrayfields['mu.rowid']['checked'])) { - print ''.yn($obj->no_email).''; + print ''.yn(!is_null($obj->no_email) ? 1 : 0).''; if (!$i) $totalarray['nbfield']++; } if (!empty($conf->socialnetworks->enabled)) { diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 9d7a23ce9fd..bc370f5552e 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -80,7 +80,7 @@ class mailing_contacts1 extends MailingTargets $statssql[0] .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $statssql[0] .= " WHERE c.entity IN (".getEntity('socpeople').")"; $statssql[0] .= " AND c.email != ''"; // Note that null != '' is false - $statssql[0] .= " AND c.no_email = 0"; + $statssql[0] .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0"; $statssql[0] .= " AND c.statut = 1"; return $statssql; @@ -104,7 +104,6 @@ class mailing_contacts1 extends MailingTargets $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc"; $sql .= " WHERE c.entity IN (".getEntity('socpeople').")"; $sql .= " AND c.email != ''"; // Note that null != '' is false - $sql .= " AND c.no_email = 0"; $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0"; // exclude unsubscribed users $sql .= " AND c.statut = 1"; @@ -132,9 +131,8 @@ class mailing_contacts1 extends MailingTargets $sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; - /*$sql.= " AND sp.email != ''"; // Note that null != '' is false - $sql.= " AND sp.no_email = 0"; - $sql.= " AND sp.statut = 1";*/ + $sql .= " AND sp.email != ''"; // Note that null != '' is false + $sql .= " AND sp.statut = 1"; $sql .= " AND (sp.poste IS NOT NULL AND sp.poste != '')"; $sql .= " GROUP BY sp.poste"; $sql .= " ORDER BY sp.poste"; @@ -166,10 +164,9 @@ class mailing_contacts1 extends MailingTargets $sql .= " ".MAIN_DB_PREFIX."socpeople as sp,"; $sql .= " ".MAIN_DB_PREFIX."categorie as c,"; $sql .= " ".MAIN_DB_PREFIX."categorie_contact as cs"; - $sql .= " WHERE sp.statut = 1"; // Note that null != '' is false - //$sql.= " AND sp.no_email = 0"; - //$sql.= " AND sp.email != ''"; - //$sql.= " AND sp.entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; + $sql .= " AND sp.email != ''"; // Note that null != '' is false + $sql .= " AND sp.statut = 1"; $sql .= " AND cs.fk_categorie = c.rowid"; $sql .= " AND cs.fk_socpeople = sp.rowid"; $sql .= " GROUP BY c.label"; @@ -241,10 +238,9 @@ class mailing_contacts1 extends MailingTargets $sql .= " ".MAIN_DB_PREFIX."socpeople as sp,"; $sql .= " ".MAIN_DB_PREFIX."categorie as c,"; $sql .= " ".MAIN_DB_PREFIX."categorie_societe as cs"; - $sql .= " WHERE sp.statut = 1"; // Note that null != '' is false - //$sql.= " AND sp.no_email = 0"; - //$sql.= " AND sp.email != ''"; - //$sql.= " AND sp.entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; + $sql .= " AND sp.email != ''"; // Note that null != '' is false + $sql .= " AND sp.statut = 1"; $sql .= " AND cs.fk_categorie = c.rowid"; $sql .= " AND cs.fk_soc = sp.fk_soc"; $sql .= " GROUP BY c.label"; @@ -283,10 +279,9 @@ class mailing_contacts1 extends MailingTargets $sql .= " ".MAIN_DB_PREFIX."socpeople as sp,"; $sql .= " ".MAIN_DB_PREFIX."categorie as c,"; $sql .= " ".MAIN_DB_PREFIX."categorie_fournisseur as cs"; - $sql .= " WHERE sp.statut = 1"; // Note that null != '' is false - //$sql.= " AND sp.no_email = 0"; - //$sql.= " AND sp.email != ''"; - //$sql.= " AND sp.entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; + $sql .= " AND sp.email != ''"; // Note that null != '' is false + $sql .= " AND sp.statut = 1"; $sql .= " AND cs.fk_categorie = c.rowid"; $sql .= " AND cs.fk_soc = sp.fk_soc"; $sql .= " GROUP BY c.label"; @@ -385,7 +380,6 @@ class mailing_contacts1 extends MailingTargets if ($filter_category_supplier <> 'all') $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as c3s"; $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; $sql .= " AND sp.email <> ''"; - $sql .= " AND sp.no_email = 0"; $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = sp.email) = 0"; // Exclude unsubscribed email adresses $sql .= " AND sp.statut = 1"; diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index ffba2571d23..d4ccc3ddb38 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -209,24 +209,6 @@ class MailingTargets // This can't be abstract as it is used for some method dol_syslog(__METHOD__.": mailing ".$j." targets added"); - /* - //Update the status to show thirdparty mail that don't want to be contacted anymore' - $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; - $sql .= " SET statut=3"; - $sql .= " WHERE fk_mailing=".$mailing_id." AND email in (SELECT email FROM ".MAIN_DB_PREFIX."societe where fk_stcomm=-1)"; - $sql .= " AND source_type='thirdparty'"; - dol_syslog(__METHOD__.": mailing update status to display thirdparty mail that do not want to be contacted"); - $result=$this->db->query($sql); - - //Update the status to show contact mail that don't want to be contacted anymore' - $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; - $sql .= " SET statut=3"; - $sql .= " WHERE fk_mailing=".$mailing_id." AND source_type='contact' AND (email in (SELECT sc.email FROM ".MAIN_DB_PREFIX."socpeople AS sc "; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid=sc.fk_soc WHERE s.fk_stcomm=-1 OR no_email=1))"; - dol_syslog(__METHOD__.": mailing update status to display contact mail that do not want to be contacted",LOG_DEBUG); - $result=$this->db->query($sql); - */ - $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; $sql .= " SET statut=3"; $sql .= " WHERE fk_mailing=".$mailing_id." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))"; diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php index d26bae234db..7b0fbf0ef72 100644 --- a/htdocs/public/emailing/mailing-unsubscribe.php +++ b/htdocs/public/emailing/mailing-unsubscribe.php @@ -100,20 +100,6 @@ if (!empty($tag) && ($unsuscrib == '1')) $resql = $db->query($sql); if (!$resql) dol_print_error($db); - /* - // Update status communication of thirdparty prospect (old usage) - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=-1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)"; - - $resql=$db->query($sql); - if (! $resql) dol_print_error($db); - - // Update status communication of contact prospect (old usage) - $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET no_email=1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='contact' AND source_id is not null)"; - - $resql=$db->query($sql); - if (! $resql) dol_print_error($db); - */ - // Update status communication of email (new usage) $sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_unsubscribe (date_creat, entity, email) VALUES ('".$db->idate(dol_now())."', ".$db->escape($obj->entity).", '".$db->escape($obj->email)."')"; From 29950a6afa83f3df3330d8e29c137302e1481999 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 23 Oct 2021 22:27:29 +0200 Subject: [PATCH 06/16] Replace != by <> in SQL requests --- htdocs/core/modules/mailings/contacts1.modules.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index bc370f5552e..bd4300ea71d 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -79,7 +79,7 @@ class mailing_contacts1 extends MailingTargets $statssql[0] .= " count(distinct(c.email)) as nb"; $statssql[0] .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $statssql[0] .= " WHERE c.entity IN (".getEntity('socpeople').")"; - $statssql[0] .= " AND c.email != ''"; // Note that null != '' is false + $statssql[0] .= " AND c.email <> ''"; // Note that null != '' is false $statssql[0] .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0"; $statssql[0] .= " AND c.statut = 1"; @@ -103,7 +103,7 @@ class mailing_contacts1 extends MailingTargets $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc"; $sql .= " WHERE c.entity IN (".getEntity('socpeople').")"; - $sql .= " AND c.email != ''"; // Note that null != '' is false + $sql .= " AND c.email <> ''"; // Note that null != '' is false $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0"; // exclude unsubscribed users $sql .= " AND c.statut = 1"; @@ -131,9 +131,9 @@ class mailing_contacts1 extends MailingTargets $sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; - $sql .= " AND sp.email != ''"; // Note that null != '' is false + $sql .= " AND sp.email <> ''"; // Note that null != '' is false $sql .= " AND sp.statut = 1"; - $sql .= " AND (sp.poste IS NOT NULL AND sp.poste != '')"; + $sql .= " AND (sp.poste IS NOT NULL AND sp.poste <> '')"; $sql .= " GROUP BY sp.poste"; $sql .= " ORDER BY sp.poste"; $resql = $this->db->query($sql); @@ -165,7 +165,7 @@ class mailing_contacts1 extends MailingTargets $sql .= " ".MAIN_DB_PREFIX."categorie as c,"; $sql .= " ".MAIN_DB_PREFIX."categorie_contact as cs"; $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; - $sql .= " AND sp.email != ''"; // Note that null != '' is false + $sql .= " AND sp.email <> ''"; // Note that null != '' is false $sql .= " AND sp.statut = 1"; $sql .= " AND cs.fk_categorie = c.rowid"; $sql .= " AND cs.fk_socpeople = sp.rowid"; @@ -239,7 +239,7 @@ class mailing_contacts1 extends MailingTargets $sql .= " ".MAIN_DB_PREFIX."categorie as c,"; $sql .= " ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; - $sql .= " AND sp.email != ''"; // Note that null != '' is false + $sql .= " AND sp.email <> ''"; // Note that null != '' is false $sql .= " AND sp.statut = 1"; $sql .= " AND cs.fk_categorie = c.rowid"; $sql .= " AND cs.fk_soc = sp.fk_soc"; @@ -280,7 +280,7 @@ class mailing_contacts1 extends MailingTargets $sql .= " ".MAIN_DB_PREFIX."categorie as c,"; $sql .= " ".MAIN_DB_PREFIX."categorie_fournisseur as cs"; $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; - $sql .= " AND sp.email != ''"; // Note that null != '' is false + $sql .= " AND sp.email <> ''"; // Note that null != '' is false $sql .= " AND sp.statut = 1"; $sql .= " AND cs.fk_categorie = c.rowid"; $sql .= " AND cs.fk_soc = sp.fk_soc"; From 983e28691bbd2186dda67a6a325e2b49f2a5d52d Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 24 Oct 2021 00:02:55 +0200 Subject: [PATCH 07/16] Use a subselect instead of a join --- htdocs/contact/list.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 935e90e6085..64207863c79 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -175,7 +175,7 @@ $arrayfields = array( 'p.phone_mobile'=>array('label'=>"PhoneMobile", 'position'=>32, 'checked'=>1), 'p.fax'=>array('label'=>"Fax", 'position'=>33, 'checked'=>0), 'p.email'=>array('label'=>"EMail", 'position'=>40, 'checked'=>1), - 'mu.rowid'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))), + 'unsubscribed'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))), 'p.thirdparty'=>array('label'=>"ThirdParty", 'position'=>50, 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)), 'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200), 'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500), @@ -307,7 +307,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); } if(!empty($conf->mailing->enabled)) { - $sql .= ", mu.rowid as no_email"; + $sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed"; } // Add fields from hooks $parameters = array(); @@ -321,7 +321,6 @@ if (!empty($search_categ)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_conta if (!empty($search_categ_thirdparty)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ if (!empty($search_categ_supplier)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; -if(!empty($conf->mailing->enabled)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mailing_unsubscribe as mu ON mu.email = p.email"; $sql .= ' WHERE p.entity IN ('.getEntity('socpeople').')'; if (!$user->rights->societe->client->voir && !$socid) //restriction { @@ -378,8 +377,8 @@ if (strlen($search_town)) $sql .= natural_search("p.town", $search_town); if (count($search_roles) > 0) { $sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".implode(',', $search_roles)."))"; } -if ($search_no_email != -1 && $search_no_email > 0) $sql .= " AND mu.rowid IS NOT NULL"; -if ($search_no_email != -1 && $search_no_email == 0) $sql .= " AND mu.rowid IS NULL"; +if ($search_no_email != -1 && $search_no_email > 0) $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) > 0"; +if ($search_no_email != -1 && $search_no_email == 0) $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) = 0"; if ($search_status != '' && $search_status >= 0) $sql .= " AND p.statut = ".$db->escape($search_status); if ($search_import_key) $sql .= natural_search("p.import_key", $search_import_key); if ($type == "o") // filtre sur type @@ -666,7 +665,7 @@ if (!empty($arrayfields['p.email']['checked'])) print ''; print ''; } -if (!empty($arrayfields['mu.rowid']['checked'])) +if (!empty($arrayfields['unsubscribed']['checked'])) { print ''; print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email); @@ -755,7 +754,7 @@ if (!empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_ if (!empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'], $_SERVER["PHP_SELF"], "p.phone_mobile", $begin, $param, '', $sortfield, $sortorder); if (!empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder); if (!empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder); -if (!empty($arrayfields['mu.rowid']['checked'])) print_liste_field_titre($arrayfields['mu.rowid']['label'], $_SERVER["PHP_SELF"], "mu.rowid", $begin, $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['unsubscribed']['checked'])) print_liste_field_titre($arrayfields['unsubscribed']['label'], $_SERVER["PHP_SELF"], "unsubscribed", $begin, $param, '', $sortfield, $sortorder, 'center '); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) { @@ -909,9 +908,9 @@ while ($i < min($num, $limit)) if (!$i) $totalarray['nbfield']++; } // No EMail - if (!empty($arrayfields['mu.rowid']['checked'])) + if (!empty($arrayfields['unsubscribed']['checked'])) { - print ''.yn(!is_null($obj->no_email) ? 1 : 0).''; + print ''.yn(($obj->unsubscribed > 0) ? 1 : 0).''; if (!$i) $totalarray['nbfield']++; } if (!empty($conf->socialnetworks->enabled)) { From e87e354bd53fdd5219c166cbdd8865646542d207 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Oct 2021 13:08:22 +0200 Subject: [PATCH 08/16] Fix: can't reset country of origin --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index c0154bf7788..ca5a8959946 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1624,7 +1624,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("CountryOrigin").''; print ''; print img_picto('', 'globe-americas', 'class="paddingrightonly"'); - print $form->select_country($object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone'); + print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; // State From fcdfd370ba226500242cd38bcc374c2a8eb8e8ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Oct 2021 14:31:55 +0200 Subject: [PATCH 09/16] Fix css --- htdocs/imports/import.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 5139e12ab7a..12b0b50c5f4 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -706,12 +706,12 @@ if ($step == 3 && $datatoimport) { print $out; print ''; - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print ''; - // Search available imports $filearray = dol_dir_list($conf->import->dir_temp, 'files', 0, '', '', 'name', SORT_DESC); if (count($filearray) > 0) { + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; + $dir = $conf->import->dir_temp; // Search available files to import @@ -752,10 +752,10 @@ if ($step == 3 && $datatoimport) { print ''; print ''; } - } - print '
'; - print '
'; + print ''; + print ''; + } print ''; } From 2436f0967b9826aee392f8e4f20c204003616354 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Oct 2021 14:37:15 +0200 Subject: [PATCH 10/16] Fix translation of Nature of member in import. --- htdocs/core/modules/modAdherent.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index d620c6244b7..66cc9799a6b 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -286,7 +286,7 @@ class modAdherent extends DolibarrModules $this->export_label[$r] = 'MembersAndSubscriptions'; $this->export_permission[$r] = array(array("adherent", "export")); $this->export_fields_array[$r] = array( - 'a.rowid'=>'Id', 'a.civility'=>"UserTitle", 'a.lastname'=>"Lastname", 'a.firstname'=>"Firstname", 'a.login'=>"Login", 'a.gender'=>"Gender", 'a.morphy'=>'Nature', + 'a.rowid'=>'Id', 'a.civility'=>"UserTitle", 'a.lastname'=>"Lastname", 'a.firstname'=>"Firstname", 'a.login'=>"Login", 'a.gender'=>"Gender", 'a.morphy'=>'MemberNature', 'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town", 'd.nom'=>"State", 'co.code'=>"CountryCode", 'co.label'=>"Country", 'a.phone'=>"PhonePro", 'a.phone_perso'=>"PhonePerso", 'a.phone_mobile'=>"PhoneMobile", 'a.email'=>"Email", 'a.birth'=>"Birthday", 'a.statut'=>"Status", 'a.photo'=>"Photo", 'a.note_public'=>"NotePublic", 'a.note_private'=>"NotePrivate", 'a.datec'=>'DateCreation', 'a.datevalid'=>'DateValidation', @@ -339,7 +339,7 @@ class modAdherent extends DolibarrModules $this->import_tables_creator_array[$r] = array('a'=>'fk_user_author'); // Fields to store import user id $this->import_fields_array[$r] = array( 'a.civility'=>"UserTitle", 'a.lastname'=>"Lastname*", 'a.firstname'=>"Firstname", 'a.gender'=>"Gender", 'a.login'=>"Login*", "a.pass"=>"Password", - "a.fk_adherent_type"=>"MemberType*", 'a.morphy'=>'Nature*', 'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town", + "a.fk_adherent_type"=>"MemberType*", 'a.morphy'=>'MemberNature*', 'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town", 'a.state_id'=>'StateId', 'a.country'=>"CountryId", 'a.phone'=>"PhonePro", 'a.phone_perso'=>"PhonePerso", 'a.phone_mobile'=>"PhoneMobile", 'a.email'=>"Email", 'a.birth'=>"Birthday", 'a.statut'=>"Status*", 'a.photo'=>"Photo", 'a.note_public'=>"NotePublic", 'a.note_private'=>"NotePrivate", 'a.datec'=>'DateCreation', 'a.datefin'=>'DateEndSubscription' From 7393abea8f816643a56b98af31c792831cf50e76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Oct 2021 14:42:26 +0200 Subject: [PATCH 11/16] Fix phpcs --- htdocs/contact/list.php | 2 +- htdocs/core/modules/mailings/modules_mailings.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 48cc6fafa61..7397cf8b61f 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -345,7 +345,7 @@ $sql .= " co.label as country, co.code as country_code"; if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); } -if(!empty($conf->mailing->enabled)) { +if (!empty($conf->mailing->enabled)) { $sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed"; } // Add fields from hooks diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 1a533591b18..1250c7a9550 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -213,7 +213,7 @@ class MailingTargets // This can't be abstract as it is used for some method $sql .= " AND source_type='thirdparty'"; dol_syslog(__METHOD__.": mailing update status to display thirdparty mail that do not want to be contacted"); $result=$this->db->query($sql); - + //Update the status to show contact mail that don't want to be contacted anymore' $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; $sql .= " SET statut=3"; @@ -222,7 +222,7 @@ class MailingTargets // This can't be abstract as it is used for some method dol_syslog(__METHOD__.": mailing update status to display contact mail that do not want to be contacted",LOG_DEBUG); $result=$this->db->query($sql); */ - + $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; $sql .= " SET statut=3"; $sql .= " WHERE fk_mailing=".((int) $mailing_id)." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))"; From 4e844b468783987c90e8455acdd5187b387d53ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Oct 2021 20:45:00 +0200 Subject: [PATCH 12/16] Fix phpcs --- htdocs/contact/list.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 1d2702d61f0..391535d784e 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -842,8 +842,7 @@ if (!empty($arrayfields['p.email']['checked'])) { print ''; print ''; } -if (!empty($arrayfields['unsubscribed']['checked'])) -{ +if (!empty($arrayfields['unsubscribed']['checked'])) { print ''; print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email); print ''; @@ -1144,8 +1143,7 @@ while ($i < min($num, $limit)) { } } // No EMail - if (!empty($arrayfields['unsubscribed']['checked'])) - { + if (!empty($arrayfields['unsubscribed']['checked'])) { print ''; if (empty($obj->email)) { //print ''.$langs->trans("NoEmail").''; From 19734c89d6e2f6cdefff152daeef5d1d9d7e931e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Oct 2021 22:09:07 +0200 Subject: [PATCH 13/16] Fix css --- htdocs/societe/list.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 8b2236cd484..000fda921ed 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1001,12 +1001,12 @@ print ''; if (!empty($arrayfields['s.rowid']['checked'])) { - print ''; } if (!empty($arrayfields['s.nom']['checked'])) { - print ''; print "\n"; print ''; if (!empty($arrayfields['s.rowid']['checked'])) { - print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder); + print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, ' data-key="id"', $sortfield, $sortorder); } if (!empty($arrayfields['s.nom']['checked'])) { - print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); + print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param,' data-key="ref"', $sortfield, $sortorder); } if (!empty($arrayfields['s.name_alias']['checked'])) { print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", "", $param, "", $sortfield, $sortorder); @@ -1387,7 +1387,7 @@ while ($i < min($num, $limit)) { } print '>'; if (!empty($arrayfields['s.rowid']['checked'])) { - print '\n"; if (!$i) { @@ -1399,7 +1399,7 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['s.name_alias']['checked'])) { $companystatic->name_alias = ''; } - print 'global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200"' : '').'>'; + print 'global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200"' : '').' data-key="ref">'; if ($contextpage == 'poslist') { print $obj->name; } else { From 637e8f44e6cb34f19643207f089433f04e8a0e5a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Oct 2021 00:05:40 +0200 Subject: [PATCH 14/16] Fix phpcs --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 000fda921ed..6f0c165b66d 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1240,7 +1240,7 @@ if (!empty($arrayfields['s.rowid']['checked'])) { print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, ' data-key="id"', $sortfield, $sortorder); } if (!empty($arrayfields['s.nom']['checked'])) { - print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param,' data-key="ref"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, ' data-key="ref"', $sortfield, $sortorder); } if (!empty($arrayfields['s.name_alias']['checked'])) { print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", "", $param, "", $sortfield, $sortorder); From e85548d4702f7095e6752ee9e010b8e52c75d2da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Oct 2021 03:06:50 +0200 Subject: [PATCH 15/16] Fix look and feel v14 --- htdocs/core/class/html.formmail.class.php | 15 +++++++-------- htdocs/core/tpl/massactions_pre.tpl.php | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 40496ee7fa9..ddffc9f2bcd 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -689,9 +689,9 @@ class FormMail extends Form $out .= '
'; + print ''; print ''; print ''; + print ''; if (!empty($search_nom_only) && empty($search_nom)) { $search_nom = $search_nom_only; } @@ -1237,10 +1237,10 @@ print '
'; + print ''; print $obj->rowid; print "
'; $out .= $langs->trans("GroupEmails"); $out .= ''; - $out .= ' withoptiononeemailperrecipient > 0 ? ' checked="checked"' : '').'> '; - $out .= $langs->trans("OneEmailPerRecipient"); - $out .= ''; + $out .= ' withoptiononeemailperrecipient > 0 ? ' checked="checked"' : '').'> '; + $out .= ''; + $out .= ''; $out .= ' - '; $out .= $langs->trans("WarningIfYouCheckOneRecipientPerEmail"); $out .= ''; @@ -771,12 +771,11 @@ class FormMail extends Form if (!empty($this->withmaindocfile)) { if ($this->withmaindocfile == 1) { - $out .= ''; + $out .= ''; + } elseif ($this->withmaindocfile == -1) { + $out .= ''; } - if ($this->withmaindocfile == -1) { - $out .= ''; - } - $out .= ' '.$langs->trans("JoinMainDoc").'.
'; + $out .= '
'; } if (is_numeric($this->withfile)) { diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 91fc11ac217..dc0a9d4bb8c 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -151,7 +151,7 @@ if ($massaction == 'presend') { // $formmail->withfile = 2; Not yet supported in mass action $formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document" if ($objecttmp->element != 'societe') { - $formmail->withfile = ''.$langs->trans("OnlyPDFattachmentSupported").''; + $formmail->withfile = ''.$langs->trans("OnlyPDFattachmentSupported").''; $formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default } $formmail->withbody = 1; From f12c709ec1fa6225381abe2364c7c83599317793 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Oct 2021 03:09:12 +0200 Subject: [PATCH 16/16] Fix checkbox --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index ddffc9f2bcd..4356bfd932e 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -775,7 +775,7 @@ class FormMail extends Form } elseif ($this->withmaindocfile == -1) { $out .= ''; } - $out .= '
'; + $out .= '
'; } if (is_numeric($this->withfile)) {