Passed
Push — master ( 8f7a8e...7e4a07 )
by Alxarafe
20:11
created
dolibarr/htdocs/margin/lib/margins.lib.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,10 +73,10 @@
 block discarded – undo
73 73
 
74 74
     if ($user->rights->societe->lire) {
75 75
         $head[$h][0] = BASE_URI . '?controller=margin&method=customerMargins';
76
-		$head[$h][1] = $langs->trans("CustomerMargins");
77
-		$head[$h][2] = 'customerMargins';
78
-		$h++;
79
-	}
76
+        $head[$h][1] = $langs->trans("CustomerMargins");
77
+        $head[$h][2] = 'customerMargins';
78
+        $h++;
79
+    }
80 80
 
81 81
     if ($user->rights->margins->read->all) {
82 82
         $title = 'UserMargins';
Please login to merge, or discard this patch.
dolibarr/htdocs/master.inc.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -68,33 +68,33 @@  discard block
 block discarded – undo
68 68
 $conf->file->dol_url_root				= array('main' => (string) DOL_URL_ROOT);									// Define array of url root path ('' or '/dolibarr')
69 69
 if (! empty($dolibarr_main_document_root_alt))
70 70
 {
71
-	// dolibarr_main_document_root_alt can contains several directories
72
-	$values=preg_split('/[;,]/',$dolibarr_main_document_root_alt);
73
-	$i=0;
71
+    // dolibarr_main_document_root_alt can contains several directories
72
+    $values=preg_split('/[;,]/',$dolibarr_main_document_root_alt);
73
+    $i=0;
74 74
     foreach ($values as $value)
75 75
         $conf->file->dol_document_root['alt' . ($i++)] = (string)$value;
76
-	$values=preg_split('/[;,]/',$dolibarr_main_url_root_alt);
77
-	$i=0;
78
-	foreach($values as $value)
79
-	{
80
-		if (preg_match('/^http(s)?:/',$value))
81
-		{
82
-			// Show error message
83
-			$correct_value = str_replace($dolibarr_main_url_root, '', $value);
84
-			print '<b>Error:</b><br>'."\n";
85
-			print 'Wrong <b>$dolibarr_main_url_root_alt</b> value in <b>conf.php</b> file.<br>'."\n";
86
-			print 'We now use a relative path to $dolibarr_main_url_root to build alternate URLs.<br>'."\n";
87
-			print 'Value found: '.$value.'<br>'."\n";
88
-			print 'Should be replaced by: '.$correct_value.'<br>'."\n";
89
-			print "Or something like following examples:<br>\n";
90
-			print "\"/extensions\"<br>\n";
91
-			print "\"/extensions1,/extensions2,...\"<br>\n";
92
-			print "\"/../extensions\"<br>\n";
93
-			print "\"/custom\"<br>\n";
94
-			exit;
95
-		}
96
-		$conf->file->dol_url_root['alt'.($i++)]=(string) $value;
97
-	}
76
+    $values=preg_split('/[;,]/',$dolibarr_main_url_root_alt);
77
+    $i=0;
78
+    foreach($values as $value)
79
+    {
80
+        if (preg_match('/^http(s)?:/',$value))
81
+        {
82
+            // Show error message
83
+            $correct_value = str_replace($dolibarr_main_url_root, '', $value);
84
+            print '<b>Error:</b><br>'."\n";
85
+            print 'Wrong <b>$dolibarr_main_url_root_alt</b> value in <b>conf.php</b> file.<br>'."\n";
86
+            print 'We now use a relative path to $dolibarr_main_url_root to build alternate URLs.<br>'."\n";
87
+            print 'Value found: '.$value.'<br>'."\n";
88
+            print 'Should be replaced by: '.$correct_value.'<br>'."\n";
89
+            print "Or something like following examples:<br>\n";
90
+            print "\"/extensions\"<br>\n";
91
+            print "\"/extensions1,/extensions2,...\"<br>\n";
92
+            print "\"/../extensions\"<br>\n";
93
+            print "\"/custom\"<br>\n";
94
+            exit;
95
+        }
96
+        $conf->file->dol_url_root['alt'.($i++)]=(string) $value;
97
+    }
98 98
 }
99 99
 
100 100
 // Chargement des includes principaux de librairies communes
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
  */
109 109
 if (! defined('NOREQUIRETRAN'))
110 110
 {
111
-	$langs = new Translate('',$conf);	// Must be after reading conf
111
+    $langs = new Translate('',$conf);	// Must be after reading conf
112 112
 }
113 113
 
114 114
 /*
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
 {
119 119
     $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
120 120
 
121
-	if ($db->error)
122
-	{
123
-		dol_print_error($db,"host=".$conf->db->host.", port=".$conf->db->port.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error);
124
-		exit;
125
-	}
121
+    if ($db->error)
122
+    {
123
+        dol_print_error($db,"host=".$conf->db->host.", port=".$conf->db->port.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error);
124
+        exit;
125
+    }
126 126
 }
127 127
 
128 128
 // Now database connexion is known, so we can forget password
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
  */
135 135
 if (! defined('NOREQUIREUSER'))
136 136
 {
137
-	$user = new User($db);
137
+    $user = new User($db);
138 138
 }
139 139
 
140 140
 /*
@@ -145,19 +145,19 @@  discard block
 block discarded – undo
145 145
 // By default conf->entity is 1, but we change this if we ask another value.
146 146
 if (session_id() && ! empty($_SESSION["dol_entity"]))			// Entity inside an opened session
147 147
 {
148
-	$conf->entity = $_SESSION["dol_entity"];
148
+    $conf->entity = $_SESSION["dol_entity"];
149 149
 }
150 150
 else if (! empty($_ENV["dol_entity"]))							// Entity inside a CLI script
151 151
 {
152
-	$conf->entity = $_ENV["dol_entity"];
152
+    $conf->entity = $_ENV["dol_entity"];
153 153
 }
154 154
 else if (isset($_POST["loginfunction"]) && GETPOST("entity",'int'))	// Just after a login page
155 155
 {
156
-	$conf->entity = GETPOST("entity",'int');
156
+    $conf->entity = GETPOST("entity",'int');
157 157
 }
158 158
 else if (defined('DOLENTITY') && is_numeric(DOLENTITY))			// For public page with MultiCompany module
159 159
 {
160
-	$conf->entity = DOLENTITY;
160
+    $conf->entity = DOLENTITY;
161 161
 }
162 162
 
163 163
 // Sanitize entity
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
 
166 166
 if (! defined('NOREQUIREDB'))
167 167
 {
168
-	//print "Will work with data into entity instance number '".$conf->entity."'";
168
+    //print "Will work with data into entity instance number '".$conf->entity."'";
169 169
 
170
-	// Here we read database (llx_const table) and define $conf->global->XXX var.
171
-	$conf->setValues($db);
170
+    // Here we read database (llx_const table) and define $conf->global->XXX var.
171
+    $conf->setValues($db);
172 172
 }
173 173
 
174 174
 // Overwrite database value
175 175
 if (! empty($conf->file->mailing_limit_sendbyweb))
176 176
 {
177
-	$conf->global->MAILING_LIMIT_SENDBYWEB = $conf->file->mailing_limit_sendbyweb;
177
+    $conf->global->MAILING_LIMIT_SENDBYWEB = $conf->file->mailing_limit_sendbyweb;
178 178
 }
179 179
 if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
180 180
 {
@@ -192,41 +192,41 @@  discard block
 block discarded – undo
192 192
 // If software has been locked. Only login $conf->global->MAIN_ONLY_LOGIN_ALLOWED is allowed.
193 193
 if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
194 194
 {
195
-	$ok=0;
196
-	if ((! session_id() || ! isset($_SESSION["dol_login"])) && ! isset($_POST["username"]) && ! empty($_SERVER["GATEWAY_INTERFACE"])) $ok=1;	// We let working pages if not logged and inside a web browser (login form, to allow login by admin)
197
-	elseif (isset($_POST["username"]) && $_POST["username"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) $ok=1;				// We let working pages that is a login submission (login submit, to allow login by admin)
198
-	elseif (defined('NOREQUIREDB'))   $ok=1;				// We let working pages that don't need database access (xxx.css.php)
199
-	elseif (defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) $ok=1;	// We let working pages that ask to work even if only login enabled (logout.php)
200
-	elseif (session_id() && isset($_SESSION["dol_login"]) && $_SESSION["dol_login"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) $ok=1;	// We let working if user is allowed admin
201
-	if (! $ok)
202
-	{
203
-		if (session_id() && isset($_SESSION["dol_login"]) && $_SESSION["dol_login"] != $conf->global->MAIN_ONLY_LOGIN_ALLOWED)
204
-		{
205
-			print 'Sorry, your application is offline.'."\n";
206
-			print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.'" is allowed to connect for the moment.'."\n";
195
+    $ok=0;
196
+    if ((! session_id() || ! isset($_SESSION["dol_login"])) && ! isset($_POST["username"]) && ! empty($_SERVER["GATEWAY_INTERFACE"])) $ok=1;	// We let working pages if not logged and inside a web browser (login form, to allow login by admin)
197
+    elseif (isset($_POST["username"]) && $_POST["username"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) $ok=1;				// We let working pages that is a login submission (login submit, to allow login by admin)
198
+    elseif (defined('NOREQUIREDB'))   $ok=1;				// We let working pages that don't need database access (xxx.css.php)
199
+    elseif (defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) $ok=1;	// We let working pages that ask to work even if only login enabled (logout.php)
200
+    elseif (session_id() && isset($_SESSION["dol_login"]) && $_SESSION["dol_login"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) $ok=1;	// We let working if user is allowed admin
201
+    if (! $ok)
202
+    {
203
+        if (session_id() && isset($_SESSION["dol_login"]) && $_SESSION["dol_login"] != $conf->global->MAIN_ONLY_LOGIN_ALLOWED)
204
+        {
205
+            print 'Sorry, your application is offline.'."\n";
206
+            print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.'" is allowed to connect for the moment.'."\n";
207 207
             $nexturl = BASE_URI . '?controller=user&method=logout';
208
-			print 'Please try later or <a href="'.$nexturl.'">click here to disconnect and change login user</a>...'."\n";
209
-		}
210
-		else
211
-		{
212
-			print 'Sorry, your application is offline. Only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.'" is allowed to connect for the moment.'."\n";
208
+            print 'Please try later or <a href="'.$nexturl.'">click here to disconnect and change login user</a>...'."\n";
209
+        }
210
+        else
211
+        {
212
+            print 'Sorry, your application is offline. Only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.'" is allowed to connect for the moment.'."\n";
213 213
             $nexturl = BASE_URI . '/';
214
-			print 'Please try later or <a href="'.$nexturl.'">click here to change login user</a>...'."\n";
215
-		}
216
-		exit;
217
-	}
214
+            print 'Please try later or <a href="'.$nexturl.'">click here to change login user</a>...'."\n";
215
+        }
216
+        exit;
217
+    }
218 218
 }
219 219
 
220 220
 // Create object $mysoc (A thirdparty object that contains properties of companies managed by Dolibarr.
221 221
 if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC'))
222 222
 {
223
-	require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php';
223
+    require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php';
224 224
 
225
-	$mysoc=new Societe($db);
226
-	$mysoc->setMysoc($conf);
225
+    $mysoc=new Societe($db);
226
+    $mysoc->setMysoc($conf);
227 227
 
228
-	// For some countries, we need to invert our address with customer address
229
-	if ($mysoc->country_code == 'DE' && ! isset($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $conf->global->MAIN_INVERT_SENDER_RECIPIENT=1;
228
+    // For some countries, we need to invert our address with customer address
229
+    if ($mysoc->country_code == 'DE' && ! isset($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $conf->global->MAIN_INVERT_SENDER_RECIPIENT=1;
230 230
 }
231 231
 
232 232
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/product.lib.php 1 patch
Indentation   +292 added lines, -292 removed lines patch added patch discarded remove patch
@@ -34,88 +34,88 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function product_prepare_head($object)
36 36
 {
37
-	global $db, $langs, $conf, $user;
38
-	$langs->load("products");
37
+    global $db, $langs, $conf, $user;
38
+    $langs->load("products");
39 39
 
40
-	$h = 0;
41
-	$head = array();
40
+    $h = 0;
41
+    $head = array();
42 42
 
43 43
     $head[$h][0] = BASE_URI . "?controller=product&method=card&id=" . $object->id;
44
-	$head[$h][1] = $langs->trans("Card");
45
-	$head[$h][2] = 'card';
46
-	$h++;
44
+    $head[$h][1] = $langs->trans("Card");
45
+    $head[$h][2] = 'card';
46
+    $h++;
47 47
 
48
-	if (! empty($object->status))
49
-	{
48
+    if (! empty($object->status))
49
+    {
50 50
         $head[$h][0] = BASE_URI . "?controller=product&method=price&id=" . $object->id;
51
-    	$head[$h][1] = $langs->trans("SellingPrices");
52
-    	$head[$h][2] = 'price';
53
-    	$h++;
54
-	}
55
-
56
-	if (! empty($object->status_buy) || (! empty($conf->margin->enabled) && ! empty($object->status)))   // If margin is on and product on sell, we may need the cost price even if product os not on purchase
57
-	{
58
-    	if ((! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
59
-    	|| (! empty($conf->margin->enabled) && $user->rights->margin->liretous)
60
-    	)
61
-    	{
51
+        $head[$h][1] = $langs->trans("SellingPrices");
52
+        $head[$h][2] = 'price';
53
+        $h++;
54
+    }
55
+
56
+    if (! empty($object->status_buy) || (! empty($conf->margin->enabled) && ! empty($object->status)))   // If margin is on and product on sell, we may need the cost price even if product os not on purchase
57
+    {
58
+        if ((! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
59
+        || (! empty($conf->margin->enabled) && $user->rights->margin->liretous)
60
+        )
61
+        {
62 62
             $head[$h][0] = BASE_URI . "?controller=product&method=fournisseurs&id=" . $object->id;
63
-    		$head[$h][1] = $langs->trans("BuyingPrices");
64
-    		$head[$h][2] = 'suppliers';
65
-    		$h++;
66
-    	}
67
-	}
68
-
69
-	// Multilangs
70
-	if (! empty($conf->global->MAIN_MULTILANGS))
71
-	{
63
+            $head[$h][1] = $langs->trans("BuyingPrices");
64
+            $head[$h][2] = 'suppliers';
65
+            $h++;
66
+        }
67
+    }
68
+
69
+    // Multilangs
70
+    if (! empty($conf->global->MAIN_MULTILANGS))
71
+    {
72 72
         $head[$h][0] = BASE_URI . "?controller=product&method=traduction&id=" . $object->id;
73
-		$head[$h][1] = $langs->trans("Translation");
74
-		$head[$h][2] = 'translation';
75
-		$h++;
76
-	}
77
-
78
-	// Sub products
79
-	if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
80
-	{
73
+        $head[$h][1] = $langs->trans("Translation");
74
+        $head[$h][2] = 'translation';
75
+        $h++;
76
+    }
77
+
78
+    // Sub products
79
+    if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
80
+    {
81 81
         $head[$h][0] = BASE_URI . "?controller=product/composition&method=card&id=" . $object->id;
82
-		$head[$h][1] = $langs->trans('AssociatedProducts');
82
+        $head[$h][1] = $langs->trans('AssociatedProducts');
83 83
 
84
-		$nbFatherAndChild = $object->hasFatherOrChild();
85
-		if ($nbFatherAndChild > 0) $head[$h][1].= ' <span class="badge">'.$nbFatherAndChild.'</span>';
86
-		$head[$h][2] = 'subproduct';
87
-		$h++;
88
-	}
84
+        $nbFatherAndChild = $object->hasFatherOrChild();
85
+        if ($nbFatherAndChild > 0) $head[$h][1].= ' <span class="badge">'.$nbFatherAndChild.'</span>';
86
+        $head[$h][2] = 'subproduct';
87
+        $h++;
88
+    }
89 89
 
90 90
     $head[$h][0] = BASE_URI . "?controller=product/stats&method=card&id=" . $object->id;
91
-	$head[$h][1] = $langs->trans('Statistics');
92
-	$head[$h][2] = 'stats';
93
-	$h++;
91
+    $head[$h][1] = $langs->trans('Statistics');
92
+    $head[$h][2] = 'stats';
93
+    $h++;
94 94
 
95 95
     $head[$h][0] = BASE_URI . "?controller=product/stats&method=facture&showmessage=1&id=" . $object->id;
96
-	$head[$h][1] = $langs->trans('Referers');
97
-	$head[$h][2] = 'referers';
98
-	$h++;
96
+    $head[$h][1] = $langs->trans('Referers');
97
+    $head[$h][2] = 'referers';
98
+    $h++;
99 99
 
100
-	if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) {
100
+    if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) {
101 101
 
102
-		global $db;
102
+        global $db;
103 103
 
104
-		require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
104
+        require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
105 105
 
106
-		$prodcomb = new ProductCombination($db);
106
+        $prodcomb = new ProductCombination($db);
107 107
 
108
-		if ($prodcomb->fetchByFkProductChild($object->id) == -1)
109
-		{
108
+        if ($prodcomb->fetchByFkProductChild($object->id) == -1)
109
+        {
110 110
             $head[$h][0] = BASE_URI . "?controller=variants&method=combinations&id=" . $object->id;
111
-			$head[$h][1] = $langs->trans('ProductCombinations');
112
-			$head[$h][2] = 'combinations';
113
-			$nbVariant = $prodcomb->countNbOfCombinationForFkProductParent($object->id);
111
+            $head[$h][1] = $langs->trans('ProductCombinations');
112
+            $head[$h][2] = 'combinations';
113
+            $nbVariant = $prodcomb->countNbOfCombinationForFkProductParent($object->id);
114 114
             if ($nbVariant > 0) $head[$h][1].= ' <span class="badge">'.$nbVariant.'</span>';
115
-		}
115
+        }
116 116
 
117
-		$h++;
118
-	}
117
+        $h++;
118
+    }
119 119
 
120 120
     if ($object->isProduct() || ($object->isService() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES)))    // If physical product we can stock (or service with option)
121 121
     {
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     }
149 149
 
150 150
     // Attachments
151
-	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
151
+    require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
152 152
     require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
153 153
     if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
154 154
     if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
     }
161 161
     $nbLinks=Link::count($db, $object->element, $object->id);
162 162
     $head[$h][0] = BASE_URI . '?controller=product&method=document&id=' . $object->id;
163
-	$head[$h][1] = $langs->trans('Documents');
164
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
165
-	$head[$h][2] = 'documents';
166
-	$h++;
163
+    $head[$h][1] = $langs->trans('Documents');
164
+    if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
165
+    $head[$h][2] = 'documents';
166
+    $h++;
167 167
 
168 168
     complete_head_from_modules($conf,$langs,$object,$head,$h,'product', 'remove');
169 169
 
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
     $head[$h][1] = $langs->trans("Events");
173 173
     if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
174 174
     {
175
-    	$head[$h][1].= '/';
176
-    	$head[$h][1].= $langs->trans("Agenda");
175
+        $head[$h][1].= '/';
176
+        $head[$h][1].= $langs->trans("Agenda");
177 177
     }
178 178
     $head[$h][2] = 'agenda';
179 179
     $h++;
180 180
 
181
-	return $head;
181
+    return $head;
182 182
 }
183 183
 
184 184
 /**
@@ -200,19 +200,19 @@  discard block
 block discarded – undo
200 200
     $head[$h][0] = BASE_URI . "?controller=product/stock&method=productlot_card&id=" . $object->id;
201 201
     $head[$h][1] = $langs->trans("Card");
202 202
     $head[$h][2] = 'card';
203
-	$h++;
203
+    $h++;
204 204
 
205
-	// Attachments
206
-	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
205
+    // Attachments
206
+    require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
207 207
     require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
208 208
     $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
209 209
     $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
210 210
     $nbLinks=Link::count($db, $object->element, $object->id);
211 211
     $head[$h][0] = BASE_URI . "?controller=product/stock&method=productlot_document&id=" . $object->id;
212
-	$head[$h][1] = $langs->trans("Documents");
213
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
212
+    $head[$h][1] = $langs->trans("Documents");
213
+    if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
214 214
     $head[$h][2] = 'documents';
215
-	$h++;
215
+    $h++;
216 216
 
217 217
     // Show more tabs from modules
218 218
     // Entries must be declared in modules descriptor with line
@@ -242,40 +242,40 @@  discard block
 block discarded – undo
242 242
 */
243 243
 function product_admin_prepare_head()
244 244
 {
245
-	global $langs, $conf, $user;
245
+    global $langs, $conf, $user;
246 246
 
247
-	$h = 0;
248
-	$head = array();
247
+    $h = 0;
248
+    $head = array();
249 249
 
250 250
     $head[$h][0] = BASE_URI . "?controller=product/admin&method=product";
251
-	$head[$h][1] = $langs->trans('Parameters');
252
-	$head[$h][2] = 'general';
253
-	$h++;
251
+    $head[$h][1] = $langs->trans('Parameters');
252
+    $head[$h][2] = 'general';
253
+    $h++;
254 254
 
255
-	if (!empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL))
256
-	{
257
-		$head[$h] = array(
255
+    if (!empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL))
256
+    {
257
+        $head[$h] = array(
258 258
             0 => BASE_URI . "?controller=product/admin&method=price_rules",
259
-			1 => $langs->trans('MultipriceRules'),
260
-			2 => 'generator'
261
-		);
262
-		$h++;
263
-	}
264
-
265
-	// Show more tabs from modules
266
-	// Entries must be declared in modules descriptor with line
259
+            1 => $langs->trans('MultipriceRules'),
260
+            2 => 'generator'
261
+        );
262
+        $h++;
263
+    }
264
+
265
+    // Show more tabs from modules
266
+    // Entries must be declared in modules descriptor with line
267 267
     // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
