Passed
Push — master ( 8f7a8e...7e4a07 )
by Alxarafe
20:11
created
dolibarr/htdocs/user/perms.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -211,14 +211,14 @@
 block discarded – undo
211 211
     $i = 0;
212 212
     while ($i < $num) {
213 213
         $obj = $db->fetch_object($result);
214
-        if (!isset($permsgroupbyentity[$obj->entity]))
215
-            $permsgroupbyentity[$obj->entity] = array();
214
+        if (!isset($permsgroupbyentity[$obj->entity])) {
215
+                    $permsgroupbyentity[$obj->entity] = array();
216
+        }
216 217
         array_push($permsgroupbyentity[$obj->entity], $obj->fk_id);
217 218
         $i++;
218 219
     }
219 220
     $db->free($result);
220
-}
221
-else {
221
+} else {
222 222
     dol_print_error($db);
223 223
 }
224 224
 
Please login to merge, or discard this patch.
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 2 patches
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.
Braces   +60 added lines, -22 removed lines patch added patch discarded remove patch
@@ -54,7 +54,10 @@  discard block
 block discarded – undo
54 54
 $conf->db->dolibarr_main_db_collation	= $dolibarr_main_db_collation;
55 55
 $conf->db->dolibarr_main_db_encryption	= $dolibarr_main_db_encryption;
56 56
 $conf->db->dolibarr_main_db_cryptkey	= $dolibarr_main_db_cryptkey;
57
-if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE');	// Force db type (for test purpose, by PHP unit for example)
57
+if (defined('TEST_DB_FORCE_TYPE')) {
58
+    $conf->db->type=constant('TEST_DB_FORCE_TYPE');
59
+}
60
+// Force db type (for test purpose, by PHP unit for example)
58 61
 
59 62
 // Set properties specific to conf file
60 63
 $conf->file->main_limit_users			= $dolibarr_main_limit_users;
@@ -71,8 +74,9 @@  discard block
 block discarded – undo
71 74
 	// dolibarr_main_document_root_alt can contains several directories
72 75
 	$values=preg_split('/[;,]/',$dolibarr_main_document_root_alt);
73 76
 	$i=0;
74
-    foreach ($values as $value)
75
-        $conf->file->dol_document_root['alt' . ($i++)] = (string)$value;
77
+    foreach ($values as $value) {
78
+            $conf->file->dol_document_root['alt' . ($i++)] = (string)$value;
79
+    }
76 80
 	$values=preg_split('/[;,]/',$dolibarr_main_url_root_alt);
77 81
 	$i=0;
78 82
 	foreach($values as $value)
@@ -98,9 +102,16 @@  discard block
 block discarded – undo
98 102
 }
99 103
 
100 104
 // Chargement des includes principaux de librairies communes
101
-if (! defined('NOREQUIREUSER')) require_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php';		// Need 500ko memory
102
-if (! defined('NOREQUIRETRAN')) require_once DOL_DOCUMENT_ROOT .'/core/class/translate.class.php';
103
-if (! defined('NOREQUIRESOC'))  require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php';
105
+if (! defined('NOREQUIREUSER')) {
106
+    require_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php';
107
+}
108
+// Need 500ko memory
109
+if (! defined('NOREQUIRETRAN')) {
110
+    require_once DOL_DOCUMENT_ROOT .'/core/class/translate.class.php';
111
+}
112
+if (! defined('NOREQUIRESOC')) {
113
+    require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php';
114
+}
104 115
 
105 116
 
106 117
 /*
@@ -143,25 +154,32 @@  discard block
 block discarded – undo
143 154
  */
144 155
 
145 156
 // By default conf->entity is 1, but we change this if we ask another value.
146
-if (session_id() && ! empty($_SESSION["dol_entity"]))			// Entity inside an opened session
157
+if (session_id() && ! empty($_SESSION["dol_entity"])) {
158
+    // Entity inside an opened session
147 159
 {
148 160
 	$conf->entity = $_SESSION["dol_entity"];
149 161
 }
150
-else if (! empty($_ENV["dol_entity"]))							// Entity inside a CLI script
162
+} else if (! empty($_ENV["dol_entity"])) {
163
+    // Entity inside a CLI script
151 164
 {
152 165
 	$conf->entity = $_ENV["dol_entity"];
153 166
 }
154
-else if (isset($_POST["loginfunction"]) && GETPOST("entity",'int'))	// Just after a login page
167
+} else if (isset($_POST["loginfunction"]) && GETPOST("entity",'int')) {
168
+    // Just after a login page
155 169
 {
156 170
 	$conf->entity = GETPOST("entity",'int');
157 171
 }
158
-else if (defined('DOLENTITY') && is_numeric(DOLENTITY))			// For public page with MultiCompany module
172
+} else if (defined('DOLENTITY') && is_numeric(DOLENTITY)) {
173
+    // For public page with MultiCompany module
159 174
 {
160 175
 	$conf->entity = DOLENTITY;
161 176
 }
177
+}
162 178
 
163 179
 // Sanitize entity
164
-if (! is_numeric($conf->entity)) $conf->entity=1;
180
+if (! is_numeric($conf->entity)) {
181
+    $conf->entity=1;
182
+}
165 183
 
166 184
 if (! defined('NOREQUIREDB'))
167 185
 {
@@ -193,11 +211,26 @@  discard block
 block discarded – undo
193 211
 if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
194 212
 {
195 213
 	$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
214
+	if ((! session_id() || ! isset($_SESSION["dol_login"])) && ! isset($_POST["username"]) && ! empty($_SERVER["GATEWAY_INTERFACE"])) {
215
+	    $ok=1;
216
+	}
217
+	// We let working pages if not logged and inside a web browser (login form, to allow login by admin)
218
+	elseif (isset($_POST["username"]) && $_POST["username"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) {
219
+	    $ok=1;
220
+	}
221
+	// We let working pages that is a login submission (login submit, to allow login by admin)
222
+	elseif (defined('NOREQUIREDB')) {
223
+	    $ok=1;
224
+	}
225
+	// We let working pages that don't need database access (xxx.css.php)
226
+	elseif (defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) {
227
+	    $ok=1;
228
+	}
229
+	// We let working pages that ask to work even if only login enabled (logout.php)
230
+	elseif (session_id() && isset($_SESSION["dol_login"]) && $_SESSION["dol_login"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) {
231
+	    $ok=1;
232
+	}
233
+	// We let working if user is allowed admin
201 234
 	if (! $ok)
202 235
 	{
203 236
 		if (session_id() && isset($_SESSION["dol_login"]) && $_SESSION["dol_login"] != $conf->global->MAIN_ONLY_LOGIN_ALLOWED)
@@ -206,8 +239,7 @@  discard block
 block discarded – undo
206 239
 			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 240
             $nexturl = BASE_URI . '?controller=user&method=logout';
208 241
 			print 'Please try later or <a href="'.$nexturl.'">click here to disconnect and change login user</a>...'."\n";
209
-		}
210
-		else
242
+		} else
211 243
 		{
212 244
 			print 'Sorry, your application is offline. Only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.'" is allowed to connect for the moment.'."\n";
213 245
             $nexturl = BASE_URI . '/';
@@ -226,15 +258,19 @@  discard block
 block discarded – undo
226 258
 	$mysoc->setMysoc($conf);
227 259
 
228 260
 	// 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
-}
261
+	if ($mysoc->country_code == 'DE' && ! isset($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
262
+	    $conf->global->MAIN_INVERT_SENDER_RECIPIENT=1;
263
+	}
264
+	}
231 265
 
232 266
 
233 267
 // Set default language (must be after the setValues setting global $conf->global->MAIN_LANG_DEFAULT. Page main.inc.php will overwrite langs->defaultlang with user value later)
234 268
 if (! defined('NOREQUIRETRAN'))
235 269
 {
236 270
     $langcode=(GETPOST('lang','aZ09')?GETPOST('lang','aZ09',1):(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT));
237
-    if (defined('MAIN_LANG_DEFAULT')) $langcode=constant('MAIN_LANG_DEFAULT');
271
+    if (defined('MAIN_LANG_DEFAULT')) {
272
+        $langcode=constant('MAIN_LANG_DEFAULT');
273
+    }
238 274
     $langs->setDefaultLang($langcode);
239 275
 }
240 276
 
@@ -244,5 +280,7 @@  discard block
 block discarded – undo
244 280
 $hookmanager=new HookManager($db);
245 281
 
246 282
 
247
-if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR');
283
+if (! defined('MAIN_LABEL_MENTION_NPR') ) {
284
+    define('MAIN_LABEL_MENTION_NPR','NPR');
285
+}
248 286
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/product.lib.php 2 patches
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
-	$measuring_units=array();
531
-	$measuring_units[0] = 0;   // m -> m3
532
-	$measuring_units[-1] = -2; // dm-> dm2
533
-	$measuring_units[-2] = -4; // cm -> cm2
534
-	$measuring_units[-3] = -6; // mm -> mm2
535
-	$measuring_units[98] = 98; // foot -> foot2
536
-	$measuring_units[99] = 99; // inch -> inch2
537
-	return $measuring_units[$unit];
530
+    $measuring_units=array();
531
+    $measuring_units[0] = 0;   // m -> m3
532
+    $measuring_units[-1] = -2; // dm-> dm2
533
+    $measuring_units[-2] = -4; // cm -> cm2
534
+    $measuring_units[-3] = -6; // mm -> mm2
535
+    $measuring_units[98] = 98; // foot -> foot2
536
+    $measuring_units[99] = 99; // inch -> inch2
537
+    return $measuring_units[$unit];
538 538
 }
539 539
 
540 540
 
@@ -547,12 +547,12 @@  discard block
 block discarded – undo
547 547
  */
548 548
 function measuring_units_cubed($unit)
549 549
 {
550
-	$measuring_units=array();
551
-	$measuring_units[0] = 0;   // m -> m2
552
-	$measuring_units[-1] = -3; // dm-> dm3
553
-	$measuring_units[-2] = -6; // cm -> cm3
554
-	$measuring_units[-3] = -9; // mm -> mm3
555
-	$measuring_units[98] = 88; // foot -> foot3
556
-	$measuring_units[99] = 89; // inch -> inch3
557
-	return $measuring_units[$unit];
550
+    $measuring_units=array();
551
+    $measuring_units[0] = 0;   // m -> m2
552
+    $measuring_units[-1] = -3; // dm-> dm3
553
+    $measuring_units[-2] = -6; // cm -> cm3
554
+    $measuring_units[-3] = -9; // mm -> mm3
555
+    $measuring_units[98] = 88; // foot -> foot3
556
+    $measuring_units[99] = 89; // inch -> inch3
557
+    return $measuring_units[$unit];
558 558
 }
Please login to merge, or discard this patch.
Braces   +63 added lines, -26 removed lines patch added patch discarded remove patch
@@ -53,13 +53,15 @@  discard block
 block discarded – undo
53 53
     	$h++;
54 54
 	}
55 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
56
+	if (! empty($object->status_buy) || (! empty($conf->margin->enabled) && ! empty($object->status))) {
57
+	    // If margin is on and product on sell, we may need the cost price even if product os not on purchase
57 58
 	{
58 59
     	if ((! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
59 60
     	|| (! empty($conf->margin->enabled) && $user->rights->margin->liretous)
60 61
     	)
61 62
     	{
62 63
             $head[$h][0] = BASE_URI . "?controller=product&method=fournisseurs&id=" . $object->id;
64
+	}
63 65
     		$head[$h][1] = $langs->trans("BuyingPrices");
64 66
     		$head[$h][2] = 'suppliers';
65 67
     		$h++;
@@ -82,7 +84,9 @@  discard block
 block discarded – undo
82 84
 		$head[$h][1] = $langs->trans('AssociatedProducts');
83 85
 
84 86
 		$nbFatherAndChild = $object->hasFatherOrChild();
85
-		if ($nbFatherAndChild > 0) $head[$h][1].= ' <span class="badge">'.$nbFatherAndChild.'</span>';
87
+		if ($nbFatherAndChild > 0) {
88
+		    $head[$h][1].= ' <span class="badge">'.$nbFatherAndChild.'</span>';
89
+		}
86 90
 		$head[$h][2] = 'subproduct';
87 91
 		$h++;
88 92
 	}
@@ -111,17 +115,21 @@  discard block
 block discarded – undo
111 115
 			$head[$h][1] = $langs->trans('ProductCombinations');
112 116
 			$head[$h][2] = 'combinations';
113 117
 			$nbVariant = $prodcomb->countNbOfCombinationForFkProductParent($object->id);
114
-            if ($nbVariant > 0) $head[$h][1].= ' <span class="badge">'.$nbVariant.'</span>';
118
+            if ($nbVariant > 0) {
119
+                $head[$h][1].= ' <span class="badge">'.$nbVariant.'</span>';
120
+            }
115 121
 		}
116 122
 
117 123
 		$h++;
118 124
 	}
119 125
 
120
-    if ($object->isProduct() || ($object->isService() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES)))    // If physical product we can stock (or service with option)
126
+    if ($object->isProduct() || ($object->isService() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
127
+        // If physical product we can stock (or service with option)
121 128
     {
122 129
         if (! empty($conf->stock->enabled) && $user->rights->stock->lire)
123 130
         {
124 131
             $head[$h][0] = BASE_URI . "?controller=product/stock&method=product&id=" . $object->id;
132
+    }
125 133
             $head[$h][1] = $langs->trans("Stock");
126 134
             $head[$h][2] = 'stock';
127 135
             $h++;
@@ -138,11 +146,17 @@  discard block
 block discarded – undo
138 146
     if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
139 147
     {
140 148
         $nbNote = 0;
141
-        if(!empty($object->note_private)) $nbNote++;
142
-        if(!empty($object->note_public)) $nbNote++;
149
+        if(!empty($object->note_private)) {
150
+            $nbNote++;
151
+        }
152
+        if(!empty($object->note_public)) {
153
+            $nbNote++;
154
+        }
143 155
         $head[$h][0] = BASE_URI . '?controller=product&method=note&id=' . $object->id;
144 156
         $head[$h][1] = $langs->trans('Notes');
145
-        if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
157
+        if ($nbNote > 0) {
158
+            $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
159
+        }
146 160
         $head[$h][2] = 'note';
147 161
         $h++;
148 162
     }
@@ -150,18 +164,28 @@  discard block
 block discarded – undo
150 164
     // Attachments
151 165
 	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
152 166
     require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
153
-    if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
154
-    if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
167
+    if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) {
168
+        $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
169
+    }
170
+    if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) {
171
+        $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
172
+    }
155 173
     $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
156 174
     if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
157
-        if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->produit->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,0,$object,'product').$object->id.'/photos';
158
-        if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,0,$object,'product').$object->id.'/photos';
175
+        if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) {
176
+            $upload_dir = $conf->produit->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,0,$object,'product').$object->id.'/photos';
177
+        }
178
+        if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) {
179
+            $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,0,$object,'product').$object->id.'/photos';
180
+        }
159 181
         $nbFiles += count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
