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 '