From aa9b4ce1f3e32e79d0c4946e9becf5cecc0a976b Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Tue, 25 Jul 2017 09:49:08 +0200
Subject: [PATCH] Fix too long combo for tags

---
 htdocs/commande/list.php       | 178 ++++++++++++++++-----------------
 htdocs/compta/facture/list.php |   2 +-
 htdocs/contrat/list.php        |  46 ++++-----
 htdocs/contrat/services.php    |  30 +++---
 htdocs/fourn/commande/list.php |   6 +-
 htdocs/fourn/facture/list.php  |  56 +++++------
 6 files changed, 159 insertions(+), 159 deletions(-)

diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index d91d1737281..bb7fa39bb5d 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -165,7 +165,7 @@ if (empty($reshook))
 {
     // Selection of new fields
     include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
-    
+
     // Purge search criteria
     if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
     {
@@ -208,51 +208,51 @@ if (empty($reshook))
 
 
 if ($massaction == 'confirm_createbills') {
-	
+
 	$orders = GETPOST('toselect');
 	$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
 	$validate_invoices = GETPOST('valdate_invoices', 'int');
-	
+
 	$TFact = array();
 	$TFactThird = array();
-	
+
 	$nb_bills_created = 0;
-	
+
 	$db->begin();
-	
+
 	foreach($orders as $id_order) {
-		
+
 		$cmd = new Commande($db);
 		if($cmd->fetch($id_order) <= 0) continue;
-		
+
 		$object = new Facture($db);
 		if(!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
 		else {
-			
+
 			$object->socid = $cmd->socid;
 			$object->type = Facture::TYPE_STANDARD;
 			$object->cond_reglement_id	= $cmd->cond_reglement_id;
 			$object->mode_reglement_id	= $cmd->mode_reglement_id;
 			$object->fk_project			= $cmd->fk_project;
-			
+
 			$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
 			if (empty($datefacture))
 			{
 				$datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y"));
 			}
-			
+
 			$object->date = $datefacture;
 			$object->origin    = 'commande';
 			$object->origin_id = $id_order;
-			
+
 			$res = $object->create($user);
-			
+
 			if($res > 0) $nb_bills_created++;
-			
+
 		}
-		
+
 		if($object->id > 0) {
-			
+
 			$db->begin();
 			$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
 			$sql.= "fk_source";
@@ -274,17 +274,17 @@ if ($massaction == 'confirm_createbills') {
 			{
 				$db->rollback();
 			}
-			
+
 			$lines = $cmd->lines;
 			if (empty($lines) && method_exists($cmd, 'fetch_lines'))
 			{
 				$cmd->fetch_lines();
 				$lines = $cmd->lines;
 			}
-			
+
 			$fk_parent_line=0;
 			$num=count($lines);
-			
+
 			for ($i=0;$i<$num;$i++)
 			{
 				$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
@@ -373,43 +373,43 @@ if ($massaction == 'confirm_createbills') {
 						$fk_parent_line = $result;
 					}
 				}
-			}			
-			
+			}
+
 		}
-		 
+
 		$cmd->classifyBilled($user);
 
 		if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
 		else $TFact[$object->id] = $object;
 	}
-	
+
 	// Build doc with all invoices
 	$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
 	$toselect = array();
-	
+
 	if(!empty($validate_invoices)) {
-		
+
 		$massaction = $action = 'builddoc';
-		
+
 		foreach($TAllFact as &$object) {
 			$object->validate($user);
 			$toselect[] = $object->id; // For builddoc action
-			
+
 			// Fac builddoc
 			$upload_dir = $conf->facture->dir_output;
 		    $permissioncreate=$user->rights->facture->creer;
 		    include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
 		}
-		
+
 		$objectclass='Facture';
 	    $objectlabel='Invoice';
 	    $permtoread = $user->rights->facture->lire;
 	    $permtodelete = $user->rights->facture->supprimer;
 	    $uploaddir = $conf->facture->dir_output;
 		include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
-		
+
 	}
-	
+
 	if (! $error)
 	{
 		$db->commit();
@@ -424,7 +424,7 @@ if ($massaction == 'confirm_createbills') {
 		setEventMessages($object->error, $object->errors, 'errors');
 		$error++;
 	}
-	
+
 }
 
 
@@ -602,9 +602,9 @@ if ($resql)
 	$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
 
 	$num = $db->num_rows($resql);
-	
+
 	$arrayofselected=is_array($toselect)?$toselect:array();
-	
+
 	$param='';
     if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
 	if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
@@ -636,7 +636,7 @@ if ($resql)
 	    $tmpkey=preg_replace('/search_options_/','',$key);
 	    if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
 	}
-	
+
 	// List of mass actions available
 	$arrayofmassactions =  array(
 	    'presend'=>$langs->trans("SendByMail"),
@@ -659,11 +659,11 @@ if ($resql)
 	print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
 
 	print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
-	
+
 	if ($massaction == 'presend')
 	{
 	    $langs->load("mails");
-	
+
 	    if (! GETPOST('cancel'))
 	    {
 	        $objecttmp=new Commande($db);
@@ -682,17 +682,17 @@ if ($resql)
 	            }
 	        }
 	    }
-	
+
 	    print '<input type="hidden" name="massaction" value="confirm_presend">';
-	
+
 	    include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
 	    $formmail = new FormMail($db);
-	
+
 	    dol_fiche_head(null, '', '');
-	
+
 	    $topicmail="SendOrderRef";
 	    $modelmail="order_send";
-	
+
 	    // Cree l'objet formulaire mail
 	    include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
 	    $formmail = new FormMail($db);
@@ -745,23 +745,23 @@ if ($resql)
 	    $formmail->substit['__REFCLIENT__']='__REFCLIENT__';	// We want to keep the tag
 	    $formmail->substit['__PERSONALIZED__']='';
 	    $formmail->substit['__CONTACTCIVNAME__']='';
-	
+
 	    // Tableau des parametres complementaires du post
 	    $formmail->param['action']=$action;
 	    $formmail->param['models']=$modelmail;
 	    $formmail->param['models_id']=GETPOST('modelmailselected','int');
 	    $formmail->param['id']=join(',',$arrayofselected);
 	    //$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
-	
+
 	    print $formmail->get_form();
-	
+
 	    dol_fiche_end();
 	}
 	elseif ($massaction == 'createbills')
 	{
 		//var_dump($_REQUEST);
 		print '<input type="hidden" name="massaction" value="confirm_createbills">';
-		
+
 		print '<table class="border" width="100%" >';
 		print '<tr>';
 		print '<td class="titlefieldmiddle">';
@@ -788,22 +788,22 @@ if ($resql)
 		print '</td>';
 		print '</tr>';
 		print '</table>';
-		
+
 		print '<br>';
 		print '<div class="center">';
 		print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisCustomer').'">  ';
 		print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
 		print '</div>';
 		print '<br>';
-		
+
 	}
-	
+
 	if ($sall)
     {
         foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
         print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
     }
-	
+
 	$moreforfilter='';
 
  	// If the user can view prospects other than his'
@@ -830,14 +830,14 @@ if ($resql)
 		$moreforfilter.='<div class="divsearchfield">';
 		$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
 		$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
-		$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
+		$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
 		$moreforfilter.='</div>';
 	}
 	$parameters=array();
 	$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters);    // Note that $action and $object may have been modified by hook
 	if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
 	else $moreforfilter = $hookmanager->resPrint;