160 182
     }
161 183
     $nbLinks=Link::count($db, $object->element, $object->id);
162 184
     $head[$h][0] = BASE_URI . '?controller=product&method=document&id=' . $object->id;
163 185
 	$head[$h][1] = $langs->trans('Documents');
164
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
186
+	if (($nbFiles+$nbLinks) > 0) {
187
+	    $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
188
+	}
165 189
 	$head[$h][2] = 'documents';
166 190
 	$h++;
167 191
 
@@ -210,7 +234,9 @@  discard block
 block discarded – undo
210 234
     $nbLinks=Link::count($db, $object->element, $object->id);
211 235
     $head[$h][0] = BASE_URI . "?controller=product/stock&method=productlot_document&id=" . $object->id;
212 236
 	$head[$h][1] = $langs->trans("Documents");
213
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
237
+	if (($nbFiles+$nbLinks) > 0) {
238
+	    $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
239
+	}
214 240
     $head[$h][2] = 'documents';
215 241
 	$h++;
216 242
 
@@ -335,7 +361,9 @@  discard block
 block discarded – undo
335 361
 	{
336 362
 		$nblines++;
337 363
 		$ret=$product->load_stats_propale($socid);
338
-		if ($ret < 0) dol_print_error($db);
364
+		if ($ret < 0) {
365
+		    dol_print_error($db);
366
+		}
339 367
 		$langs->load("propal");
340 368
 		print '<tr><td>';
341 369
 		print '<a href="propal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("Proposals").'</a>';
@@ -353,7 +381,9 @@  discard block
 block discarded – undo
353 381
 	{
354 382
 		$nblines++;
355 383
 		$ret=$product->load_stats_proposal_supplier($socid);
356
-		if ($ret < 0) dol_print_error($db);
384
+		if ($ret < 0) {
385
+		    dol_print_error($db);
386
+		}
357 387
 		$langs->load("propal");
358 388
 		print '<tr><td>';
359 389
 		print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("SupplierProposals").'</a>';
@@ -371,7 +401,9 @@  discard block
 block discarded – undo
371 401
 	{
372 402
 		$nblines++;
373 403
 		$ret=$product->load_stats_commande($socid);
374
-		if ($ret < 0) dol_print_error($db);
404
+		if ($ret < 0) {
405
+		    dol_print_error($db);
406
+		}
375 407
 		$langs->load("orders");
376 408
 		print '<tr><td>';
377 409
 		print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
@@ -389,7 +421,9 @@  discard block
 block discarded – undo
389 421
 	{
390 422
 		$nblines++;
391 423
 		$ret=$product->load_stats_commande_fournisseur($socid);
392
-		if ($ret < 0) dol_print_error($db);
424
+		if ($ret < 0) {
425
+		    dol_print_error($db);
426
+		}
393 427
 		$langs->load("orders");
394 428
 		print '<tr><td>';
395 429
 		print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("SuppliersOrders").'</a>';
@@ -407,7 +441,9 @@  discard block
 block discarded – undo
407 441
 	{
408 442
 		$nblines++;
409 443
 		$ret=$product->load_stats_facture($socid);
410
-		if ($ret < 0) dol_print_error($db);
444
+		if ($ret < 0) {
445
+		    dol_print_error($db);
446
+		}
411 447
 		$langs->load("bills");
412 448
 		print '<tr><td>';
413 449
 		print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
@@ -425,7 +461,9 @@  discard block
 block discarded – undo
425 461
 	{
426 462
 		$nblines++;
427 463
 		$ret=$product->load_stats_facture_fournisseur($socid);
428
-		if ($ret < 0) dol_print_error($db);
464
+		if ($ret < 0) {
465
+		    dol_print_error($db);
466
+		}
429 467
 		$langs->load("bills");
430 468
 		print '<tr><td>';
431 469
 		print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("SuppliersInvoices").'</a>';
@@ -444,7 +482,9 @@  discard block
 block discarded – undo
444 482
 	{
445 483
 		$nblines++;
446 484
 		$ret=$product->load_stats_contrat($socid);
447
-		if ($ret < 0) dol_print_error($db);
485
+		if ($ret < 0) {
486
+		    dol_print_error($db);
487
+		}
448 488
 		$langs->load("contracts");
449 489
 		print '<tr><td>';
450 490
 		print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>';
@@ -483,8 +523,7 @@  discard block
 block discarded – undo
483 523
 		$measuring_units[-6] = $langs->transnoentitiesnoconv("WeightUnitmg");
484 524
 		$measuring_units[98] = $langs->transnoentitiesnoconv("WeightUnitounce");
485 525
 		$measuring_units[99] = $langs->transnoentitiesnoconv("WeightUnitpound");
486
-	}
487
-	else if ($measuring_style == 'size')
526
+	} else if ($measuring_style == 'size')
488 527
 	{
489 528
 		$measuring_units[0] = $langs->transnoentitiesnoconv("SizeUnitm");
490 529
 		$measuring_units[-1] = $langs->transnoentitiesnoconv("SizeUnitdm");
@@ -492,8 +531,7 @@  discard block
 block discarded – undo
492 531
 		$measuring_units[-3] = $langs->transnoentitiesnoconv("SizeUnitmm");
493 532
         $measuring_units[98] = $langs->transnoentitiesnoconv("SizeUnitfoot");
494 533
 		$measuring_units[99] = $langs->transnoentitiesnoconv("SizeUnitinch");
495
-	}
496
-	else if ($measuring_style == 'surface')
534
+	} else if ($measuring_style == 'surface')
497 535
 	{
498 536
 		$measuring_units[0] = $langs->transnoentitiesnoconv("SurfaceUnitm2");
499 537
 		$measuring_units[-2] = $langs->transnoentitiesnoconv("SurfaceUnitdm2");
@@ -501,8 +539,7 @@  discard block
 block discarded – undo
501 539
 		$measuring_units[-6] = $langs->transnoentitiesnoconv("SurfaceUnitmm2");
502 540
         $measuring_units[98] = $langs->transnoentitiesnoconv("SurfaceUnitfoot2");
503 541
 		$measuring_units[99] = $langs->transnoentitiesnoconv("SurfaceUnitinch2");
504
-	}
505
-	else if ($measuring_style == 'volume')
542
+	} else if ($measuring_style == 'volume')
506 543
 	{
507 544
 		$measuring_units[0] = $langs->transnoentitiesnoconv("VolumeUnitm3");
508 545
 		$measuring_units[-3] = $langs->transnoentitiesnoconv("VolumeUnitdm3");
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modMargin.class.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -30,119 +30,119 @@
 block discarded – undo
30 30
  */
31 31
 class modMargin extends DolibarrModules
32 32
 {
33
-	/**
34
-	 * 	Constructor
35
-	 *
36
-	 * 	@param	DoliDB	$db		Database handler
37
-	 */
38
-	function __construct($db)
39
-	{
40
-		$this->db = $db;
41
-
42
-		// Id for module (must be unique).
43
-		// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
44
-		$this->numero = 59000;
45
-		// Key text used to identify module (for permissions, menus, etc...)
46
-		$this->rights_class = 'margins';
47
-
48
-		// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
49
-		// It is used to group modules in module setup page
50
-		$this->family = "financial";
51
-		$this->module_position = '55';
52
-		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53
-		$this->name = preg_replace('/^mod/i','',get_class($this));
54
-		// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
55
-		$this->description = "Margin management";
56
-		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
57
-		$this->version = 'dolibarr';
58
-		// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
59
-		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
60
-		// Name of png file (without png) used for this module.
61
-		// Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
62
-		$this->picto='margin';
63
-
64
-		// Data directories to create when module is enabled.
65
-		$this->dirs = array('/margin/temp');
66
-
67
-		// Config pages. Put here list of php page names stored in admmin directory used to setup module.
68
-		$this->config_page_url = array("margin.php@margin");
69
-
70
-		// Dependencies
71
-		$this->hidden = false;			// A condition to hide module
72
-		$this->depends = array("modPropale", "modProduct");		// List of module class names as string that must be enabled if this module is enabled
73
-		$this->requiredby = array();	// List of module ids to disable if this one is disabled
74
-		$this->conflictwith = array();	// List of module class names as string this module is in conflict with
75
-		$this->phpmin = array(5,4);		// Minimum version of PHP required by module
76
-		$this->need_dolibarr_version = array(3,2);	// Minimum version of Dolibarr required by module
77
-		$this->langfiles = array("margins");
78
-
79
-		// Constants
80
-		// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
81
-		// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
82
-		//                             1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
83
-		// );
84
-		$this->const = array(0=>array('MARGIN_TYPE','chaine','costprice','Rule for margin calculation by default',0,'current',0));			// List of particular constants to add when module is enabled
85
-
86
-		// New pages on tabs
87
-		$this->tabs = array(
33
+    /**
34
+     * 	Constructor
35
+     *
36
+     * 	@param	DoliDB	$db		Database handler
37
+     */
38
+    function __construct($db)
39
+    {
40
+        $this->db = $db;
41
+
42
+        // Id for module (must be unique).
43
+        // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
44
+        $this->numero = 59000;
45
+        // Key text used to identify module (for permissions, menus, etc...)
46
+        $this->rights_class = 'margins';
47
+
48
+        // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
49
+        // It is used to group modules in module setup page
50
+        $this->family = "financial";
51
+        $this->module_position = '55';
52
+        // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53
+        $this->name = preg_replace('/^mod/i','',get_class($this));
54
+        // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
55
+        $this->description = "Margin management";
56
+        // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
57
+        $this->version = 'dolibarr';
58
+        // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
59
+        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
60
+        // Name of png file (without png) used for this module.
61
+        // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
62
+        $this->picto='margin';
63
+
64
+        // Data directories to create when module is enabled.
65
+        $this->dirs = array('/margin/temp');
66
+
67
+        // Config pages. Put here list of php page names stored in admmin directory used to setup module.
68
+        $this->config_page_url = array("margin.php@margin");
69
+
70
+        // Dependencies
71
+        $this->hidden = false;			// A condition to hide module
72
+        $this->depends = array("modPropale", "modProduct");		// List of module class names as string that must be enabled if this module is enabled
73
+        $this->requiredby = array();	// List of module ids to disable if this one is disabled
74
+        $this->conflictwith = array();	// List of module class names as string this module is in conflict with
75
+        $this->phpmin = array(5,4);		// Minimum version of PHP required by module
76
+        $this->need_dolibarr_version = array(3,2);	// Minimum version of Dolibarr required by module
77
+        $this->langfiles = array("margins");
78
+
79
+        // Constants
80
+        // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
81
+        // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
82
+        //                             1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
83
+        // );
84
+        $this->const = array(0=>array('MARGIN_TYPE','chaine','costprice','Rule for margin calculation by default',0,'current',0));			// List of particular constants to add when module is enabled
85
+
86
+        // New pages on tabs
87
+        $this->tabs = array(
88 88
             'product:+margin:Margins:margins:$user->rights->margins->liretous:?controller=margin/tabs&method=productMargins&id=__ID__',
89 89
             'thirdparty:+margin:Margins:margins:empty($user->societe_id) && $user->rights->margins->liretous && ($object->client > 0):?controller=margin/tabs&method=thirdpartyMargins&socid=__ID__'
90
-		);
90
+        );
91 91
 
92 92
 
93
-		// Boxes
94
-		$this->boxes = array();			// List of boxes
95
-		$r=0;
93
+        // Boxes
94
+        $this->boxes = array();			// List of boxes
95
+        $r=0;
96 96
 
97
-		// Permissions
98
-		$this->rights = array();		// Permission array used by this module
99
-		$r=0;
97
+        // Permissions
98
+        $this->rights = array();		// Permission array used by this module
99
+        $r=0;
100 100
 
101
-		// Main menu entries
102
-		$this->menu = array();			// List of menus to add
103
-		$r = 0;
101
+        // Main menu entries
102
+        $this->menu = array();			// List of menus to add
103
+        $r = 0;
104 104
 
105
-		// left menu entry
106
-		$this->menu[$r]=array(
107
-				'fk_menu'=>'fk_mainmenu=billing',			// Put 0 if this is a top menu
108
-    			'type'=>'left',			// This is a Top menu entry
109
-    			'titre'=>'Margins',
110
-    			'mainmenu'=>'billing',
111
-    			'leftmenu'=>'margins',
105
+        // left menu entry
106
+        $this->menu[$r]=array(
107
+                'fk_menu'=>'fk_mainmenu=billing',			// Put 0 if this is a top menu
108
+                'type'=>'left',			// This is a Top menu entry
109
+                'titre'=>'Margins',
110
+                'mainmenu'=>'billing',
111
+                'leftmenu'=>'margins',
112 112
             'url' => '?controller=margin&method=index',
113
-    			'langs'=>'margins',	// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
114
-    			'position'=>100,
115
-    			'enabled'=>'$conf->margin->enabled',			// Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
116
-    			'perms'=>'$user->rights->margins->liretous',	// Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
117
-    			'target'=>'',
118
-    			'user'=>2);				// 0=Menu for internal users, 1=external users, 2=both
119
-		$r++;
120
-
121
-		// Permissions
122
-		$this->rights = array();
123
-		$r=0;
124
-
125
-		$r++;
126
-		$this->rights[$r][0] = 59001; // id de la permission
127
-		$this->rights[$r][1] = 'Visualiser les marges'; // libelle de la permission
128
-		$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
129
-		$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
130
-		$this->rights[$r][4] = 'liretous';
131
-
132
-		$r++;
133
-		$this->rights[$r][0] = 59002; // id de la permission
134
-		$this->rights[$r][1] = 'Définir les marges'; // libelle de la permission
135
-		$this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour)
136
-		$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
137
-		$this->rights[$r][4] = 'creer';
138
-
139
-		$r++;
140
-		$this->rights[$r][0] = 59003; // id de la permission
141
-		$this->rights[$r][1] = 'Read every user margin'; // libelle de la permission
142
-		$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
143
-		$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
144
-		$this->rights[$r][4] = 'read';
145
-		$this->rights[$r][5] = 'all';
146
-	}
113
+                'langs'=>'margins',	// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
114
+                'position'=>100,
115
+                'enabled'=>'$conf->margin->enabled',			// Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
116
+                'perms'=>'$user->rights->margins->liretous',	// Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
117
+                'target'=>'',
118
+                'user'=>2);				// 0=Menu for internal users, 1=external users, 2=both
119
+        $r++;
120
+
121
+        // Permissions
122
+        $this->rights = array();
123
+        $r=0;
124
+
125
+        $r++;
126
+        $this->rights[$r][0] = 59001; // id de la permission
127
+        $this->rights[$r][1] = 'Visualiser les marges'; // libelle de la permission
128
+        $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
129
+        $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
130
+        $this->rights[$r][4] = 'liretous';
131
+
132
+        $r++;
133
+        $this->rights[$r][0] = 59002; // id de la permission
134
+        $this->rights[$r][1] = 'Définir les marges'; // libelle de la permission
135
+        $this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour)
136
+        $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
137
+        $this->rights[$r][4] = 'creer';
138
+
139
+        $r++;
140
+        $this->rights[$r][0] = 59003; // id de la permission
141
+        $this->rights[$r][1] = 'Read every user margin'; // libelle de la permission
142
+        $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
143
+        $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
144
+        $this->rights[$r][4] = 'read';
145
+        $this->rights[$r][5] = 'all';
146
+    }
147 147
 }
148 148
 
Please login to merge, or discard this patch.
dolibarr/htdocs/don/card.php 2 patches
Indentation   +455 added lines, -455 removed lines patch added patch discarded remove patch
@@ -78,117 +78,117 @@  discard block
 block discarded – undo
78 78
 
79 79
 if ($action == 'update')
80 80
 {
81
-	if (! empty($cancel))
82
-	{
81
+    if (! empty($cancel))
82
+    {
83 83
         header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id);
84
-		exit;
85
-	}
84
+        exit;
85
+    }
86 86
 
87
-	$error=0;
87
+    $error=0;
88 88
 
89 89
     if (empty($donation_date))
90 90
     {
91
-	    setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
91
+        setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
92 92
         $action = "create";
93 93
         $error++;
94 94
     }
95 95
 
96
-	if (empty($amount))
97
-	{
98
-		setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
99
-		$action = "create";
100
-		$error++;
101
-	}
96
+    if (empty($amount))
97
+    {
98
+        setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
99
+        $action = "create";
100
+        $error++;
101
+    }
102 102
 
103
-	if (! $error)
104
-	{
105
-		$object->fetch($id);
106
-
107
-		$object->firstname   = GETPOST("firstname",'alpha');
108
-		$object->lastname    = GETPOST("lastname",'alpha');
109
-		$object->societe     = GETPOST("societe",'alpha');
110
-		$object->address     = GETPOST("address",'alpha');
111
-		$object->amount      = price2num(GETPOST("amount",'alpha'));
112
-		$object->town        = GETPOST("town",'alpha');
113
-		$object->zip         = GETPOST("zipcode",'alpha');
103
+    if (! $error)
104
+    {
105
+        $object->fetch($id);
106
+
107
+        $object->firstname   = GETPOST("firstname",'alpha');
108
+        $object->lastname    = GETPOST("lastname",'alpha');
109
+        $object->societe     = GETPOST("societe",'alpha');
110
+        $object->address     = GETPOST("address",'alpha');
111
+        $object->amount      = price2num(GETPOST("amount",'alpha'));
112
+        $object->town        = GETPOST("town",'alpha');
113
+        $object->zip         = GETPOST("zipcode",'alpha');
114 114
         $object->country_id  = GETPOST('country_id', 'int');
115 115
         $object->email       = GETPOST("email",'alpha');
116
-		$object->date        = $donation_date;
117
-		$object->public      = GETPOST("public",'alpha');
118
-		$object->fk_project  = GETPOST("fk_project",'alpha');
119
-		$object->note_private= GETPOST("note_private",'none');
120
-		$object->note_public = GETPOST("note_public",'none');
121
-		$object->modepaymentid = GETPOST('modepayment','int');
122
-
123
-		// Fill array 'array_options' with data from add form
116
+        $object->date        = $donation_date;
117
+        $object->public      = GETPOST("public",'alpha');
118
+        $object->fk_project  = GETPOST("fk_project",'alpha');
119
+        $object->note_private= GETPOST("note_private",'none');
120
+        $object->note_public = GETPOST("note_public",'none');
121
+        $object->modepaymentid = GETPOST('modepayment','int');
122
+
123
+        // Fill array 'array_options' with data from add form
124 124
         $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
125
-		if ($ret < 0) $error++;
125
+        if ($ret < 0) $error++;
126 126
 
127
-		if ($object->update($user) > 0)
128
-		{
127
+        if ($object->update($user) > 0)
128
+        {
129 129
             header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $object->id);
130
-			exit;
131
-		}
132
-	}
130
+            exit;
131
+        }
132
+    }
133 133
 }
