From 5b965278052671cf92714c6646b341dd4c866e65 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Wed, 27 Oct 2010 14:15:30 +0000
Subject: [PATCH] Qual: Uniformize code (ligne -> line)

---
 dev/samples/create_invoice.php                       |  2 +-
 htdocs/comm/propal/class/propal.class.php            | 12 +++++++-----
 htdocs/compta/facture/class/facture.class.php        | 12 ++++++------
 htdocs/core/class/translate.class.php                |  6 +++---
 ...nterface_modPropale_Exportsynchro.class.php-NORUN | 10 +++++-----
 htdocs/lib/datepicker.php                            |  4 ++--
 htdocs/theme/auguria/style.css.php                   |  6 +++---
 htdocs/theme/eldy/style.css.php                      |  6 +++---
 htdocs/theme/freelug/style.css.php                   |  4 ++--
 htdocs/theme/yellow/style.css.php                    |  4 ++--
 10 files changed, 34 insertions(+), 32 deletions(-)

diff --git a/dev/samples/create_invoice.php b/dev/samples/create_invoice.php
index 89203b27300..25c70fc1fe6 100644
--- a/dev/samples/create_invoice.php
+++ b/dev/samples/create_invoice.php
@@ -85,7 +85,7 @@ $line1->qty=1;
 $line1->total_ht=100;
 $line1->total_tva=10;
 $line1->total_ttc=110;
-$obj->lignes[]=$line1;
+$obj->lines[]=$line1;
 
 // Create invoice
 $idobject=$obj->create($user);
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 2ef0c20ecb1..d4353ece3ef 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -954,10 +954,12 @@ class Propal extends CommonObject
 					$this->brouillon = 1;
 				}
 
-				$this->lignes = array();
-				$this->db->free($resql);
+                $this->db->free($resql);
 
-				/*
+                $this->lignes = array(); // TODO: deprecated
+                $this->lines = array();
+
+                /*
 				 * Lignes propales liees a un produit ou non
 				 */
 				$sql = "SELECT d.rowid, d.fk_propal, d.description, d.price, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,";
@@ -1012,8 +1014,8 @@ class Propal extends CommonObject
 
 						$this->lignes[$i]       = $line; // TODO: deprecated
 						$this->lines[$i]        = $line;
-						//dol_syslog("1 ".$ligne->fk_product);
-						//print "xx $i ".$this->lignes[$i]->fk_product;
+						//dol_syslog("1 ".$line->fk_product);
+						//print "xx $i ".$this->lines[$i]->fk_product;
 						$i++;
 					}
 					$this->db->free($result);
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index afa0878acf4..d2356f4069e 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -134,12 +134,12 @@ class Facture extends CommonObject
 	}
 
 	/**
-	 *	\brief     	Create invoice in database
-	 *	\param     	user       		Object user that create
-	 *	\param      notrigger		1 ne declenche pas les triggers, 0 sinon
-	 * 	\param		forceduedate	Do not recalculate due date from payment condition but force it with value
-	 *	\return		int				<0 if KO, >0 if OK
-	 *	\remarks	this->ref can be set or empty. If empty, we will use "(PROV)"
+	 *	Create invoice in database
+	 *	@param     	user       		Object user that create
+	 *	@param      notrigger		1=Does not execute triggers, 0 otherwise
+	 * 	@param		forceduedate	1=Do not recalculate due date from payment condition but force it with value
+	 *	@return		int				<0 if KO, >0 if OK
+	 *	@remarks	this->ref can be set or empty. If empty, we will use "(PROV)"
 	 */
 	function create($user,$notrigger=0,$forceduedate=0)
 	{
diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php
index eaaae3acb2e..19cbcfb6f20 100644
--- a/htdocs/core/class/translate.class.php
+++ b/htdocs/core/class/translate.class.php
@@ -237,16 +237,16 @@ class Translate {
 								{
 									$value=trim(preg_replace('/\\n/',"\n",$tab[1]));
 
-									if (preg_match('/^CHARSET$/',$key))		// This is to declare in which charset files are encoded
+									if ($key == 'CHARSET')		// This is to declare in which charset files are encoded
 									{
 										$this->charset_inputfile[$newdomain]=strtoupper($value);
 										//print 'File '.$file_lang.' is declared to have format '.$this->charset_inputfile[$newdomain].'<br>';
 									}
-									elseif (preg_match('/^DIRECTION$/',$key))	// This is to declare direction of language
+									elseif ($key == 'DIRECTION')	// This is to declare direction of language
 									{
 										if ($alt < 2)	// We do not load direction for alternate files 2
 										{
-											$this->direction=$value;
+                                            $this->tab_translate[$key]=$value;
 											if ($stopafterdirection) break;
 										}
 									}
diff --git a/htdocs/includes/triggers/interface_modPropale_Exportsynchro.class.php-NORUN b/htdocs/includes/triggers/interface_modPropale_Exportsynchro.class.php-NORUN
index fabd8835a04..1c05cff6fe0 100644
--- a/htdocs/includes/triggers/interface_modPropale_Exportsynchro.class.php-NORUN
+++ b/htdocs/includes/triggers/interface_modPropale_Exportsynchro.class.php-NORUN
@@ -171,13 +171,13 @@ class InterfaceExportsynchro
            							);
             
         $i=0;
-        while ($i < count($propal->lignes))
+        while ($i < count($propal->lines))
         {
         	$objPropalLine_data[$i] = array(	"Ref"=>$propal->ref,
-            									"ProductRef"=>$propal->lignes[$i]->ref,
-            									"Label"=>$propal->lignes[$i]->libelle,
-            									"LineQty"=>$propal->lignes[$i]->qty,
-            									"LineTotalHT"=>$propal->lignes[$i]->total_ht
+            									"ProductRef"=>$propal->lines[$i]->ref,
+            									"Label"=>$propal->lines[$i]->libelle,
+            									"LineQty"=>$propal->lines[$i]->qty,
+            									"LineTotalHT"=>$propal->lines[$i]->total_ht
            									);
            	$i++;
         }
diff --git a/htdocs/lib/datepicker.php b/htdocs/lib/datepicker.php
index 90d8f4defba..12c651ee7a3 100644
--- a/htdocs/lib/datepicker.php
+++ b/htdocs/lib/datepicker.php
@@ -41,8 +41,8 @@ require_once("../main.inc.php");
 
 if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]);	// If language was forced on URL by the main.inc.php
 $langs->load("main");
