From e9de415dc09556051de2e0dbd116743a00b94ae3 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 4 Feb 2021 08:35:17 +0100 Subject: [PATCH 1/7] start --- htdocs/societe/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 9d145957040..401c5572597 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1498,7 +1498,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // Type - Workforce/Staff print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"' : '').'>'."\n"; $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. - print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam, '', 1); + print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; if ($conf->browser->layout == 'phone') print ''; @@ -2174,7 +2174,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // Type - Workforce/Staff print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''; - print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); + print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; if ($conf->browser->layout == 'phone') print ''; From 86e9398b796fb988a2f5479ad7f0237cab0aa4d3 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 4 Feb 2021 09:05:58 +0100 Subject: [PATCH 2/7] no inner join --- htdocs/compta/facture/list.php | 4 ++-- htdocs/compta/facture/stats/index.php | 2 +- htdocs/core/class/html.formcompany.class.php | 2 +- htdocs/fourn/facture/list.php | 6 +++--- htdocs/install/mysql/data/llx_c_typent.sql | 1 - htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 4 ++++ htdocs/install/mysql/tables/llx_societe.sql | 2 +- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index da5bab5b47e..ef34979d9ff 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -494,7 +494,7 @@ if ($search_town) $sql .= natural_search('s.town', $search_town); if ($search_zip) $sql .= natural_search("s.zip", $search_zip); if ($search_state) $sql .= natural_search("state.nom", $search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; +if ($search_type_thirdparty != '' && $search_type_thirdparty != '-1') $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_company_alias) $sql .= natural_search('s.name_alias', $search_company_alias); if ($search_montant_ht != '') $sql .= natural_search('f.total', $search_montant_ht, 1); @@ -894,7 +894,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth100'); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth100', '', 1); print ''; } // Payment mode diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 13378979932..e50edbeee18 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -264,7 +264,7 @@ print ''; // ThirdParty Type print ''.$langs->trans("ThirdPartyType").''; $sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. -print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam_typent); +print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '' , 1); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index d9d0442e49e..b3e383ea762 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -1031,7 +1031,7 @@ class FormCompany extends Form $out .= ''; $out .= ''; $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. - $out .= $this->selectarray($htmlname, $this->typent_array(0, $filter), $selected, 0, 0, 0, '', 0, 0, 0, $sortparam, '', 1); + $out .= $this->selectarray($htmlname, $this->typent_array(0, $filter), $selected, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1); $out .= ''; $out .= ''; } else { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index eef93849c8b..1188db2efd8 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -532,7 +532,7 @@ if ($search_town) $sql .= natural_search('s.town', $search_town); if ($search_zip) $sql .= natural_search("s.zip", $search_zip); if ($search_state) $sql .= natural_search("state.nom", $search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_type_thirdparty != '' && $search_type_thirdparty >= 0) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_montant_ht != '') $sql .= natural_search('f.total_ht', $search_montant_ht, 1); if ($search_montant_vat != '') $sql .= natural_search('f.total_tva', $search_montant_vat, 1); if ($search_montant_localtax1 != '') $sql .= natural_search('f.localtax1', $search_montant_localtax1, 1); @@ -917,7 +917,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),'', 1); print ''; } // Condition of payment @@ -1298,7 +1298,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1); + if (empty($typenArray)) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; if (!$i) $totalarray['nbfield']++; diff --git a/htdocs/install/mysql/data/llx_c_typent.sql b/htdocs/install/mysql/data/llx_c_typent.sql index ef725f43d98..d55d8fc67c2 100644 --- a/htdocs/install/mysql/data/llx_c_typent.sql +++ b/htdocs/install/mysql/data/llx_c_typent.sql @@ -32,7 +32,6 @@ delete from llx_c_typent; -- Entries for all countries -insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 0, 'TE_UNKNOWN', '-', NULL, 1); insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 1, 'TE_STARTUP', 'Start-up', NULL, 0); insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 2, 'TE_GROUP', 'Grand groupe', NULL, 1); insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 3, 'TE_MEDIUM', 'PME/PMI', NULL, 1); diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 287a568c646..85d2b91e9f9 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -119,3 +119,7 @@ ALTER TABLE llx_societe CHANGE fk_entrepot fk_warehouse INTEGER DEFAULT NULL; --ALTER TABLE llx_societe ADD CONSTRAINT fk_propal_fk_warehouse FOREIGN KEY (fk_warehouse) REFERENCES llx_entrepot(rowid); ALTER TABLE llx_societe ADD INDEX idx_societe_warehouse(fk_warehouse); +ALTER TABLE llx_societe MODIFY COLUMN fk_typent integer DEFAULT NULL; +UPDATE llx_societe SET fk_typent=NULL WHERE fk_typent=0; +DELETE FROM llx_c_typent WHERE code='TE_UNKNOWN'; + diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index 4459c7a1748..201114c7863 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -63,7 +63,7 @@ create table llx_societe whatsapp varchar(255), -- deprecated fk_effectif integer DEFAULT 0, -- - fk_typent integer DEFAULT 0, -- + fk_typent integer DEFAULT NULL, -- type ent fk_forme_juridique integer DEFAULT 0, -- juridical status fk_currency varchar(3), -- default currency siren varchar(128), -- IDProf1: depends on country (example: siren or RCS for france, ...) From ec41bf58e528a9157f8eda6e78c5c97b5e51abc5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 4 Feb 2021 09:48:17 +0100 Subject: [PATCH 3/7] always ajax now --- htdocs/comm/propal/list.php | 11 ++++++++--- htdocs/comm/propal/stats/index.php | 2 +- htdocs/commande/list.php | 4 ++-- htdocs/commande/stats/index.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/contrat/list.php | 6 +++++- htdocs/expedition/list.php | 5 +++-- htdocs/fourn/commande/list.php | 6 ++++-- htdocs/fourn/facture/list.php | 1 + htdocs/reception/list.php | 4 ++-- htdocs/societe/list.php | 4 ++-- htdocs/supplier_proposal/list.php | 5 +++-- 12 files changed, 33 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index e660f32ec5d..05321fa4424 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -436,13 +436,12 @@ if ($search_town) $sql .= natural_search('s.town', $search_town); if ($search_zip) $sql .= natural_search("s.zip", $search_zip); if ($search_state) $sql .= natural_search("state.nom", $search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; +if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer); if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject); if ($search_project) $sql .= natural_search('pr.title', $search_project); if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).')'; - if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_societe_alias) $sql .= natural_search('s.name_alias', $search_societe_alias); if ($search_login) $sql .= natural_search("u.login", $search_login); @@ -574,6 +573,12 @@ if ($resql) if ($search_fk_cond_reglement > 0) $param .= '&search_fk_cond_reglement='.$search_fk_cond_reglement; if ($search_fk_shipping_method > 0) $param .= '&search_fk_shipping_method='.$search_fk_shipping_method; if ($search_fk_mode_reglement > 0) $param .= '&search_fk_mode_reglement='.$search_fk_mode_reglement; + if ($search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.$search_type_thirdparty; + if ($search_town) $param .= '&search_town='.$search_town; + if ($search_zip) $param .= '&search_zip='.$search_zip; + if ($search_state) $param .= '&search_state='.$search_state; + if ($search_town) $param .= '&search_town='.$search_town; + if ($search_country) $param .= '&search_country='.$search_country; // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -750,7 +755,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); print ajax_combobox('search_type_thirdparty'); print ''; } diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 34feb8bbe44..900185ef24a 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -263,7 +263,7 @@ print '
'; // ThirdParty Type print ''.$langs->trans("ThirdPartyType").''; $sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. - print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam_typent); + print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent,'',1); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; // Category diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 7cbff15f1da..8b4a79f4dda 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -489,7 +489,7 @@ if ($resql) if ($search_zip != '') $param .= '&search_zip='.urlencode($search_zip); if ($search_state != '') $param .= '&search_state='.urlencode($search_state); if ($search_country != '') $param .= '&search_country='.urlencode($search_country); - if ($search_type_thirdparty != '') $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category); if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus); if ($show_files) $param .= '&show_files='.urlencode($show_files); @@ -727,7 +727,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); print ''; } // Date order diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 6e7c8ef36fb..43980135140 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -271,7 +271,7 @@ print ''; // ThirdParty Type print ''.$langs->trans("ThirdPartyType").''; $sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. -print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam_typent); +print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; // Category diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index e4d0b81d88b..7b60dd639f6 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -894,7 +894,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth100', '', 1); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth100', 1); print ''; } // Payment mode diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 5b208f34ff7..26779740feb 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -175,6 +175,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $sall = ""; $search_status = ""; $toselect = ''; + $search_type_thirdparty = ''; $search_array_options = array(); } @@ -198,6 +199,7 @@ $form = new Form($db); $formfile = new FormFile($db); $formother = new FormOther($db); $socstatic = new Societe($db); +$formcompany = new FormCompany($db); $contracttmp = new Contrat($db); $sql = 'SELECT'; @@ -235,6 +237,7 @@ if ($search_user > 0) } $sql .= " WHERE c.fk_soc = s.rowid "; $sql .= ' AND c.entity IN ('.getEntity('contract').')'; +if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; if ($search_product_category > 0) $sql .= " AND cp.fk_categorie = ".$search_product_category; if ($socid) $sql .= " AND s.rowid = ".$db->escape($socid); if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; @@ -346,6 +349,7 @@ if ($search_dfyear != '') $param .= '&search_dfyear='.urlencode($search_df if ($search_dfmonth != '') $param .= '&search_dfmonth='.urlencode($search_dfmonth); if ($search_sale != '') $param .= '&search_sale='.urlencode($search_sale); if ($search_user != '') $param .= '&search_user='.urlencode($search_user); +if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category); if ($show_files) $param .= '&show_files='.urlencode($show_files); if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); @@ -491,7 +495,7 @@ if (!empty($arrayfields['country.code_iso']['checked'])) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); print ''; } if (!empty($arrayfields['sale_representative']['checked'])) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 20bb6f298cb..a21ad170b09 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -274,7 +274,7 @@ if ($search_zip) $sql .= natural_search("s.zip", $search_zip); if ($search_state) $sql .= natural_search("state.nom", $search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; if ($search_tracking) $sql .= natural_search("e.tracking_number", $search_tracking); -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale; if ($search_user > 0) { @@ -339,6 +339,7 @@ if ($resql) if ($search_tracking) $param .= "&search_tracking=".urlencode($search_tracking); if ($search_town) $param .= '&search_town='.urlencode($search_town); if ($search_zip) $param .= '&search_zip='.urlencode($search_zip); + if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start); if ($search_datedelivery_end) $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end); @@ -490,7 +491,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); print ''; } // Weight diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 52b8c1d2cd3..23250e85950 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -595,7 +595,7 @@ if ($search_town) $sql .= natural_search('s.town', $search_town); if ($search_zip) $sql .= natural_search("s.zip", $search_zip); if ($search_state) $sql .= natural_search("state.nom", $search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; +if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale); if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='supplier_order' AND tc.source='internal' AND ec.element_id = cf.rowid AND ec.fk_socpeople = ".$db->escape($search_user); @@ -680,6 +680,8 @@ if ($resql) if ($search_billed != '') $param .= "&search_billed=".urlencode($search_billed); if ($show_files) $param .= '&show_files='.urlencode($show_files); if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -875,7 +877,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); print ''; } // Date order diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index aa2caaa3c57..729134ef9e6 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -677,6 +677,7 @@ if ($resql) if ($option) $param .= "&option=".urlencode($option); if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); if ($search_categ_sup > 0) $param .= '&search_categ_sup='.urlencode($search_categ_sup); + if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 30d31291a74..cb9bc100f79 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -447,7 +447,7 @@ if ($search_town) $sql .= natural_search('s.town', $search_town); if ($search_zip) $sql .= natural_search("s.zip", $search_zip); if ($search_state) $sql .= natural_search("state.nom", $search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_ref_rcp) $sql .= natural_search('e.ref', $search_ref_rcp); if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv); if ($search_company) $sql .= natural_search('s.nom', $search_company); @@ -656,7 +656,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); print ''; } // Date delivery planned diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 2553179acb8..cb62d82173c 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -485,7 +485,7 @@ if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; if ($search_status != '' && $search_status >= 0) $sql .= natural_search("s.status", $search_status, 2); if (!empty($conf->barcode->enabled) && $search_barcode) $sql .= natural_search("s.barcode", $search_barcode); if ($search_prive_level && $search_prive_level != '-1') $sql .= natural_search("s.price_level", $search_prive_level, 2); -if ($search_type_thirdparty && $search_type_thirdparty != '-1') $sql .= natural_search("s.fk_typent", $search_type_thirdparty, 2); +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') $sql .= natural_search("s.fk_effectif", $search_staff, 2); if ($search_level) $sql .= natural_search("s.fk_prospectlevel", join(',', $search_level), 3); if ($search_parent_name) $sql .= natural_search("s2.nom", $search_parent_name); @@ -582,7 +582,7 @@ if ($search_idprof5 != '') $param .= '&search_idprof5='.urlencode($search_idprof if ($search_idprof6 != '') $param .= '&search_idprof6='.urlencode($search_idprof6); if ($search_vat != '') $param .= '&search_vat='.urlencode($search_vat); if ($search_prive_level != '') $param .= '&search_prive_level='.urlencode($search_prive_level); -if ($search_type_thirdparty != '') $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); +if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); if ($search_type != '') $param .= '&search_type='.urlencode($search_type); if (is_array($search_level) && count($search_level)) foreach ($search_level as $slevel) $param .= '&search_level[]='.urlencode($slevel); if ($search_status != '') $param .= '&search_status='.urlencode($search_status); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 421ac40b447..e56f347738b 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -294,7 +294,7 @@ if ($search_town) $sql .= natural_search('s.town', $search_town); if ($search_zip) $sql .= natural_search("s.zip", $search_zip); if ($search_state) $sql .= natural_search("state.nom", $search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_ref) $sql .= natural_search('sp.ref', $search_ref); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_login) $sql .= natural_search('u.login', $search_login); @@ -395,6 +395,7 @@ if ($resql) if ($socid > 0) $param .= '&socid='.urlencode($socid); if ($search_status != '') $param .= '&search_status='.urlencode($search_status); if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -518,7 +519,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),'' 1); print ''; } // Date From 149d2a1d5535db35d1b0239ec556c4cb68cdf05d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 4 Feb 2021 08:52:16 +0000 Subject: [PATCH 4/7] Fixing style errors. --- htdocs/comm/propal/stats/index.php | 2 +- htdocs/compta/facture/stats/index.php | 2 +- htdocs/fourn/facture/list.php | 2 +- htdocs/supplier_proposal/list.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 900185ef24a..c28da3ed048 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -263,7 +263,7 @@ print '
'; // ThirdParty Type print ''.$langs->trans("ThirdPartyType").''; $sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. - print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent,'',1); + print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; // Category diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index e50edbeee18..2a722f8723d 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -264,7 +264,7 @@ print ''; // ThirdParty Type print ''.$langs->trans("ThirdPartyType").''; $sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. -print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '' , 1); +print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 729134ef9e6..99ab93ca973 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -920,7 +920,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),'', 1); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); print ''; } // Condition of payment diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index e56f347738b..2aa1dccbb50 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -519,7 +519,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),'' 1); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '' 1); print ''; } // Date From b696f87415bcefc0cb95f42802129133732ea040 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 4 Feb 2021 10:03:45 +0100 Subject: [PATCH 5/7] always ajax now --- htdocs/supplier_proposal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index e56f347738b..100f77f3189 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -519,7 +519,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),'' 1); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),'', 1); print ''; } // Date From 5d1cceae1b1995d1187464b011bde6359c220ce8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 4 Feb 2021 09:06:49 +0000 Subject: [PATCH 6/7] Fixing style errors. --- htdocs/supplier_proposal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 100f77f3189..9826c2a409d 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -519,7 +519,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),'', 1); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); print ''; } // Date From ea7a0f86f76f082f578334ecd7020b48c33432fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Feb 2021 15:34:55 +0100 Subject: [PATCH 7/7] Update 13.0.0-14.0.0.sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index dfc1a08e553..6367dc9dd21 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -119,7 +119,8 @@ ALTER TABLE llx_societe CHANGE fk_entrepot fk_warehouse INTEGER DEFAULT NULL; --ALTER TABLE llx_societe ADD CONSTRAINT fk_propal_fk_warehouse FOREIGN KEY (fk_warehouse) REFERENCES llx_entrepot(rowid); ALTER TABLE llx_societe ADD INDEX idx_societe_warehouse(fk_warehouse); -ALTER TABLE llx_societe MODIFY COLUMN fk_typent integer DEFAULT NULL; +-- VMYSQL4.3 ALTER TABLE llx_societe MODIFY COLUMN fk_typent integer NULL; +-- VPGSQL8.2 ALTER TABLE llx_societe ALTER COLUMN fk_typent DROP NOT NULL; UPDATE llx_societe SET fk_typent=NULL WHERE fk_typent=0; DELETE FROM llx_c_typent WHERE code='TE_UNKNOWN';