134 134
 
135 135
 if ($action == 'add')
136 136
 {
137
-	if (! empty($cancel))
138
-	{
139
-		header("Location: index.php");
140
-		exit;
141
-	}
137
+    if (! empty($cancel))
138
+    {
139
+        header("Location: index.php");
140
+        exit;
141
+    }
142 142
 
143
-	$error=0;
143
+    $error=0;
144 144
 
145 145
     if (empty($donation_date))
146 146
     {
147
-	    setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
147
+        setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
148 148
         $action = "create";
149 149
         $error++;
150 150
     }
151 151
 
152
-	if (empty($amount))
153
-	{
154
-		setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
155
-		$action = "create";
156
-		$error++;
157
-	}
152
+    if (empty($amount))
153
+    {
154
+        setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
155
+        $action = "create";
156
+        $error++;
157
+    }
158 158
 
159
-	if (! $error)
160
-	{
161
-		$object->firstname   = GETPOST("firstname",'alpha');
162
-		$object->lastname    = GETPOST("lastname",'alpha');
163
-		$object->societe     = GETPOST("societe",'alpha');
164
-		$object->address     = GETPOST("address",'alpha');
165
-		$object->amount      = price2num(GETPOST("amount",'alpha'));
166
-		$object->zip         = GETPOST("zipcode",'alpha');
167
-		$object->town        = GETPOST("town",'alpha');
159
+    if (! $error)
160
+    {
161
+        $object->firstname   = GETPOST("firstname",'alpha');
162
+        $object->lastname    = GETPOST("lastname",'alpha');
163
+        $object->societe     = GETPOST("societe",'alpha');
164
+        $object->address     = GETPOST("address",'alpha');
165
+        $object->amount      = price2num(GETPOST("amount",'alpha'));
166
+        $object->zip         = GETPOST("zipcode",'alpha');
167
+        $object->town        = GETPOST("town",'alpha');
168 168
         $object->country_id  = GETPOST('country_id', 'int');
169 169
         $object->email       = GETPOST("email",'alpha');
170
-		$object->date        = $donation_date;
171
-		$object->note_private= GETPOST("note_private",'none');
172
-		$object->note_public = GETPOST("note_public",'none');
173
-		$object->public      = GETPOST("public",'alpha');
174
-		$object->fk_project  = GETPOST("fk_project",'alpha');
175
-		$object->modepaymentid = GETPOST('modepayment','int');
176
-
177
-		// Fill array 'array_options' with data from add form
170
+        $object->date        = $donation_date;
171
+        $object->note_private= GETPOST("note_private",'none');
172
+        $object->note_public = GETPOST("note_public",'none');
173
+        $object->public      = GETPOST("public",'alpha');
174
+        $object->fk_project  = GETPOST("fk_project",'alpha');
175
+        $object->modepaymentid = GETPOST('modepayment','int');
176
+
177
+        // Fill array 'array_options' with data from add form
178 178
         $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
179
-		if ($ret < 0) $error++;
179
+        if ($ret < 0) $error++;
180 180
 
181
-		$res = $object->create($user);
182
-		if ($res > 0)
183
-		{
181
+        $res = $object->create($user);
182
+        if ($res > 0)
183
+        {
184 184
             header("Location: " . $_SERVER['PHP_SELF'] . '&id=' . $res);
185
-			exit;
186
-		}
187
-		else
188
-		{
189
-			setEventMessages($object->error, $object->errors, 'errors');
190
-		}
191
-	}
185
+            exit;
186
+        }
187
+        else
188
+        {
189
+            setEventMessages($object->error, $object->errors, 'errors');
190
+        }
191
+    }
192 192
 }