-	
+
 	if (! empty($moreforfilter))
 	{
 		print '<div class="liste_titre liste_titre_bydiv centpercent">';
@@ -847,7 +847,7 @@ if ($resql)
 
     $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
     $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);	// This also change content of $arrayfields
-	
+
     print '<div class="div-table-responsive">';
     print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
 
@@ -869,9 +869,9 @@ if ($resql)
 	// Extra fields
 	if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
 	{
-	   foreach($extrafields->attribute_label as $key => $val) 
+	   foreach($extrafields->attribute_label as $key => $val)
 	   {
-           if (! empty($arrayfields["ef.".$key]['checked'])) 
+           if (! empty($arrayfields["ef.".$key]['checked']))
            {
 				$align=$extrafields->getAlignFlag($key);
 				print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
@@ -891,21 +891,21 @@ if ($resql)
 
 	print '<tr class="liste_titre">';
 	// Ref
-	if (! empty($arrayfields['c.ref']['checked'])) 
+	if (! empty($arrayfields['c.ref']['checked']))
 	{
 	    print '<td class="liste_titre">';
     	print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
 	    print '</td>';
 	}
 	// Ref customer
-	if (! empty($arrayfields['c.ref_client']['checked'])) 
+	if (! empty($arrayfields['c.ref_client']['checked']))
 	{
     	print '<td class="liste_titre" align="left">';
     	print '<input class="flat" type="text" size="6" name="search_ref_customer" value="'.$search_ref_customer.'">';
     	print '</td>';
 	}
 	// Thirpdarty
-	if (! empty($arrayfields['s.nom']['checked'])) 
+	if (! empty($arrayfields['s.nom']['checked']))
 	{
     	print '<td class="liste_titre" align="left">';
     	print '<input class="flat" type="text" name="search_company" value="'.$search_company.'">';
@@ -945,7 +945,7 @@ if ($resql)
         $formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5);
     	print '</td>';
 	}
-	if (! empty($arrayfields['c.date_delivery']['checked'])) 
+	if (! empty($arrayfields['c.date_delivery']['checked']))
 	{
     	print '<td class="liste_titre" align="center">';
         if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="deliveryday" value="'.$deliveryday.'">';
@@ -1018,10 +1018,10 @@ if ($resql)
 	{
 	    print '<td class="liste_titre maxwidthonsmartphone" align="right">';
     	$liststatus=array(
-    	    Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"), 
-    	    Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), 
-    	    Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"), 
-    	    Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), 
+    	    Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"),
+    	    Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
+    	    Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"),
+    	    Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
     	    Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
     	);
     	print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
@@ -1039,16 +1039,16 @@ if ($resql)
 	$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
 	print $searchpitco;
 	print '</td>';
-	
+
     print "</tr>\n";
 
 	$total=0;
 	$subtotal=0;
     $productstat_cache=array();
-    
+
     $generic_commande = new Commande($db);
     $generic_product = new Product($db);
-	
+
     $i=0;
 	$var=true;
 	$totalarray=array();
@@ -1063,7 +1063,7 @@ if ($resql)
         $text_info='';
         $text_warning='';
         $nbprod=0;
-        
+
         // Ref
         if (! empty($arrayfields['c.ref']['checked']))
         {
@@ -1079,12 +1079,12 @@ if ($resql)
             $generic_commande->total_ttc = $obj->total_ttc;
             $generic_commande->lines=array();
             $generic_commande->getLinesArray();
-    
+
             print '<table class="nobordernopadding"><tr class="nocellnopadd">';
             print '<td class="nobordernopadding nowrap">';
             print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$obj->fk_statut));
             print '</td>';
-    		
+
             // Show shippable Icon (create subloop, so may be slow)
             if ($conf->stock->enabled)
             {
@@ -1092,7 +1092,7 @@ if ($resql)
 	            if (($obj->fk_statut > 0) && ($obj->fk_statut < 3))
     	        {
                     $numlines = count($generic_commande->lines); // Loop on each line of order
-                    for ($lig=0; $lig < $numlines; $lig++) 
+                    for ($lig=0; $lig < $numlines; $lig++)
                     {
                         if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0)  // If line is a product and not a service
                         {
@@ -1116,8 +1116,8 @@ if ($resql)
                                 $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel;
                                 $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique;
                                 $text_info .= '<br>';
-                                
-                                if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) 
+
+                                if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel)
                                 {
                                     $notshippable++;
                                 }
@@ -1177,7 +1177,7 @@ if ($resql)
                         $text_info = $langs->trans('NonShippable').'<br>'.$text_info;
                     }
                 }