268 268
     // $this->tabs = array('entity:-tabname);   												to remove a tab
269
-	complete_head_from_modules($conf,$langs,null,$head,$h,'product_admin');
269
+    complete_head_from_modules($conf,$langs,null,$head,$h,'product_admin');
270 270
 
271 271
     $head[$h][0] = BASE_URI . '?controller=product/admin&method=product_extrafields';
272
-	$head[$h][1] = $langs->trans("ExtraFields");
273
-	$head[$h][2] = 'attributes';
274
-	$h++;
272
+    $head[$h][1] = $langs->trans("ExtraFields");
273
+    $head[$h][2] = 'attributes';
274
+    $h++;
275 275
 
276
-	complete_head_from_modules($conf,$langs,null,$head,$h,'product_admin','remove');
276
+    complete_head_from_modules($conf,$langs,null,$head,$h,'product_admin','remove');
277 277
 
278
-	return $head;
278
+    return $head;
279 279
 }
280 280
 
281 281
 
@@ -319,146 +319,146 @@  discard block
 block discarded – undo
319 319
  */
320 320
 function show_stats_for_company($product,$socid)
321 321
 {
322
-	global $conf,$langs,$user,$db;
323
-
324
-	$nblines = 0;
325
-
326
-	print '<tr class="liste_titre">';
327
-	print '<td align="left" width="25%">'.$langs->trans("Referers").'</td>';
328
-	print '<td align="right" width="25%">'.$langs->trans("NbOfThirdParties").'</td>';
329
-	print '<td align="right" width="25%">'.$langs->trans("NbOfObjectReferers").'</td>';
330
-	print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
331
-	print '</tr>';
332
-
333
-	// Customer proposals
334
-	if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
335
-	{
336
-		$nblines++;
337
-		$ret=$product->load_stats_propale($socid);
338
-		if ($ret < 0) dol_print_error($db);
339
-		$langs->load("propal");
340
-		print '<tr><td>';
341
-		print '<a href="propal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("Proposals").'</a>';
342
-		print '</td><td align="right">';
343
-		print $product->stats_propale['customers'];
344
-		print '</td><td align="right">';
345
-		print $product->stats_propale['nb'];
346
-		print '</td><td align="right">';
347
-		print $product->stats_propale['qty'];
348
-		print '</td>';
349
-		print '</tr>';
350
-	}
351
-	// Supplier proposals
352
-	if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
353
-	{
354
-		$nblines++;
355
-		$ret=$product->load_stats_proposal_supplier($socid);
356
-		if ($ret < 0) dol_print_error($db);
357
-		$langs->load("propal");
358
-		print '<tr><td>';
359
-		print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("SupplierProposals").'</a>';
360
-		print '</td><td align="right">';
361
-		print $product->stats_proposal_supplier['suppliers'];
362
-		print '</td><td align="right">';
363
-		print $product->stats_proposal_supplier['nb'];
364
-		print '</td><td align="right">';
365
-		print $product->stats_proposal_supplier['qty'];
366
-		print '</td>';
367
-		print '</tr>';
368
-	}
369
-	// Customer orders
370
-	if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
371
-	{
372
-		$nblines++;
373
-		$ret=$product->load_stats_commande($socid);
374
-		if ($ret < 0) dol_print_error($db);
375
-		$langs->load("orders");
376
-		print '<tr><td>';
377
-		print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
378
-		print '</td><td align="right">';
379
-		print $product->stats_commande['customers'];
380
-		print '</td><td align="right">';
381
-		print $product->stats_commande['nb'];
382
-		print '</td><td align="right">';
383
-		print $product->stats_commande['qty'];
384
-		print '</td>';
385
-		print '</tr>';
386
-	}
387
-	// Supplier orders
388
-	if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
389
-	{
390
-		$nblines++;
391
-		$ret=$product->load_stats_commande_fournisseur($socid);
392
-		if ($ret < 0) dol_print_error($db);
393
-		$langs->load("orders");
394
-		print '<tr><td>';
395
-		print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("SuppliersOrders").'</a>';
396
-		print '</td><td align="right">';
397
-		print $product->stats_commande_fournisseur['suppliers'];
398
-		print '</td><td align="right">';
399
-		print $product->stats_commande_fournisseur['nb'];
400
-		print '</td><td align="right">';
401
-		print $product->stats_commande_fournisseur['qty'];
402
-		print '</td>';
403
-		print '</tr>';
404
-	}
405
-	// Customer invoices
406
-	if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
407
-	{
408
-		$nblines++;
409
-		$ret=$product->load_stats_facture($socid);
410
-		if ($ret < 0) dol_print_error($db);
411
-		$langs->load("bills");
412
-		print '<tr><td>';
413
-		print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
414
-		print '</td><td align="right">';
415
-		print $product->stats_facture['customers'];
416
-		print '</td><td align="right">';
417
-		print $product->stats_facture['nb'];
418
-		print '</td><td align="right">';
419
-		print $product->stats_facture['qty'];
420
-		print '</td>';
421
-		print '</tr>';
422
-	}
423
-	// Supplier invoices
424
-	if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
425
-	{
426
-		$nblines++;
427
-		$ret=$product->load_stats_facture_fournisseur($socid);
428
-		if ($ret < 0) dol_print_error($db);
429
-		$langs->load("bills");
430
-		print '<tr><td>';
431
-		print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("SuppliersInvoices").'</a>';
432
-		print '</td><td align="right">';
433
-		print $product->stats_facture_fournisseur['suppliers'];
434
-		print '</td><td align="right">';
435
-		print $product->stats_facture_fournisseur['nb'];
436
-		print '</td><td align="right">';
437
-		print $product->stats_facture_fournisseur['qty'];
438
-		print '</td>';
439
-		print '</tr>';
440
-	}
441
-
442
-	// Contracts
443
-	if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
444
-	{
445
-		$nblines++;
446
-		$ret=$product->load_stats_contrat($socid);
447
-		if ($ret < 0) dol_print_error($db);
448
-		$langs->load("contracts");
449
-		print '<tr><td>';
450
-		print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>';
451
-		print '</td><td align="right">';
452
-		print $product->stats_contrat['customers'];
453
-		print '</td><td align="right">';
454
-		print $product->stats_contrat['nb'];
455
-		print '</td><td align="right">';
456
-		print $product->stats_contrat['qty'];
457
-		print '</td>';
458
-		print '</tr>';
459
-	}
460
-
461
-	return $nblines++;
322
+    global $conf,$langs,$user,$db;
323
+
324
+    $nblines = 0;
325
+
326
+    print '<tr class="liste_titre">';
327
+    print '<td align="left" width="25%">'.$langs->trans("Referers").'</td>';
328
+    print '<td align="right" width="25%">'.$langs->trans("NbOfThirdParties").'</td>';
329
+    print '<td align="right" width="25%">'.$langs->trans("NbOfObjectReferers").'</td>';
330
+    print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
331
+    print '</tr>';
332
+
333
+    // Customer proposals
334
+    if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
335
+    {
336
+        $nblines++;
337
+        $ret=$product->load_stats_propale($socid);
338
+        if ($ret < 0) dol_print_error($db);
339
+        $langs->load("propal");
340
+        print '<tr><td>';
341
+        print '<a href="propal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("Proposals").'</a>';
342
+        print '</td><td align="right">';
343
+        print $product->stats_propale['customers'];
344
+        print '</td><td align="right">';
345
+        print $product->stats_propale['nb'];
346
+        print '</td><td align="right">';
347
+        print $product->stats_propale['qty'];
348
+        print '</td>';
349
+        print '</tr>';
350
+    }
351
+    // Supplier proposals
352
+    if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
353
+    {
354
+        $nblines++;
355
+        $ret=$product->load_stats_proposal_supplier($socid);
356
+        if ($ret < 0) dol_print_error($db);
357
+        $langs->load("propal");
358
+        print '<tr><td>';
359
+        print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("SupplierProposals").'</a>';
360
+        print '</td><td align="right">';
361
+        print $product->stats_proposal_supplier['suppliers'];
362
+        print '</td><td align="right">';
363
+        print $product->stats_proposal_supplier['nb'];
364
+        print '</td><td align="right">';
365
+        print $product->stats_proposal_supplier['qty'];
366
+        print '</td>';
367
+        print '</tr>';
368
+    }
369
+    // Customer orders
370
+    if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
371
+    {
372
+        $nblines++;
373
+        $ret=$product->load_stats_commande($socid);
374
+        if ($ret < 0) dol_print_error($db);
375
+        $langs->load("orders");
376
+        print '<tr><td>';
377
+        print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
378
+        print '</td><td align="right">';
379
+        print $product->stats_commande['customers'];
380
+        print '</td><td align="right">';
381
+        print $product->stats_commande['nb'];
382
+        print '</td><td align="right">';
383
+        print $product->stats_commande['qty'];
384
+        print '</td>';
385
+        print '</tr>';
386
+    }
387
+    // Supplier orders
388
+    if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
389
+    {
390
+        $nblines++;
391
+        $ret=$product->load_stats_commande_fournisseur($socid);
392
+        if ($ret < 0) dol_print_error($db);
393
+        $langs->load("orders");
394
+        print '<tr><td>';
395
+        print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("SuppliersOrders").'</a>';
396
+        print '</td><td align="right">';
397
+        print $product->stats_commande_fournisseur['suppliers'];
398
+        print '</td><td align="right">';
399
+        print $product->stats_commande_fournisseur['nb'];
400
+        print '</td><td align="right">';
401
+        print $product->stats_commande_fournisseur['qty'];
402
+        print '</td>';
403
+        print '</tr>';
404
+    }
405
+    // Customer invoices
406
+    if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
407
+    {
408
+        $nblines++;
409
+        $ret=$product->load_stats_facture($socid);
410
+        if ($ret < 0) dol_print_error($db);
411
+        $langs->load("bills");
412
+        print '<tr><td>';
413
+        print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
414
+        print '</td><td align="right">';
415
+        print $product->stats_facture['customers'];
416
+        print '</td><td align="right">';
417
+        print $product->stats_facture['nb'];
418
+        print '</td><td align="right">';
419
+        print $product->stats_facture['qty'];
420
+        print '</td>';
421
+        print '</tr>';
422
+    }
423
+    // Supplier invoices
424
+    if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
425
+    {
426
+        $nblines++;
427
+        $ret=$product->load_stats_facture_fournisseur($socid);
428
+        if ($ret < 0) dol_print_error($db);
429
+        $langs->load("bills");
430
+        print '<tr><td>';
431
+        print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("SuppliersInvoices").'</a>';
432
+        print '</td><td align="right">';
433
+        print $product->stats_facture_fournisseur['suppliers'];
434
+        print '</td><td align="right">';
435
+        print $product->stats_facture_fournisseur['nb'];
436
+        print '</td><td align="right">';
437
+        print $product->stats_facture_fournisseur['qty'];
438
+        print '</td>';
439
+        print '</tr>';
440
+    }
441
+
442
+    // Contracts
443
+    if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
444
+    {
445
+        $nblines++;
446
+        $ret=$product->load_stats_contrat($socid);
447
+        if ($ret < 0) dol_print_error($db);
448
+        $langs->load("contracts");
449
+        print '<tr><td>';
450
+        print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>';
451
+        print '</td><td align="right">';
452
+        print $product->stats_contrat['customers'];
453
+        print '</td><td align="right">';
454
+        print $product->stats_contrat['nb'];
455
+        print '</td><td align="right">';
456
+        print $product->stats_contrat['qty'];
457
+        print '</td>';
458
+        print '</tr>';
459
+    }
460
+
461
+    return $nblines++;
462 462
 }