-$right=($langs->direction=='rtl'?'left':'right');
-$left=($langs->direction=='rtl'?'right':'left');
+$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
+$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
 
 //var_dump($langs->defaultlang);
 //var_dump($conf->format_date_short_java);
diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php
index 2b1dfcdb613..dad9ab1967e 100644
--- a/htdocs/theme/auguria/style.css.php
+++ b/htdocs/theme/auguria/style.css.php
@@ -52,8 +52,8 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
 if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]);  // If language was forced on URL
 if (! empty($_GET["theme"])) $conf->theme=$_GET["theme"];  // If theme was forced on URL
 $langs->load("main",0,1);
-$right=($langs->direction=='rtl'?'left':'right');
-$left=($langs->direction=='rtl'?'right':'left');
+$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
+$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
 $fontsize=empty($conf->browser->phone)?'12':'12';
 $fontsizesmaller=empty($conf->browser->phone)?'11':'11';
 
@@ -76,7 +76,7 @@ body {
     margin-bottom: 0;
     margin-right: 0;
     margin-left: 0;
-    <?php print 'direction: '.$langs->direction.";\n"; ?>
+    <?php print 'direction: '.$langs->trans("DIRECTION").";\n"; ?>
 }
 
 a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: bold; color: #000000; text-decoration: none; }
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index edef7988854..02f39d6bc49 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -52,8 +52,8 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
 if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]);	// If language was forced on URL
 if (! empty($_GET["theme"])) $conf->theme=$_GET["theme"];  // If theme was forced on URL
 $langs->load("main",0,1);
-$right=($langs->direction=='rtl'?'left':'right');
-$left=($langs->direction=='rtl'?'right':'left');
+$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
+$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
 $fontsize=empty($conf->browser->phone)?'12':'12';
 $fontsizesmaller=empty($conf->browser->phone)?'11':'11';
 
@@ -79,7 +79,7 @@ body {
     margin-bottom: 0;
     margin-right: 0;
     margin-left: 0;
-    <?php print 'direction: '.$langs->direction.";\n"; ?>
+    <?php print 'direction: '.$langs->trans("DIRECTION").";\n"; ?>
 }
 
 a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: bold; color: #000000; text-decoration: none; }
diff --git a/htdocs/theme/freelug/style.css.php b/htdocs/theme/freelug/style.css.php
index dd0842f7de6..392e64f0022 100644
--- a/htdocs/theme/freelug/style.css.php
+++ b/htdocs/theme/freelug/style.css.php
@@ -51,8 +51,8 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
 if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]);  // If language was forced on URL
 if (! empty($_GET["theme"])) $conf->theme=$_GET["theme"];  // If theme was forced on URL
 $langs->load("main",0,1);
-$right=($langs->direction=='rtl'?'left':'right');
-$left=($langs->direction=='rtl'?'right':'left');
+$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
+$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
 ?>
 
 /* ============================================================================== */
diff --git a/htdocs/theme/yellow/style.css.php b/htdocs/theme/yellow/style.css.php
index 34a0d94ebbf..58bbabb74a5 100644
--- a/htdocs/theme/yellow/style.css.php
+++ b/htdocs/theme/yellow/style.css.php
@@ -51,8 +51,8 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
 if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]);  // If language was forced on URL
 if (! empty($_GET["theme"])) $conf->theme=$_GET["theme"];  // If theme was forced on URL
 $langs->load("main",0,1);
-$right=($langs->direction=='rtl'?'left':'right');
-$left=($langs->direction=='rtl'?'right':'left');
+$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
+$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
 ?>
 
 /* ============================================================================== */
-- 
GitLab