From 2c74444b1dd7652c35c8a9ebbe28496e43341872 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Aug 2026 06:12:35 +0200 Subject: [PATCH] Clean code --- .../class/externalModules.class.php | 2 - htdocs/admin/system/modules.php | 2 +- htdocs/admin/system/perf.php | 2 +- htdocs/comm/contact.php | 208 ------------------ htdocs/comm/mailing/advtargetemailing.php | 50 ++--- htdocs/theme/common/help.png | Bin 348 -> 232 bytes htdocs/theme/common/warning.png | Bin 0 -> 241 bytes .../eldy/img/{search.png => searchx.png} | Bin 8 files changed, 27 insertions(+), 237 deletions(-) delete mode 100644 htdocs/comm/contact.php create mode 100644 htdocs/theme/common/warning.png rename htdocs/theme/eldy/img/{search.png => searchx.png} (100%) diff --git a/htdocs/admin/remotestore/class/externalModules.class.php b/htdocs/admin/remotestore/class/externalModules.class.php index be99a65d0f3..33637313d22 100644 --- a/htdocs/admin/remotestore/class/externalModules.class.php +++ b/htdocs/admin/remotestore/class/externalModules.class.php @@ -557,7 +557,6 @@ class ExternalModules $urldownload = 'https://www.dolistore.com/_service_download.php?t=free&p='.$reg[1]; $download_link .= ''; $download_link .= img_picto('', 'download', 'class="size2x paddingright"'); - //$download_link .= ''; $download_link .= ''; } } @@ -569,7 +568,6 @@ class ExternalModules $download_link .= ''; $download_link .= ''; $download_link .= img_picto('', 'download', 'class="size2x paddingright"'); - //$download_link .= ''; $download_link .= ''; } diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 234fe8633b9..b21e6c56159 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -406,7 +406,7 @@ foreach ($moduleList as $module) { if (getDolGlobalString('MAIN_SHOW_PERMISSION')) { if (empty($langs->tab_translate[$translationKey])) { $tooltip = 'Missing translation (key '.$translationKey.' not found in admin.lang)'; - $idperms .= ' Warning'; + $idperms .= ' Warning'; } } } diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index a4eba7ecb9c..918ca2e8a5e 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -335,7 +335,7 @@ jQuery(document).ready(function() { getimgurl = $.ajax({ type: "GET", data: { token: \'notrequired\' }, - url: \''.DOL_URL_ROOT.'/theme/eldy/img/help.png\', + url: \''.DOL_URL_ROOT.'/theme/common/img/help.png\', cache: false, /* async: false, */ /* crossDomain: true,*/ diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php deleted file mode 100644 index 5c9d4658470..00000000000 --- a/htdocs/comm/contact.php +++ /dev/null @@ -1,208 +0,0 @@ - - * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2009 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024-2026 MDW - * - * 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 . - */ - -/** - * \file htdocs/comm/contact.php - * \ingroup commercial - * \brief Liste des contacts - */ - -// Load Dolibarr environment -require '../main.inc.php'; - -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - -// Load translation files required by the page -$langs->load("companies"); - -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (!$sortorder) { - $sortorder = "ASC"; -} -if (!$sortfield) { - $sortfield = "p.lastname"; -} -if ($page < 0) { - $page = 0; -} -$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; -$offset = $limit * $page; - -$type = GETPOST('type', 'alpha'); -$search_lastname = GETPOST('search_nom') ? GETPOST('search_nom') : GETPOST('search_lastname'); // For backward compatibility -$search_firstname = GETPOST('search_firstname') ? GETPOST('search_firstname') : GETPOST('search_firstname'); // For backward compatibility -$search_company = GETPOST('search_societe') ? GETPOST('search_societe') : GETPOST('search_company'); // For backward compatibility -$contactname = GETPOST('contactname'); -$begin = GETPOST('begin', 'alpha'); - -// Security check -$socid = GETPOSTINT('socid'); -if ($user->socid) { - $action = ''; - $socid = $user->socid; -} - -$hookmanager->initHooks(array('contactlist')); -$result = restrictedArea($user, 'societe', $socid, ''); - - -/* - * View - */ - -llxHeader('', $langs->trans("Contacts")); - -$urlfiche = null; - -$label = $langs->trans("Unknown"); // Ensure label is defined - -if ($type == "c" || $type == "p") { - $label = $langs->trans("Customers"); - $urlfiche = "card.php"; -} -if ($type == "f") { - $label = $langs->trans("Suppliers"); - $urlfiche = "card.php"; -} - -/* - * List mode - */ - -$sql = "SELECT s.rowid, s.nom as name, st.libelle as stcomm,"; -$sql .= " p.rowid as cidp, p.lastname, p.firstname, p.email, p.phone"; -$sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st,"; -$sql .= " ".MAIN_DB_PREFIX."socpeople as p"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; -$sql .= " WHERE s.fk_stcomm = st.id"; -$sql .= " AND p.entity IN (".getEntity('contact').")"; -if ($type == "c") { - $sql .= " AND s.client IN (1, 3)"; -} -if ($type == "p") { - $sql .= " AND s.client IN (2, 3)"; -} -if ($type == "f") { - $sql .= " AND s.fournisseur = 1"; -} -if (!empty($search_lastname)) { - $sql .= " AND p.lastname LIKE '%".$db->escape($search_lastname)."%'"; -} -if (!empty($search_firstname)) { - $sql .= " AND p.firstname LIKE '%".$db->escape($search_firstname)."%'"; -} -if (!empty($search_company)) { - $sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'"; -} -if (!empty($contactname)) { // access a partir du module de recherche - $sql .= " AND (p.lastname LIKE '%".$db->escape($contactname)."%' OR p.firstname LIKE '%".$db->escape($contactname)."%') "; - $sortfield = "p.lastname"; - $sortorder = "ASC"; -} -// If the internal user must only see his customers, force searching by him -$search_sale = 0; -if (!$user->hasRight('societe', 'client', 'voir')) { - $search_sale = $user->id; -} -// Search on sale representative -if ($search_sale && $search_sale != '-1') { - if ($search_sale == -2) { - $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)"; - } elseif ($search_sale > 0) { - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; - } -} -// Search on socid -if ($socid) { - $sql .= " AND p.fk_soc = ".((int) $socid); -} - -$sql .= $db->order($sortfield, $sortorder); -$sql .= $db->plimit($limit + 1, $offset); - -$resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); - - $param = "&type=".$type; - - $title = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); - print_barre_liste($title.($label ? " (".$label.")" : ""), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num); - - print '
'; - - print ''; - print ''; - print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "p.lastname", $begin, $param, "", $sortfield, $sortorder); - print_liste_field_titre("Firstname", $_SERVER["PHP_SELF"], "p.firstname", $begin, $param, "", $sortfield, $sortorder); - print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", $begin, $param, "", $sortfield, $sortorder); - print_liste_field_titre("Email"); - print_liste_field_titre("Phone"); - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $i = 0; - while ($i < min($num, $limit)) { - $obj = $db->fetch_object($resql); - - print ''; - print ''; - print ''; - - print '\n"; - - print ''; - - print ''; - - print "\n"; - $i++; - } - print "
 