193 193
 if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer)
194 194
 {
@@ -207,46 +207,46 @@  discard block
 block discarded – undo
207 207
 }
208 208
 if ($action == 'valid_promesse')
209 209
 {
210
-	$object->fetch($id);
211
-	if ($object->valid_promesse($id, $user->id) >= 0)
212
-	{
213
-		setEventMessages($langs->trans("DonationValidated", $object->ref), null);
210
+    $object->fetch($id);
211
+    if ($object->valid_promesse($id, $user->id) >= 0)
212
+    {
213
+        setEventMessages($langs->trans("DonationValidated", $object->ref), null);
214 214
 
215 215
         header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id);
216
-		exit;
217
-	}
216
+        exit;
217
+    }
218 218
     else {
219
-	    setEventMessages($object->error, $object->errors, 'errors');
219
+        setEventMessages($object->error, $object->errors, 'errors');
220 220
     }
221 221
 }
222 222
 if ($action == 'set_cancel')
223 223
 {
224
-	$object->fetch($id);
225
-	if ($object->set_cancel($id) >= 0)
224
+    $object->fetch($id);
225
+    if ($object->set_cancel($id) >= 0)
226 226
     {
227 227
         header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id);
228 228
         exit;
229 229
     }
230 230
     else {
231
-	    setEventMessages($object->error, $object->errors, 'errors');
231
+        setEventMessages($object->error, $object->errors, 'errors');
232 232
     }
233 233
 }
234 234
 if ($action == 'set_paid')
235 235
 {
236
-	$object->fetch($id);
237
-	if ($object->set_paid($id, $modepayment) >= 0)
238
-	{
236
+    $object->fetch($id);
237
+    if ($object->set_paid($id, $modepayment) >= 0)
238
+    {
239 239
         header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id);
240
-		exit;
241
-	}
240
+        exit;
241
+    }
242 242
     else {
243
-	    setEventMessages($object->error, $object->errors, 'errors');
243
+        setEventMessages($object->error, $object->errors, 'errors');
244 244
     }
245 245
 }
246 246
 else if ($action == 'classin' && $user->rights->don->creer)
247 247
 {
248
-	$object->fetch($id);
249
-	$object->setProject($projectid);
248
+    $object->fetch($id);
249
+    $object->setProject($projectid);
250 250
 }
251 251
 
252 252
 // Actions to build doc
@@ -321,50 +321,50 @@  discard block
 block discarded – undo
321 321
 
322 322
 if ($action == 'create')
323 323
 {
324
-	print load_fiche_titre($langs->trans("AddDonation"));
324
+    print load_fiche_titre($langs->trans("AddDonation"));
325 325
 
326
-	print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
327
-	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
328
-	print '<input type="hidden" name="action" value="add">';
326
+    print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
327
+    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
328
+    print '<input type="hidden" name="action" value="add">';
329 329
 
330
-	dol_fiche_head('');
330
+    dol_fiche_head('');
331 331
 
332
-	print '<table class="border" width="100%">';
333
-	print '<tbody>';
332
+    print '<table class="border" width="100%">';
333
+    print '<tbody>';
334 334
 
335
-	// Ref
336
-	print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>';
335
+    // Ref
336
+    print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>';
337 337
 
338
-	// Company
339
-	if (! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES))
340
-	{
341
-		// Thirdparty
342
-		print '<td>' . $langs->trans('Customer') . '</td>';
343
-		if ($soc->id > 0 && ! GETPOST('fac_rec','alpha'))
344
-		{
345
-			print '<td colspan="2">';
346
-			print $soc->getNomUrl(1);
347
-			print '<input type="hidden" name="socid" value="' . $soc->id . '">';
348
-			// Outstanding Bill
349
-			$outstandingBills = $soc->get_OutstandingBill();
350
-			print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
351
-			print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency);
352
-			if ($soc->outstanding_limit != '')
353
-			{
354
-				if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
355
-				print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
356
-			}
357
-			print ')';
358
-			print '</td>';
359
-		}
360
-		else
361
-		{
362
-			print '<td colspan="2">';
363
-			print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
364
-			// Option to reload page to retrieve customer informations. Note, this clear other input
365
-			if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
366
-			{
367
-				print '<script type="text/javascript">
338
+    // Company
339
+    if (! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES))
340
+    {
341
+        // Thirdparty
342
+        print '<td>' . $langs->trans('Customer') . '</td>';
343
+        if ($soc->id > 0 && ! GETPOST('fac_rec','alpha'))
344
+        {
345
+            print '<td colspan="2">';
346
+            print $soc->getNomUrl(1);
347
+            print '<input type="hidden" name="socid" value="' . $soc->id . '">';
348
+            // Outstanding Bill
349
+            $outstandingBills = $soc->get_OutstandingBill();
350
+            print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
351
+            print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency);
352
+            if ($soc->outstanding_limit != '')
353
+            {
354
+                if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
355
+                print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
356
+            }
357
+            print ')';
358
+            print '</td>';
359
+        }
360
+        else
361
+        {
362
+            print '<td colspan="2">';
363
+            print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
364
+            // Option to reload page to retrieve customer informations. Note, this clear other input
365
+            if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
366
+            {
367
+                print '<script type="text/javascript">
368 368
 				$(document).ready(function() {
369 369
 					$("#socid").change(function() {
370 370
 						var socid = $(this).val();
@@ -374,82 +374,82 @@  discard block
 block discarded – undo
374 374
 					});
375 375
 				});
376 376
 				</script>';
377
-			}
377
+            }
378 378
             //print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
379 379
             print ' <a href="' . BASE_URI . '?controller=societe&method=card&action=create&client=3&fournisseur=0&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create') . '">' . $langs->trans("AddThirdParty") . '</a>';
380
-			print '</td>';
381
-		}
382
-		print '</tr>' . "\n";
383
-	}
380
+            print '</td>';
381
+        }
382
+        print '</tr>' . "\n";
383
+    }
384 384
 
385
-	// Date
386
-	print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>';
387
-	print $form->selectDate($donation_date?$donation_date:-1, '', '', '', '', "add", 1, 1);
388
-	print '</td>';
385
+    // Date
386
+    print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>';
387
+    print $form->selectDate($donation_date?$donation_date:-1, '', '', '', '', "add", 1, 1);
388
+    print '</td>';
389 389
 
390
-	// Amount
391
-	print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.dol_escape_htmltag(GETPOST("amount")).'" size="10"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
390
+    // Amount
391
+    print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.dol_escape_htmltag(GETPOST("amount")).'" size="10"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
392 392
 
393
-	// Public donation
394
-	print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
395
-	print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1);
396
-	print "</td></tr>\n";
393
+    // Public donation
394
+    print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
395
+    print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1);
396
+    print "</td></tr>\n";
397 397
 
398
-	if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES))
399
-	{
400
-		print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.dol_escape_htmltag(GETPOST("societe")).'" class="maxwidth200"></td></tr>';
401
-		print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.dol_escape_htmltag(GETPOST("lastname")).'" class="maxwidth200"></td></tr>';
402
-		print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST("firstname")).'" class="maxwidth200"></td></tr>';
403
-		print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
404
-		print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="3">'.dol_escape_htmltag(GETPOST("address")).'</textarea></td></tr>';
405
-
406
-		// Zip / Town
407
-		print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
408
-		print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
409
-		print ' ';
410
-		print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
411
-		print '</tr>';
412
-
413
-		// Country
414
-		print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">';
415
-		print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id);
416
-		if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
417
-		print '</td></tr>';
418
-
419
-		print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>';
420
-	}
398
+    if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES))
399
+    {
400
+        print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.dol_escape_htmltag(GETPOST("societe")).'" class="maxwidth200"></td></tr>';
401
+        print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.dol_escape_htmltag(GETPOST("lastname")).'" class="maxwidth200"></td></tr>';
402
+        print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST("firstname")).'" class="maxwidth200"></td></tr>';
403
+        print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
404
+        print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="3">'.dol_escape_htmltag(GETPOST("address")).'</textarea></td></tr>';
405
+
406
+        // Zip / Town
407
+        print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
408
+        print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
409
+        print ' ';
410
+        print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
411
+        print '</tr>';
412
+
413
+        // Country
414
+        print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">';
415
+        print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id);
416
+        if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
417
+        print '</td></tr>';
418
+
419
+        print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>';
420
+    }
421 421
 
