From 663f7938f83343bbd172005ab7328a97666b5690 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sun, 27 Nov 2016 20:02:57 +0100
Subject: [PATCH] Fxi responsive design

---
 .../class/html.formventilation.class.php      |  4 +-
 htdocs/compta/bank/card.php                   |  6 +-
 htdocs/compta/bank/treso.php                  | 11 ++--
 htdocs/margin/tabs/productMargins.php         |  4 +-
 htdocs/product/card.php                       | 62 +++++++++----------
 htdocs/product/fournisseurs.php               |  4 +-
 htdocs/product/price.php                      |  4 +-
 htdocs/product/stock/product.php              |  7 ++-
 8 files changed, 55 insertions(+), 47 deletions(-)

diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php
index 069e0ea3df3..2c538e7a627 100644
--- a/htdocs/accountancy/class/html.formventilation.class.php
+++ b/htdocs/accountancy/class/html.formventilation.class.php
@@ -71,8 +71,8 @@ class FormVentilation extends Form
 	 * @param string   $htmlname           Name of field in html form
 	 * @param int      $showempty          Add an empty field
 	 * @param array    $event              Event options
-	 * @param int      $select_in          selectid value is a aa.rowid (0 default) or aa.account_number (1)
-	 * @param int      $select_out         set value returned by select 0=rowid (default), 1=account_number
+	 * @param int      $select_in          0=selectid value is a aa.rowid (default) or 1=selectid is aa.account_number
+	 * @param int      $select_out         Set value returned by select. 0=rowid (default), 1=account_number
 	 * @param string   $morecss            More css non HTML object
 	 * @param string   $usecache           Key to use to store result into a cache. Next call with same key will reuse the cache.
 	 * @return string                      String with HTML select
diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index 7b44bb5b6b4..d2b3c167872 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -603,7 +603,7 @@ else
 		print '<td>'.$object->label.'</td></tr>';*/
 
 		// Type
-		print '<tr><td>'.$langs->trans("AccountType").'</td>';
+		print '<tr><td class="titlefield">'.$langs->trans("AccountType").'</td>';
 		print '<td>'.$object->type_lib[$object->type].'</td></tr>';
 
 		// Currency
@@ -683,12 +683,12 @@ else
 		
         // Categories
         if ($conf->categorie->enabled) {
-            print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
+            print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
             print $form->showCategories($object->id,'account',1);
             print "</td></tr>";
         }
 
-		print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
+		print '<tr><td class="tdtop titlefield">'.$langs->trans("Comment").'</td>';
 		print '<td>'.dol_htmlentitiesbr($object->comment).'</td></tr>';
 
 		print '</table>';
diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php
index 3de977f29cf..7cc31e576f6 100644
--- a/htdocs/compta/bank/treso.php
+++ b/htdocs/compta/bank/treso.php
@@ -104,10 +104,9 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
 
 	$solde = $object->solde(0);
 
-	/*
-	 * Affiche tableau des echeances a venir
-	 */
-	print '<table class="noborder centpercent">';
+	// Show next coming entries
+    print '<div class="div-table-responsive">';
+    print '<table class="noborder centpercent">';
 
 	// Ligne de titre tableau des ecritures
 	print '<tr class="liste_titre">';
@@ -121,7 +120,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
 
 	$var=true;
 
-	// Solde actuel
+	// Current balance
 	$var=!$var;
 	print '<tr class="liste_total">';
 	print '<td align="left" colspan="5">'.$langs->trans("CurrentBalance").'</td>';
@@ -327,7 +326,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
 	print '</tr>';
 
 	print "</table>";
