From 76733148c5b22b098a9ad78ac4177864509c6425 Mon Sep 17 00:00:00 2001 From: Jonathan lescaut Date: Fri, 29 Mar 2024 10:31:35 +0100 Subject: [PATCH] retour PR --- htdocs/societe/list.php | 916 ++++++++++++++++++++-------------------- 1 file changed, 464 insertions(+), 452 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index ff430db78c8ab..73e793c0e2b05 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -31,35 +31,37 @@ */ /** - * \file htdocs/societe/list.php - * \ingroup societe - * \brief Page to show list of third parties + * \file htdocs/societe/list.php + * \ingroup societe + * \brief Page to show list of third parties */ + // Load Dolibarr environment require_once '../main.inc.php'; -include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; -require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php'; +include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; if (isModEnabled('category')) { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcategory.class.php'; + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php'; } // Load translation files required by the page $langs->loadLangs(array("companies", "commercial", "customers", "suppliers", "bills", "compta", "categories", "cashdesk")); + // Get parameters -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOSTINT('show_files'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); +$confirm = GETPOST('confirm', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'thirdpartylist'; -$optioncss = GETPOST('optioncss', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); if ($contextpage == 'poslist') { $optioncss = 'print'; } @@ -108,11 +110,11 @@ $searchCategorySupplierOperator = getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT'); } $searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array'); -if (! empty($search_categ_cus) && empty($searchCategoryCustomerList)) { +if (!empty($search_categ_cus) && empty($searchCategoryCustomerList)) { $searchCategoryCustomerList = array($search_categ_cus); } $searchCategorySupplierList = GETPOST('search_category_supplier_list', 'array'); -if (! empty($search_categ_sup) && empty($searchCategorySupplierList)) { +if (!empty($search_categ_sup) && empty($searchCategorySupplierList)) { $searchCategorySupplierList = array($search_categ_sup); } $search_country = GETPOST("search_country", 'intcomma'); @@ -123,41 +125,42 @@ $search_type = GETPOST('search_type', 'alpha'); $search_level = GETPOST("search_level", "array:alpha"); $search_stcomm = GETPOST('search_stcomm', "array:int"); -$search_import_key = trim(GETPOST("search_import_key", "alpha")); +$search_import_key = trim(GETPOST("search_import_key", "alpha")); $search_parent_name = trim(GETPOST('search_parent_name', 'alpha')); $search_date_creation_startmonth = GETPOSTINT('search_date_creation_startmonth'); $search_date_creation_startyear = GETPOSTINT('search_date_creation_startyear'); $search_date_creation_startday = GETPOSTINT('search_date_creation_startday'); -$search_date_creation_start = dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear); // Use tzserver +$search_date_creation_start = dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear); // Use tzserver $search_date_creation_endmonth = GETPOSTINT('search_date_creation_endmonth'); $search_date_creation_endyear = GETPOSTINT('search_date_creation_endyear'); $search_date_creation_endday = GETPOSTINT('search_date_creation_endday'); -$search_date_creation_end = dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear); // Use tzserver +$search_date_creation_end = dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear); // Use tzserver $search_date_modif_startmonth = GETPOSTINT('search_date_modif_startmonth'); $search_date_modif_startyear = GETPOSTINT('search_date_modif_startyear'); $search_date_modif_startday = GETPOSTINT('search_date_modif_startday'); -$search_date_modif_start = dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear); // Use tzserver +$search_date_modif_start = dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear); // Use tzserver $search_date_modif_endmonth = GETPOSTINT('search_date_modif_endmonth'); $search_date_modif_endyear = GETPOSTINT('search_date_modif_endyear'); $search_date_modif_endday = GETPOSTINT('search_date_modif_endday'); -$search_date_modif_end = dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear); // Use tzserver +$search_date_modif_end = dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear); // Use tzserver + $type = GETPOST('type', 'alpha'); $place = GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'; // $place is string id of table for Bar or Restaurant -$diroutputmassaction = $conf->societe->dir_output . '/temp/massgeneration/' . $user->id; +$diroutputmassaction = $conf->societe->dir_output.'/temp/massgeneration/'.$user->id; // Load variable for pagination $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (! $sortorder) { +if (!$sortorder) { $sortorder = "ASC"; } -if (! $sortfield) { +if (!$sortfield) { $sortfield = "s.nom"; } if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { @@ -231,13 +234,13 @@ 's.phone_mobile' => "PhoneMobile", 's.fax' => "Fax", ); -if (($tmp = $langs->transnoentities("ProfId4" . $mysoc->country_code)) && $tmp != "ProfId4" . $mysoc->country_code && $tmp != '-') { +if (($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') { $fieldstosearchall['s.idprof4'] = 'ProfId4'; } -if (($tmp = $langs->transnoentities("ProfId5" . $mysoc->country_code)) && $tmp != "ProfId5" . $mysoc->country_code && $tmp != '-') { +if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') { $fieldstosearchall['s.idprof5'] = 'ProfId5'; } -if (($tmp = $langs->transnoentities("ProfId6" . $mysoc->country_code)) && $tmp != "ProfId6" . $mysoc->country_code && $tmp != '-') { +if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') { $fieldstosearchall['s.idprof6'] = 'ProfId6'; } if (isModEnabled('barcode')) { @@ -248,6 +251,7 @@ $fieldstosearchall = dolExplodeIntoArray($conf->global->THIRDPARTY_QUICKSEARCH_ON_FIELDS); } + // Define list of fields to show into list $checkedcustomercode = (in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist', 'poslist')) ? 1 : 0); $checkedsuppliercode = (in_array($contextpage, array('supplierlist')) ? 1 : 0); @@ -311,7 +315,7 @@ $arrayfields['sales.representative'] = array('label' => $langs->trans("SalesRepresentatives"), 'checked' => 1, 'position' => 12); // Extra fields -include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php'; +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); @@ -324,42 +328,44 @@ } $result = restrictedArea($user, 'societe', $socid, ''); + + /* * Actions */ -if ($action == "change" && $user->hasRight('takepos', 'run')) { // Change customer for TakePOS +if ($action == "change" && $user->hasRight('takepos', 'run')) { // Change customer for TakePOS $idcustomer = GETPOSTINT('idcustomer'); // Check if draft invoice already exists, if not create it - $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "facture where ref='(PROV-POS" . $_SESSION["takeposterminal"] . "-" . $place . ")' AND entity IN (" . getEntity('invoice') . ")"; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")"; $result = $db->query($sql); $num_lines = $db->num_rows($result); if ($num_lines == 0) { - require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $invoice = new Facture($db); - $constforthirdpartyid = 'CASHDESK_ID_THIRDPARTY' . $_SESSION["takeposterminal"]; + $constforthirdpartyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]; $invoice->socid = getDolGlobalInt($constforthirdpartyid); $invoice->date = dol_now(); $invoice->module_source = 'takepos'; $invoice->pos_source = $_SESSION["takeposterminal"]; $placeid = $invoice->create($user); - $sql = "UPDATE " . MAIN_DB_PREFIX . "facture set ref='(PROV-POS" . $_SESSION["takeposterminal"] . "-" . $place . ")' where rowid = " . ((int) $placeid); + $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid = ".((int) $placeid); $db->query($sql); } - $sql = "UPDATE " . MAIN_DB_PREFIX . "facture set fk_soc=" . ((int) $idcustomer) . " where ref='(PROV-POS" . $_SESSION["takeposterminal"] . "-" . $place . ")'"; + $sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".((int) $idcustomer)." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; $resql = $db->query($sql); ?> - + parent.$.colorbox.close(); /* Close the popup */ + }); + hasRight('societe', 'supprimer'); $permissiontoadd = $user->hasRight("societe", "creer"); $uploaddir = $conf->societe->dir_output; - include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php'; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; if ($action == 'setstcomm') { $object = new Client($db); @@ -474,6 +480,8 @@ $search_status = 1; // display active thirdparty only by default } + + /* * View */ @@ -510,10 +518,11 @@ } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; + // Select every potentials, and note each potentials which fit in search parameters $tab_level = array(); $sql = "SELECT code, label, sortorder"; -$sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectlevel"; +$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel"; $sql .= " WHERE active > 0"; $sql .= " ORDER BY sortorder"; $resql = $db->query($sql); @@ -545,9 +554,9 @@ $sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " region.code_region as region_code, region.nom as region_name"; // Add fields from extrafields -if (! empty($extrafields->attributes[$object->table_element]['label'])) { +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 : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } // Add fields from hooks @@ -559,28 +568,28 @@ $sqlfields = $sql; // $sql fields to remove for count total -$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s2 ON s.parent = s2.rowid"; -if (! empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element . "_extrafields as ef on (s.rowid = ef.fk_object)"; +$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s.parent = s2.rowid"; +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)"; } -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as country on (country.rowid = s.fk_pays)"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_typent as typent on (typent.id = s.fk_typent)"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_effectif as staff on (staff.id = s.fk_effectif)"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_departements as state on (state.rowid = s.fk_departement)"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_regions as region on (region.code_region = state.fk_region)"; -$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . "c_stcomm as st ON s.fk_stcomm = st.id"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region.code_region = state.fk_region)"; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id"; // Add table from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; -if (! $user->hasRight('fournisseur', 'lire')) { +$sql .= " WHERE s.entity IN (".getEntity('societe').")"; +if (!$user->hasRight('fournisseur', 'lire')) { $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible } // Search on sale representative -if (! empty($search_sale) && $search_sale != '-1') { +if (!empty($search_sale) && $search_sale != '-1') { $search_sale_req = array_filter($search_sale, function (string $value): bool { $value = intval($value); return $value >= 0; @@ -588,69 +597,69 @@ $search_sale_req = implode(',', $search_sale_req); if (count($search_sale) == 1 && in_array('-2', $search_sale)) { - $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)"; - } elseif (count($search_sale) > 1 && ! in_array('-2', $search_sale)) { - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user IN (" . $search_sale_req . "))"; + $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)"; + } elseif (count($search_sale) > 1 && !in_array('-2', $search_sale)) { + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user IN (".$search_sale_req."))"; } elseif (count($search_sale) > 1 && in_array('-2', $search_sale)) { - $sql .= " AND (EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user IN (" . $search_sale_req . "))"; - $sql .= " OR NOT EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = s.rowid))"; + $sql .= " AND (EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user IN (".$search_sale_req."))"; + $sql .= " OR NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = s.rowid))"; } } // Search for tag/category ($searchCategoryCustomerList is an array of ID) -if (! empty($searchCategoryCustomerList)) { +if (!empty($searchCategoryCustomerList)) { $searchCategoryCustomerSqlList = array(); $listofcategoryid = ''; foreach ($searchCategoryCustomerList as $searchCategoryCustomer) { if (intval($searchCategoryCustomer) == -2) { - $searchCategoryCustomerSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM " . MAIN_DB_PREFIX . "categorie_societe as ck WHERE s.rowid = ck.fk_soc)"; + $searchCategoryCustomerSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc)"; } elseif (intval($searchCategoryCustomer) > 0) { if ($searchCategoryCustomerOperator == 0) { - $searchCategoryCustomerSqlList[] = " EXISTS (SELECT ck.fk_soc FROM " . MAIN_DB_PREFIX . "categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = " . ((int) $searchCategoryCustomer) . ")"; + $searchCategoryCustomerSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategoryCustomer).")"; } else { - $listofcategoryid .= ($listofcategoryid ? ', ' : '') . ((int) $searchCategoryCustomer); + $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer); } } } if ($listofcategoryid) { - $searchCategoryCustomerSqlList[] = " EXISTS (SELECT ck.fk_soc FROM " . MAIN_DB_PREFIX . "categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (" . $db->sanitize($listofcategoryid) . "))"; + $searchCategoryCustomerSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))"; } if ($searchCategoryCustomerOperator == 1) { - if (! empty($searchCategoryCustomerSqlList)) { - $sql .= " AND (" . implode(' OR ', $searchCategoryCustomerSqlList) . ")"; + if (!empty($searchCategoryCustomerSqlList)) { + $sql .= " AND (".implode(' OR ', $searchCategoryCustomerSqlList).")"; } } else { - if (! empty($searchCategoryCustomerSqlList)) { - $sql .= " AND (" . implode(' AND ', $searchCategoryCustomerSqlList) . ")"; + if (!empty($searchCategoryCustomerSqlList)) { + $sql .= " AND (".implode(' AND ', $searchCategoryCustomerSqlList).")"; } } } // Search for tag/category ($searchCategorySupplierList is an array of ID) -if (! empty($searchCategorySupplierList)) { +if (!empty($searchCategorySupplierList)) { $searchCategorySupplierSqlList = array(); $listofcategoryid = ''; foreach ($searchCategorySupplierList as $searchCategorySupplier) { if (intval($searchCategorySupplier) == -2) { - $searchCategorySupplierSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM " . MAIN_DB_PREFIX . "categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)"; + $searchCategorySupplierSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)"; } elseif (intval($searchCategorySupplier) > 0) { if ($searchCategorySupplierOperator == 0) { - $searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM " . MAIN_DB_PREFIX . "categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = " . ((int) $searchCategorySupplier) . ")"; + $searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategorySupplier).")"; } else { - $listofcategoryid .= ($listofcategoryid ? ', ' : '') . ((int) $searchCategorySupplier); + $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier); } } } if ($listofcategoryid) { - $searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM " . MAIN_DB_PREFIX . "categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (" . $db->sanitize($listofcategoryid) . "))"; + $searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))"; } if ($searchCategorySupplierOperator == 1) { - if (! empty($searchCategorySupplierSqlList)) { - $sql .= " AND (" . implode(' OR ', $searchCategorySupplierSqlList) . ")"; + if (!empty($searchCategorySupplierSqlList)) { + $sql .= " AND (".implode(' OR ', $searchCategorySupplierSqlList).")"; } } else { - if (! empty($searchCategorySupplierSqlList)) { - $sql .= " AND (" . implode(' AND ', $searchCategorySupplierSqlList) . ")"; + if (!empty($searchCategorySupplierSqlList)) { + $sql .= " AND (".implode(' AND ', $searchCategorySupplierSqlList).")"; } } } @@ -705,7 +714,7 @@ $sql .= natural_search("region.nom", $search_region); } if ($search_country && $search_country != '-1') { - $sql .= " AND s.fk_pays IN (" . $db->sanitize($search_country) . ')'; + $sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')'; } if ($search_email) { $sql .= natural_search("s.email", $search_email); @@ -745,7 +754,7 @@ } // Filter on type of thirdparty if ($search_type > 0 && in_array($search_type, array('1,3', '1,2,3', '2,3'))) { - $sql .= " AND s.client IN (" . $db->sanitize($search_type) . ")"; + $sql .= " AND s.client IN (".$db->sanitize($search_type).")"; } if ($search_type > 0 && in_array($search_type, array('4'))) { $sql .= " AND s.fournisseur = 1"; @@ -765,7 +774,7 @@ if ($search_type_thirdparty && $search_type_thirdparty > 0) { $sql .= natural_search("s.fk_typent", $search_type_thirdparty, 2); } -if (! empty($search_staff) && $search_staff != '-1') { +if (!empty($search_staff) && $search_staff != '-1') { $sql .= natural_search("s.fk_effectif", $search_staff, 2); } if ($search_parent_name) { @@ -781,27 +790,27 @@ $sql .= natural_search("s.import_key", $search_import_key); } if ($search_date_creation_start) { - $sql .= " AND s.datec >= '" . $db->idate($search_date_creation_start) . "'"; + $sql .= " AND s.datec >= '".$db->idate($search_date_creation_start)."'"; } if ($search_date_creation_end) { - $sql .= " AND s.datec <= '" . $db->idate($search_date_creation_end) . "'"; + $sql .= " AND s.datec <= '".$db->idate($search_date_creation_end)."'"; } if ($search_date_modif_start) { - $sql .= " AND s.tms >= '" . $db->idate($search_date_modif_start) . "'"; + $sql .= " AND s.tms >= '".$db->idate($search_date_modif_start)."'"; } if ($search_date_modif_end) { - $sql .= " AND s.tms <= '" . $db->idate($search_date_modif_end) . "'"; + $sql .= " AND s.tms <= '".$db->idate($search_date_modif_end)."'"; } // Add where from extra fields -include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php'; +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { if ($socid) { - $sql .= " AND s.rowid = " . ((int) $socid); + $sql .= " AND s.rowid = ".((int) $socid); } } $sql .= $hookmanager->resPrint; @@ -813,9 +822,9 @@ // Count total nb of records $nbtotalofrecords = ''; -if (! getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { +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('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); $resql = $db->query($sqlforcount); if ($resql) { @@ -825,7 +834,7 @@ dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -838,29 +847,30 @@ $sql .= $db->plimit($limit + 1, $offset); } $resql = $db->query($sql); -if (! $resql) { +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 != '' || $search_cti != '') && $action != 'list') { $obj = $db->fetch_object($resql); $id = $obj->rowid; if (getDolGlobalString('SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD')) { if ($obj->client > 0) { - header("Location: " . DOL_URL_ROOT . '/comm/card.php?socid=' . $id); + header("Location: ".DOL_URL_ROOT.'/comm/card.php?socid='.$id); exit; } if ($obj->fournisseur > 0) { - header("Location: " . DOL_URL_ROOT . '/fourn/card.php?socid=' . $id); + header("Location: ".DOL_URL_ROOT.'/fourn/card.php?socid='.$id); exit; } } - header("Location: " . DOL_URL_ROOT . '/societe/card.php?socid=' . $id); + header("Location: ".DOL_URL_ROOT.'/societe/card.php?socid='.$id); exit; } @@ -869,49 +879,50 @@ $paramsCat = ''; foreach ($searchCategoryCustomerList as $searchCategoryCustomer) { - $paramsCat .= "&search_category_customer_list[]=" . urlencode($searchCategoryCustomer); + $paramsCat .= "&search_category_customer_list[]=".urlencode($searchCategoryCustomer); } foreach ($searchCategorySupplierList as $searchCategorySupplier) { - $paramsCat .= "&search_category_supplier_list[]=" . urlencode($searchCategorySupplier); + $paramsCat .= "&search_category_supplier_list[]=".urlencode($searchCategorySupplier); } llxHeader('', $title, $help_url, '', 0, 0, array(), array(), $paramsCat); + $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; -if (! empty($mode)) { - $param .= '&mode=' . urlencode($mode); +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); } -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage=' . urlencode($contextpage); +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit=' . ((int) $limit); + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { - $param .= '&optioncss=' . urlencode($optioncss); + $param .= '&optioncss='.urlencode($optioncss); } if ($search_all != '') { - $param = "&search_all=" . urlencode($search_all); + $param = "&search_all=".urlencode($search_all); } if ($search_categ_cus > 0) { - $param .= '&search_categ_cus=' . urlencode((string) ($search_categ_cus)); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } if ($search_categ_sup > 0) { - $param .= '&search_categ_sup=' . urlencode((string) ($search_categ_sup)); + $param .= '&search_categ_sup='.urlencode((string) ($search_categ_sup)); } if ($searchCategoryCustomerOperator == 1) { - $param .= "&search_category_customer_operator=" . urlencode((string) ($searchCategoryCustomerOperator)); + $param .= "&search_category_customer_operator=".urlencode((string) ($searchCategoryCustomerOperator)); } if ($searchCategorySupplierOperator == 1) { - $param .= "&search_category_supplier_operator=" . urlencode((string) ($searchCategorySupplierOperator)); + $param .= "&search_category_supplier_operator=".urlencode((string) ($searchCategorySupplierOperator)); } foreach ($searchCategoryCustomerList as $searchCategoryCustomer) { - $param .= "&search_category_customer_list[]=" . urlencode($searchCategoryCustomer); + $param .= "&search_category_customer_list[]=".urlencode($searchCategoryCustomer); } foreach ($searchCategorySupplierList as $searchCategorySupplier) { - $param .= "&search_category_supplier_list[]=" . urlencode($searchCategorySupplier); + $param .= "&search_category_supplier_list[]=".urlencode($searchCategorySupplier); } if (is_array($search_sale)) { foreach ($search_sale as $sale_id) { @@ -919,165 +930,165 @@ } } if ($search_id > 0) { - $param .= "&search_id=" . ((int) $search_id); + $param .= "&search_id=".((int) $search_id); } if ($search_nom != '') { - $param .= "&search_nom=" . urlencode($search_nom); + $param .= "&search_nom=".urlencode($search_nom); } if ($search_alias != '') { - $param .= "&search_alias=" . urlencode($search_alias); + $param .= "&search_alias=".urlencode($search_alias); } if ($search_address != '') { - $param .= '&search_address=' . urlencode($search_address); + $param .= '&search_address='.urlencode($search_address); } if ($search_zip != '') { - $param .= "&search_zip=" . urlencode($search_zip); + $param .= "&search_zip=".urlencode($search_zip); } if ($search_town != '') { - $param .= "&search_town=" . urlencode($search_town); + $param .= "&search_town=".urlencode($search_town); } if ($search_phone != '') { - $param .= "&search_phone=" . urlencode($search_phone); + $param .= "&search_phone=".urlencode($search_phone); } if ($search_phone_mobile != '') { - $param .= "&search_phone_mobile=" . urlencode($search_phone_mobile); + $param .= "&search_phone_mobile=".urlencode($search_phone_mobile); } if ($search_fax != '') { - $param .= "&search_fax=" . urlencode($search_fax); + $param .= "&search_fax=".urlencode($search_fax); } if ($search_email != '') { - $param .= "&search_email=" . urlencode($search_email); + $param .= "&search_email=".urlencode($search_email); } if ($search_url != '') { - $param .= "&search_url=" . urlencode($search_url); + $param .= "&search_url=".urlencode($search_url); } if ($search_state != '') { - $param .= "&search_state=" . urlencode($search_state); + $param .= "&search_state=".urlencode($search_state); } if ($search_region != '') { - $param .= "&search_region=" . urlencode($search_region); + $param .= "&search_region=".urlencode($search_region); } if ($search_country != '') { - $param .= "&search_country=" . urlencode($search_country); + $param .= "&search_country=".urlencode($search_country); } if ($search_customer_code != '') { - $param .= "&search_customer_code=" . urlencode($search_customer_code); + $param .= "&search_customer_code=".urlencode($search_customer_code); } if ($search_supplier_code != '') { - $param .= "&search_supplier_code=" . urlencode($search_supplier_code); + $param .= "&search_supplier_code=".urlencode($search_supplier_code); } if ($search_account_customer_code != '') { - $param .= "&search_account_customer_code=" . urlencode($search_account_customer_code); + $param .= "&search_account_customer_code=".urlencode($search_account_customer_code); } if ($search_account_supplier_code != '') { - $param .= "&search_account_supplier_code=" . urlencode($search_account_supplier_code); + $param .= "&search_account_supplier_code=".urlencode($search_account_supplier_code); } if ($search_barcode != '') { - $param .= "&search_barcode=" . urlencode($search_barcode); + $param .= "&search_barcode=".urlencode($search_barcode); } if ($search_idprof1 != '') { - $param .= '&search_idprof1=' . urlencode($search_idprof1); + $param .= '&search_idprof1='.urlencode($search_idprof1); } if ($search_idprof2 != '') { - $param .= '&search_idprof2=' . urlencode($search_idprof2); + $param .= '&search_idprof2='.urlencode($search_idprof2); } if ($search_idprof3 != '') { - $param .= '&search_idprof3=' . urlencode($search_idprof3); + $param .= '&search_idprof3='.urlencode($search_idprof3); } if ($search_idprof4 != '') { - $param .= '&search_idprof4=' . urlencode($search_idprof4); + $param .= '&search_idprof4='.urlencode($search_idprof4); } if ($search_idprof5 != '') { - $param .= '&search_idprof5=' . urlencode($search_idprof5); + $param .= '&search_idprof5='.urlencode($search_idprof5); } if ($search_idprof6 != '') { - $param .= '&search_idprof6=' . urlencode($search_idprof6); + $param .= '&search_idprof6='.urlencode($search_idprof6); } if ($search_vat != '') { - $param .= '&search_vat=' . urlencode($search_vat); + $param .= '&search_vat='.urlencode($search_vat); } if ($search_price_level != '') { - $param .= '&search_price_level=' . urlencode($search_price_level); + $param .= '&search_price_level='.urlencode($search_price_level); } if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty=' . urlencode((string) ($search_type_thirdparty)); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } if ($search_type != '') { - $param .= '&search_type=' . urlencode($search_type); + $param .= '&search_type='.urlencode($search_type); } if ($search_status != '') { - $param .= '&search_status=' . urlencode((string) ($search_status)); + $param .= '&search_status='.urlencode((string) ($search_status)); } if (is_array($search_level) && count($search_level)) { foreach ($search_level as $slevel) { - $param .= '&search_level[]=' . urlencode($slevel); + $param .= '&search_level[]='.urlencode($slevel); } } if (is_array($search_stcomm) && count($search_stcomm)) { foreach ($search_stcomm as $slevel) { - $param .= '&search_stcomm[]=' . urlencode($slevel); + $param .= '&search_stcomm[]='.urlencode($slevel); } } if ($search_parent_name != '') { - $param .= '&search_parent_name=' . urlencode($search_parent_name); + $param .= '&search_parent_name='.urlencode($search_parent_name); } if ($search_import_key != '') { - $param .= '&search_import_key=' . urlencode($search_import_key); + $param .= '&search_import_key='.urlencode($search_import_key); } if ($type != '') { - $param .= '&type=' . urlencode($type); + $param .= '&type='.urlencode($type); } if ($search_date_creation_startmonth) { - $param .= '&search_date_creation_startmonth=' . urlencode((string) ($search_date_creation_startmonth)); + $param .= '&search_date_creation_startmonth='.urlencode((string) ($search_date_creation_startmonth)); } if ($search_date_creation_startyear) { - $param .= '&search_date_creation_startyear=' . urlencode((string) ($search_date_creation_startyear)); + $param .= '&search_date_creation_startyear='.urlencode((string) ($search_date_creation_startyear)); } if ($search_date_creation_startday) { - $param .= '&search_date_creation_startday=' . urlencode((string) ($search_date_creation_startday)); + $param .= '&search_date_creation_startday='.urlencode((string) ($search_date_creation_startday)); } if ($search_date_creation_start) { - $param .= '&search_date_creation_start=' . urlencode($search_date_creation_start); + $param .= '&search_date_creation_start='.urlencode($search_date_creation_start); } if ($search_date_creation_endmonth) { - $param .= '&search_date_creation_endmonth=' . urlencode((string) ($search_date_creation_endmonth)); + $param .= '&search_date_creation_endmonth='.urlencode((string) ($search_date_creation_endmonth)); } if ($search_date_creation_endyear) { - $param .= '&search_date_creation_endyear=' . urlencode((string) ($search_date_creation_endyear)); + $param .= '&search_date_creation_endyear='.urlencode((string) ($search_date_creation_endyear)); } if ($search_date_creation_endday) { - $param .= '&search_date_creation_endday=' . urlencode((string) ($search_date_creation_endday)); + $param .= '&search_date_creation_endday='.urlencode((string) ($search_date_creation_endday)); } if ($search_date_creation_end) { - $param .= '&search_date_creation_end=' . urlencode($search_date_creation_end); + $param .= '&search_date_creation_end='.urlencode($search_date_creation_end); } if ($search_date_modif_startmonth) { - $param .= '&search_date_modif_startmonth=' . urlencode((string) ($search_date_modif_startmonth)); + $param .= '&search_date_modif_startmonth='.urlencode((string) ($search_date_modif_startmonth)); } if ($search_date_modif_startyear) { - $param .= '&search_date_modif_startyear=' . urlencode((string) ($search_date_modif_startyear)); + $param .= '&search_date_modif_startyear='.urlencode((string) ($search_date_modif_startyear)); } if ($search_date_modif_startday) { - $param .= '&search_date_modif_startday=' . urlencode((string) ($search_date_modif_startday)); + $param .= '&search_date_modif_startday='.urlencode((string) ($search_date_modif_startday)); } if ($search_date_modif_start) { - $param .= '&search_date_modif_start=' . urlencode($search_date_modif_start); + $param .= '&search_date_modif_start='.urlencode($search_date_modif_start); } if ($search_date_modif_endmonth) { - $param .= '&search_date_modif_endmonth=' . urlencode((string) ($search_date_modif_endmonth)); + $param .= '&search_date_modif_endmonth='.urlencode((string) ($search_date_modif_endmonth)); } if ($search_date_modif_endyear) { - $param .= '&search_date_modif_endyear=' . urlencode((string) ($search_date_modif_endyear)); + $param .= '&search_date_modif_endyear='.urlencode((string) ($search_date_modif_endyear)); } if ($search_date_modif_endday) { - $param .= '&search_date_modif_endday=' . urlencode((string) ($search_date_modif_endday)); + $param .= '&search_date_modif_endday='.urlencode((string) ($search_date_modif_endday)); } if ($search_date_modif_end) { $param .= '&search_date_modif_end=' . urlencode($search_date_modif_end); } // Add $param from extra fields -include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php'; +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -1090,24 +1101,24 @@ // List of mass actions available $arrayofmassactions = array( - 'presend' => img_picto('', 'email', 'class="pictofixedwidth"') . $langs->trans("SendByMail"), + 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if (isModEnabled('category') && $user->hasRight("societe", "creer")) { - $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"') . $langs->trans("AffectTag"); + $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } if ($user->hasRight("societe", "creer")) { - $arrayofmassactions['preenable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"') . $langs->trans("SetToStatus", $object->LibStatut($object::STATUS_INACTIVITY)); + $arrayofmassactions['preenable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToStatus", $object->LibStatut($object::STATUS_INACTIVITY)); } if ($user->hasRight("societe", "creer")) { - $arrayofmassactions['predisable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"') . $langs->trans("SetToStatus", $object->LibStatut($object::STATUS_CEASED)); + $arrayofmassactions['predisable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToStatus", $object->LibStatut($object::STATUS_CEASED)); } if ($user->hasRight("societe", "creer")) { - $arrayofmassactions['presetcommercial'] = img_picto('', 'user', 'class="pictofixedwidth"') . $langs->trans("AllocateCommercial"); + $arrayofmassactions['presetcommercial'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AllocateCommercial"); } if ($user->hasRight('societe', 'supprimer')) { - $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"') . $langs->trans("Delete"); + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) { $arrayofmassactions = array(); @@ -1117,8 +1128,8 @@ $typefilter = ''; $label = 'MenuNewThirdParty'; -if (! empty($type)) { - $typefilter = '&type=' . $type; +if (!empty($type)) { + $typefilter = '&type='.$type; if ($type == 'p') { $label = 'MenuNewProspect'; } @@ -1131,47 +1142,47 @@ } if ($contextpage == 'poslist' && $type == 't' && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { - print get_htmloutput_mesg(img_warning('default') . ' ' . $langs->trans("BecarefullChangeThirdpartyBeforeAddProductToInvoice"), '', 'warning', 1); + print get_htmloutput_mesg(img_warning('default').' '.$langs->trans("BecarefullChangeThirdpartyBeforeAddProductToInvoice"), '', 'warning', 1); } // Show the new button only when this page is not opend from the Extended POS (pop-up window) // but allow it too, when a user has the rights to create a new customer if ($contextpage != 'poslist') { - $url = DOL_URL_ROOT . '/societe/card.php?action=create' . $typefilter; - if (! empty($socid)) { - $url .= '&socid=' . $socid; + $url = DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter; + if (!empty($socid)) { + $url .= '&socid='.$socid; } - $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"] . '?mode=common' . preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"] . '?mode=kanban' . preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->hasRight('societe', 'creer')); } elseif ($user->hasRight('societe', 'creer')) { - $url = DOL_URL_ROOT . '/societe/card.php?action=create&type=t&contextpage=poslist&optioncss=print&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=t&contextpage=poslist&nomassaction=1&optioncss=print&place=' . $place); + $url = DOL_URL_ROOT.'/societe/card.php?action=create&type=t&contextpage=poslist&optioncss=print&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type=t&contextpage=poslist&nomassaction=1&optioncss=print&place='.$place); $label = 'MenuNewCustomer'; $newcardbutton = dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url); } -print '
' . "\n"; +print ''."\n"; if ($optioncss != '') { - print ''; + print ''; } -print ''; +print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; //print ''; -print ''; -if (! empty($place)) { - print ''; +print ''; +if (!empty($place)) { + print ''; } print ''; -print ''; +print ''; if (empty($arrayfields['customerorsupplier']['checked'])) { - print ''; + print ''; } -if (! empty($place)) { - print ''; +if (!empty($place)) { + print ''; } print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'building', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -1179,9 +1190,9 @@ $langs->load("other"); $textprofid = array(); foreach (array(1, 2, 3, 4, 5, 6) as $key) { - $label = $langs->transnoentities("ProfId" . $key . $mysoc->country_code); + $label = $langs->transnoentities("ProfId".$key.$mysoc->country_code); $textprofid[$key] = ''; - if ($label != "ProfId" . $key . $mysoc->country_code) { // Get only text between () + if ($label != "ProfId".$key.$mysoc->country_code) { // Get only text between () if (preg_match('/\((.*)\)/i', $label, $reg)) { $label = $reg[1]; } @@ -1194,14 +1205,14 @@ $topicmail = "Information"; $modelmail = "thirdparty"; $objecttmp = new Societe($db); -$trackid = 'thi' . $object->id; -include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php'; +$trackid = 'thi'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; -if (! empty($search_categ_cus) || ! empty($search_categ_sup)) { +if (!empty($search_categ_cus) || !empty($search_categ_sup)) { print "
"; $c = new Categorie($db); $ways = $c->print_all_ways(' > ', 'societe/list.php'); - print " > " . $ways[0] . "
\n"; + print " > ".$ways[0]."
\n"; print "

"; } @@ -1209,10 +1220,10 @@ $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); - $setupstring .= $key . "=" . $val . ";"; + $setupstring .= $key."=".$val.";"; } - print '' . "\n"; - print '
' . $langs->trans("FilterOnInto", $search_all) . implode(', ', $fieldstosearchall) . '
'; + print ''."\n"; + print '
'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'
'; } // Filter on categories @@ -1238,10 +1249,10 @@ $moreforfilter .= '
'; $tmptitle = $langs->trans('SalesRepresentatives'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"'); - $moreforfilter .= $form->multiselectarray('search_sale', $userlist, $search_sale, 0, 0, '', 0, 300, '', '', $langs->trans('SalesRepresentatives'), 1); + $moreforfilter .= $form->multiselectarray('search_sale', $userlist, $search_sale, 0, 0, '', 0, 300, '', '', $langs->trans('SalesRepresentatives'), 1); $moreforfilter .= '
'; } -if (! empty($moreforfilter)) { +if (!empty($moreforfilter)) { print '
'; print $moreforfilter; $parameters = array('type' => $type); @@ -1256,7 +1267,7 @@ $selectedfields .= ((count($arrayofmassactions) && $contextpage != 'poslist') ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table -print '' . "\n"; +print '
'."\n"; // Fields title search // -------------------------------------------------------------------- @@ -1268,227 +1279,227 @@ print $searchpicto; print ''; } -if (! empty($arrayfields['s.rowid']['checked'])) { +if (!empty($arrayfields['s.rowid']['checked'])) { print ''; } -if (! empty($arrayfields['s.nom']['checked'])) { +if (!empty($arrayfields['s.nom']['checked'])) { print ''; } -if (! empty($arrayfields['s.name_alias']['checked'])) { +if (!empty($arrayfields['s.name_alias']['checked'])) { print ''; } // Barcode -if (! empty($arrayfields['s.barcode']['checked'])) { +if (!empty($arrayfields['s.barcode']['checked'])) { print ''; } // Customer code -if (! empty($arrayfields['s.code_client']['checked'])) { +if (!empty($arrayfields['s.code_client']['checked'])) { print ''; } // Supplier code -if (! empty($arrayfields['s.code_fournisseur']['checked'])) { +if (!empty($arrayfields['s.code_fournisseur']['checked'])) { print ''; } // Account Customer code -if (! empty($arrayfields['s.code_compta']['checked'])) { +if (!empty($arrayfields['s.code_compta']['checked'])) { print ''; } // Account Supplier code -if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) { +if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) { print ''; } // Address -if (! empty($arrayfields['s.address']['checked'])) { +if (!empty($arrayfields['s.address']['checked'])) { print ''; } // Sales representatives -if (! empty($arrayfields['sales.representative']['checked'])) { +if (!empty($arrayfields['sales.representative']['checked'])) { print ''; } // Zip -if (! empty($arrayfields['s.zip']['checked'])) { +if (!empty($arrayfields['s.zip']['checked'])) { print ''; } // Town -if (! empty($arrayfields['s.town']['checked'])) { +if (!empty($arrayfields['s.town']['checked'])) { print ''; } // State -if (! empty($arrayfields['state.nom']['checked'])) { +if (!empty($arrayfields['state.nom']['checked'])) { print ''; } // Region -if (! empty($arrayfields['region.nom']['checked'])) { +if (!empty($arrayfields['region.nom']['checked'])) { print ''; } // Country -if (! empty($arrayfields['country.code_iso']['checked'])) { +if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; } // Company type -if (! empty($arrayfields['typent.code']['checked'])) { +if (!empty($arrayfields['typent.code']['checked'])) { print ''; } // Multiprice level -if (! empty($arrayfields['s.price_level']['checked'])) { +if (!empty($arrayfields['s.price_level']['checked'])) { print ''; } // Staff -if (! empty($arrayfields['staff.code']['checked'])) { +if (!empty($arrayfields['staff.code']['checked'])) { print ''; } -if (! empty($arrayfields['s.email']['checked'])) { +if (!empty($arrayfields['s.email']['checked'])) { // Email print ''; } -if (! empty($arrayfields['s.phone']['checked'])) { +if (!empty($arrayfields['s.phone']['checked'])) { // Phone print ''; } -if (! empty($arrayfields['s.phone_mobile']['checked'])) { +if (!empty($arrayfields['s.phone_mobile']['checked'])) { // PhoneMobile print ''; } -if (! empty($arrayfields['s.fax']['checked'])) { +if (!empty($arrayfields['s.fax']['checked'])) { // Fax print ''; } -if (! empty($arrayfields['s.url']['checked'])) { +if (!empty($arrayfields['s.url']['checked'])) { // Url print ''; } -if (! empty($arrayfields['s.siren']['checked'])) { +if (!empty($arrayfields['s.siren']['checked'])) { // IdProf1 print ''; } -if (! empty($arrayfields['s.siret']['checked'])) { +if (!empty($arrayfields['s.siret']['checked'])) { // IdProf2 print ''; } -if (! empty($arrayfields['s.ape']['checked'])) { +if (!empty($arrayfields['s.ape']['checked'])) { // IdProf3 print ''; } -if (! empty($arrayfields['s.idprof4']['checked'])) { +if (!empty($arrayfields['s.idprof4']['checked'])) { // IdProf4 print ''; } -if (! empty($arrayfields['s.idprof5']['checked'])) { +if (!empty($arrayfields['s.idprof5']['checked'])) { // IdProf5 print ''; } -if (! empty($arrayfields['s.idprof6']['checked'])) { +if (!empty($arrayfields['s.idprof6']['checked'])) { // IdProf6 print ''; } -if (! empty($arrayfields['s.tva_intra']['checked'])) { +if (!empty($arrayfields['s.tva_intra']['checked'])) { // Vat number print ''; } // Nature (customer/prospect/supplier) -if (! empty($arrayfields['customerorsupplier']['checked'])) { +if (!empty($arrayfields['customerorsupplier']['checked'])) { print ''; } // Prospect level -if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) { +if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) { print ''; } // Prospect status -if (! empty($arrayfields['s.fk_stcomm']['checked'])) { +if (!empty($arrayfields['s.fk_stcomm']['checked'])) { print ''; } -if (! empty($arrayfields['s2.nom']['checked'])) { +if (!empty($arrayfields['s2.nom']['checked'])) { print ''; } // Extra fields -include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php'; +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; // Creation date -if (! empty($arrayfields['s.datec']['checked'])) { +if (!empty($arrayfields['s.datec']['checked'])) { print ''; } // Modification date -if (! empty($arrayfields['s.tms']['checked'])) { +if (!empty($arrayfields['s.tms']['checked'])) { print ''; } // Status -if (! empty($arrayfields['s.status']['checked'])) { +if (!empty($arrayfields['s.status']['checked'])) { print ''; } -if (! empty($arrayfields['s.import_key']['checked'])) { +if (!empty($arrayfields['s.import_key']['checked'])) { print ''; } // Action column -if (! getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } -print '' . "\n"; +print ''."\n"; $totalarray = array(); $totalarray['nbfield'] = 0; @@ -1538,173 +1549,174 @@ print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ') . "\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } -if (! empty($arrayfields['s.rowid']['checked'])) { +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, ''); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.nom']['checked'])) { +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, ' '); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.name_alias']['checked'])) { +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); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.barcode']['checked'])) { +if (!empty($arrayfields['s.barcode']['checked'])) { print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode", $param, '', '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.code_client']['checked'])) { +if (!empty($arrayfields['s.code_client']['checked'])) { print_liste_field_titre($arrayfields['s.code_client']['label'], $_SERVER["PHP_SELF"], "s.code_client", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.code_fournisseur']['checked'])) { +if (!empty($arrayfields['s.code_fournisseur']['checked'])) { print_liste_field_titre($arrayfields['s.code_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_fournisseur", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.code_compta']['checked'])) { +if (!empty($arrayfields['s.code_compta']['checked'])) { print_liste_field_titre($arrayfields['s.code_compta']['label'], $_SERVER["PHP_SELF"], "s.code_compta", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) { +if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) { print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_compta_fournisseur", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.address']['checked'])) { +if (!empty($arrayfields['s.address']['checked'])) { print_liste_field_titre($arrayfields['s.address']['label'], $_SERVER['PHP_SELF'], 's.address', '', $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['sales.representative']['checked'])) { +if (!empty($arrayfields['sales.representative']['checked'])) { print_liste_field_titre($arrayfields['sales.representative']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.zip']['checked'])) { +if (!empty($arrayfields['s.zip']['checked'])) { print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], "s.zip", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.town']['checked'])) { +if (!empty($arrayfields['s.town']['checked'])) { print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], "s.town", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['state.nom']['checked'])) { +if (!empty($arrayfields['state.nom']['checked'])) { print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['region.nom']['checked'])) { +if (!empty($arrayfields['region.nom']['checked'])) { print_liste_field_titre($arrayfields['region.nom']['label'], $_SERVER["PHP_SELF"], "region.nom", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['country.code_iso']['checked'])) { +if (!empty($arrayfields['country.code_iso']['checked'])) { print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } -if (! empty($arrayfields['typent.code']['checked'])) { +if (!empty($arrayfields['typent.code']['checked'])) { print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, "", $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } -if (! empty($arrayfields['staff.code']['checked'])) { +if (!empty($arrayfields['staff.code']['checked'])) { print_liste_field_titre($arrayfields['staff.code']['label'], $_SERVER["PHP_SELF"], "staff.code", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.price_level']['checked'])) { +if (!empty($arrayfields['s.price_level']['checked'])) { print_liste_field_titre($arrayfields['s.price_level']['label'], $_SERVER["PHP_SELF"], "s.price_level", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.email']['checked'])) { +if (!empty($arrayfields['s.email']['checked'])) { print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.phone']['checked'])) { +if (!empty($arrayfields['s.phone']['checked'])) { print_liste_field_titre($arrayfields['s.phone']['label'], $_SERVER["PHP_SELF"], "s.phone", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.phone_mobile']['checked'])) { +if (!empty($arrayfields['s.phone_mobile']['checked'])) { print_liste_field_titre($arrayfields['s.phone_mobile']['label'], $_SERVER["PHP_SELF"], "s.phone_mobile", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.fax']['checked'])) { +if (!empty($arrayfields['s.fax']['checked'])) { print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.url']['checked'])) { +if (!empty($arrayfields['s.url']['checked'])) { print_liste_field_titre($arrayfields['s.url']['label'], $_SERVER["PHP_SELF"], "s.url", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.siren']['checked'])) { +if (!empty($arrayfields['s.siren']['checked'])) { print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.siret']['checked'])) { +if (!empty($arrayfields['s.siret']['checked'])) { print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.ape']['checked'])) { +if (!empty($arrayfields['s.ape']['checked'])) { print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"), $textprofid[3], 1, 0), $_SERVER["PHP_SELF"], "s.ape", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.idprof4']['checked'])) { +if (!empty($arrayfields['s.idprof4']['checked'])) { print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof4", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.idprof5']['checked'])) { +if (!empty($arrayfields['s.idprof5']['checked'])) { print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[5], 1, 0), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.idprof6']['checked'])) { +if (!empty($arrayfields['s.idprof6']['checked'])) { print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[6], 1, 0), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.tva_intra']['checked'])) { +if (!empty($arrayfields['s.tva_intra']['checked'])) { print_liste_field_titre($arrayfields['s.tva_intra']['label'], $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder, 'nowrap '); $totalarray['nbfield']++; } -if (! empty($arrayfields['customerorsupplier']['checked'])) { +if (!empty($arrayfields['customerorsupplier']['checked'])) { print_liste_field_titre($arrayfields['customerorsupplier']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); // type of customer $totalarray['nbfield']++; } -if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) { +if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) { print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } -if (! empty($arrayfields['s.fk_stcomm']['checked'])) { +if (!empty($arrayfields['s.fk_stcomm']['checked'])) { print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } -if (! empty($arrayfields['s2.nom']['checked'])) { +if (!empty($arrayfields['s2.nom']['checked'])) { print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } // Extra fields -include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php'; +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (! empty($arrayfields['s.datec']['checked'])) { +if (!empty($arrayfields['s.datec']['checked'])) { print_liste_field_titre($arrayfields['s.datec']['label'], $_SERVER["PHP_SELF"], "s.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); - $totalarray['nbfield']++; // For the column action + $totalarray['nbfield']++; // For the column action } -if (! empty($arrayfields['s.tms']['checked'])) { +if (!empty($arrayfields['s.tms']['checked'])) { print_liste_field_titre($arrayfields['s.tms']['label'], $_SERVER["PHP_SELF"], "s.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); - $totalarray['nbfield']++; // For the column action + $totalarray['nbfield']++; // For the column action } -if (! empty($arrayfields['s.status']['checked'])) { +if (!empty($arrayfields['s.status']['checked'])) { print_liste_field_titre($arrayfields['s.status']['label'], $_SERVER["PHP_SELF"], "s.status", "", $param, '', $sortfield, $sortorder, 'center '); - $totalarray['nbfield']++; // For the column action + $totalarray['nbfield']++; // For the column action } -if (! empty($arrayfields['s.import_key']['checked'])) { +if (!empty($arrayfields['s.import_key']['checked'])) { print_liste_field_titre($arrayfields['s.import_key']['label'], $_SERVER["PHP_SELF"], "s.import_key", "", $param, '', $sortfield, $sortorder, 'center '); - $totalarray['nbfield']++; // For the column action + $totalarray['nbfield']++; // For the column action } // Action column -if (! getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ') . "\n"; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } -print '' . "\n"; +print ''."\n"; + // Loop on record // -------------------------------------------------------------------- @@ -1754,7 +1766,7 @@ if ($mode == 'kanban') { if ($i == 0) { - print ''; @@ -1780,85 +1792,85 @@ if (in_array($obj->rowid, $arrayofselected)) { $selected = 1; } - print ''; + print ''; } print ''; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.rowid']['checked'])) { + if (!empty($arrayfields['s.rowid']['checked'])) { print '\n"; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.nom']['checked'])) { - print ''; + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; if ($contextpage == 'poslist') { print dol_escape_htmltag($companystatic->name); } else { print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); } print "\n"; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.name_alias']['checked'])) { - print '\n"; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } // Barcode - if (! empty($arrayfields['s.barcode']['checked'])) { - print ''; - if (! $i) { + if (!empty($arrayfields['s.barcode']['checked'])) { + print ''; + if (!$i) { $totalarray['nbfield']++; } } // Customer code - if (! empty($arrayfields['s.code_client']['checked'])) { - print ''; - if (! $i) { + if (!empty($arrayfields['s.code_client']['checked'])) { + print ''; + if (!$i) { $totalarray['nbfield']++; } } // Supplier code - if (! empty($arrayfields['s.code_fournisseur']['checked'])) { - print ''; - if (! $i) { + if (!empty($arrayfields['s.code_fournisseur']['checked'])) { + print ''; + if (!$i) { $totalarray['nbfield']++; } } // Account customer code - if (! empty($arrayfields['s.code_compta']['checked'])) { - print ''; - if (! $i) { + if (!empty($arrayfields['s.code_compta']['checked'])) { + print ''; + if (!$i) { $totalarray['nbfield']++; } } // Account supplier code - if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) { - print ''; - if (! $i) { + if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) { + print ''; + if (!$i) { $totalarray['nbfield']++; } } // Address - if (! empty($arrayfields['s.address']['checked'])) { - print ''; - if (! $i) { + if (!empty($arrayfields['s.address']['checked'])) { + print ''; + if (!$i) { $totalarray['nbfield']++; } } // Sales Representative - if (! empty($arrayfields['sales.representative']['checked'])) { + if (!empty($arrayfields['sales.representative']['checked'])) { print ''; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } // Zip - if (! empty($arrayfields['s.zip']['checked'])) { - print "\n"; - if (! $i) { + if (!empty($arrayfields['s.zip']['checked'])) { + print "\n"; + if (!$i) { $totalarray['nbfield']++; } } // Town - if (! empty($arrayfields['s.town']['checked'])) { - print '\n"; - if (! $i) { + if (!empty($arrayfields['s.town']['checked'])) { + print '\n"; + if (!$i) { $totalarray['nbfield']++; } } // State - if (! empty($arrayfields['state.nom']['checked'])) { - print "\n"; - if (! $i) { + if (!empty($arrayfields['state.nom']['checked'])) { + print "\n"; + if (!$i) { $totalarray['nbfield']++; } } // Region - if (! empty($arrayfields['region.nom']['checked'])) { - print "\n"; - if (! $i) { + if (!empty($arrayfields['region.nom']['checked'])) { + print "\n"; + if (!$i) { $totalarray['nbfield']++; } } // Country - if (! empty($arrayfields['country.code_iso']['checked'])) { + if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } // Type ent - if (! empty($arrayfields['typent.code']['checked'])) { - if (! isset($typenArray) || ! is_array($typenArray) || count($typenArray) == 0) { + if (!empty($arrayfields['typent.code']['checked'])) { + if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) { $typenArray = $formcompany->typent_array(1); } $labeltypeofcompany = empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code]; - print ''; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } // Multiprice level - if (! empty($arrayfields['s.price_level']['checked'])) { - print '\n"; - if (! $i) { + if (!empty($arrayfields['s.price_level']['checked'])) { + print '\n"; + if (!$i) { $totalarray['nbfield']++; } } // Staff - if (! empty($arrayfields['staff.code']['checked'])) { + if (!empty($arrayfields['staff.code']['checked'])) { print ''; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.email']['checked'])) { - print '\n"; - if (! $i) { + if (!empty($arrayfields['s.email']['checked'])) { + print '\n"; + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.phone']['checked'])) { - print '\n"; - if (! $i) { + if (!empty($arrayfields['s.phone']['checked'])) { + print '\n"; + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.phone_mobile']['checked'])) { - print '\n"; - if (! $i) { + if (!empty($arrayfields['s.phone_mobile']['checked'])) { + print '\n"; + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.fax']['checked'])) { - print '\n"; - if (! $i) { + if (!empty($arrayfields['s.fax']['checked'])) { + print '\n"; + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.url']['checked'])) { - print "\n"; - if (! $i) { + if (!empty($arrayfields['s.url']['checked'])) { + print "\n"; + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.siren']['checked'])) { - print "\n"; - if (! $i) { + if (!empty($arrayfields['s.siren']['checked'])) { + print "\n"; + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.siret']['checked'])) { - print "\n"; - if (! $i) { + if (!empty($arrayfields['s.siret']['checked'])) { + print "\n"; + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.ape']['checked'])) { - print "\n"; - if (! $i) { + if (!empty($arrayfields['s.ape']['checked'])) { + print "\n"; + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.idprof4']['checked'])) { - print "\n"; - if (! $i) { + if (!empty($arrayfields['s.idprof4']['checked'])) { + print "\n"; + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.idprof5']['checked'])) { - print "\n"; - if (! $i) { + if (!empty($arrayfields['s.idprof5']['checked'])) { + print "\n"; + if (!$i) { $totalarray['nbfield']++; } } - if (! empty($arrayfields['s.idprof6']['checked'])) { - print "\n"; - if (! $i) { + if (!empty($arrayfields['s.idprof6']['checked'])) { + print "\n"; + if (!$i) { $totalarray['nbfield']++; } } // VAT - if (! empty($arrayfields['s.tva_intra']['checked'])) { - print '\n"; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } // Nature - if (! empty($arrayfields['customerorsupplier']['checked'])) { + if (!empty($arrayfields['customerorsupplier']['checked'])) { print ''; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } // Prospect level - if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) { + if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) { print '"; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } // Prospect status - if (! empty($arrayfields['s.fk_stcomm']['checked'])) { + if (!empty($arrayfields['s.fk_stcomm']['checked'])) { print ''; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } // Parent company - if (! empty($arrayfields['s2.nom']['checked'])) { + if (!empty($arrayfields['s2.nom']['checked'])) { print '"; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } // Extra fields - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation - if (! empty($arrayfields['s.datec']['checked'])) { + if (!empty($arrayfields['s.datec']['checked'])) { print ''; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } // Date modification - if (! empty($arrayfields['s.tms']['checked'])) { + if (!empty($arrayfields['s.tms']['checked'])) { print ''; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } // Status - if (! empty($arrayfields['s.status']['checked'])) { - print ''; - if (! $i) { + if (!empty($arrayfields['s.status']['checked'])) { + print ''; + if (!$i) { $totalarray['nbfield']++; } } // Import key - if (! empty($arrayfields['s.import_key']['checked'])) { - print '\n"; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } // Action column (Show the massaction button only when this page is not opend from the Extended POS) - if (! getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; - if (! $i) { + if (!$i) { $totalarray['nbfield']++; } } - print '' . "\n"; + print ''."\n"; } $i++; } // Show total line -include DOL_DOCUMENT_ROOT . '/core/tpl/list_print_total.tpl.php'; +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; // If no record found if ($num == 0) { $colspan = 1; foreach ($arrayfields as $key => $val) { - if (! empty($val['checked'])) { + if (!empty($val['checked'])) { $colspan++; } } - print ''; + print ''; } $db->free($resql); @@ -2171,13 +2183,13 @@ $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print '
'; - print ''; + print ''; print ''; - if (! empty($search_nom_only) && empty($search_nom)) { + if (!empty($search_nom_only) && empty($search_nom)) { $search_nom = $search_nom_only; } - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print ''; // We use showempty=0 here because there is already an unknown value into dictionary. - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (! getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'minwidth50 maxwidth125', 1); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'minwidth50 maxwidth125', 1); print ''; - print ''; + print ''; print ''; print $form->selectarray("search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100', 1); print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; if ($type != '') { - print ''; + print ''; } print $formcompany->selectProspectCustomerType($search_type, 'search_type', 'search_type', 'list'); print ''; print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2); print ''; $arraystcomm = array(); foreach ($prospectstatic->cacheprospectstatus as $key => $val) { - $arraystcomm[$val['id']] = ($langs->trans("StatusProspect" . $val['id']) != "StatusProspect" . $val['id'] ? $langs->trans("StatusProspect" . $val['id']) : $val['label']); + $arraystcomm[$val['id']] = ($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']); } //print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0, '', 0, 0, 0, '', '', 1); print $form->multiselectarray('search_stcomm', $arraystcomm, $search_stcomm, 0, 0, 'width100', 0, 0, '', '', '', 2); print ''; - print ''; + print ''; print ''; print '
'; print $form->selectDate($search_date_creation_start ? $search_date_creation_start : -1, 'search_date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -1499,7 +1510,7 @@ print '
'; print '
'; print $form->selectDate($search_date_modif_start ? $search_date_modif_start : -1, 'search_date_modif_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -1510,25 +1521,25 @@ print '
'; print $form->selectarray('search_status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage', 1); print ''; - print ''; + print ''; print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; + print '
'; print '
'; } // Output Kanban @@ -1766,9 +1778,9 @@ } else { // Show line of result $j = 0; - print '
'; print $obj->rowid; print "'; + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; print dol_escape_htmltag($companystatic->name_alias); print "' . dol_escape_htmltag($companystatic->barcode) . ''.dol_escape_htmltag($companystatic->barcode).'' . dol_escape_htmltag($companystatic->code_client) . ''.dol_escape_htmltag($companystatic->code_client).'' . dol_escape_htmltag($companystatic->code_fournisseur) . ''.dol_escape_htmltag($companystatic->code_fournisseur).'' . dol_escape_htmltag($companystatic->code_compta_client) . ''.dol_escape_htmltag($companystatic->code_compta_client).'' . dol_escape_htmltag($companystatic->code_compta_fournisseur) . ''.dol_escape_htmltag($companystatic->code_compta_fournisseur).'' . dol_escape_htmltag($companystatic->address) . ''.dol_escape_htmltag($companystatic->address).''; $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); $nbofsalesrepresentative = count($listsalesrepresentatives); @@ -1891,181 +1903,181 @@ print ' '; } print '" . dol_escape_htmltag($companystatic->zip) . "".dol_escape_htmltag($companystatic->zip)."' . dol_escape_htmltag($companystatic->town) . "'.dol_escape_htmltag($companystatic->town)."" . dol_escape_htmltag($obj->state_name) . "".dol_escape_htmltag($obj->state_name)."" . dol_escape_htmltag($obj->region_name) . "".dol_escape_htmltag($obj->region_name)."'; - $labelcountry = ($companystatic->country_code && ($langs->trans("Country" . $companystatic->country_code) != "Country" . $companystatic->country_code)) ? $langs->trans("Country" . $companystatic->country_code) : $obj->country_label; + $labelcountry = ($companystatic->country_code && ($langs->trans("Country".$companystatic->country_code) != "Country".$companystatic->country_code)) ? $langs->trans("Country".$companystatic->country_code) : $obj->country_label; print $labelcountry; print ''; + print ''; print dol_escape_htmltag($labeltypeofcompany); print '' . $obj->price_level . "'.$obj->price_level."'; - if (! empty($obj->staff_code)) { + if (!empty($obj->staff_code)) { if (empty($conf->cache['staffArray'])) { $conf->cache['staffArray'] = $formcompany->effectif_array(1); } print $conf->cache['staffArray'][$obj->staff_code]; } print '' . dol_print_email($obj->email, $obj->rowid, $obj->rowid, 1, 0, 0, 1) . "'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 1, 0, 0, 1)."' . dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone') . "'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."' . dol_print_phone($obj->phone_mobile, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone_mobile') . "'.dol_print_phone($obj->phone_mobile, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone_mobile')."' . dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax') . "'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."" . dol_print_url($obj->url, '', '', 1) . "".dol_print_url($obj->url, '', '', 1)."" . $obj->idprof1 . "".$obj->idprof1."" . $obj->idprof2 . "".$obj->idprof2."" . $obj->idprof3 . "".$obj->idprof3."" . $obj->idprof4 . "".$obj->idprof4."" . $obj->idprof5 . "".$obj->idprof5."" . $obj->idprof6 . "".$obj->idprof6."'; - if ($companystatic->tva_intra && ! isValidVATID($companystatic)) { + if (!empty($arrayfields['s.tva_intra']['checked'])) { + print ''; + if ($companystatic->tva_intra && !isValidVATID($companystatic)) { print img_warning("BadVATNumber", '', 'pictofixedwidth'); } print $companystatic->tva_intra; print "'; print $companystatic->getTypeUrl(1); print ''; print $companystatic->getLibProspLevel(); print "'; $prospectid = $obj->rowid; @@ -2074,95 +2086,95 @@ $formcompany->selectProspectStatus('status_prospect', $prospectstatic, $statusprospect, $prospectid); print ''; if ($companystatic->parent > 0) { $companyparent->fetch($companystatic->parent); print $companyparent->getNomUrl(1); } print "'; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser'); print '' . $companystatic->getLibStatut(5) . ''.$companystatic->getLibStatut(5).''; + if (!empty($arrayfields['s.import_key']['checked'])) { + print ''; print dol_escape_htmltag($obj->import_key); print "'; if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($obj->rowid, $arrayofselected)) { $selected = 1; } - print ''; + print ''; } print '
' . $langs->trans("NoRecordFound") . '
'.$langs->trans("NoRecordFound").'
' . "\n"; -print '
' . "\n"; +print ''."\n"; +print '
'."\n"; // Line that calls the select_status function by passing it js as the 5th parameter in order to activate the js script $formcompany->selectProspectStatus('status_prospect', $prospectstatic, null, null, "js"); -print '
' . "\n"; +print ''."\n"; // End of page llxFooter();