422
-	// Payment mode
423
-	print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
424
-	$selected = GETPOST('modepayment','int');
425
-	$form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
426
-	print "</td></tr>\n";
422
+    // Payment mode
423
+    print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
424
+    $selected = GETPOST('modepayment','int');
425
+    $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
426
+    print "</td></tr>\n";
427 427
 
428
-	// Public note
429
-	print '<tr>';
430
-	print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>';
431
-	print '<td>';
428
+    // Public note
429
+    print '<tr>';
430
+    print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>';
431
+    print '<td>';
432 432
 
433 433
     $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
434
-	print $doleditor->Create(1);
435
-	print '</td></tr>';
436
-
437
-	// Private note
438
-	if (empty($user->societe_id)) {
439
-		print '<tr>';
440
-		print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
441
-		print '<td>';
442
-
443
-		$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
444
-		print $doleditor->Create(1);
445
-		print '</td></tr>';
446
-	}
434
+    print $doleditor->Create(1);
435
+    print '</td></tr>';
436
+
437
+    // Private note
438
+    if (empty($user->societe_id)) {
439
+        print '<tr>';
440
+        print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
441
+        print '<td>';
442
+
443
+        $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
444
+        print $doleditor->Create(1);
445
+        print '</td></tr>';
446
+    }
447 447
 
448
-	if (! empty($conf->projet->enabled))
448
+    if (! empty($conf->projet->enabled))
449 449
     {
450 450
         print "<tr><td>".$langs->trans("Project")."</td><td>";
451 451
         $formproject->select_projects(-1, $projectid,'fk_project', 0, 0, 1, 1);
452
-		print "</td></tr>\n";
452
+        print "</td></tr>\n";
453 453
     }
454 454
 
455 455
     // Other attributes
@@ -458,21 +458,21 @@  discard block
 block discarded – undo
458 458
     print $hookmanager->resPrint;
459 459
     if (empty($reshook))
460 460
     {
461
-		print $object->showOptionals($extrafields,'edit',$parameters);
461
+        print $object->showOptionals($extrafields,'edit',$parameters);
462 462
     }
463 463
 
464 464
     print '</tbody>';
465
-	print "</table>\n";
465
+    print "</table>\n";
466 466
 
467
-	dol_fiche_end();
467
+    dol_fiche_end();
468 468
 
469
-	print '<div class="center">';
470
-	print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
471
-	print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
472
-	print '<input type="button" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" onClick="javascript:history.go(-1)">';
473
-	print '</div>';
469
+    print '<div class="center">';
470
+    print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
471
+    print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
472
+    print '<input type="button" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" onClick="javascript:history.go(-1)">';
473
+    print '</div>';
474 474
 
475
-	print "</form>\n";
475
+    print "</form>\n";
476 476
 }
477 477
 
478 478
 
@@ -484,80 +484,80 @@  discard block
 block discarded – undo
484 484
 
485 485
 if (! empty($id) && $action == 'edit')
486 486
 {
487
-	$result=$object->fetch($id);
488
-	if ($result < 0) {
489
-		dol_print_error($db,$object->error); exit;
490
-	}
491
-	$result=$object->fetch_optionals();
492
-	if ($result < 0) {
493
-		dol_print_error($db); exit;
494
-	}
487
+    $result=$object->fetch($id);
488
+    if ($result < 0) {
489
+        dol_print_error($db,$object->error); exit;
490
+    }
491
+    $result=$object->fetch_optionals();
492
+    if ($result < 0) {
493
+        dol_print_error($db); exit;
494
+    }
495 495
 
496
-	$hselected='card';
497
-	$head = donation_prepare_head($object);
496
+    $hselected='card';
497
+    $head = donation_prepare_head($object);
498 498
 
499
-	print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
500
-	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
501
-	print '<input type="hidden" name="action" value="update">';
502
-	print '<input type="hidden" name="rowid" value="'.$object->id.'">';
503
-	print '<input type="hidden" name="amount" value="'.$object->amount.'">';
499
+    print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
500
+    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
501
+    print '<input type="hidden" name="action" value="update">';
502
+    print '<input type="hidden" name="rowid" value="'.$object->id.'">';
503
+    print '<input type="hidden" name="amount" value="'.$object->amount.'">';
504 504
 
505 505
 
506
-	dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
506
+    dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
507 507
 
508
-	print '<table class="border" width="100%">';
508
+    print '<table class="border" width="100%">';
509 509
 
510
-	// Ref
511
-	print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2">';
512
-	print $object->getNomUrl();
513
-	print '</td>';
514
-	print '</tr>';
510
+    // Ref
511
+    print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2">';
512
+    print $object->getNomUrl();
513
+    print '</td>';
514
+    print '</tr>';
515 515
 
516
-	// Date
517
-	print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Date").'</td><td>';
518
-	print $form->selectDate($object->date,'','','','',"update");
519
-	print '</td>';
516
+    // Date
517
+    print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Date").'</td><td>';
518
+    print $form->selectDate($object->date,'','','','',"update");
519
+    print '</td>';
520 520
 
521
-	// Amount
522
-	if ($object->statut == 0)
523
-	{
524
-		print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.dol_escape_htmltag($object->amount).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
525
-	}
526
-	else
527
-	{
528
-		print '<tr><td>'.$langs->trans("Amount").'</td><td>';
529
-		print price($object->amount,0,$langs,0,0,-1,$conf->currency);
530
-		print '</td></tr>';
531
-	}
521
+    // Amount
522
+    if ($object->statut == 0)
523
+    {
524
+        print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.dol_escape_htmltag($object->amount).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
525
+    }
526
+    else
527
+    {
528
+        print '<tr><td>'.$langs->trans("Amount").'</td><td>';
529
+        print price($object->amount,0,$langs,0,0,-1,$conf->currency);
530
+        print '</td></tr>';
531
+    }
532 532
 
533
-	print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
534
-	print $form->selectyesno("public",1,1);
535
-	print "</td>";
536
-	print "</tr>\n";
533
+    print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
534
+    print $form->selectyesno("public",1,1);
535
+    print "</td>";
536
+    print "</tr>\n";
537 537
 
538
-	$langs->load("companies");
539
-	print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="maxwidth200" value="'.dol_escape_htmltag($object->societe).'"></td></tr>';
540
-	print '<tr><td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="maxwidth200" value="'.dol_escape_htmltag($object->lastname).'"></td></tr>';
541
-	print '<tr><td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="maxwidth200" value="'.dol_escape_htmltag($object->firstname).'"></td></tr>';
542
-	print '<tr><td>'.$langs->trans("Address").'</td><td>';
543
-	print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag($object->address).'</textarea></td></tr>';
538
+    $langs->load("companies");
539
+    print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="maxwidth200" value="'.dol_escape_htmltag($object->societe).'"></td></tr>';
540
+    print '<tr><td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="maxwidth200" value="'.dol_escape_htmltag($object->lastname).'"></td></tr>';
541
+    print '<tr><td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="maxwidth200" value="'.dol_escape_htmltag($object->firstname).'"></td></tr>';
542
+    print '<tr><td>'.$langs->trans("Address").'</td><td>';
543
+    print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag($object->address).'</textarea></td></tr>';
544 544
 
545 545
     // Zip / Town
546 546
     print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
547
-	print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
547
+    print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
548 548
     print ' ';
549
-	print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
550
-	print '</tr>';
549
+    print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
550
+    print '</tr>';
551 551
 
552
-	// Country
553
-	print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>';
554
-	print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id');
555
-	if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
556
-	print '</td></tr>';
552
+    // Country
553
+    print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>';
554
+    print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id');
555
+    if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
556
+    print '</td></tr>';
557 557
 
558
-	print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>';
558
+    print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>';
559 559
 
560
-	// Payment mode
560
+    // Payment mode
561 561
     print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
562 562
     if ($object->modepaymentid) $selected = $object->modepaymentid;
563 563
     else $selected = '';
@@ -565,16 +565,16 @@  discard block
 block discarded – undo
565 565
     print "</td></tr>\n";
566 566
 
567 567
     // Status
568
-	print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
568
+    print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
569 569
 
570 570
     // Project
571 571
     if (! empty($conf->projet->enabled))
572 572
     {
573
-    	$formproject=new FormProjets($db);
573
+        $formproject=new FormProjets($db);
574 574
 
575 575
         $langs->load('projects');
576 576
         print '<tr><td>'.$langs->trans('Project').'</td><td>';
577
-		$formproject->select_projects(-1, $object->fk_project,'fk_project', 0, 0, 1, 1);
577
+        $formproject->select_projects(-1, $object->fk_project,'fk_project', 0, 0, 1, 1);
578 578
         print '</td></tr>';
579 579
     }
580 580
 
@@ -584,16 +584,16 @@  discard block
 block discarded – undo
584 584
     print $hookmanager->resPrint;
585 585
     if (empty($reshook))
586 586
     {
587
-      	print $object->showOptionals($extrafields,'edit');
587
+            print $object->showOptionals($extrafields,'edit');
588 588
     }
589 589
 
590
-	print "</table>\n";
590
+    print "</table>\n";
591 591
 
592
-	dol_fiche_end();
592
+    dol_fiche_end();
593 593
 
594
-	print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
594
+    print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
595 595
 
596
-	print "</form>\n";
596
+    print "</form>\n";
597 597
 }
598 598
 
599 599
 
@@ -605,66 +605,66 @@  discard block
 block discarded – undo
605 605
 /* ************************************************************ */
606 606
 if (! empty($id) && $action != 'edit')
607 607
 {
608
-	// Confirmation delete
608
+    // Confirmation delete
609 609
     if ($action == 'delete')
610 610
     {
611 611
         $text=$langs->trans("ConfirmDeleteADonation");
612 612
         print $form->formconfirm($_SERVER["PHP_SELF"] . "&id=" . $object->id, $langs->trans("DeleteADonation"), $text, "confirm_delete", '', '', 1);
613 613
     }
614 614
 
615
-	$result=$object->fetch($id);
616
-	if ($result < 0) {
617
-		dol_print_error($db,$object->error); exit;
618
-	}
619
-	$result=$object->fetch_optionals();
620
-	if ($result < 0) {
621
-		dol_print_error($db); exit;
622
-	}
615
+    $result=$object->fetch($id);
616
+    if ($result < 0) {
617
+        dol_print_error($db,$object->error); exit;
618
+    }
619
+    $result=$object->fetch_optionals();
620
+    if ($result < 0) {
621
+        dol_print_error($db); exit;
622
+    }
623 623
 
624
-	$hselected='card';
624
+    $hselected='card';
625 625
 
626
-	$head = donation_prepare_head($object);
627
-	dol_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'generic');
626
+    $head = donation_prepare_head($object);
627
+    dol_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'generic');
628 628
 
629
-	// Print form confirm
630
-	print $formconfirm;
629
+    // Print form confirm
630
+    print $formconfirm;
631 631
 
632 632
     // $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
633 633
     $linkback = '<a href="' . BASE_URI . '?controller=don&method=list' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
634 634
 