-
+    print "</div>";
 }
 else
 {
diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php
index f6d94fb8135..7550b672007 100644
--- a/htdocs/margin/tabs/productMargins.php
+++ b/htdocs/margin/tabs/productMargins.php
@@ -167,6 +167,8 @@ if ($id > 0 || ! empty($ref))
                 print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&amp;id=$object->id",$sortfield,$sortorder,'',0,0,'');
 
                 $i = 0;
+                
+                print '<div class="div-table-responsive">';
                 print '<table class="noborder" width="100%">';
 
                 print '<tr class="liste_titre">';
@@ -252,7 +254,7 @@ if ($id > 0 || ! empty($ref))
                 print '<td align="right">&nbsp;</td>';
                 print "</tr>\n";
                 print "</table>";
-                print '<br>';
+                print '</div>';
             } else {
                 dol_print_error($db);
             }
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index a564818f9e7..c31c8885454 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -144,7 +144,6 @@ if (empty($reshook))
 	 */
 	else if ($action == 'builddoc' && $user->rights->produit->creer)
 	{
-
 		// Save last template used to generate document
 		if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
 
@@ -749,7 +748,7 @@ if (empty($reshook))
                 {
                     $buyprice = $result;
                 }
-                
+
                 $result = $facture->addline(
                     $desc,
                     $pu_ht,
@@ -790,7 +789,6 @@ if (empty($reshook))
         else {
             $action="";
             setEventMessages($langs->trans("WarningSelectOneDocument"), null, 'warnings');
-
         }
     }
 }
@@ -891,11 +889,12 @@ else
 
         dol_fiche_head('');
 
-        print '<table class="border" width="100%">';
+        print '<table class="border centpercent">';
+        
         print '<tr>';
         $tmpcode='';
 		if (! empty($modCodeProduct->code_auto)) $tmpcode=$modCodeProduct->getNextValue($object,$type);
-        print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td colspan="3"><input name="ref" size="32" maxlength="128" value="'.dol_escape_htmltag(GETPOST('ref')?GETPOST('ref'):$tmpcode).'">';
+        print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="ref" class="maxwidth200" maxlength="128" value="'.dol_escape_htmltag(GETPOST('ref')?GETPOST('ref'):$tmpcode).'">';
         if ($refalreadyexists)
         {
             print $langs->trans("RefAlreadyExists");
@@ -903,7 +902,7 @@ else
         print '</td></tr>';
 
         // Label
-        print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td colspan="3"><input name="label" size="40" maxlength="255" value="'.dol_escape_htmltag(GETPOST('label')).'"></td></tr>';
+        print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td colspan="3"><input name="label" class="minwidth300 maxwidth400onsmartphone" maxlength="255" value="'.dol_escape_htmltag(GETPOST('label')).'"></td></tr>';
 
         // On sell
         print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="3">';
@@ -946,14 +945,14 @@ else
 	        print '</td><td>'.$langs->trans("BarcodeValue").'</td><td>';
 	        $tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode;
 	        if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type);
-	        print '<input size="40" class="maxwidthonsmartphone" type="text" name="barcode" value="'.dol_escape_htmltag($tmpcode).'">';
+	        print '<input class="maxwidth100" type="text" name="barcode" value="'.dol_escape_htmltag($tmpcode).'">';
 	        print '</td></tr>';
         }
 
         // Description (used in invoice, propal...)
         print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
 
-        $doleditor = new DolEditor('desc', GETPOST('desc'), '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '80%');
+        $doleditor = new DolEditor('desc', GETPOST('desc'), '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%');
         $doleditor->Create();
 
         print "</td></tr>";
@@ -967,11 +966,11 @@ else
         if ($type != 1 && ! empty($conf->stock->enabled))
         {
             print '<tr><td>'.$langs->trans("StockLimit").'</td><td>';
-            print '<input name="seuil_stock_alerte" size="4" value="'.GETPOST('seuil_stock_alerte').'">';
+            print '<input name="seuil_stock_alerte" class="maxwidth50" value="'.GETPOST('seuil_stock_alerte').'">';
             print '</td>';
             // Stock desired level
             print '<td>'.$langs->trans("DesiredStock").'</td><td>';
-            print '<input name="desiredstock" size="4" value="'.GETPOST('desiredstock').'">';
+            print '<input name="desiredstock" class="maxwidth50" value="'.GETPOST('desiredstock').'">';
             print '</td></tr>';
         }
         else
@@ -1043,7 +1042,7 @@ else
         // Custom code
         if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO) && empty($type))
         {
-	        print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.GETPOST('customcode').'"></td>';
+	        print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.GETPOST('customcode').'"></td>';
 	        // Origin country
 	        print '<td>'.$langs->trans("CountryOrigin").'</td><td>';
 	        print $form->select_country(GETPOST('country_id','int'),'country_id');
@@ -1065,7 +1064,7 @@ else
             print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="3">';
     
             // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
-            $doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_8, '80%');
+            $doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_8, '90%');
     	    $doleditor->Create();
     
             print "</td></tr>";