-                
+
                 print '<td>';
                 if ($nbprod)
                 {
@@ -1188,7 +1188,7 @@ if ($resql)
                 }
                 print '</td>';
             }
-    
+
             // Warning late icon and note
     		print '<td class="nobordernopadding nowrap">';
     		if ($generic_commande->hasDelay()) {
@@ -1201,7 +1201,7 @@ if ($resql)
     			print '</span>';
     		}
     		print '</td>';
-    
+
     		print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
     		$filename=dol_sanitizeFileName($obj->ref);
     		$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
@@ -1209,11 +1209,11 @@ if ($resql)
     		print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
     		print '</td>';
     		print '</tr></table>';
-    
+
     		print '</td>';
     		if (! $i) $totalarray['nbfield']++;
         }
-        
+
 		// Ref customer
 		if (! empty($arrayfields['c.ref_client']['checked']))
 		{
@@ -1231,7 +1231,7 @@ if ($resql)
 		{
     		print '<td>';
     		print $companystatic->getNomUrl(1,'customer');
-    
+
     		// If module invoices enabled and user with invoice creation permissions
     		if (! empty($conf->facture->enabled) && ! empty($conf->global->ORDER_BILLING_ALL_CUSTOMER))
     		{
@@ -1287,7 +1287,7 @@ if ($resql)
 		    print '</td>';
 		    if (! $i) $totalarray['nbfield']++;
 		}
-		
+
 		// Order date
 		if (! empty($arrayfields['c.date_commande']['checked']))
 		{
@@ -1328,7 +1328,7 @@ if ($resql)
 		    if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
 		    $totalarray['totalttc'] += $obj->total_ttc;
         }
-		
+
         // Extra fields
         if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
         {
@@ -1379,7 +1379,7 @@ if ($resql)
             print '<td align="center">'.yn($obj->billed).'</td>';
             if (! $i) $totalarray['nbfield']++;
         }
-        
+
         // Action column
         print '<td class="nowrap" align="center">';
         if ($massactionbutton || $massaction)   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
@@ -1390,9 +1390,9 @@ if ($resql)
         }
         print '</td>';
         if (! $i) $totalarray['nbfield']++;
-		
+
 		print "</tr>\n";
-        
+
 		$total+=$obj->total_ht;
 		$subtotal+=$obj->total_ht;
 		$i++;
@@ -1425,18 +1425,18 @@ if ($resql)
 	}
 
 	$db->free($resql);