635
-	$morehtmlref='<div class="refidno">';
636
-	// Project
637
-	if (! empty($conf->projet->enabled))
638
-	{
639
-	    $langs->load("projects");
640
-	    $morehtmlref.=$langs->trans('Project') . ' ';
641
-	    if ($user->rights->don->creer)
642
-	    {
643
-	        if ($action != 'classify')
644
-	            $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
645
-	            if ($action == 'classify') {
635
+    $morehtmlref='<div class="refidno">';
636
+    // Project
637
+    if (! empty($conf->projet->enabled))
638
+    {
639
+        $langs->load("projects");
640
+        $morehtmlref.=$langs->trans('Project') . ' ';
641
+        if ($user->rights->don->creer)
642
+        {
643
+            if ($action != 'classify')
644
+                $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
645
+                if ($action == 'classify') {
646 646
                     $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
647
-	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
648
-	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
649
-	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
650
-	                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
651
-	                $morehtmlref.='</form>';
652
-	            } else {
647
+                    $morehtmlref.='<input type="hidden" name="action" value="classin">';
648
+                    $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
649
+                    $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
650
+                    $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
651
+                    $morehtmlref.='</form>';
652
+                } else {
653 653
                     $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '&id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
654
-	            }
655
-	    } else {
656
-	        if (! empty($object->fk_project)) {
657
-	            $proj = new Project($db);
658
-	            $proj->fetch($object->fk_project);
654
+                }
655
+        } else {
656
+            if (! empty($object->fk_project)) {
657
+                $proj = new Project($db);
658
+                $proj->fetch($object->fk_project);
659 659
                 $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&methos=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
660
-	            $morehtmlref.=$proj->ref;
661
-	            $morehtmlref.='</a>';
662
-	        } else {
663
-	            $morehtmlref.='';
664
-	        }
665
-	    }
666
-	}
667
-	$morehtmlref.='</div>';
660
+                $morehtmlref.=$proj->ref;
661
+                $morehtmlref.='</a>';
662
+            } else {
663
+                $morehtmlref.='';
664
+            }
665
+        }
666
+    }
667
+    $morehtmlref.='</div>';
668 668
 
669 669
 
670 670
     dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
@@ -676,195 +676,195 @@  discard block
 block discarded – undo
676 676
 
677 677
     print '<table class="border" width="100%">';
678 678
 
679
-	// Date
680
-	print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td colspan="2">';
681
-	print dol_print_date($object->date,"day");
682
-	print "</td>";
679
+    // Date
680
+    print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td colspan="2">';
681
+    print dol_print_date($object->date,"day");
682
+    print "</td>";
683 683
 
684 684
     print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="2">';
685
-	print price($object->amount,0,$langs,0,0,-1,$conf->currency);
686
-	print '</td></tr>';
685
+    print price($object->amount,0,$langs,0,0,-1,$conf->currency);
686
+    print '</td></tr>';
687 687
 
688
-	print '<tr><td>'.$langs->trans("PublicDonation").'</td><td colspan="2">';
689
-	print yn($object->public);
690
-	print '</td></tr>';
688
+    print '<tr><td>'.$langs->trans("PublicDonation").'</td><td colspan="2">';
689
+    print yn($object->public);
690
+    print '</td></tr>';
691 691
 
692
-	print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2">'.$object->societe.'</td></tr>';
693
-	print '<tr><td>'.$langs->trans("Lastname").'</td><td colspan="2">'.$object->lastname.'</td></tr>';
694
-	print '<tr><td>'.$langs->trans("Firstname").'</td><td colspan="2">'.$object->firstname.'</td></tr>';
692
+    print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2">'.$object->societe.'</td></tr>';
693
+    print '<tr><td>'.$langs->trans("Lastname").'</td><td colspan="2">'.$object->lastname.'</td></tr>';
694
+    print '<tr><td>'.$langs->trans("Firstname").'</td><td colspan="2">'.$object->firstname.'</td></tr>';
695 695
 
696
-	// Payment mode
697
-	print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
698
-	$form->form_modes_reglement(null, $object->modepaymentid,'none');
699
-	print "</td></tr>\n";
696
+    // Payment mode
697
+    print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
698
+    $form->form_modes_reglement(null, $object->modepaymentid,'none');
699
+    print "</td></tr>\n";
700 700
 
701
-	// Other attributes
702
-	$cols = 2;
703
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
701
+    // Other attributes
702
+    $cols = 2;
703
+    include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
704 704
 
705
-	print '</table>';
705
+    print '</table>';
706 706
 
707
-	print '</div>';
708
-	print '<div class="fichehalfright">';
709
-	print '<div class="ficheaddleft">';
707
+    print '</div>';
708
+    print '<div class="fichehalfright">';
709
+    print '<div class="ficheaddleft">';
710 710
 
711
-	/*
711
+    /*
712 712
 	 * Payments
713 713
 	 */
714
-	$sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
715
-	$sql.= "c.code as type_code,c.libelle as paiement_type";
716
-	$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
717
-	$sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
718
-	$sql.= ", ".MAIN_DB_PREFIX."don as d";
719
-	$sql.= " WHERE d.rowid = '".$id."'";
720
-	$sql.= " AND p.fk_donation = d.rowid";
721
-	$sql.= " AND d.entity IN (".getEntity('donation').")";
722
-	$sql.= " AND p.fk_typepayment = c.id";
723
-	$sql.= " ORDER BY dp";
724
-
725
-	//print $sql;
726
-	$resql = $db->query($sql);
727
-	if ($resql)
728
-	{
729
-		$num = $db->num_rows($resql);
730
-		$i = 0; $total = 0;
731
-		print '<table class="noborder" width="100%">';
732
-		print '<tr class="liste_titre">';
733
-		print '<td>'.$langs->trans("RefPayment").'</td>';
734
-		print '<td>'.$langs->trans("Date").'</td>';
735
-		print '<td>'.$langs->trans("Type").'</td>';
736
-   		print '<td align="right">'.$langs->trans("Amount").'</td>';
737
-   		print '</tr>';
738
-
739
-		while ($i < $num)
740
-		{
741
-			$objp = $db->fetch_object($resql);
742
-
743
-			print '<tr class="oddeven"><td>';
714
+    $sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
715
+    $sql.= "c.code as type_code,c.libelle as paiement_type";
716
+    $sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
717
+    $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
718
+    $sql.= ", ".MAIN_DB_PREFIX."don as d";
719
+    $sql.= " WHERE d.rowid = '".$id."'";
720
+    $sql.= " AND p.fk_donation = d.rowid";
721
+    $sql.= " AND d.entity IN (".getEntity('donation').")";
722
+    $sql.= " AND p.fk_typepayment = c.id";
723
+    $sql.= " ORDER BY dp";
724
+
725
+    //print $sql;
726
+    $resql = $db->query($sql);
727
+    if ($resql)
728
+    {
729
+        $num = $db->num_rows($resql);
730
+        $i = 0; $total = 0;
731
+        print '<table class="noborder" width="100%">';
732
+        print '<tr class="liste_titre">';
733
+        print '<td>'.$langs->trans("RefPayment").'</td>';
734
+        print '<td>'.$langs->trans("Date").'</td>';
735
+        print '<td>'.$langs->trans("Type").'</td>';
736
+            print '<td align="right">'.$langs->trans("Amount").'</td>';
737
+            print '</tr>';
738
+
739
+        while ($i < $num)
740
+        {
741
+            $objp = $db->fetch_object($resql);
742
+
743
+            print '<tr class="oddeven"><td>';
744 744
             print '<a href="' . BASE_URI . '?controller=don/payment&method=card&id=' . $objp->rowid . '">' . img_object($langs->trans("Payment"), "payment") . ' ' . $objp->rowid . '</a></td>';
745
-			print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
746
-		    $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
745
+            print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
746
+            $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
747 747
             print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
748
-			print '<td align="right">'.price($objp->amount)."</td>\n";
749
-			print "</tr>";
750
-			$totalpaid += $objp->amount;
751
-			$i++;
752
-		}
753
-
754
-		if ($object->paid == 0)
755
-		{
756
-			print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaid)."</td></tr>\n";
757
-			print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\">".price($object->amount)."</td></tr>\n";
758
-
759
-			$remaintopay = $object->amount - $totalpaid;
760
-
761
-			print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
762
-			print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':'').'><b>'.price($remaintopay)."</b></td></tr>\n";
763
-		}
764
-		print "</table>";
765
-		$db->free($resql);
766
-	}
767
-	else
768
-	{
769
-		dol_print_error($db);
770
-	}
748
+            print '<td align="right">'.price($objp->amount)."</td>\n";
749
+            print "</tr>";
750
+            $totalpaid += $objp->amount;
751
+            $i++;
752
+        }
753
+
754
+        if ($object->paid == 0)
755
+        {
756
+            print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaid)."</td></tr>\n";
757
+            print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\">".price($object->amount)."</td></tr>\n";
758
+
759
+            $remaintopay = $object->amount - $totalpaid;
760
+
761
+            print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
762
+            print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':'').'><b>'.price($remaintopay)."</b></td></tr>\n";
763
+        }
764
+        print "</table>";
765
+        $db->free($resql);
766
+    }
767
+    else
768
+    {
769
+        dol_print_error($db);
770
+    }
771 771
 
772
-	print '</div>';
773
-	print '</div>';
774
-	print '</div>';
772
+    print '</div>';
773
+    print '</div>';
774
+    print '</div>';
775 775
 
776
-	print '<div class="clearboth"></div>';
776
+    print '<div class="clearboth"></div>';
777 777
 
778 778
     dol_fiche_end();
779 779
 
780
-	$remaintopay = $object->amount - $totalpaid;
780
+    $remaintopay = $object->amount - $totalpaid;
781 781
 
782
-	// Actions buttons
782
+    // Actions buttons
783 783
 
784
-	print '<div class="tabsAction">';
784
+    print '<div class="tabsAction">';
785 785
 
786 786
     print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '&action=edit&rowid=' . $object->id . '">' . $langs->trans('Modify') . '</a></div>';
787 787
 
788
-	if ($object->statut == 0)
789
-	{
788
+    if ($object->statut == 0)
789
+    {
790 790
         print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '&rowid=' . $object->id . '&action=valid_promesse">' . $langs->trans("ValidPromess") . '</a></div>';
791
-	}
791
+    }
792 792
 
793 793
     if (($object->statut == 0 || $object->statut == 1) && $totalpaid == 0 && $object->paid == 0)
794 794
     {
795 795
         print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '&rowid=' . $object->id . '&action=set_cancel">' . $langs->trans("ClassifyCanceled") . "</a></div>";
796 796
     }
797 797
 
798
-	// Create payment
799
-	if ($object->statut == 1 && $object->paid == 0 && $user->rights->don->creer)
800
-	{
801
-		if ($remaintopay == 0)
802
-		{
803
-			print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
804
-		}
805
-		else
806
-		{
798
+    // Create payment
799
+    if ($object->statut == 1 && $object->paid == 0 && $user->rights->don->creer)
800
+    {
801
+        if ($remaintopay == 0)
802
+        {
803
+            print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
804
+        }
805
+        else
806
+        {
807 807
             print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=don/payment&method=payment&rowid=' . $object->id . '&amp;action=create">' . $langs->trans('DoPayment') . '</a></div>';
808
-		}
809
-	}
808
+        }
809
+    }
810 810
 
811
-	// Classify 'paid'
812
-	if ($object->statut == 1 && round($remaintopay) == 0 && $object->paid == 0 && $user->rights->don->creer)
813
-	{
814
-		print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
815
-	}
811
+    // Classify 'paid'
812
+    if ($object->statut == 1 && round($remaintopay) == 0 && $object->paid == 0 && $user->rights->don->creer)
813
+    {
814
+        print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
815
+    }
816 816
 
