Completed
Branch develop (f580bb)
by
unknown
22:52
created
dev/initdata/purge-data.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 $sapi_type = php_sapi_name();
29 29
 $script_file = basename(__FILE__);
30
-$path=__DIR__.'/';
30
+$path = __DIR__.'/';
31 31
 
32 32
 // Test si mode batch
33 33
 if (substr($sapi_type, 0, 3) == 'cgi') {
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 }
37 37
 
38 38
 // Recupere root dolibarr
39
-$path=preg_replace('/purge-data.php/i', '', $_SERVER["PHP_SELF"]);
39
+$path = preg_replace('/purge-data.php/i', '', $_SERVER["PHP_SELF"]);
40 40
 require $path."../../htdocs/master.inc.php";
41 41
 include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
42 42
 include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 $langs->loadLangs(array("main", "errors"));
49 49
 
50 50
 // Global variables
51
-$version=DOL_VERSION;
52
-$error=0;
51
+$version = DOL_VERSION;
52
+$error = 0;
53 53
 
54 54
 // List of sql to execute
55
-$sqls=array(
55
+$sqls = array(
56 56
 	'user'=>array(
57 57
 		"DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user IN (SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin') AND fk_user IN (select rowid FROM ".MAIN_DB_PREFIX."user where datec < '__DATE__')",
58 58
 		"DELETE FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin' AND datec < '__DATE__'",
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 $option = $argv[2];
184 184
 $date = $argv[3];
185 185
 
186
-if (empty($mode) || ! in_array($mode, array('test','confirm'))) {
186
+if (empty($mode) || !in_array($mode, array('test', 'confirm'))) {
187 187
 	print "Usage:  $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
188 188
 	print "\n";
189 189
 	print "option can be ".implode(',', array_keys($sqls))."\n";
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 	exit(1);
197 197
 }
198 198
 if ($option != 'all') {
199
-	$listofoptions=explode(',', $option);
199
+	$listofoptions = explode(',', $option);
200 200
 	foreach ($listofoptions as $cursoroption) {
201
-		if (! in_array($cursoroption, array_keys($sqls))) {
201
+		if (!in_array($cursoroption, array_keys($sqls))) {
202 202
 			print "Usage:  $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
203 203
 			print "\n";
204 204
 			print "option '".$cursoroption."' must be in list ".implode(',', array_keys($sqls))."\n";
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	}
208 208
 }
209 209
 
210
-if (empty($date) || (! preg_match('/\d\d\d\d\-\d\d\-\d\d$/', $date) && $date != 'all')) {
210
+if (empty($date) || (!preg_match('/\d\d\d\d\-\d\d\-\d\d$/', $date) && $date != 'all')) {
211 211
 	print "Usage:  $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
212 212
 	print "\n";
213 213
 	print "date can be 'all' or 'YYYY-MM-DD' to delete record before YYYY-MM-DD\n";
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
 if (!empty($argv[4])) {
223 223
 	$db->close();
224 224
 	unset($db);
225
-	$db=getDoliDBInstance($argv[4], $argv[5], $argv[6], $argv[7], $argv[8], $argv[9]);
226
-	$user=new User($db);
225
+	$db = getDoliDBInstance($argv[4], $argv[5], $argv[6], $argv[7], $argv[8], $argv[9]);
226
+	$user = new User($db);
227 227
 }
228 228
 
229
-$ret=$user->fetch('', 'admin');
230
-if (! $ret > 0) {
229
+$ret = $user->fetch('', 'admin');
230
+if (!$ret > 0) {
231 231
 	print 'An admin user with login "admin" must exists to use this script.'."\n";
232 232
 	exit;
233 233
 }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 print "User = ".$db->database_user."\n";
243 243
 print "\n";
244 244
 
245
-if (! $confirmed) {
245
+if (!$confirmed) {
246 246
 	print "Hit Enter to continue or CTRL+C to stop...\n";
247 247
 	$input = trim(fgets(STDIN));
248 248
 }
@@ -259,10 +259,10 @@  discard block
 block discarded – undo
259 259
 {
260 260
 	global $db, $sqls;
261 261
 
262
-	$error=0;
262
+	$error = 0;
263 263
 	foreach ($sqls[$family] as $sql) {
264 264
 		if (preg_match('/^@/', $sql)) {
265
-			$newfamily=preg_replace('/@/', '', $sql);
265
+			$newfamily = preg_replace('/@/', '', $sql);
266 266
 			processfamily($newfamily, $date);
267 267
 			continue;
268 268
 		}
@@ -271,8 +271,8 @@  discard block
 block discarded – undo
271 271
 
272 272
 		print "Run sql: ".$sql."\n";
273 273
 
274
-		$resql=$db->query($sql);
275
-		if (! $resql) {
274
+		$resql = $db->query($sql);
275
+		if (!$resql) {
276 276
 			if ($db->errno() != 'DB_ERROR_NOSUCHTABLE') {
277 277
 				$error++;
278 278
 			}
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
 
296 296
 $db->begin();
297 297
 
298
-$listofoptions=explode(',', $option);
298
+$listofoptions = explode(',', $option);
299 299
 foreach ($listofoptions as $cursoroption) {
300
-	$oldfamily='';
300
+	$oldfamily = '';
301 301
 	foreach ($sqls as $family => $familysql) {
302 302
 		if ($cursoroption && $cursoroption != 'all' && $cursoroption != $family) {
303 303
 			continue;
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 		}
309 309
 		$oldfamily = $family;
310 310
 
311
-		$result=processfamily($family, $date);
311
+		$result = processfamily($family, $date);
312 312
 		if ($result < 0) {
313 313
 			$error++;
314 314
 			break;
Please login to merge, or discard this patch.
dev/initdata/import-products.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 // Test si mode batch
30 30
 $sapi_type = php_sapi_name();
31 31
 $script_file = basename(__FILE__);
32
-$path=dirname(__FILE__).'/';
32
+$path = dirname(__FILE__).'/';
33 33
 if (substr($sapi_type, 0, 3) == 'cgi') {
34 34
 	echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
35 35
 	exit;
36 36
 }
37 37
 
38 38
 // Recupere root dolibarr
39
-$path=preg_replace('/import-products.php/i', '', $_SERVER["PHP_SELF"]);
39
+$path = preg_replace('/import-products.php/i', '', $_SERVER["PHP_SELF"]);
40 40
 require $path."../../htdocs/master.inc.php";
41 41
 include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
42 42
 include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -67,39 +67,39 @@  discard block
 block discarded – undo
67 67
 $startlinenb = empty($argv[4]) ? 1 : $argv[4];
68 68
 $endlinenb = empty($argv[5]) ? 0 : $argv[5];
69 69
 
70
-if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
70
+if (empty($mode) || !in_array($mode, array('test', 'confirm', 'confirmforced')) || empty($filepath)) {
71 71
 	print "Usage:  $script_file (test|confirm|confirmforced) filepath.csv [defaultlang] [startlinenb] [endlinenb]\n";
72 72
 	print "Usage:  $script_file test myfilepath.csv fr_FR 2 1002\n";
73 73
 	print "\n";
74 74
 	exit(1);
75 75
 }
76
-if (! file_exists($filepath)) {
76
+if (!file_exists($filepath)) {
77 77
 	print "Error: File ".$filepath." not found.\n";
78 78
 	print "\n";
79 79
 	exit(1);
80 80
 }
81 81
 
82 82
 $ret = $user->fetch('', 'admin');
83
-if (! $ret > 0) {
83
+if (!$ret > 0) {
84 84
 	print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
85 85
 	exit;
86 86
 }
87 87
 $user->loadRights();
88 88
 
89 89
 // Ask confirmation
90
-if (! $confirmed) {
90
+if (!$confirmed) {
91 91
 	print "Hit Enter to continue or CTRL+C to stop...\n";
92 92
 	$input = trim(fgets(STDIN));
93 93
 }
94 94
 
95 95
 // Open input and output files
96 96
 $fhandle = fopen($filepath, 'r');
97
-if (! $fhandle) {
97
+if (!$fhandle) {
98 98
 	print 'Error: Failed to open file '.$filepath."\n";
99 99
 	exit(1);
100 100
 }
101 101
 $fhandleerr = fopen($filepatherr, 'w');
102
-if (! $fhandleerr) {
102
+if (!$fhandleerr) {
103 103
 	print 'Error: Failed to open file '.$filepatherr."\n";
104 104
 	exit(1);
105 105
 }
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 
110 110
 $db->begin();
111 111
 
112
-$i=0;
112
+$i = 0;
113 113
 $nboflines++;
114
-while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) {
114
+while ($fields = fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) {
115 115
 	$i++;
116
-	$errorrecord=0;
116
+	$errorrecord = 0;
117 117
 
118 118
 	if ($startlinenb && $i < $startlinenb) {
119 119
 		continue;
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	$produit->volume = price2num($fields[8]);
136 136
 	$produit->volume_unit = 0;
137 137
 	$produit->weight = price2num($fields[9]);
138
-	$produit->weight_units = 0;          // -3 = g
138
+	$produit->weight_units = 0; // -3 = g
139 139
 
140 140
 	$produit->customcode = $fields[10];
141 141
 	$produit->barcode = $fields[1];
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 	$produit->cost_price = price2num($fields[16]);
157 157
 
158 158
 	// Extrafields
159
-	$produit->array_options['options_ecotaxdeee']=price2num($fields[17]);
159
+	$produit->array_options['options_ecotaxdeee'] = price2num($fields[17]);
160 160
 
161
-	$ret=$produit->create($user);
161
+	$ret = $produit->create($user);
162 162
 	if ($ret < 0) {
163 163
 		print " - Error in create result code = ".$ret." - ".$produit->errorsToString();
164 164
 		$errorrecord++;
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
 	dol_syslog("Add prices");
170 170
 
171 171
 	// If we use price level, insert price for each level
172
-	if (! $errorrecord && 1) {
173
-		$ret1=$produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array());
174
-		$ret2=$produit->updatePrice(price2num($fields[14]), 'HT', $user, $produit->tva_tx, $produit->price_min, 2, $produit->tva_npr, 0, 0, array());
172
+	if (!$errorrecord && 1) {
173
+		$ret1 = $produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array());
174
+		$ret2 = $produit->updatePrice(price2num($fields[14]), 'HT', $user, $produit->tva_tx, $produit->price_min, 2, $produit->tva_npr, 0, 0, array());
175 175
 		if ($ret1 < 0 || $ret2 < 0) {
176 176
 			print " - Error in updatePrice result code = ".$ret1." ".$ret2." - ".$produit->errorsToString();
177 177
 			$errorrecord++;
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	dol_syslog("Add multilangs");
184 184
 
185 185
 	// Add alternative languages
186
-	if (! $errorrecord && 1) {
187
-		$produit->multilangs['fr_FR']=array('label'=>$produit->label, 'description'=>$produit->description, 'note'=>$produit->note_private);
188
-		$produit->multilangs['en_US']=array('label'=>$fields[3], 'description'=>$produit->description, 'note'=>$produit->note_private);
186
+	if (!$errorrecord && 1) {
187
+		$produit->multilangs['fr_FR'] = array('label'=>$produit->label, 'description'=>$produit->description, 'note'=>$produit->note_private);
188
+		$produit->multilangs['en_US'] = array('label'=>$fields[3], 'description'=>$produit->description, 'note'=>$produit->note_private);
189 189
 
190
-		$ret=$produit->setMultiLangs($user);
190
+		$ret = $produit->setMultiLangs($user);
191 191
 		if ($ret < 0) {
192 192
 			print " - Error in setMultiLangs result code = ".$ret." - ".$produit->errorsToString();
193 193
 			$errorrecord++;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
 	if ($errorrecord) {
202 202
 		fwrite($fhandleerr, 'Error on record nb '.$i." - ".$produit->errorsToString()."\n");
203
-		$error++;    // $errorrecord will be reset
203
+		$error++; // $errorrecord will be reset
204 204
 	}
205 205
 }
206 206
 
Please login to merge, or discard this patch.
dev/initdata/import-users.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 // Test si mode batch
30 30
 $sapi_type = php_sapi_name();
31 31
 $script_file = basename(__FILE__);
32
-$path=dirname(__FILE__).'/';
32
+$path = dirname(__FILE__).'/';
33 33
 if (substr($sapi_type, 0, 3) == 'cgi') {
34 34
 	echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
35 35
 	exit;
36 36
 }
37 37
 
38 38
 // Recupere root dolibarr
39
-$path=preg_replace('/import-users.php/i', '', $_SERVER["PHP_SELF"]);
39
+$path = preg_replace('/import-users.php/i', '', $_SERVER["PHP_SELF"]);
40 40
 require $path."../../htdocs/master.inc.php";
41 41
 include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
42 42
 include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -67,39 +67,39 @@  discard block
 block discarded – undo
67 67
 $startlinenb = empty($argv[3]) ? 1 : $argv[3];
68 68
 $endlinenb = empty($argv[4]) ? 0 : $argv[4];
69 69
 
70
-if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
70
+if (empty($mode) || !in_array($mode, array('test', 'confirm', 'confirmforced')) || empty($filepath)) {
71 71
 	print "Usage:  $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
72 72
 	print "Usage:  $script_file test myfilepath.csv 2 1002\n";
73 73
 	print "\n";
74 74
 	exit(1);
75 75
 }
76
-if (! file_exists($filepath)) {
76
+if (!file_exists($filepath)) {
77 77
 	print "Error: File ".$filepath." not found.\n";
78 78
 	print "\n";
79 79
 	exit(1);
80 80
 }
81 81
 
82
-$ret=$user->fetch('', 'admin');
83
-if (! $ret > 0) {
82
+$ret = $user->fetch('', 'admin');
83
+if (!$ret > 0) {
84 84
 	print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
85 85
 	exit;
86 86
 }
87 87
 $user->loadRights();
88 88
 
89 89
 // Ask confirmation
90
-if (! $confirmed) {
90
+if (!$confirmed) {
91 91
 	print "Hit Enter to continue or CTRL+C to stop...\n";
92 92
 	$input = trim(fgets(STDIN));
93 93
 }
94 94
 
95 95
 // Open input and output files
96 96
 $fhandle = fopen($filepath, 'r');
97
-if (! $fhandle) {
97
+if (!$fhandle) {
98 98
 	print 'Error: Failed to open file '.$filepath."\n";
99 99
 	exit(1);
100 100
 }
101 101
 $fhandleerr = fopen($filepatherr, 'w');
102
-if (! $fhandleerr) {
102
+if (!$fhandleerr) {
103 103
 	print 'Error: Failed to open file '.$filepatherr."\n";
104 104
 	exit(1);
105 105
 }
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 
110 110
 $db->begin();
111 111
 
112
-$i=0;
113
-$nboflines=0;
114
-while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) {
112
+$i = 0;
113
+$nboflines = 0;
114
+while ($fields = fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) {
115 115
 	$i++;
116
-	$errorrecord=0;
116
+	$errorrecord = 0;
117 117
 
118 118
 	if ($startlinenb && $i < $startlinenb) {
119 119
 		continue;
@@ -127,20 +127,20 @@  discard block
 block discarded – undo
127 127
 	$object = new User($db);
128 128
 	$object->status = 1;
129 129
 
130
-	$tmp=explode(' ', $fields[3], 2);
130
+	$tmp = explode(' ', $fields[3], 2);
131 131
 	$object->firstname = trim($tmp[0]);
132 132
 	$object->lastname = trim($tmp[1]);
133 133
 	if ($object->lastname) {
134
-		$object->login = strtolower(substr($object->firstname, 0, 1)) . strtolower(substr($object->lastname, 0));
134
+		$object->login = strtolower(substr($object->firstname, 0, 1)).strtolower(substr($object->lastname, 0));
135 135
 	} else {
136
-		$object->login=strtolower($object->firstname);
136
+		$object->login = strtolower($object->firstname);
137 137
 	}
138
-	$object->login=preg_replace('/ /', '', $object->login);
138
+	$object->login = preg_replace('/ /', '', $object->login);
139 139
 	$object->password = 'init';
140 140
 
141 141
 	print "Process line nb ".$i.", login ".$object->login;
142 142
 
143
-	$ret=$object->create($user);
143
+	$ret = $object->create($user);
144 144
 	if ($ret < 0) {
145 145
 		print " - Error in create result code = ".$ret." - ".$object->errorsToString();
146 146
 		$errorrecord++;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
 	if ($errorrecord) {
154 154
 		fwrite($fhandleerr, 'Error on record nb '.$i." - ".$object->errorsToString()."\n");
155
-		$error++;    // $errorrecord will be reset
155
+		$error++; // $errorrecord will be reset
156 156
 	}
157 157
 }
158 158
 
Please login to merge, or discard this patch.
dev/initdata/import-thirdparties.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 // Test si mode batch
30 30
 $sapi_type = php_sapi_name();
31 31
 $script_file = basename(__FILE__);
32
-$path=dirname(__FILE__).'/';
32
+$path = dirname(__FILE__).'/';
33 33
 if (substr($sapi_type, 0, 3) == 'cgi') {
34 34
 	echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
35 35
 	exit;
36 36
 }
37 37
 
38 38
 // Recupere root dolibarr
39
-$path=preg_replace('/import-thirdparties.php/i', '', $_SERVER["PHP_SELF"]);
39
+$path = preg_replace('/import-thirdparties.php/i', '', $_SERVER["PHP_SELF"]);
40 40
 require $path."../../htdocs/master.inc.php";
41 41
 include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
42 42
 include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -67,39 +67,39 @@  discard block
 block discarded – undo
67 67
 $startlinenb = empty($argv[3]) ? 1 : $argv[3];
68 68
 $endlinenb = empty($argv[4]) ? 0 : $argv[4];
69 69
 
70
-if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
70
+if (empty($mode) || !in_array($mode, array('test', 'confirm', 'confirmforced')) || empty($filepath)) {
71 71
 	print "Usage:  $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
72 72
 	print "Usage:  $script_file test myfilepath.csv 2 1002\n";
73 73
 	print "\n";
74 74
 	exit(1);
75 75
 }
76
-if (! file_exists($filepath)) {
76
+if (!file_exists($filepath)) {
77 77
 	print "Error: File ".$filepath." not found.\n";
78 78
 	print "\n";
79 79
 	exit(1);
80 80
 }
81 81
 
82 82
 $ret = $user->fetch('', 'admin');
83
-if (! $ret > 0) {
83
+if (!$ret > 0) {
84 84
 	print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
85 85
 	exit;
86 86
 }
87 87
 $user->loadRights();
88 88
 
89 89
 // Ask confirmation
90
-if (! $confirmed) {
90
+if (!$confirmed) {
91 91
 	print "Hit Enter to continue or CTRL+C to stop...\n";
92 92
 	$input = trim(fgets(STDIN));
93 93
 }
94 94
 
95 95
 // Open input and output files
96 96
 $fhandle = fopen($filepath, 'r');
97
-if (! $fhandle) {
97
+if (!$fhandle) {
98 98
 	print 'Error: Failed to open file '.$filepath."\n";
99 99
 	exit(1);
100 100
 }
101 101
 $fhandleerr = fopen($filepatherr, 'w');
102
-if (! $fhandleerr) {
102
+if (!$fhandleerr) {
103 103
 	print 'Error: Failed to open file '.$filepatherr."\n";
104 104
 	exit(1);
105 105
 }
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 
110 110
 $db->begin();
111 111
 
112
-$i=0;
113
-$nboflines=0;
114
-while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) {
112
+$i = 0;
113
+$nboflines = 0;
114
+while ($fields = fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) {
115 115
 	$i++;
116
-	$errorrecord=0;
116
+	$errorrecord = 0;
117 117
 
118 118
 	if ($startlinenb && $i < $startlinenb) {
119 119
 		continue;
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 
176 176
 
177 177
 	// Extrafields
178
-	$object->array_options['options_anastate']=price2num($fields[20]);
179
-	$object->array_options['options_anaregion']=price2num($fields[17]);
178
+	$object->array_options['options_anastate'] = price2num($fields[20]);
179
+	$object->array_options['options_anaregion'] = price2num($fields[17]);
180 180
 
181
-	if (! $errorrecord) {
182
-		$ret=$object->create($user);
181
+	if (!$errorrecord) {
182
+		$ret = $object->create($user);
183 183
 		if ($ret < 0) {
184 184
 			print " - Error in create result code = ".$ret." - ".$object->errorsToString();
185 185
 			$errorrecord++;
@@ -188,24 +188,24 @@  discard block
 block discarded – undo
188 188
 		}
189 189
 	}
190 190
 
191
-	if (! $errorrecord) {
191
+	if (!$errorrecord) {
192 192
 		dol_syslog("Set price level");
193 193
 		$object->set_price_level($object->price_level, $user);
194 194
 	}
195 195
 
196 196
 	// Assign sales representative
197
-	if (! $errorrecord && $fields[3]) {
198
-		$salesrep=new User($db);
197
+	if (!$errorrecord && $fields[3]) {
198
+		$salesrep = new User($db);
199 199
 
200
-		$tmp=explode(' ', $fields[3], 2);
200
+		$tmp = explode(' ', $fields[3], 2);
201 201
 		$salesrep->firstname = trim($tmp[0]);
202 202
 		$salesrep->lastname = trim($tmp[1]);
203 203
 		if ($salesrep->lastname) {
204
-			$salesrep->login = strtolower(substr($salesrep->firstname, 0, 1)) . strtolower(substr($salesrep->lastname, 0));
204
+			$salesrep->login = strtolower(substr($salesrep->firstname, 0, 1)).strtolower(substr($salesrep->lastname, 0));
205 205
 		} else {
206
-			$salesrep->login=strtolower($salesrep->firstname);
206
+			$salesrep->login = strtolower($salesrep->firstname);
207 207
 		}
208
-		$salesrep->login=preg_replace('/ /', '', $salesrep->login);
208
+		$salesrep->login = preg_replace('/ /', '', $salesrep->login);
209 209
 		$salesrep->fetch(0, $salesrep->login);
210 210
 
211 211
 		$result = $object->add_commercial($user, $salesrep->id);
@@ -219,19 +219,19 @@  discard block
 block discarded – undo
219 219
 
220 220
 	dol_syslog("Add invoice contacts");
221 221
 	// Insert an invoice contact if there is an invoice email != standard email
222
-	if (! $errorrecord && $fields[27] && $fields[26] != $fields[27]) {
223
-		$ret1=$ret2=0;
222
+	if (!$errorrecord && $fields[27] && $fields[26] != $fields[27]) {
223
+		$ret1 = $ret2 = 0;
224 224
 
225 225
 		$contact = new Contact($db);
226 226
 		$contact->lastname = $object->name;
227
-		$contact->address=$object->address;
228
-		$contact->zip=$object->zip;
229
-		$contact->town=$object->town;
230
-		$contact->country_id=$object->country_id;
231
-		$contact->email=$fields[27];
232
-		$contact->socid=$object->id;
233
-
234
-		$ret1=$contact->create($user);
227
+		$contact->address = $object->address;
228
+		$contact->zip = $object->zip;
229
+		$contact->town = $object->town;
230
+		$contact->country_id = $object->country_id;
231
+		$contact->email = $fields[27];
232
+		$contact->socid = $object->id;
233
+
234
+		$ret1 = $contact->create($user);
235 235
 		if ($ret1 > 0) {
236 236
 			//$ret2=$contact->add_contact($object->id, 'BILLING');
237 237
 		}
@@ -245,22 +245,22 @@  discard block
 block discarded – undo
245 245
 
246 246
 	dol_syslog("Add delivery contacts");
247 247
 	// Insert a delivery contact
248
-	if (! $errorrecord && $fields[47]) {
249
-		$ret1=$ret2=0;
248
+	if (!$errorrecord && $fields[47]) {
249
+		$ret1 = $ret2 = 0;
250 250
 
251 251
 		$contact2 = new Contact($db);
252 252
 		$contact2->lastname = 'Service livraison - '.$fields[47];
253 253
 		$contact2->address = $fields[48];
254 254
 		$contact2->zip = $fields[50];
255 255
 		$contact2->town = $fields[51];
256
-		$contact2->country_id=dol_getIdFromCode($db, trim($fields[52]), 'c_country', 'code', 'rowid');
257
-		$contact2->note_public=$fields[54];
258
-		$contact2->socid=$object->id;
256
+		$contact2->country_id = dol_getIdFromCode($db, trim($fields[52]), 'c_country', 'code', 'rowid');
257
+		$contact2->note_public = $fields[54];
258
+		$contact2->socid = $object->id;
259 259
 
260 260
 		// Extrafields
261
-		$contact2->array_options['options_anazoneliv']=price2num($fields[53]);
261
+		$contact2->array_options['options_anazoneliv'] = price2num($fields[53]);
262 262
 
263
-		$ret1=$contact2->create($user);
263
+		$ret1 = $contact2->create($user);
264 264
 		if ($ret1 > 0) {
265 265
 			//$ret2=$contact2->add_contact($object->id, 'SHIPPING');
266 266
 		}
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 	if ($errorrecord) {
279 279
 		fwrite($fhandleerr, 'Error on record nb '.$i." - ".$object->errorsToString()."\n");
280
-		$error++;    // $errorrecord will be reset
280
+		$error++; // $errorrecord will be reset
281 281
 	}
282 282
 }
283 283
 
Please login to merge, or discard this patch.
dev/build/generate_filelist_xml.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  */
25 25
 
26 26
 if (!defined('NOREQUIREDB')) {
27
-	define('NOREQUIREDB', '1');	// Do not create database handler $db
27
+	define('NOREQUIREDB', '1'); // Do not create database handler $db
28 28
 }
29 29
 
30 30
 $sapi_type = php_sapi_name();
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 $result = array();
61 61
 while ($i < $argc) {
62 62
 	if (!empty($argv[$i])) {
63
-		parse_str($argv[$i], $result);	// set all params $release, $includecustom, $includeconstant, $buildzip ...
63
+		parse_str($argv[$i], $result); // set all params $release, $includecustom, $includeconstant, $buildzip ...
64 64
 	}
65 65
 	if (!empty($result["release"])) {
66 66
 		$release = $result["release"];
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 		$buildzip = 1;
76 76
 	}
77 77
 	if (preg_match('/includeconstant=/', strval($argv[$i]))) {
78
-		$tmp = explode(':', $result['includeconstant'], 3);			// $includeconstant has been set with previous parse_str()
78
+		$tmp = explode(':', $result['includeconstant'], 3); // $includeconstant has been set with previous parse_str()
79 79
 		if (count($tmp) != 3) {
80
-			print "Error: Bad parameter includeconstant=".$result['includeconstant'] ."\n";
80
+			print "Error: Bad parameter includeconstant=".$result['includeconstant']."\n";
81 81
 			exit(1);
82 82
 		}
83 83
 		$includeconstants[$tmp[0]][$tmp[1]] = $tmp[2];
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 }
153 153
 
154 154
 $gitcommit = 'seetag';
155
-$branchname = preg_replace('/^(\d+\.\d+)\..*$/', '\1', $release);	// Keep only x.y into x.y.z
155
+$branchname = preg_replace('/^(\d+\.\d+)\..*$/', '\1', $release); // Keep only x.y into x.y.z
156 156
 $fileforgit = dirname(dirname(dirname(__FILE__))).'/.git/refs/heads/'.$branchname;
157 157
 print "Try to get last commit ID from file ".$fileforgit."\n";
158 158
 $fileforgitcontent = file_get_contents($fileforgit);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
 // Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php)
182 182
 $regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
183
-$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|escpos-php\/doc|escpos-php\/example|escpos-php\/test|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$';  // Exclude dirs
183
+$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|escpos-php\/doc|escpos-php\/example|escpos-php\/test|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
184 184
 $files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
185 185
 
186 186
 $dir = '';
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 fputs($fp, '<dolibarr_script_dir version="'.$release.'">'."\n");
224 224
 
225 225
 $regextoinclude = '\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
226
-$regextoexclude = '(custom|documents|conf|install)$';  // Exclude dirs
226
+$regextoexclude = '(custom|documents|conf|install)$'; // Exclude dirs
227 227
 $files = dol_dir_list(dirname(__FILE__).'/../../scripts/', 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
228 228
 $dir = '';
229 229
 foreach ($files as $filetmp) {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 fputs($fp, '<dolibarr_unalterable_files version="'.$release.'">'."\n");
265 265
 
266 266
 $regextoinclude = '(\.php|\.sql)$';
267
-$regextoexclude = '';  // Exclude dirs
267
+$regextoexclude = ''; // Exclude dirs
268 268
 $files = dol_dir_list(dirname(__FILE__).'/../../htdocs/blockedlog', 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
269 269
 $dir = '';
270 270
 foreach ($files as $filetmp) {
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 }
293 293
 // Add the SQL file
294 294
 $regextoinclude = 'llx_blockedlog.*(\.php|\.sql)$';
295
-$regextoexclude = '';  // Exclude dirs
295
+$regextoexclude = ''; // Exclude dirs
296 296
 $files = dol_dir_list(dirname(__FILE__).'/../../htdocs/install/mysql/tables', 'files', 0, $regextoinclude, $regextoexclude, 'fullname');
297 297
 foreach ($files as $filetmp) {
298 298
 	$file = $filetmp['fullname'];
Please login to merge, or discard this patch.
htdocs/modulebuilder/template/build/buildzip.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
  */
72 72
 function detectModule()
73 73
 {
74
-	$name  = $version = "";
74
+	$name = $version = "";
75 75
 	$tab = glob("core/modules/mod*.class.php");
76 76
 	if (count($tab) == 0) {
77 77
 		echo "[fail] Error on auto detect data : there is no mod*.class.php file into core/modules dir\n";
@@ -212,15 +212,15 @@  discard block
 block discarded – undo
212 212
 		// Loop through the files in source directory
213 213
 		while ($file = readdir($dir)) {
214 214
 			if (($file != '.') && ($file != '..')) {
215
-				if (is_dir($src . '/' . $file)) {
215
+				if (is_dir($src.'/'.$file)) {
216 216
 					// Recursively calling custom copy function
217 217
 					// for sub directory
218
-					if (!rcopy($src . '/' . $file, $dst . '/' . $file)) {
218
+					if (!rcopy($src.'/'.$file, $dst.'/'.$file)) {
219 219
 						return false;
220 220
 					}
221 221
 				} else {
222 222
 					if (!is_excluded($file)) {
223
-						if (!copy($src . '/' . $file, $dst . '/' . $file)) {
223
+						if (!copy($src.'/'.$file, $dst.'/'.$file)) {
224 224
 							return false;
225 225
 						}
226 226
 					}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 		if ($f->isDot()) {
255 255
 			continue;
256 256
 		} //skip . ..
257
-		$src = $folder . '/' . $f;
257
+		$src = $folder.'/'.$f;
258 258
 		$dst = substr($f->getPathname(), strlen($root));
259 259
 		if ($f->isDir()) {
260 260
 			if ($zip->addEmptyDir($dst)) {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 			}
269 269
 		}
270 270
 		if ($f->isFile()) {
271
-			if (! $zip->addFile($src, $dst)) {
271
+			if (!$zip->addFile($src, $dst)) {
272 272
 				return false;
273 273
 			}
274 274
 		}
@@ -281,22 +281,22 @@  discard block
 block discarded – undo
281 281
  */
282 282
 
283 283
 list($mod, $version) = detectModule();
284
-$outzip = sys_get_temp_dir() . "/module_" . $mod . "-" . $version . ".zip";
284
+$outzip = sys_get_temp_dir()."/module_".$mod."-".$version.".zip";
285 285
 if (file_exists($outzip)) {
286 286
 	secureUnlink($outzip);
287 287
 }
288 288
 
289 289
 //copy all sources into system temp directory
290
-$tmpdir = tempnam(sys_get_temp_dir(), $mod . "-module");
290
+$tmpdir = tempnam(sys_get_temp_dir(), $mod."-module");
291 291
 secureUnlink($tmpdir);
292 292
 mkdirAndCheck($tmpdir);
293
-$dst = $tmpdir . "/" . $mod;
293
+$dst = $tmpdir."/".$mod;
294 294
 mkdirAndCheck($dst);
295 295
 
296 296
 foreach ($listOfModuleContent as $moduleContent) {
297 297
 	foreach (glob($moduleContent) as $entry) {
298
-		if (!rcopy($entry, $dst . '/' . $entry)) {
299
-			echo "[fail]  Error on copy " . $entry . " to " . $dst . "/" . $entry . "\n";
298
+		if (!rcopy($entry, $dst.'/'.$entry)) {
299
+			echo "[fail]  Error on copy ".$entry." to ".$dst."/".$entry."\n";
300 300
 			echo "Please take time to analyze the problem and fix the bug\n";
301 301
 			exit(8);
302 302
 		}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 
306 306
 $z = new ZipArchive();
307 307
 $z->open($outzip, ZIPARCHIVE::CREATE);
308
-zipDir($tmpdir, $z, $tmpdir . '/');
308
+zipDir($tmpdir, $z, $tmpdir.'/');
309 309
 $z->close();
310 310
 delTree($tmpdir);
311 311
 if (file_exists($outzip)) {
Please login to merge, or discard this patch.
htdocs/public/webportal/webportal.main.inc.php 1 patch
Spacing   +13 added lines, -14 removed lines patch added patch discarded remove patch
@@ -63,15 +63,14 @@  discard block
 block discarded – undo
63 63
 		$dolibarr_main_cookie_cryptkey; // This is loaded by filefunc.inc.php
64 64
 
65 65
 		$tmp_instance_unique_id = empty($dolibarr_main_instance_unique_id) ?
66
-			(empty($dolibarr_main_cookie_cryptkey) ? '' :
67
-				$dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id;
66
+			(empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id;
68 67
 		// Unique id of instance
69 68
 
70 69
 		// The recommended value (may be not defined for old versions)
71 70
 		if (!empty($tmp_instance_unique_id)) {
72
-			return sha1('webportal' . $tmp_instance_unique_id);
71
+			return sha1('webportal'.$tmp_instance_unique_id);
73 72
 		} else {
74
-			return sha1('webportal' . $_SERVER['SERVER_NAME'].$_SERVER['DOCUMENT_ROOT'].DOL_DOCUMENT_ROOT);
73
+			return sha1('webportal'.$_SERVER['SERVER_NAME'].$_SERVER['DOCUMENT_ROOT'].DOL_DOCUMENT_ROOT);
75 74
 		}
76 75
 	}
77 76
 }
@@ -82,12 +81,12 @@  discard block
 block discarded – undo
82 81
 }
83 82
 include $relDir.'../../main.inc.php';
84 83
 
85
-require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
86
-require_once DOL_DOCUMENT_ROOT . '/societe/class/societeaccount.class.php';
87
-require_once DOL_DOCUMENT_ROOT . '/public/webportal/lib/webportal.lib.php';
88
-require_once DOL_DOCUMENT_ROOT . '/webportal/class/context.class.php';
89
-require_once DOL_DOCUMENT_ROOT . '/webportal/class/webportalmember.class.php';
90
-require_once DOL_DOCUMENT_ROOT . '/webportal/class/webportalpartnership.class.php';
84
+require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
85
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
86
+require_once DOL_DOCUMENT_ROOT.'/public/webportal/lib/webportal.lib.php';
87
+require_once DOL_DOCUMENT_ROOT.'/webportal/class/context.class.php';
88
+require_once DOL_DOCUMENT_ROOT.'/webportal/class/webportalmember.class.php';
89
+require_once DOL_DOCUMENT_ROOT.'/webportal/class/webportalpartnership.class.php';
91 90
 /**
92 91
  * @var Conf $conf
93 92
  * @var DoliDB $db
@@ -98,8 +97,8 @@  discard block
 block discarded – undo
98 97
 // Must be done after the include of filefunc.inc.php so global variables of conf file are defined (like $dolibarr_main_instance_unique_id or $dolibarr_main_force_https).
99 98
 // Note: the function dol_getprefix is defined into functions.lib.php but may have been defined to return a different key to manage another area to protect.
100 99
 $prefix = dol_getprefix('');
101
-$sessionname = 'WEBPORTAL_SESSID_' . $prefix;
102
-$sessiontimeout = 'WEBPORTAL_SESSTIMEOUT_' . $prefix;
100
+$sessionname = 'WEBPORTAL_SESSID_'.$prefix;
101
+$sessiontimeout = 'WEBPORTAL_SESSTIMEOUT_'.$prefix;
103 102
 if (!empty($_COOKIE[$sessiontimeout]) && session_status() === PHP_SESSION_NONE) {
104 103
 	ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
105 104
 }
@@ -118,7 +117,7 @@  discard block
 block discarded – undo
118 117
 
119 118
 if (!defined('WEBPORTAL_NOREQUIRETRAN') || (!defined('WEBPORTAL_NOLOGIN') && !empty($context->controllerInstance->accessNeedLoggedUser))) {
120 119
 	if (!is_object($langs)) { // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages.
121
-		include_once DOL_DOCUMENT_ROOT . '/core/class/translate.class.php';
120
+		include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
122 121
 		$langs = new Translate("", $conf);
123 122
 		$langcode = (GETPOST('lang', 'aZ09', 1) ? GETPOST('lang', 'aZ09', 1) : (empty($logged_user->conf->MAIN_LANG_DEFAULT) ? getDolGlobalString('MAIN_LANG_DEFAULT', 'auto') : $logged_user->conf->MAIN_LANG_DEFAULT));
124 123
 		if (defined('MAIN_LANG_DEFAULT')) {
@@ -285,7 +284,7 @@  discard block
 block discarded – undo
285 284
 						if (!$error) {
286 285
 							if ($logged_thirdparty->default_lang != $langs->defaultlang && !defined('WEBPORTAL_NOREQUIRETRAN')) {
287 286
 								if (!is_object($langs)) { // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages.
288
-									include_once DOL_DOCUMENT_ROOT . '/core/class/translate.class.php';
287
+									include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
289 288
 									$langs = new Translate("", $conf);
290 289
 									$langs->setDefaultLang($logged_thirdparty->default_lang);
291 290
 								}
Please login to merge, or discard this patch.
htdocs/societe/class/societe.class.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @var string		Prefix to check for any trigger code of any business class to prevent bad value for trigger code.
63 63
 	 * @see CommonTrigger::call_trigger()
64 64
 	 */
65
-	public $TRIGGER_PREFIX = 'COMPANY'; 	// to be overridden in child class implementations, i.e. 'BILL', 'TASK', 'PROPAL', etc.
65
+	public $TRIGGER_PREFIX = 'COMPANY'; // to be overridden in child class implementations, i.e. 'BILL', 'TASK', 'PROPAL', etc.
66 66
 
67 67
 	/**
68 68
 	 * @var string ID of module.
@@ -1087,8 +1087,8 @@  discard block
 block discarded – undo
1087 1087
 			$sql .= ", '".$this->db->escape($this->ip)."'";
1088 1088
 			if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
1089 1089
 				$sql .= ", ".(empty($this->vat_reverse_charge) ? '0' : '1');
1090
-				$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1091
-				$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1090
+				$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1091
+				$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1092 1092
 			}
1093 1093
 			$sql .= ")";
1094 1094
 
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 				}
1142 1142
 
1143 1143
 				if ($ret >= 0) {
1144
-					if (! $notrigger) {
1144
+					if (!$notrigger) {
1145 1145
 						// Call trigger
1146 1146
 						$result = $this->call_trigger('COMPANY_CREATE', $user);
1147 1147
 						if ($result < 0) {
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
 						if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) {
1386 1386
 							$langs->loadLangs(array("errors", 'compta'));
1387 1387
 							$error++;
1388
-							$this->errors[] = $langs->trans('CustomerAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1388
+							$this->errors[] = $langs->trans('CustomerAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')';
1389 1389
 						}
1390 1390
 					}
1391 1391
 
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
 					if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) {
1394 1394
 						$langs->loadLangs(array("errors", 'compta'));
1395 1395
 						$error++;
1396
-						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1396
+						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')';
1397 1397
 					}
1398 1398
 				} elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER' && !empty($this->fournisseur)) {
1399 1399
 					// Check for unicity
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
 						if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) {
1402 1402
 							$langs->loadLangs(array("errors", 'compta'));
1403 1403
 							$error++;
1404
-							$this->errors[] = $langs->trans('SupplierAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1404
+							$this->errors[] = $langs->trans('SupplierAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')';
1405 1405
 						}
1406 1406
 					}
1407 1407
 
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 					if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_SUPPLIER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) {
1410 1410
 						$langs->loadLangs(array("errors", 'compta'));
1411 1411
 						$error++;
1412
-						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1412
+						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')';
1413 1413
 					}
1414 1414
 				}
1415 1415
 			}
@@ -1459,17 +1459,17 @@  discard block
 block discarded – undo
1459 1459
 		$now = dol_now();
1460 1460
 
1461 1461
 		// Clean parameters
1462
-		$this->id 			= $id;
1463
-		$this->entity 		= ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
1462
+		$this->id = $id;
1463
+		$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
1464 1464
 		$this->name 		= $this->name ? trim($this->name) : trim((string) $this->nom);
1465 1465
 		$this->nom 			= $this->name; // For backward compatibility
1466
-		$this->name_alias 	= trim((string) $this->name_alias);
1466
+		$this->name_alias = trim((string) $this->name_alias);
1467 1467
 		$this->ref_ext		= (empty($this->ref_ext) ? '' : trim($this->ref_ext));
1468 1468
 		$this->address		= trim((string) $this->address);
1469 1469
 		$this->zip 			= trim((string) $this->zip);
1470 1470
 		$this->town 		= trim((string) $this->town);
1471
-		$this->state_id 	= (is_numeric($this->state_id)) ? (int) $this->state_id : 0;
1472
-		$this->country_id 	= ($this->country_id > 0) ? $this->country_id : 0;
1471
+		$this->state_id = (is_numeric($this->state_id)) ? (int) $this->state_id : 0;
1472
+		$this->country_id = ($this->country_id > 0) ? $this->country_id : 0;
1473 1473
 		$this->phone		= trim((string) $this->phone);
1474 1474
 		$this->phone		= preg_replace("/\s/", "", $this->phone);
1475 1475
 		$this->phone		= preg_replace("/\./", "", $this->phone);
@@ -1479,7 +1479,7 @@  discard block
 block discarded – undo
1479 1479
 		$this->fax			= trim((string) $this->fax);
1480 1480
 		$this->fax			= preg_replace("/\s/", "", $this->fax);
1481 1481
 		$this->fax			= preg_replace("/\./", "", $this->fax);
1482
-		$this->email		= trim((string) $this->email);
1482
+		$this->email = trim((string) $this->email);
1483 1483
 		$this->url			= $this->url ? clean_url($this->url, 0) : '';
1484 1484
 		$this->note_private = (empty($this->note_private) ? '' : trim($this->note_private));
1485 1485
 		$this->note_public  = (empty($this->note_public) ? '' : trim($this->note_public));
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
 			$sql .= ",tva_assuj = ".($this->tva_assuj != '' ? "'".$this->db->escape((string) $this->tva_assuj)."'" : "null");
1649 1649
 			$sql .= ",tva_intra = '".$this->db->escape($this->tva_intra)."'";
1650 1650
 			if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
1651
-				$sql .= ",vat_reverse_charge = " . ($this->vat_reverse_charge != '' ? "'" . $this->db->escape((string) $this->vat_reverse_charge) . "'" : 0);
1651
+				$sql .= ",vat_reverse_charge = ".($this->vat_reverse_charge != '' ? "'".$this->db->escape((string) $this->vat_reverse_charge)."'" : 0);
1652 1652
 			}
1653 1653
 			$sql .= ",status = ".((int) $this->status);
1654 1654
 
@@ -1710,8 +1710,8 @@  discard block
 block discarded – undo
1710 1710
 			$sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount != '' ? $this->supplier_order_min_amount : 'null');
1711 1711
 			$sql .= ",fk_prospectlevel='".$this->db->escape($this->fk_prospectlevel)."'";
1712 1712
 			if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
1713
-				$sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'";
1714
-				$sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'";
1713
+				$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
1714
+				$sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'";
1715 1715
 				if ($customer) {
1716 1716
 					$sql .= ", accountancy_code_customer_general = ".(!empty($this->accountancy_code_customer_general) ? "'".$this->db->escape($this->accountancy_code_customer_general)."'" : "null");
1717 1717
 					$sql .= ", code_compta = ".(!empty($this->code_compta_client) ? "'".$this->db->escape($this->code_compta_client)."'" : "null");
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 					$this->vat_reverse_charge = 0;
2111 2111
 				}
2112 2112
 
2113
-				$this->status				= $obj->status;
2113
+				$this->status = $obj->status;
2114 2114
 
2115 2115
 				// Local Taxes
2116 2116
 				$this->localtax1_assuj      = $obj->localtax1_assuj;
@@ -2138,7 +2138,7 @@  discard block
 block discarded – undo
2138 2138
 
2139 2139
 				$this->mode_reglement_id 	= $obj->mode_reglement;
2140 2140
 				$this->cond_reglement_id 	= $obj->cond_reglement;
2141
-				$this->deposit_percent		= $obj->deposit_percent;
2141
+				$this->deposit_percent = $obj->deposit_percent;
2142 2142
 				$this->transport_mode_id 	= $obj->transport_mode;
2143 2143
 				$this->mode_reglement_supplier_id = $obj->mode_reglement_supplier;
2144 2144
 				$this->cond_reglement_supplier_id = $obj->cond_reglement_supplier;
@@ -2303,7 +2303,7 @@  discard block
 block discarded – undo
2303 2303
 		}
2304 2304
 
2305 2305
 		if ($sqlprof) {
2306
-			$sqlprofquery = $sqlstart . " AND (".$sqlprof." )";
2306
+			$sqlprofquery = $sqlstart." AND (".$sqlprof." )";
2307 2307
 			$resql = $this->db->query($sqlprofquery);
2308 2308
 			if ($resql) {
2309 2309
 				$num = $this->db->num_rows($resql);
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
 		}
2357 2357
 
2358 2358
 		if ($sqlref) {
2359
-			$sqlrefquery = $sqlstart . " AND (".$sqlref." )";
2359
+			$sqlrefquery = $sqlstart." AND (".$sqlref." )";
2360 2360
 			$resql = $this->db->query($sqlrefquery);
2361 2361
 			if ($resql) {
2362 2362
 				$num = $this->db->num_rows($resql);
@@ -2875,7 +2875,7 @@  discard block
 block discarded – undo
2875 2875
 			$sortfield = 'u.lastname,u.firstname';
2876 2876
 		}
2877 2877
 		if (empty($sortorder)) {
2878
-			$sortorder = str_repeat('ASC,', count(explode(',', $sortfield)) - 1) . 'ASC';
2878
+			$sortorder = str_repeat('ASC,', count(explode(',', $sortfield)) - 1).'ASC';
2879 2879
 		}
2880 2880
 		$sql .= $this->db->order($sortfield, $sortorder);
2881 2881
 
@@ -2892,10 +2892,10 @@  discard block
 block discarded – undo
2892 2892
 					$reparray[$i]['firstname'] = $obj->firstname;
2893 2893
 					$reparray[$i]['email'] = $obj->email;
2894 2894
 					$reparray[$i]['phone'] = $obj->office_phone;
2895
-					$reparray[$i]['office_phone'] = $obj->office_phone;			// Pro phone
2895
+					$reparray[$i]['office_phone'] = $obj->office_phone; // Pro phone
2896 2896
 					$reparray[$i]['office_fax'] = $obj->office_fax;
2897
-					$reparray[$i]['user_mobile'] = $obj->user_mobile;			// Pro mobile
2898
-					$reparray[$i]['personal_mobile'] = $obj->personal_mobile;	// Personal mobile
2897
+					$reparray[$i]['user_mobile'] = $obj->user_mobile; // Pro mobile
2898
+					$reparray[$i]['personal_mobile'] = $obj->personal_mobile; // Personal mobile
2899 2899
 					$reparray[$i]['job'] = $obj->job;
2900 2900
 					$reparray[$i]['statut'] = $obj->status; // deprecated
2901 2901
 					$reparray[$i]['status'] = $obj->status;
@@ -3108,7 +3108,7 @@  discard block
 block discarded – undo
3108 3108
 			$datas['status'] = ' '.$this->getLibStatut(5);
3109 3109
 		}
3110 3110
 		if (isset($this->client) && isset($this->fournisseur)) {
3111
-			$datas['type'] = ' &nbsp; ' . $this->getTypeUrl(1, '', 0, 'span');
3111
+			$datas['type'] = ' &nbsp; '.$this->getTypeUrl(1, '', 0, 'span');
3112 3112
 		}
3113 3113
 		$datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag(dol_string_nohtmltag($this->name));
3114 3114
 		if (!empty($this->name_alias) && empty($noaliasinname)) {
@@ -3176,9 +3176,9 @@  discard block
 block discarded – undo
3176 3176
 		}
3177 3177
 		// show categories for this record only in ajax to not overload lists
3178 3178
 		if (!$nofetch && isModEnabled('category') && $this->client) {
3179
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
3179
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
3180 3180
 			$form = new Form($this->db);
3181
-			$datas['categories_customer'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1);
3181
+			$datas['categories_customer'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1);
3182 3182
 		}
3183 3183
 		if (!empty($this->code_fournisseur) && $this->fournisseur) {
3184 3184
 			$datas['suppliercode'] = '<br><b>'.$langs->trans('SupplierCode').':</b> '.$this->code_fournisseur;
@@ -3189,9 +3189,9 @@  discard block
 block discarded – undo
3189 3189
 		}
3190 3190
 		// show categories for this record only in ajax to not overload lists
3191 3191
 		if (!$nofetch && isModEnabled('category') && $this->fournisseur) {
3192
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
3192
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
3193 3193
 			$form = new Form($this->db);
3194
-			$datas['categories_supplier'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1);
3194
+			$datas['categories_supplier'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1);
3195 3195
 		}
3196 3196
 
3197 3197
 		$datas['divclose'] = '</div>';
@@ -3738,7 +3738,7 @@  discard block
 block discarded – undo
3738 3738
 	{
3739 3739
 		// phpcs:enable
3740 3740
 		require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
3741
-		$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type = 'ban' AND default_rib = 1 AND fk_soc = ". (int) $this->id;
3741
+		$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type = 'ban' AND default_rib = 1 AND fk_soc = ".(int) $this->id;
3742 3742
 		$resql = $this->db->query($sql);
3743 3743
 		if (!$resql) {
3744 3744
 			$this->error = $this->db->lasterror();
@@ -4128,7 +4128,7 @@  discard block
 block discarded – undo
4128 4128
 		global $langs;
4129 4129
 
4130 4130
 		if ($company_id > 0) {
4131
-			$sql = "SELECT parent FROM " . MAIN_DB_PREFIX . "societe WHERE rowid = ".((int) $company_id);
4131
+			$sql = "SELECT parent FROM ".MAIN_DB_PREFIX."societe WHERE rowid = ".((int) $company_id);
4132 4132
 			$resql = $this->db->query($sql);
4133 4133
 			if ($resql) {
4134 4134
 				if ($obj = $this->db->fetch_object($resql)) {
@@ -4768,7 +4768,7 @@  discard block
 block discarded – undo
4768 4768
 		$country_code = $country_label = '';
4769 4769
 		if (getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')) {
4770 4770
 			$tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY'));
4771
-			$country_id =  (is_numeric($tmp[0])) ? (int) $tmp[0] : 0;
4771
+			$country_id = (is_numeric($tmp[0])) ? (int) $tmp[0] : 0;
4772 4772
 			if (!empty($tmp[1])) {   // If $conf->global->MAIN_INFO_SOCIETE_COUNTRY is "id:code:label"
4773 4773
 				$country_code = $tmp[1];
4774 4774
 				$country_label = $tmp[2];
@@ -5654,7 +5654,7 @@  discard block
 block discarded – undo
5654 5654
 		if (method_exists($this, 'getLibStatut')) {
5655 5655
 			$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
5656 5656
 		}
5657
-		$return .= '</div>';	// end info-box-content
5657
+		$return .= '</div>'; // end info-box-content
5658 5658
 		$return .= '</div>';
5659 5659
 		$return .= '</div>';
5660 5660
 
@@ -5757,7 +5757,7 @@  discard block
 block discarded – undo
5757 5757
 		global $conf, $langs, $hookmanager, $user, $action;
5758 5758
 
5759 5759
 		$error = 0;
5760
-		$soc_origin = new Societe($this->db);		// The thirdparty that we will delete
5760
+		$soc_origin = new Societe($this->db); // The thirdparty that we will delete
5761 5761
 
5762 5762
 		dol_syslog("mergeCompany merge thirdparty id=".$soc_origin_id." (will be deleted) into the thirdparty id=".$this->id);
5763 5763
 
Please login to merge, or discard this patch.
htdocs/api/class/api_setup.class.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1295,7 +1295,7 @@  discard block
 block discarded – undo
1295 1295
 					$list[$tab->elementtype][$tab->name]['computed'] = $tab->fieldcomputed;
1296 1296
 					$list[$tab->elementtype][$tab->name]['unique'] = $tab->fieldunique;
1297 1297
 					$list[$tab->elementtype][$tab->name]['required'] = $tab->fieldrequired;
1298
-					$list[$tab->elementtype][$tab->name]['param'] = ($tab->param ? jsonOrUnserialize($tab->param) : '');	// This may be a string encoded with serialise() or json_encode()
1298
+					$list[$tab->elementtype][$tab->name]['param'] = ($tab->param ? jsonOrUnserialize($tab->param) : ''); // This may be a string encoded with serialise() or json_encode()
1299 1299
 					$list[$tab->elementtype][$tab->name]['pos'] = $tab->pos;
1300 1300
 					$list[$tab->elementtype][$tab->name]['alwayseditable'] = $tab->alwayseditable;
1301 1301
 					$list[$tab->elementtype][$tab->name]['perms'] = $tab->perms;
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 					$answer[$tab->elementtype][$tab->name]['computed'] = $tab->fieldcomputed;
1408 1408
 					$answer[$tab->elementtype][$tab->name]['unique'] = $tab->fieldunique;
1409 1409
 					$answer[$tab->elementtype][$tab->name]['required'] = $tab->fieldrequired;
1410
-					$answer[$tab->elementtype][$tab->name]['param'] = ($tab->param ? jsonOrUnserialize($tab->param) : '');	// This may be a string encoded with serialise() or json_encode()
1410
+					$answer[$tab->elementtype][$tab->name]['param'] = ($tab->param ? jsonOrUnserialize($tab->param) : ''); // This may be a string encoded with serialise() or json_encode()
1411 1411
 					$answer[$tab->elementtype][$tab->name]['pos'] = $tab->pos;
1412 1412
 					$answer[$tab->elementtype][$tab->name]['alwayseditable'] = $tab->alwayseditable;
1413 1413
 					$answer[$tab->elementtype][$tab->name]['perms'] = $tab->perms;
@@ -2665,7 +2665,7 @@  discard block
 block discarded – undo
2665 2665
 				throw new RestException(500, $langs->trans('XmlNotFound').': /install/'.$xmlshortfile);
2666 2666
 			}
2667 2667
 		} else {
2668
-			$xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0);	// Accept http or https links on external remote server only. Same is used into filecheck.php.
2668
+			$xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only. Same is used into filecheck.php.
2669 2669
 
2670 2670
 			// Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
2671 2671
 			if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != 400 && $xmlarray['http_code'] != 404) {
@@ -2734,7 +2734,7 @@  discard block
 block discarded – undo
2734 2734
 
2735 2735
 				// Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php)
2736 2736
 				$regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
2737
-				$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|escpos-php\/doc|escpos-php\/example|escpos-php\/test|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$';  // Exclude dirs
2737
+				$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|escpos-php\/doc|escpos-php\/example|escpos-php\/test|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
2738 2738
 				$scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);
2739 2739
 
2740 2740
 				// Fill file_list with files in signature, new files, modified files
@@ -2846,7 +2846,7 @@  discard block
 block discarded – undo
2846 2846
 						$out .= '<tr class="oddeven">';
2847 2847
 						$out .= '<td>'.$i.'</td>'."\n";
2848 2848
 						$out .= '<td>'.dol_escape_htmltag($file['filename']).'</td>'."\n";
2849
-						$out .= '<td class="center">'.$file['expectedmd5'].'</td>'."\n";  // @phan-suppress-current-line PhanTypeInvalidDimOffset,PhanTypeSuspiciousStringExpression
2849
+						$out .= '<td class="center">'.$file['expectedmd5'].'</td>'."\n"; // @phan-suppress-current-line PhanTypeInvalidDimOffset,PhanTypeSuspiciousStringExpression
2850 2850
 						$out .= '<td class="center">'.$file['md5'].'</td>'."\n";
2851 2851
 						$size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
2852 2852
 						$totalsize += $size;
Please login to merge, or discard this patch.