-	
+
 	$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
 	$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters);    // Note that $action and $object may have been modified by hook
 	print $hookmanager->resPrint;
-				
+
 	print '</table>'."\n";
 	print '</div>';
-	
+
 	print '</form>'."\n";
 
 	//print '<br>'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'<br>';
-	
+
 	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
 	{
 	    /*
@@ -1444,18 +1444,18 @@ if ($resql)
 	     */
 	    $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
 	    $urlsource.=str_replace('&amp;','&',$param);
-	
+
 	    $filedir=$diroutputmassaction;
 	    $genallowed=$user->rights->commande->lire;
 	    $delallowed=$user->rights->commande->lire;
-	
+
 	    print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
 	}
 	else
 	{
 	    print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
 	}
-	
+
 }
 else
 {
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 5a05c7c43ac..e11946c8841 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -621,7 +621,7 @@ if ($resql)
 		$moreforfilter.='<div class="divsearchfield">';
 		$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
 		$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
-		$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
+		$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
 		$moreforfilter.='</div>';
 	}
     $parameters=array();
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 6c28dbe631e..883c602d09e 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -305,14 +305,14 @@ if ($resql)
     $i = 0;
 
     $arrayofselected=is_array($toselect)?$toselect:array();
-    
+
 	if ($socid > 0)
 	{
 		$soc = new Societe($db);
 		$soc->fetch($socid);
 		if (empty($search_name)) $search_name = $soc->name;
 	}