@@ -1093,18 +1092,18 @@ else
             print '<table class="border" width="100%">';
 
             // Price
-            print '<tr><td>'.$langs->trans("SellingPrice").'</td>';
-            print '<td><input name="price" size="10" value="'.$object->price.'">';
+            print '<tr><td class="titlefieldcreate">'.$langs->trans("SellingPrice").'</td>';
+            print '<td><input name="price" class="maxwidth50" value="'.$object->price.'">';
             print $form->selectPriceBaseType($object->price_base_type, "price_base_type");
             print '</td></tr>';
 
             // Min price
             print '<tr><td>'.$langs->trans("MinPrice").'</td>';
-            print '<td><input name="price_min" size="10" value="'.$object->price_min.'">';
+            print '<td><input name="price_min" class="maxwidth50" value="'.$object->price_min.'">';
             print '</td></tr>';
 
             // VAT
-            print '<tr><td width="20%">'.$langs->trans("VATRate").'</td><td>';
+            print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
             print $form->load_tva("tva_tx",-1,$mysoc,'');
             print '</td></tr>';
 
@@ -1113,32 +1112,33 @@ else
             print '<br>';
         }
 
+        // Accountancy codes
         print '<table class="border" width="100%">';
 		
 		if (! empty($conf->accounting->enabled))
 		{
             // Accountancy_code_sell
             print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
-            print '<td class="maxwidthonsmartphone">';
-		    print $formaccountancy->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 0, 1);
+            print '<td>';
+		    print $formaccountancy->select_account(GETPOST('accountancy_code_sell'), 'accountancy_code_sell', 1, null, 1, 1, '');
             print '</td></tr>';
 
             // Accountancy_code_buy
             print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
-            print '<td class="maxwidthonsmartphone">';
-			print $formaccountancy->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 0, 1);
+            print '<td>';
+			print $formaccountancy->select_account(GETPOST('accountancy_code_buy'), 'accountancy_code_buy', 1, null, 1, 1, '');
             print '</td></tr>';
 		}			
 		else // For external software 
 		{
             // Accountancy_code_sell
             print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
-            print '<td class="maxwidthonsmartphone"><input name="accountancy_code_sell" size="16" value="'.$object->accountancy_code_sell.'">';
+            print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.'">';
             print '</td></tr>';
 
             // Accountancy_code_buy
             print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
-            print '<td class="maxwidthonsmartphone"><input name="accountancy_code_buy" size="16" value="'.$object->accountancy_code_buy.'">';
+            print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.'">';
             print '</td></tr>';
         }
 		print '</table>';
@@ -1185,10 +1185,10 @@ else
             print '<table class="border allwidth">';
 
             // Ref
-            print '<tr><td width="20%" class="fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="ref" size="32" maxlength="128" value="'.dol_escape_htmltag($object->ref).'"></td></tr>';
+            print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="ref" class="maxwidth200" maxlength="128" value="'.dol_escape_htmltag($object->ref).'"></td></tr>';
 
             // Label
-            print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td colspan="3"><input name="label" size="40" maxlength="255" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
+            print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td colspan="3"><input name="label" class="minwidth300 maxwidth400onsmartphone" maxlength="255" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
 
             // Status To sell
             print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="3">';