'.img_object($langs->trans("ShowContact"), "contact"); - print ' '.$obj->name.''.dol_escape_htmltag($obj->firstname).''.img_object($langs->trans("ShowCompany"), "company").' '; - print ''.$obj->name."'.dol_print_email($obj->email, $obj->cidp, $obj->rowid, 'AC_EMAIL').''.dol_print_phone($obj->phone, $obj->country_code, $obj->cidp, $obj->rowid, 'AC_TEL').' 
"; - - print '
'; - - $db->free($resql); -} else { - dol_print_error($db); -} - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index 7187c97a6a1..de74a12bb78 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -718,7 +718,7 @@ if ($object->fetch($id) >= 0) { // Code Client print ''.$langs->trans('CustomerCode'); if (!empty($array_query['cust_code'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); $cust_code_str = (string) $array_query['cust_code']; } else { $cust_code_str = null; @@ -730,7 +730,7 @@ if ($object->fetch($id) >= 0) { // Address Client print ''.$langs->trans('Address'); if (!empty($array_query['cust_adress'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); @@ -739,7 +739,7 @@ if ($object->fetch($id) >= 0) { // Zip Client print ''.$langs->trans('Zip'); if (!empty($array_query['cust_zip'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); @@ -748,7 +748,7 @@ if ($object->fetch($id) >= 0) { // City Client print ''.$langs->trans('Town'); if (!empty($array_query['cust_city'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); @@ -757,7 +757,7 @@ if ($object->fetch($id) >= 0) { // State Client print ''.$langs->trans('State'); if (!empty($array_query['cust_state'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print $formadvtargetemaling->multiselectState('cust_state', $array_query['cust_state']); @@ -767,7 +767,7 @@ if ($object->fetch($id) >= 0) { // Customer Country print ''.$langs->trans("Country"); if (!empty($array_query['cust_country'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print $formadvtargetemaling->multiselectCountry('cust_country', $array_query['cust_country']); @@ -777,7 +777,7 @@ if ($object->fetch($id) >= 0) { // State Customer print ''.$langs->trans('Status').' '.$langs->trans('ThirdParty'); if (!empty($array_query['cust_status'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''; print $formadvtargetemaling->advMultiselectarray( @@ -794,7 +794,7 @@ if ($object->fetch($id) >= 0) { // Mother Company print ''.$langs->trans("ParentCompany"); if (!empty($array_query['cust_mothercompany'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print ''; @@ -806,7 +806,7 @@ if ($object->fetch($id) >= 0) { $selected = $array_query['cust_typecust']; print ''.$langs->trans('ProspectCustomer').' '.$langs->trans('ThirdParty'); if (!empty($array_query['cust_typecust'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''; $options_array = array( @@ -822,7 +822,7 @@ if ($object->fetch($id) >= 0) { // Prospection status print ''.$langs->trans('ProspectLevel'); if (!empty($array_query['cust_prospect_status'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''; print $formadvtargetemaling->multiselectProspectionStatus($array_query['cust_prospect_status'], 'cust_prospect_status'); @@ -832,7 +832,7 @@ if ($object->fetch($id) >= 0) { // Prospection comm status print ''.$langs->trans('StatusProsp'); if (!empty($array_query['cust_comm_status'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''; print $formadvtargetemaling->advMultiselectarray('cust_comm_status', $advTarget->type_statuscommprospect, $array_query['cust_comm_status']); @@ -842,7 +842,7 @@ if ($object->fetch($id) >= 0) { // Customer Type print ''.$langs->trans("ThirdPartyType"); if (!empty($array_query['cust_typeent'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print $formadvtargetemaling->advMultiselectarray('cust_typeent', $formcompany->typent_array(0, "(id:<>:0)"), $array_query['cust_typeent']); @@ -852,7 +852,7 @@ if ($object->fetch($id) >= 0) { // Staff number print ''.$langs->trans("Staff"); if (!empty($array_query['cust_effectif_id'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''; print $formadvtargetemaling->advMultiselectarray("cust_effectif_id", $formcompany->effectif_array(0, "(id:<>:0)"), $array_query['cust_effectif_id']); @@ -862,7 +862,7 @@ if ($object->fetch($id) >= 0) { // Sales manager print ''.$langs->trans("SalesRepresentatives"); if (!empty($array_query['cust_saleman'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print $formadvtargetemaling->multiselectselectSalesRepresentatives('cust_saleman', $array_query['cust_saleman'], $user); @@ -873,7 +873,7 @@ if ($object->fetch($id) >= 0) { if (getDolGlobalInt('MAIN_MULTILANGS')) { print ''.$langs->trans("DefaultLang"); if (!empty($array_query['cust_language'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print $formadvtargetemaling->multiselectselectLanguage('cust_language', $array_query['cust_language']); @@ -904,7 +904,7 @@ if ($object->fetch($id) >= 0) { } print ''.$langs->trans($extrafieldinfo['label'][$key]); if (!empty($array_query['options_'.$key]) || (is_array($array_query['options_'.$key]) && count($array_query['options_'.$key]) > 0)) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''; if (($extrafieldinfo['type'][$key] == 'varchar') || ($extrafieldinfo['type'][$key] == 'text')) { @@ -973,7 +973,7 @@ if ($object->fetch($id) >= 0) { // State Contact print ''.$langs->trans('Status').' '.$langs->trans('Contact'); if (!empty($array_query['contact_status'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''; print $formadvtargetemaling->advMultiselectarray( @@ -991,7 +991,7 @@ if ($object->fetch($id) >= 0) { // Civility print ''.$langs->trans("UserTitle"); if (!empty($array_query['contact_civility'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''; print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']); @@ -1000,14 +1000,14 @@ if ($object->fetch($id) >= 0) { // contact name print ''.$langs->trans('Contact').' '.$langs->trans('Lastname'); if (!empty($array_query['contact_lastname'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print ''."\n"; print ''.$langs->trans('Contact').' '.$langs->trans('Firstname'); if (!empty($array_query['contact_firstname'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); @@ -1016,7 +1016,7 @@ if ($object->fetch($id) >= 0) { // Contact Country print ''.$langs->trans('Contact').' '.$langs->trans("Country"); if (!empty($array_query['contact_country'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']); @@ -1026,7 +1026,7 @@ if ($object->fetch($id) >= 0) { // Never send mass mailing print ''.$langs->trans('Contact').' '.$langs->trans("No_Email"); if (!empty($array_query['contact_no_email'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print $form->selectarray( @@ -1044,7 +1044,7 @@ if ($object->fetch($id) >= 0) { // Contact Date Create print ''.$langs->trans('Contact').' '.$langs->trans("DateCreation"); if (!empty($array_query['contact_create_st_dt'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print ''; @@ -1059,7 +1059,7 @@ if ($object->fetch($id) >= 0) { // Contact update Create print '
'.$langs->trans('Contact').' '.$langs->trans("DateLastModification"); if (!empty($array_query['contact_update_st_dt'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''."\n"; print ''; @@ -1099,7 +1099,7 @@ if ($object->fetch($id) >= 0) { foreach ($extrafieldinfo['label'] as $key => $val) { print '
'.$extrafieldinfo['label'][$key]; if ($array_query['options_'.$key.'_cnct'] != '' || (is_array($array_query['options_'.$key.'_cnct']) && count($array_query['options_'.$key.'_cnct']) > 0)) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + print img_picto($langs->trans('AdvTgtUse'), 'tick'); } print ''; if (($extrafieldinfo['type'][$key] == 'varchar') || ($extrafieldinfo['type'][$key] == 'text')) { diff --git a/htdocs/theme/common/help.png b/htdocs/theme/common/help.png index 58b0619317c99409540878958de4dc52a08b263e..d769e2712251a5a3405cc5f981eec49a28f0cb73 100644 GIT binary patch delta 215 zcmV;|04V?50_Xvd8Gi-<0019IEztk~0Ix|zK~#7FW1tAQxw$a|@pT~nkB(hkU6J`W zKx*L{fs$NMiGNV~9S}P~@q3sY)DSLY8@XVnLKT9jQQ5G%v@Q2DDk zHKO1O@z9b034?q}bAW3N#K}005BU(qqmF RrpW*R002ovPDHLkV1kuFSa|>d delta 332 zcmV-S0ki(-0o($R8Gix*0059Gx`qG%00wkYPE!E?0RI60H&`2e0003INklezt)U5a2_bolzUoQ9!TF=6^t0iuOgzMq4SbVf5v=E6l|DlYIo z;AWPjxj;MTZ$-Z# ex6CZ)m&reHR{MhV)lSv`0000(tog(73M8