-	
+
     $param='';
     if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
     if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
@@ -330,7 +330,7 @@ if ($resql)
         $tmpkey=preg_replace('/search_options_/','',$key);
         if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
     }
-    
+
     // List of mass actions available
     $arrayofmassactions =  array(
         //'presend'=>$langs->trans("SendByMail"),
@@ -339,7 +339,7 @@ if ($resql)
     if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
     if ($massaction == 'presend') $arrayofmassactions=array();
     $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
-    
+
     print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
     if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
 	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@@ -355,9 +355,9 @@ if ($resql)
         foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
         print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
     }
-    
+
     $moreforfilter='';
-    
+
     // If the user can view prospects other than his'
     if ($user->rights->societe->client->voir || $socid)
     {
@@ -382,15 +382,15 @@ if ($resql)
 		$moreforfilter.='<div class="divsearchfield">';
 		$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
 		$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
-		$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
+		$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
 		$moreforfilter.='</div>';
 	}
-    
+
     $parameters=array();
     $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters);    // Note that $action and $object may have been modified by hook
 	if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
 	else $moreforfilter = $hookmanager->resPrint;
-    
+
     if (! empty($moreforfilter))
     {
         print '<div class="liste_titre liste_titre_bydiv centpercent">';
@@ -400,7 +400,7 @@ if ($resql)
 
     $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
     $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);	// This also change content of $arrayfields
-	
+
     print '<div class="div-table-responsive">';
     print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
     print '<tr class="liste_titre">';
@@ -418,9 +418,9 @@ if ($resql)
 	// Extra fields
 	if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
 	{
-	   foreach($extrafields->attribute_label as $key => $val) 
+	   foreach($extrafields->attribute_label as $key => $val)
 	   {
-           if (! empty($arrayfields["ef.".$key]['checked'])) 
+           if (! empty($arrayfields["ef.".$key]['checked']))
            {
 				$align=$extrafields->getAlignFlag($key);
 				print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
@@ -493,7 +493,7 @@ if ($resql)
         print '<td class="liste_titre maxwidthonsmartphone" align="center">';
         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 '</td>';
-    }    
+    }
     if (! empty($arrayfields['sale_representative']['checked']))
     {
         print '<td class="liste_titre"></td>';
@@ -548,7 +548,7 @@ if ($resql)
     {
         print '<td class="liste_titre">';
         print '</td>';
-    }    
+    }
     // Status
     if (! empty($arrayfields['status']['checked']))
     {
@@ -564,12 +564,12 @@ if ($resql)
     while ($i < min($num,$limit))
     {
         $obj = $db->fetch_object($resql);
-        
+
         $contracttmp->ref=$obj->ref;
         $contracttmp->id=$obj->rowid;
         $contracttmp->ref_customer=$obj->ref_customer;
         $contracttmp->ref_supplier=$obj->ref_supplier;
-        
+
         $var=!$var;
         print '<tr '.$bc[$var].'>';
         if (! empty($arrayfields['c.ref']['checked']))
@@ -585,15 +585,15 @@ if ($resql)
             }
             print '</td>';
         }
-        if (! empty($arrayfields['c.ref_customer']['checked'])) 
+        if (! empty($arrayfields['c.ref_customer']['checked']))
         {
             print '<td>'.$obj->ref_customer.'</td>';
         }
-        if (! empty($arrayfields['c.ref_supplier']['checked'])) 
+        if (! empty($arrayfields['c.ref_supplier']['checked']))
         {
             print '<td>'.$obj->ref_supplier.'</td>';
         }
-        if (! empty($arrayfields['s.nom']['checked'])) 
+        if (! empty($arrayfields['s.nom']['checked']))
         {
             print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
         }
@@ -636,7 +636,7 @@ if ($resql)
             print $typenArray[$obj->typent_code];
             print '</td>';
             if (! $i) $totalarray['nbfield']++;
-        }        
+        }
         if (! empty($arrayfields['sale_representative']['checked']))
         {
             // Sales representatives
@@ -720,7 +720,7 @@ if ($resql)
             if (! $i) $totalarray['nbfield']++;
         }
         // Status