817
-	// Delete
818
-	if ($user->rights->don->supprimer)
819
-	{
820
-		if ($object->statut == -1 || $object->statut == 0)
821
-		{
817
+    // Delete
818
+    if ($user->rights->don->supprimer)
819
+    {
820
+        if ($object->statut == -1 || $object->statut == 0)
821
+        {
822 822
             // TODO: Original href="card.php?rowid='.$object->id.'&action=delete"
823 823
             print '<div class="inline-block divButAction"><a class="butActionDelete" href="?controller=don&method=card&rowid=' . $object->id . '&action=delete">' . $langs->trans("Delete") . "</a></div>";
824
-		}
825
-		else
826
-		{
827
-			print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
828
-		}
829
-	}
830
-	else
831
-	{
832
-		print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
833
-	}
824
+        }
825
+        else
826
+        {
827
+            print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
828
+        }
829
+    }
830
+    else
831
+    {
832
+        print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
833
+    }
834 834
 
835
-	print "</div>";
835
+    print "</div>";
836 836
 
837 837
 
838 838
     print '<div class="fichecenter"><div class="fichehalfleft">';
839 839
 
840
-	/*
840
+    /*
841 841
 	 * Documents generes
842 842
 	 */
843
-	$filename	=	dol_sanitizeFileName($object->id);
844
-	$filedir	=	$conf->don->dir_output . "/" . dol_sanitizeFileName($object->id);
843
+    $filename	=	dol_sanitizeFileName($object->id);
844
+    $filedir	=	$conf->don->dir_output . "/" . dol_sanitizeFileName($object->id);
845 845
     $urlsource = $_SERVER['PHP_SELF'] . '&rowid=' . $object->id;
846
-	$genallowed	=	(($object->paid == 0 || $user->admin) && $user->rights->don->lire);
847
-	$delallowed	=	$user->rights->don->creer;
846
+    $genallowed	=	(($object->paid == 0 || $user->admin) && $user->rights->don->lire);
847
+    $delallowed	=	$user->rights->don->creer;
848 848
 
849
-	print $formfile->showdocuments('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
849
+    print $formfile->showdocuments('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
850 850
 
851
-	// Show links to link elements
852
-	$linktoelem = $form->showLinkToObjectBlock($object, null, array('don'));
853
-	$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
851
+    // Show links to link elements
852
+    $linktoelem = $form->showLinkToObjectBlock($object, null, array('don'));
853
+    $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
854 854
 
855
-		// Show online payment link
856
-		$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
855
+        // Show online payment link
856
+        $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
857 857
 
858
-		if ($useonlinepayment) //$object->statut != Facture::STATUS_DRAFT &&
859
-		{
860
-			print '<br><!-- Link to pay -->'."\n";
861
-			require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
862
-			print showOnlinePaymentUrl('donation', $object->ref).'<br>';
863
-		}
858
+        if ($useonlinepayment) //$object->statut != Facture::STATUS_DRAFT &&
859
+        {
860
+            print '<br><!-- Link to pay -->'."\n";
861
+            require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
862
+            print showOnlinePaymentUrl('donation', $object->ref).'<br>';
863
+        }
864 864
 
865
-	print '</div><div class="fichehalfright"><div class="ficheaddleft">';
865
+    print '</div><div class="fichehalfright"><div class="ficheaddleft">';
866 866
 
867
-	print '</div></div></div>';
867
+    print '</div></div></div>';
868 868
 }
869 869
 
870 870
 llxFooter();
Please login to merge, or discard this patch.
Braces   +41 added lines, -35 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
  */
75 75
 
76 76
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
77
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
77
+if ($reshook < 0) {
78
+    setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
79
+}
78 80
 
79 81
 if ($action == 'update')
80 82
 {
@@ -122,7 +124,9 @@  discard block
 block discarded – undo
122 124
 
123 125
 		// Fill array 'array_options' with data from add form
124 126
         $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
125
-		if ($ret < 0) $error++;
127
+		if ($ret < 0) {
128
+		    $error++;
129
+		}
126 130
 
127 131
 		if ($object->update($user) > 0)
128 132
 		{
@@ -176,15 +180,16 @@  discard block
 block discarded – undo
176 180
 
177 181
 		// Fill array 'array_options' with data from add form
178 182
         $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
179
-		if ($ret < 0) $error++;
183
+		if ($ret < 0) {
184
+		    $error++;
185
+		}
180 186
 
181 187
 		$res = $object->create($user);
182 188
 		if ($res > 0)
183 189
 		{
184 190
             header("Location: " . $_SERVER['PHP_SELF'] . '&id=' . $res);
185 191
 			exit;
186
-		}
187
-		else
192
+		} else
188 193
 		{
189 194
 			setEventMessages($object->error, $object->errors, 'errors');
190 195
 		}
@@ -198,8 +203,7 @@  discard block
 block discarded – undo
198 203
     {
199 204
         header("Location: index.php");
200 205
         exit;
201
-    }
202
-    else
206
+    } else
203 207
     {
204 208
         dol_syslog($object->error,LOG_DEBUG);
205 209
         setEventMessages($object->error, $object->errors, 'errors');
@@ -214,8 +218,7 @@  discard block
 block discarded – undo
214 218
 
215 219
         header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id);
216 220
 		exit;
217
-	}
218
-    else {
221
+	} else {
219 222
 	    setEventMessages($object->error, $object->errors, 'errors');
220 223
     }
221 224
 }
@@ -226,8 +229,7 @@  discard block
 block discarded – undo
226 229
     {
227 230
         header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id);
228 231
         exit;
229
-    }
230
-    else {
232
+    } else {
231 233
 	    setEventMessages($object->error, $object->errors, 'errors');
232 234
     }
233 235
 }
@@ -238,12 +240,10 @@  discard block
 block discarded – undo
238 240
 	{
239 241
         header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id);
240 242
 		exit;
241
-	}
242
-    else {
243
+	} else {
243 244
 	    setEventMessages($object->error, $object->errors, 'errors');
244 245
     }
245
-}
246
-else if ($action == 'classin' && $user->rights->don->creer)
246
+} else if ($action == 'classin' && $user->rights->don->creer)
247 247
 {
248 248
 	$object->fetch($id);
249 249
 	$object->setProject($projectid);
@@ -351,13 +351,14 @@  discard block
 block discarded – undo
351 351
 			print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency);
352 352
 			if ($soc->outstanding_limit != '')
353 353
 			{
354
-				if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
354
+				if ($outstandingBills > $soc->outstanding_limit) {
355
+				    print img_warning($langs->trans("OutstandingBillReached"));
356
+				}
355 357
 				print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
356 358
 			}
357 359
 			print ')';
358 360
 			print '</td>';
359
-		}
360
-		else
361
+		} else
361 362
 		{
362 363
 			print '<td colspan="2">';
363 364
 			print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
@@ -413,7 +414,9 @@  discard block
 block discarded – undo
413 414
 		// Country
414 415
 		print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">';
415 416
 		print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id);
416
-		if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
417
+		if ($user->admin) {
418
+		    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
419
+		}
417 420
 		print '</td></tr>';
418 421
 
419 422
 		print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>';
@@ -522,8 +525,7 @@  discard block
 block discarded – undo
522 525
 	if ($object->statut == 0)
523 526
 	{
524 527
 		print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.dol_escape_htmltag($object->amount).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
525
-	}
526
-	else
528
+	} else
527 529
 	{
528 530
 		print '<tr><td>'.$langs->trans("Amount").'</td><td>';
529 531
 		print price($object->amount,0,$langs,0,0,-1,$conf->currency);
@@ -552,15 +554,20 @@  discard block
 block discarded – undo
552 554
 	// Country
553 555
 	print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>';
554 556
 	print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id');
555
-	if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
557
+	if ($user->admin) {
558
+	    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
559
+	}
556 560
 	print '</td></tr>';
557 561
 
558 562
 	print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>';
559 563
 
560 564
 	// Payment mode
561 565
     print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
562
-    if ($object->modepaymentid) $selected = $object->modepaymentid;
563
-    else $selected = '';
566
+    if ($object->modepaymentid) {
567
+        $selected = $object->modepaymentid;
568
+    } else {
569
+        $selected = '';
570
+    }
564 571
     $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
565 572
     print "</td></tr>\n";
566 573
 
@@ -640,8 +647,9 @@  discard block
 block discarded – undo
640 647
 	    $morehtmlref.=$langs->trans('Project') . ' ';
641 648
 	    if ($user->rights->don->creer)
642 649
 	    {
643
-	        if ($action != 'classify')
644
-	            $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
650
+	        if ($action != 'classify') {
651
+	        	            $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
652
+	        }
645 653
 	            if ($action == 'classify') {
646 654
                     $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
647 655
 	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
@@ -763,8 +771,7 @@  discard block
 block discarded – undo
763 771
 		}
764 772
 		print "</table>";
765 773
 		$db->free($resql);
766
-	}
767
-	else
774
+	} else
768 775
 	{
769 776
 		dol_print_error($db);
770 777
 	}
@@ -801,8 +808,7 @@  discard block
 block discarded – undo
801 808
 		if ($remaintopay == 0)
802 809
 		{
803 810
 			print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
804
-		}
805
-		else
811
+		} else
806 812
 		{
807 813
             print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=don/payment&method=payment&rowid=' . $object->id . '&amp;action=create">' . $langs->trans('DoPayment') . '</a></div>';
808 814
 		}
@@ -821,13 +827,11 @@  discard block
 block discarded – undo
821 827
 		{
822 828
             // TODO: Original href="card.php?rowid='.$object->id.'&action=delete"
823 829
             print '<div class="inline-block divButAction"><a class="butActionDelete" href="?controller=don&method=card&rowid=' . $object->id . '&action=delete">' . $langs->trans("Delete") . "</a></div>";
824
-		}
825
-		else
830
+		} else
826 831
 		{
827 832
 			print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
828 833
 		}
829
-	}
830
-	else
834
+	} else
831 835
 	{
832 836
 		print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
833 837
 	}
@@ -855,9 +859,11 @@  discard block
 block discarded – undo
855 859
 		// Show online payment link
856 860
 		$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
857 861
 
858
-		if ($useonlinepayment) //$object->statut != Facture::STATUS_DRAFT &&
862
+		if ($useonlinepayment) {
863
+		    //$object->statut != Facture::STATUS_DRAFT &&
859 864
 		{
860 865
 			print '<br><!-- Link to pay -->'."\n";
866
+		}
861 867
 			require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
862 868
 			print showOnlinePaymentUrl('donation', $object->ref).'<br>';
863 869
 		}
Please login to merge, or discard this patch.
dolibarr/htdocs/don/class/paymentdonation.class.php 1 patch
Braces   +73 added lines, -24 removed lines patch added patch discarded remove patch
@@ -116,26 +116,47 @@  discard block
 block discarded – undo
116 116
         }
117 117
 
118 118
         // Clean parameters
119
-        if (isset($this->fk_donation)) $this->fk_donation = trim($this->fk_donation);
120
-        if (isset($this->amount)) $this->amount = trim($this->amount);
121
-        if (isset($this->fk_typepayment)) $this->fk_typepayment = trim($this->fk_typepayment);
122
-        if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment);
123
-        if (isset($this->note)) $this->note = trim($this->note);
124
-        if (isset($this->fk_bank)) $this->fk_bank = trim($this->fk_bank);
125
-        if (isset($this->fk_user_creat)) $this->fk_user_creat = trim($this->fk_user_creat);
126
-        if (isset($this->fk_user_modif)) $this->fk_user_modif = trim($this->fk_user_modif);
119
+        if (isset($this->fk_donation)) {
120
+            $this->fk_donation = trim($this->fk_donation);
121
+        }
122
+        if (isset($this->amount)) {
123
+            $this->amount = trim($this->amount);
124
+        }
125
+        if (isset($this->fk_typepayment)) {
126
+            $this->fk_typepayment = trim($this->fk_typepayment);
127
+        }
128
+        if (isset($this->num_payment)) {
129
+            $this->num_payment = trim($this->num_payment);
130
+        }
131
+        if (isset($this->note)) {
132
+            $this->note = trim($this->note);
133
+        }
134
+        if (isset($this->fk_bank)) {
135
+            $this->fk_bank = trim($this->fk_bank);
136
+        }
137
+        if (isset($this->fk_user_creat)) {
138
+            $this->fk_user_creat = trim($this->fk_user_creat);
139
+        }
140
+        if (isset($this->fk_user_modif)) {
141
+            $this->fk_user_modif = trim($this->fk_user_modif);
142
+        }
127 143
 