@@ -1356,7 +1356,7 @@ else
 	        // Custom code
     	    if (! $object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
         	{
-	            print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.$object->customcode.'"></td>';
+	            print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.$object->customcode.'"></td>';
 	            // Origin country
 	            print '<td>'.$langs->trans("CountryOrigin").'</td><td>';
 	            print $form->select_country($object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone');
@@ -1406,13 +1406,13 @@ else
 			if (! empty($conf->accounting->enabled))
 			{
                 // Accountancy_code_sell
-                print '<tr><td width="20%">'.$langs->trans("ProductAccountancySellCode").'</td>';
+                print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellCode").'</td>';
                 print '<td>';
 				print $formaccountancy->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1);
                 print '</td></tr>';
 
                 // Accountancy_code_buy
-                print '<tr><td width="20%">'.$langs->trans("ProductAccountancyBuyCode").'</td>';
+                print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
                 print '<td>';
 				print $formaccountancy->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1);
                 print '</td></tr>';
@@ -1420,13 +1420,13 @@ else
 			else // For external software 
 			{
                 // Accountancy_code_sell
-                print '<tr><td width="20%">'.$langs->trans("ProductAccountancySellCode").'</td>';
-                print '<td><input name="accountancy_code_sell" size="16" value="'.$object->accountancy_code_sell.'">';
+                print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellCode").'</td>';
+                print '<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.'">';
                 print '</td></tr>';
 
                 // Accountancy_code_buy
-                print '<tr><td width="20%">'.$langs->trans("ProductAccountancyBuyCode").'</td>';
-                print '<td><input name="accountancy_code_buy" size="16" value="'.$object->accountancy_code_buy.'">';
+                print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
+                print '<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.'">';
                 print '</td></tr>';
             }
 			print '</table>';
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 05d70e7eb26..a71db876dd0 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -587,7 +587,8 @@ if ($id > 0 || $ref)
 			if ($user->rights->fournisseur->lire)
 			{
 				// Suppliers list title
-				print '<table class="noborder" width="100%">';
+			    print '<div class="div-table-responsive">';
+			    print '<table class="noborder" width="100%">';
 				if ($object->isProduct()) $nblignefour=4;
 				else $nblignefour=4;
 
@@ -713,6 +714,7 @@ if ($id > 0 || $ref)
 				}
 
 				print '</table>';
+				print '</div>';
 			}
 		}
 	}
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index 4e04a4c626a..f74a637d270 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -959,7 +959,7 @@ else
 				}
 			}
 			if ($action != 'edit_price_by_qty') {
-				print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
+				print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';  // FIXME a form into a table is not allowed
 				print '<input type="hidden" name="action" value="update_price_by_qty">';
 				print '<input type="hidden" name="priceid" value="' . $object->prices_by_qty_id [0] . '">';
 				print '<input type="hidden" value="0" name="rowid">';
@@ -1345,6 +1345,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
     		if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"),'','','','','',$backbutton, 0, 0, 'title_accountancy.png');
     		else print_barre_liste($langs->trans("PriceByCustomerLog"),'','','','','','', 0, 0, 'title_accountancy.png');
     
+    		print '<div class="div-table-responsive">';
     		print '<table class="noborder" width="100%">';
     
     		print '<tr class="liste_titre">';
@@ -1450,6 +1451,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
     		
     		$db->free($result);
     		print "</table>";
+    		print '</div>';
     		print "<br>";
     	}
     } else {
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index 4c00a2b9675..7a0068fdda8 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -785,8 +785,10 @@ if (empty($reshook))
  * Stock detail (by warehouse). May go down into batch details.
  */
 
+print '<div class="div-table-responsive">';
 print '<table class="noborder" width="100%">';
-print '<tr class="liste_titre"><td width="40%" colspan="4">'.$langs->trans("Warehouse").'</td>';
+print '<tr class="liste_titre">';
+print '<td colspan="4">'.$langs->trans("Warehouse").'</td>';
 print '<td align="right">'.$langs->trans("NumberOfUnit").'</td>';
 print '<td align="right">'.$langs->trans("AverageUnitPricePMPShort").'</td>';
 print '<td align="right">'.$langs->trans("EstimatedStockValueShort").'</td>';
@@ -918,10 +920,11 @@ else print $langs->trans("Variable");
 print '</td>';
 print "</tr>";
 print "</table>";
+print '</div>';
 
 if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
 	
-	print '<br /><br />';
+	print '<br><br>';
 	print_titre($langs->trans('AddNewProductStockWarehouse'));
 	//print '<br />';
 	
-- 
GitLab