-        if (! empty($arrayfields['status']['checked'])) 
+        if (! empty($arrayfields['status']['checked']))
         {
             print '<td align="center">'.($obj->nb_initial>0?$obj->nb_initial:'').'</td>';
             print '<td align="center">'.($obj->nb_running>0?$obj->nb_running:'').'</td>';
@@ -737,7 +737,7 @@ if ($resql)
         }
         print '</td>';
         if (! $i) $totalarray['nbfield']++;
-        
+
         print "</tr>\n";
         $i++;
     }
@@ -745,7 +745,7 @@ if ($resql)
 
     print '</table>';
     print '</div>';
-    
+
     print '</form>';
 }
 else
diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php
index 42ff4b04e83..f21c476fe35 100644
--- a/htdocs/contrat/services.php
+++ b/htdocs/contrat/services.php
@@ -331,7 +331,7 @@ if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights-
     $moreforfilter.='<div class="divsearchfield">';
     $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
     $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
-    $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
+    $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
     $moreforfilter.='</div>';
 }
 
@@ -515,23 +515,23 @@ $var=True; $i=0;
 while ($i < min($num,$limit))
 {
 	$obj = $db->fetch_object($resql);
-	
+
 	$contractstatic->id=$obj->cid;
 	$contractstatic->ref=$obj->ref?$obj->ref:$obj->cid;
-	
+
 	$var=!$var;
 
 	print "<tr ".$bc[$var].">";
-	
+
 	// Ref
-    if (! empty($arrayfields['c.ref']['checked'])) 
+    if (! empty($arrayfields['c.ref']['checked']))
     {
         print '<td>';
 		print $contractstatic->getNomUrl(1,16);
 		print '</td>';
     }
 	// Service
-    if (! empty($arrayfields['p.description']['checked'])) 
+    if (! empty($arrayfields['p.description']['checked']))
     {
         print '<td>';
 		if ($obj->pid)
@@ -551,9 +551,9 @@ while ($i < min($num,$limit))
 		}
 		print '</td>';
     }
-    
+
 	// Third party
-    if (! empty($arrayfields['s.nom']['checked'])) 
+    if (! empty($arrayfields['s.nom']['checked']))
     {
         print '<td>';
 		$companystatic->id=$obj->socid;
@@ -562,9 +562,9 @@ while ($i < min($num,$limit))
 		print $companystatic->getNomUrl(1,'customer',28);
 		print '</td>';
     }
-    
+
 	// Start date
-    if (! empty($arrayfields['cd.date_ouverture_prevue']['checked'])) 
+    if (! empty($arrayfields['cd.date_ouverture_prevue']['checked']))
     {
 		print '<td align="center">';
 		print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):'&nbsp;');
@@ -573,15 +573,15 @@ while ($i < min($num,$limit))
 		else print '&nbsp;&nbsp;&nbsp;&nbsp;';
 		print '</td>';
 	}
-    if (! empty($arrayfields['cd.date_ouverture']['checked'])) 
+    if (! empty($arrayfields['cd.date_ouverture']['checked']))
     {
 	    print '<td align="center">'.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):'&nbsp;').'</td>';
 	}
 	// End date