128 144
         $totalamount = 0;
129
-        foreach ($this->amounts as $key => $value)  // How payment is dispatch
145
+        foreach ($this->amounts as $key => $value) {
146
+            // How payment is dispatch
130 147
         {
131 148
             $newvalue = price2num($value, 'MT');
149
+        }
132 150
             $this->amounts[$key] = $newvalue;
133 151
             $totalamount += $newvalue;
134 152
         }
135 153
         $totalamount = price2num($totalamount);
136 154
 
137 155
         // Check parameters
138
-        if ($totalamount == 0) return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null
156
+        if ($totalamount == 0) {
157
+            return -1;
158
+        }
159
+        // On accepte les montants negatifs pour les rejets de prelevement mais pas null
139 160
 
140 161
 
141 162
         $this->db->begin();
@@ -260,14 +281,30 @@  discard block
 block discarded – undo
260 281
 
261 282
         // Clean parameters
262 283
 
263
-        if (isset($this->fk_donation)) $this->fk_donation = trim($this->fk_donation);
264
-        if (isset($this->amount)) $this->amount = trim($this->amount);
265
-        if (isset($this->fk_typepayment)) $this->fk_typepayment = trim($this->fk_typepayment);
266
-        if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment);
267
-        if (isset($this->note)) $this->note = trim($this->note);
268
-        if (isset($this->fk_bank)) $this->fk_bank = trim($this->fk_bank);
269
-        if (isset($this->fk_user_creat)) $this->fk_user_creat = trim($this->fk_user_creat);
270
-        if (isset($this->fk_user_modif)) $this->fk_user_modif = trim($this->fk_user_modif);
284
+        if (isset($this->fk_donation)) {
285
+            $this->fk_donation = trim($this->fk_donation);
286
+        }
287
+        if (isset($this->amount)) {
288
+            $this->amount = trim($this->amount);
289
+        }
290
+        if (isset($this->fk_typepayment)) {
291
+            $this->fk_typepayment = trim($this->fk_typepayment);
292
+        }
293
+        if (isset($this->num_payment)) {
294
+            $this->num_payment = trim($this->num_payment);
295
+        }
296
+        if (isset($this->note)) {
297
+            $this->note = trim($this->note);
298
+        }
299
+        if (isset($this->fk_bank)) {
300
+            $this->fk_bank = trim($this->fk_bank);
301
+        }
302
+        if (isset($this->fk_user_creat)) {
303
+            $this->fk_user_creat = trim($this->fk_user_creat);
304
+        }
305
+        if (isset($this->fk_user_modif)) {
306
+            $this->fk_user_modif = trim($this->fk_user_modif);
307
+        }
271 308
 
272 309
         // Check parameters
273 310
         // Put here code to add control on parameters values
@@ -522,7 +559,9 @@  discard block
 block discarded – undo
522 559
             $acc->fetch($accountid);
523 560
 
524 561
             $total = $this->total;
525
-            if ($mode == 'payment_donation') $amount = $total;
562
+            if ($mode == 'payment_donation') {
563
+                $amount = $total;
564
+            }
526 565
 
527 566
             // Insert payment into llx_bank
528 567
             $bank_line_id = $acc->addline(
@@ -548,7 +587,9 @@  discard block
 block discarded – undo
548 587
 
549 588
                 // Add link 'payment', 'payment_supplier', 'payment_donation' in bank_url between payment and bank transaction
550 589
                 $url = '';
551
-                if ($mode == 'payment_donation') $url = DOL_URL_ROOT . '/don/payment/card.php?rowid=';
590
+                if ($mode == 'payment_donation') {
591
+                    $url = DOL_URL_ROOT . '/don/payment/card.php?rowid=';
592
+                }
552 593
                 if ($url) {
553 594
                     $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
554 595
                     if ($result <= 0) {
@@ -606,16 +647,24 @@  discard block
 block discarded – undo
606 647
 
607 648
         $result = '';
608 649
 
609
-        if (empty($this->ref)) $this->ref = $this->lib;
650
+        if (empty($this->ref)) {
651
+            $this->ref = $this->lib;
652
+        }
610 653
         $label = $langs->trans("ShowPayment") . ': ' . $this->ref;
611 654
 
612 655
         if (!empty($this->id)) {
613 656
             $link = '<a href="' . DOL_URL_ROOT . '/don/payment/card.php?id=' . $this->id . '" title="' . dol_escape_htmltag($label, 1) . '" class="classfortooltip">';
614 657
             $linkend = '</a>';
615 658
 
616
-            if ($withpicto) $result .= ($link . img_object($label, 'payment', 'class="classfortooltip"') . $linkend . ' ');
617
-            if ($withpicto && $withpicto != 2) $result .= ' ';
618
-            if ($withpicto != 2) $result .= $link . ($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref) . $linkend;
659
+            if ($withpicto) {
660
+                $result .= ($link . img_object($label, 'payment', 'class="classfortooltip"') . $linkend . ' ');
661
+            }
662
+            if ($withpicto && $withpicto != 2) {
663
+                $result .= ' ';
664
+            }
665
+            if ($withpicto != 2) {
666
+                $result .= $link . ($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref) . $linkend;
667
+            }
619 668
         }
620 669
 
621 670
         return $result;
Please login to merge, or discard this patch.
dolibarr/htdocs/don/note.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 
64 64
 if ($action == 'classin' && $user->rights->don->creer)
65 65
 {
66
-	$object->fetch($id);
67
-	$object->setProject($projectid);
66
+    $object->fetch($id);
67
+    $object->setProject($projectid);
68 68
 }
69 69
 
70 70
 /*
@@ -80,59 +80,59 @@  discard block
 block discarded – undo
80 80
 
81 81
 if ($id > 0 || ! empty($ref))
82 82
 {
83
-	$object = new Don($db);
84
-	$object->fetch($id,$ref);
83
+    $object = new Don($db);
84
+    $object->fetch($id,$ref);
85 85
 
86
-	$head = donation_prepare_head($object);
86
+    $head = donation_prepare_head($object);
87 87
 
88
-	dol_fiche_head($head, 'note', $langs->trans("Donation"), -1, 'generic');
88
+    dol_fiche_head($head, 'note', $langs->trans("Donation"), -1, 'generic');
89 89
 
90 90
     // $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
91 91
     $linkback = '<a href="' . BASE_URI . '?controller=don&method=list' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
92 92
 
93
-	$morehtmlref='<div class="refidno">';
94
-	// Project
95
-	if (! empty($conf->projet->enabled))
96
-	{
97
-	    $langs->load("projects");
98
-	    $morehtmlref.=$langs->trans('Project') . ' ';
99
-	    if ($user->rights->don->creer)
100
-	    {
101
-	        if ($action != 'classify')
102
-	            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
103
-	            if ($action == 'classify') {
93
+    $morehtmlref='<div class="refidno">';
94
+    // Project
95
+    if (! empty($conf->projet->enabled))
96
+    {
97
+        $langs->load("projects");
98
+        $morehtmlref.=$langs->trans('Project') . ' ';
99
+        if ($user->rights->don->creer)
100
+        {
101
+            if ($action != 'classify')
102
+                // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
103
+                if ($action == 'classify') {
104 104
                     $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
105
-	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
106
-	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
107
-	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
108
-	                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
109
-	                $morehtmlref.='</form>';
110
-	            } else {
105
+                    $morehtmlref.='<input type="hidden" name="action" value="classin">';
106
+                    $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
107
+                    $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
108
+                    $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
109
+                    $morehtmlref.='</form>';
110
+                } else {
111 111
                     $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '&id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
112
-	            }
113
-	    } else {
114
-	        if (! empty($object->fk_project)) {
115
-	            $proj = new Project($db);
116
-	            $proj->fetch($object->fk_project);
112
+                }
113
+        } else {
114
+            if (! empty($object->fk_project)) {
115
+                $proj = new Project($db);
116
+                $proj->fetch($object->fk_project);
117 117
                 $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
118
-	            $morehtmlref.=$proj->ref;
119
-	            $morehtmlref.='</a>';
120
-	        } else {
121
-	            $morehtmlref.='';
122
-	        }
123
-	    }
124
-	}
125
-	$morehtmlref.='</div>';
118
+                $morehtmlref.=$proj->ref;
119
+                $morehtmlref.='</a>';
120
+            } else {
121
+                $morehtmlref.='';
122
+            }
123
+        }
124
+    }
125
+    $morehtmlref.='</div>';
126 126
 
127
-	dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
127
+    dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
128 128
 
129
-	print '<div class="fichecenter">';
130
-	print '<div class="underbanner clearboth"></div>';
129
+    print '<div class="fichecenter">';
130
+    print '<div class="underbanner clearboth"></div>';
131 131
 
132
-	$cssclass="titlefield";
133
-	include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
132
+    $cssclass="titlefield";
133
+    include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
134 134
 
135
-	dol_fiche_end();
135
+    dol_fiche_end();
136 136
 }
137 137
 
138 138
 llxFooter();
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
 
48 48
 // Security check
49 49
 $socid=0;
50
-if ($user->societe_id) $socid=$user->societe_id;
50
+if ($user->societe_id) {
51
+    $socid=$user->societe_id;
52
+}
51 53
 $result=restrictedArea($user,'don',$id,'');
52 54
 
53 55
 $object = new Don($db);
@@ -98,10 +100,11 @@  discard block
 block discarded – undo
98 100
 	    $morehtmlref.=$langs->trans('Project') . ' ';
99 101
 	    if ($user->rights->don->creer)
100 102
 	    {
101
-	        if ($action != 'classify')
102
-	            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
103
+	        if ($action != 'classify') {
104
+	        	            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
103 105
 	            if ($action == 'classify') {
104 106
                     $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
107
+	        }
105 108
 	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
106 109
 	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
107 110
 	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
Please login to merge, or discard this patch.
dolibarr/htdocs/don/info.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
41 41
 
42 42
 // Security check
43
-if ($user->societe_id) $socid = $user->societe_id;
43
+if ($user->societe_id) {
44
+    $socid = $user->societe_id;
45
+}
44 46
 $result = restrictedArea($user, 'don', $id, '');
45 47
 
46 48
 $object = new Don($db);
@@ -79,10 +81,11 @@  discard block
 block discarded – undo
79 81
     $langs->load("projects");
80 82
     $morehtmlref .= $langs->trans('Project') . ' ';
81 83
     if ($user->rights->don->creer) {
82
-        if ($action != 'classify')
83
-            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
84
+        if ($action != 'classify') {
85
+                    // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
84 86
             if ($action == 'classify') {
85 87
                 $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
88
+        }
86 89
                 $morehtmlref .= '<input type="hidden" name="action" value="classin">';
87 90
                 $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
88 91
                 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
Please login to merge, or discard this patch.