463 463
 
464 464
 
@@ -472,50 +472,50 @@  discard block
 block discarded – undo
472 472
  */
473 473
 function measuring_units_string($unit,$measuring_style='')
474 474
 {
475
-	global $langs;
476
-
477
-	$measuring_units=array();
478
-	if ($measuring_style == 'weight')
479
-	{
480
-		$measuring_units[3] = $langs->transnoentitiesnoconv("WeightUnitton");
481
-		$measuring_units[0] = $langs->transnoentitiesnoconv("WeightUnitkg");
482
-		$measuring_units[-3] = $langs->transnoentitiesnoconv("WeightUnitg");
483
-		$measuring_units[-6] = $langs->transnoentitiesnoconv("WeightUnitmg");
484
-		$measuring_units[98] = $langs->transnoentitiesnoconv("WeightUnitounce");
485
-		$measuring_units[99] = $langs->transnoentitiesnoconv("WeightUnitpound");
486
-	}
487
-	else if ($measuring_style == 'size')
488
-	{
489
-		$measuring_units[0] = $langs->transnoentitiesnoconv("SizeUnitm");
490
-		$measuring_units[-1] = $langs->transnoentitiesnoconv("SizeUnitdm");
491
-		$measuring_units[-2] = $langs->transnoentitiesnoconv("SizeUnitcm");
492
-		$measuring_units[-3] = $langs->transnoentitiesnoconv("SizeUnitmm");
475
+    global $langs;
476
+
477
+    $measuring_units=array();
478
+    if ($measuring_style == 'weight')
479
+    {
480
+        $measuring_units[3] = $langs->transnoentitiesnoconv("WeightUnitton");
481
+        $measuring_units[0] = $langs->transnoentitiesnoconv("WeightUnitkg");
482
+        $measuring_units[-3] = $langs->transnoentitiesnoconv("WeightUnitg");
483
+        $measuring_units[-6] = $langs->transnoentitiesnoconv("WeightUnitmg");
484
+        $measuring_units[98] = $langs->transnoentitiesnoconv("WeightUnitounce");
485
+        $measuring_units[99] = $langs->transnoentitiesnoconv("WeightUnitpound");
486
+    }
487
+    else if ($measuring_style == 'size')
488
+    {
489
+        $measuring_units[0] = $langs->transnoentitiesnoconv("SizeUnitm");
490
+        $measuring_units[-1] = $langs->transnoentitiesnoconv("SizeUnitdm");
491
+        $measuring_units[-2] = $langs->transnoentitiesnoconv("SizeUnitcm");
492
+        $measuring_units[-3] = $langs->transnoentitiesnoconv("SizeUnitmm");
493 493
         $measuring_units[98] = $langs->transnoentitiesnoconv("SizeUnitfoot");
494
-		$measuring_units[99] = $langs->transnoentitiesnoconv("SizeUnitinch");
495
-	}
496
-	else if ($measuring_style == 'surface')
497
-	{
498
-		$measuring_units[0] = $langs->transnoentitiesnoconv("SurfaceUnitm2");
499
-		$measuring_units[-2] = $langs->transnoentitiesnoconv("SurfaceUnitdm2");
500
-		$measuring_units[-4] = $langs->transnoentitiesnoconv("SurfaceUnitcm2");
501
-		$measuring_units[-6] = $langs->transnoentitiesnoconv("SurfaceUnitmm2");
494
+        $measuring_units[99] = $langs->transnoentitiesnoconv("SizeUnitinch");
495
+    }
496
+    else if ($measuring_style == 'surface')
497
+    {
498
+        $measuring_units[0] = $langs->transnoentitiesnoconv("SurfaceUnitm2");
499
+        $measuring_units[-2] = $langs->transnoentitiesnoconv("SurfaceUnitdm2");
500
+        $measuring_units[-4] = $langs->transnoentitiesnoconv("SurfaceUnitcm2");
501
+        $measuring_units[-6] = $langs->transnoentitiesnoconv("SurfaceUnitmm2");
502 502
         $measuring_units[98] = $langs->transnoentitiesnoconv("SurfaceUnitfoot2");
503
-		$measuring_units[99] = $langs->transnoentitiesnoconv("SurfaceUnitinch2");
504
-	}
505
-	else if ($measuring_style == 'volume')
506
-	{
507
-		$measuring_units[0] = $langs->transnoentitiesnoconv("VolumeUnitm3");
508
-		$measuring_units[-3] = $langs->transnoentitiesnoconv("VolumeUnitdm3");
509
-		$measuring_units[-6] = $langs->transnoentitiesnoconv("VolumeUnitcm3");
510
-		$measuring_units[-9] = $langs->transnoentitiesnoconv("VolumeUnitmm3");
503
+        $measuring_units[99] = $langs->transnoentitiesnoconv("SurfaceUnitinch2");
504
+    }
505
+    else if ($measuring_style == 'volume')
506
+    {
507
+        $measuring_units[0] = $langs->transnoentitiesnoconv("VolumeUnitm3");
508
+        $measuring_units[-3] = $langs->transnoentitiesnoconv("VolumeUnitdm3");
509
+        $measuring_units[-6] = $langs->transnoentitiesnoconv("VolumeUnitcm3");
510
+        $measuring_units[-9] = $langs->transnoentitiesnoconv("VolumeUnitmm3");
511 511
         $measuring_units[88] = $langs->transnoentitiesnoconv("VolumeUnitfoot3");
512 512
         $measuring_units[89] = $langs->transnoentitiesnoconv("VolumeUnitinch3");
513
-		$measuring_units[97] = $langs->transnoentitiesnoconv("VolumeUnitounce");
514
-		$measuring_units[98] = $langs->transnoentitiesnoconv("VolumeUnitlitre");
513
+        $measuring_units[97] = $langs->transnoentitiesnoconv("VolumeUnitounce");
514
+        $measuring_units[98] = $langs->transnoentitiesnoconv("VolumeUnitlitre");
515 515
         $measuring_units[99] = $langs->transnoentitiesnoconv("VolumeUnitgallon");
516
-	}
516
+    }
517 517
 
518
-	return $measuring_units[$unit];
518
+    return $measuring_units[$unit];
519 519
 }
520 520
 
521 521
 /**
@@ -527,14 +527,14 @@  discard block
 block discarded – undo
527 527
  */
528 528
 function measuring_units_squared($unit)
529 529
 {
530