-    if (! empty($arrayfields['cd.date_fin_validite']['checked'])) 
+    if (! empty($arrayfields['cd.date_fin_validite']['checked']))
     {
 	    print '<td align="center">'.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):'&nbsp;');
-		if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) 
+		if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5)
 		{
 		    $warning_delay=$conf->contrat->services->expires->warning_delay / 3600 / 24;
             $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
@@ -590,7 +590,7 @@ while ($i < min($num,$limit))
 		else print '&nbsp;&nbsp;&nbsp;&nbsp;';
 	    print '</td>';
     }
-    if (! empty($arrayfields['cd.date_cloture']['checked'])) 
+    if (! empty($arrayfields['cd.date_cloture']['checked']))
     {
         print '<td align="center">'.dol_print_date($db->jdate($obj->date_cloture)).'</td>';
     }
@@ -657,7 +657,7 @@ while ($i < min($num,$limit))
 	}
 	print '</td>';
 	if (! $i) $totalarray['nbfield']++;
-	
+
 	print "</tr>\n";
 	$i++;
 }
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 42773058471..5998cab9343 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -475,7 +475,7 @@ if ($resql)
         $moreforfilter.='<div class="divsearchfield">';
         $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
         $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
-        $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
+        $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
         $moreforfilter.='</div>';
     }
     $parameters=array();
@@ -719,7 +719,7 @@ if ($resql)
         if (! empty($arrayfields['cf.ref']['checked']))
         {
             print '<td class="nowrap">';
-            
+
             print '<table class="nobordernopadding"><tr class="nocellnopadd">';
             // Picto + Ref
             print '<td class="nobordernopadding nowrap">';
@@ -734,7 +734,7 @@ if ($resql)
 			$filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref);
 			print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
 			print '</td></tr></table>';
-			
+
 			print '</td>'."\n";
             if (! $i) $totalarray['nbfield']++;
         }
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 8022eb7ef17..118ef3df3b1 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -232,7 +232,7 @@ if (empty($reshook))
 
 
 }
-    
+
 /*
  * View
  */
@@ -389,7 +389,7 @@ if ($resql)
 	$num = $db->num_rows($resql);
 
 	$arrayofselected=is_array($toselect)?$toselect:array();
-	
+
 	if ($socid)
 	{
 		$soc = new Societe($db);
@@ -424,9 +424,9 @@ if ($resql)
 	    $tmpkey=preg_replace('/search_options_/','',$key);
 	    if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
 	}
-	
+
 	$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
-	
+
 	$i = 0;
 	print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
     if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@@ -439,13 +439,13 @@ if ($resql)
 	print '<input type="hidden" name="socid" value="'.$socid.'">';
 
 	print_barre_liste($langs->trans("BillsSuppliers").($socid?" - $soc->name":""), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
-	
+
 	if ($search_all)
     {
         foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
         print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
     }
-    
+
  	// If the user can view prospects other than his'
     $moreforfilter='';
  	if ($user->rights->societe->client->voir || $socid)
@@ -471,7 +471,7 @@ if ($resql)
 		$moreforfilter.='<div class="divsearchfield">';
 		$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
 		$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
-		$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
+		$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
 		$moreforfilter.='</div>';
 	}
     $parameters=array();
@@ -488,7 +488,7 @@ if ($resql)
 
     $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
     $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);	// This also change content of $arrayfields
-	
+
     print '<div class="div-table-responsive">';
     print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
 	print '<tr class="liste_titre">';
@@ -694,7 +694,7 @@ if ($resql)
     $facturestatic=new FactureFournisseur($db);
 	$supplierstatic=new Fournisseur($db);
 	$projectstatic=new Project($db);
-	
+
 	if ($num > 0)
     {
 		$i=0;
@@ -705,14 +705,14 @@ if ($resql)
 		{
 			$obj = $db->fetch_object($resql);
 			$var=!$var;
-		
+
 			$datelimit=$db->jdate($obj->datelimite);
 			$facturestatic->id=$obj->facid;
 			$facturestatic->ref=$obj->ref;
 			$facturestatic->ref_supplier=$obj->ref_supplier;
 			$facturestatic->date_echeance = $db->jdate($obj->datelimite);
 			$facturestatic->statut = $obj->fk_statut;
-	
+
             print '<tr '.$bc[$var].'>';
     		if (! empty($arrayfields['f.ref']['checked']))
     		{
@@ -733,11 +733,11 @@ if ($resql)
 				$subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
 				print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir);
 				print '</td></tr></table>';
-				
+
                 print "</td>\n";
 				if (! $i) $totalarray['nbfield']++;
     		}
-    		
+
 			// Customer ref
     		if (! empty($arrayfields['f.ref_supplier']['checked']))
     		{
@@ -746,7 +746,7 @@ if ($resql)
     			print '</td>';
     		    if (! $i) $totalarray['nbfield']++;
     		}
-    		
+
 			// Label
     		if (! empty($arrayfields['f.label']['checked']))
     		{
@@ -755,7 +755,7 @@ if ($resql)
     			print '</td>';
     		    if (! $i) $totalarray['nbfield']++;
     		}
-    		
+
 			// Date
     		if (! empty($arrayfields['f.datef']['checked']))
     		{
@@ -764,7 +764,7 @@ if ($resql)
                 print '</td>';
     		    if (! $i) $totalarray['nbfield']++;
     		}
-    		
+
             // Date limit
     		if (! empty($arrayfields['f.date_lim_reglement']['checked']))
     		{
@@ -776,7 +776,7 @@ if ($resql)
                 print '</td>';
     		    if (! $i) $totalarray['nbfield']++;
     		}
-    		
+
     		// Project
     		if (! empty($arrayfields['p.ref']['checked']))
     		{
@@ -790,7 +790,7 @@ if ($resql)
     		    print '</td>';
     		    if (! $i) $totalarray['nbfield']++;
     		}
-    		
+
     		// Third party
     		if (! empty($arrayfields['s.nom']['checked']))
     		{
@@ -844,7 +844,7 @@ if ($resql)
     		    print '</td>';
     		    if (! $i) $totalarray['nbfield']++;
     		}
-    		
+
             // Payment mode
     		if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
     		{
@@ -853,7 +853,7 @@ if ($resql)
                 print '</td>';
     		    if (! $i) $totalarray['nbfield']++;
     		}
-    		
+
             // Amount HT
             if (! empty($arrayfields['f.total_ht']['checked']))
             {
@@ -894,7 +894,7 @@ if ($resql)
     		    if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
     		    $totalarray['totalrtp'] += $remaintopay;
             }
-            
+
             // Extra fields
             if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
             {
@@ -942,7 +942,7 @@ if ($resql)
                 print "</td>";
                 if (! $i) $totalarray['nbfield']++;
             }
-            
+
     		// Action column
             print '<td class="nowrap" align="center">';
             $selected=0;
@@ -950,12 +950,12 @@ if ($resql)
     		//print '<input id="cb'.$obj->facid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.'"'.($selected?' checked="checked"':'').'>';
     		print '</td>' ;
     		if (! $i) $totalarray['nbfield']++;
-    		
+
 			print "</tr>\n";
-			
+
 			$i++;
 		}
-		
+
 	    // Show total line
     	if (isset($totalarray['totalhtfield'])
  	   || isset($totalarray['totalvatfield'])
@@ -982,16 +982,16 @@ if ($resql)
     		   else print '<td></td>';
     		}
     		print '</tr>';
-    		
+
     	}
 	}
 
 	$db->free($resql);
-	
+
 	$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
 	$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters);    // Note that $action and $object may have been modified by hook
 	print $hookmanager->resPrint;
-	
+
 	print "</table>\n";
     print '</div>';
 	print "</form>\n";
-- 
GitLab