Completed
Branch develop (d97ff7)
by
unknown
25:29
created
dev/tools/phan/config.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 	'bom' => 'Bom',
77 77
 	'bookcal' => 'BookCal',
78 78
 	'bookmark' => 'Bookmark',
79
-	'cashdesk' => null,  // TODO: fill in proper class
79
+	'cashdesk' => null, // TODO: fill in proper class
80 80
 	'category' => 'Categorie',
81 81
 	'clicktodial' => 'ClickToDial',
82 82
 	'collab' => 'Collab',
83 83
 	'comptabilite' => 'Comptabilite',
84
-	'contact' => null,  // TODO: fill in proper class
84
+	'contact' => null, // TODO: fill in proper class
85 85
 	'contract' => 'Contrat',
86 86
 	'cron' => 'Cron',
87 87
 	'datapolicy' => 'DataPolicy',
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	'don' => 'Don',
94 94
 	'dynamicprices' => 'DynamicPrices',
95 95
 	'ecm' => 'ECM',
96
-	'ecotax' => null,  // TODO: External module ?
96
+	'ecotax' => null, // TODO: External module ?
97 97
 	'emailcollector' => 'EmailCollector',
98 98
 	'eventorganization' => 'EventOrganization',
99 99
 	'expensereport' => 'ExpenseReport',
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	'fournisseur' => 'Fournisseur',
105 105
 	'ftp' => 'FTP',
106 106
 	'geoipmaxmind' => 'GeoIPMaxmind',
107
-	'google' => null,  // External ?
107
+	'google' => null, // External ?
108 108
 	'gravatar' => 'Gravatar',
109 109
 	'holiday' => 'Holiday',
110 110
 	'hrm' => 'HRM',
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	'ldap' => 'Ldap',
119 119
 	'loan' => 'Loan',
120 120
 	'mailing' => 'Mailing',
121
-	'mailman' => null,  // Same module as mailmanspip -> MailmanSpip ??
121
+	'mailman' => null, // Same module as mailmanspip -> MailmanSpip ??
122 122
 	'mailmanspip' => 'MailmanSpip',
123 123
 	'margin' => 'Margin',
124 124
 	'member' => 'Adherent',
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	'notification' => 'Notification',
132 132
 	'numberwords' => null, // Not provided by default, no module tests
133 133
 	'oauth' => 'OAuth',
134
-	'openstreetmap' => null,  // External module?
134
+	'openstreetmap' => null, // External module?
135 135
 	'opensurvey' => 'OpenSurvey',
136 136
 	'order' => 'Commande',
137 137
 	'partnership' => 'Partnership',
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	'stock' => 'Stock',
159 159
 	'stocktransfer' => 'StockTransfer',
160 160
 	'stripe' => 'Stripe',
161
-	'supplier_invoice' => null,  // Special case, uses invoice
162
-	'supplier_order' => null,  // Special case, uses invoice
161
+	'supplier_invoice' => null, // Special case, uses invoice
162
+	'supplier_order' => null, // Special case, uses invoice
163 163
 	'supplier_proposal' => 'SupplierProposal',
164 164
 	'syslog' => 'Syslog',
165 165
 	'takepos' => 'TakePos',
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	//	'processes' => 6,
222 222
 	'backward_compatibility_checks' => false,
223 223
 	'simplify_ast' => true,
224
-	'analyzed_file_extensions' => ['php','inc'],
224
+	'analyzed_file_extensions' => ['php', 'inc'],
225 225
 	'globals_type_map' => [
226 226
 		'action' => 'string',
227 227
 		'actioncode' => 'string',
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		'objsoc' => '\Societe',
273 273
 		'senderissupplier' => 'int<0,2>',
274 274
 		'user' => '\User',
275
-		'website' => 'string',  // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334  // Disable because Phan infers Website type
275
+		'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334  // Disable because Phan infers Website type
276 276
 		'websitepage' => '\WebSitePage',
277 277
 		'websitepagefile' => 'string',
278 278
 		// 'object' => '\CommonObject',  // Deprecated, not enabled because conflicts with $object assignments
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	// your application should be included in this list.
297 297
 	'directory_list' => [
298 298
 		'htdocs',
299
-		PHAN_DIR . '/stubs/',
299
+		PHAN_DIR.'/stubs/',
300 300
 	],
301 301
 
302 302
 	// A directory list that defines files that will be excluded
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		'htdocs/includes/',
315 315
 		'htdocs/install/doctemplates/websites/',
316 316
 		'htdocs/core/class/lessc.class.php', // External library
317
-		PHAN_DIR . '/stubs/',
317
+		PHAN_DIR.'/stubs/',
318 318
 	],
319 319
 	//'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@',
320 320
 	'exclude_file_regex' => '@^('  // @phpstan-ignore-line
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 		.'|htdocs/includes/stripe/.*'  // @phpstan-ignore-line
332 332
 		.'|htdocs/conf/conf.php'  // @phpstan-ignore-line
333 333
 		// .'|htdocs/[^h].*/.*'  // For testing @phpstan-ignore-line
334
-		.')@',  // @phpstan-ignore-line
334
+		.')@', // @phpstan-ignore-line
335 335
 
336 336
 	// A list of plugin files to execute.
337 337
 	// Plugins which are bundled with Phan can be added here by providing their name
@@ -347,14 +347,14 @@  discard block
 block discarded – undo
347 347
 		'/^isModEnabled$/' => [0, $moduleNameRegex, 'UnknownModuleName'],
348 348
 		// Note: trick to have different key for same regex:
349 349
 		'/^isModEnable[d]$/' => [0, $deprecatedModuleNameRegex, "DeprecatedModuleName"],
350
-		'/^sanitizeVal$/' => [1, $sanitizeRegex,"UnknownSanitizeType"],
351
-		'/^checkVal$/' => [1, $sanitizeRegex,"UnknownCheckValSanitizeType"],
352
-		'/^\\\\ExtraFields::addExtraField$/' => [2, $extraFieldTypeRegex,"UnknownExtrafieldTypeBack"],
353
-		'/^dol_now$/' => [0, '{^(?:auto|gmt|tz(?:server|ref|user(?:rel)?))$}',"InvalidDolNowArgument"],
354
-		'/^dol_mktime$/' => [6, '{^(?:|0|1|auto|gmt|tz(?:server|ref|user(?:rel)?|,[+a-zA-Z-/]+))$}',"InvalidDolMktimeArgument"],  // '', 0, 1 match bool and int values
355
-		'/^dol_print_date$/' => [2, '{^(?:|0|1|auto|gmt|tz(?:server|user(?:rel)?))$}',"InvalidDolMktimeArgument"],  // '', 0, 1 match bool and int values
356
-		'/^GETPOSTFLOAT$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}',"InvalidGetPostFloatRounding"],
357
-		'/^price2num$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}',"InvalidPrice2NumRounding"],
350
+		'/^sanitizeVal$/' => [1, $sanitizeRegex, "UnknownSanitizeType"],
351
+		'/^checkVal$/' => [1, $sanitizeRegex, "UnknownCheckValSanitizeType"],
352
+		'/^\\\\ExtraFields::addExtraField$/' => [2, $extraFieldTypeRegex, "UnknownExtrafieldTypeBack"],
353
+		'/^dol_now$/' => [0, '{^(?:auto|gmt|tz(?:server|ref|user(?:rel)?))$}', "InvalidDolNowArgument"],
354
+		'/^dol_mktime$/' => [6, '{^(?:|0|1|auto|gmt|tz(?:server|ref|user(?:rel)?|,[+a-zA-Z-/]+))$}', "InvalidDolMktimeArgument"], // '', 0, 1 match bool and int values
355
+		'/^dol_print_date$/' => [2, '{^(?:|0|1|auto|gmt|tz(?:server|user(?:rel)?))$}', "InvalidDolMktimeArgument"], // '', 0, 1 match bool and int values
356
+		'/^GETPOSTFLOAT$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}', "InvalidGetPostFloatRounding"],
357
+		'/^price2num$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}', "InvalidPrice2NumRounding"],
358 358
 	],
359 359
 	'plugins' => [
360 360
 		__DIR__.'/plugins/NoVarDumpPlugin.php',
@@ -415,42 +415,42 @@  discard block
 block discarded – undo
415 415
 		// Dolibarr uses a lot of internal deprecated stuff, not reporting
416 416
 		'PhanDeprecatedProperty',
417 417
 
418
-		'PhanCompatibleNegativeStringOffset',	// return false positive
419
-		'PhanPluginConstantVariableBool',		// a lot of false positive, in most cases, we want to keep the code as it is
418
+		'PhanCompatibleNegativeStringOffset', // return false positive
419
+		'PhanPluginConstantVariableBool', // a lot of false positive, in most cases, we want to keep the code as it is
420 420
 		// 'PhanPluginUnknownArrayPropertyType',	// this option costs more time to be supported than it solves time
421
-		'PhanTypeArraySuspiciousNullable',		// this option costs more time to be supported than it solves time
421
+		'PhanTypeArraySuspiciousNullable', // this option costs more time to be supported than it solves time
422 422
 		// 'PhanTypeInvalidDimOffset',			// Helps identify missing array indexes in types or reference to unset indexes
423 423
 		'PhanTypeObjectUnsetDeclaredProperty',
424
-		'PhanTypePossiblyInvalidDimOffset',			// a lot of false positive, in most cases, we want to keep the code as it is
424
+		'PhanTypePossiblyInvalidDimOffset', // a lot of false positive, in most cases, we want to keep the code as it is
425 425
 		// 'PhanPluginUnknownArrayFunctionReturnType',	// a lot of false positive, in most cases, we want to keep the code as it is
426 426
 
427
-		'PhanPluginWhitespaceTab',		// Dolibarr uses tabs
428
-		'PhanPluginCanUsePHP71Void',	// Dolibarr is maintaining 7.0 compatibility
429
-		'PhanPluginShortArray',			// Dolibarr uses array()
430
-		'PhanPluginShortArrayList',		// Dolibarr uses array()
427
+		'PhanPluginWhitespaceTab', // Dolibarr uses tabs
428
+		'PhanPluginCanUsePHP71Void', // Dolibarr is maintaining 7.0 compatibility
429
+		'PhanPluginShortArray', // Dolibarr uses array()
430
+		'PhanPluginShortArrayList', // Dolibarr uses array()
431 431
 		// Fixers From PHPDocToRealTypesPlugin:
432
-		'PhanPluginCanUseParamType',			// Fixer - Report/Add types in the function definition (function abc(string $var) (adds string)
433
-		'PhanPluginCanUseReturnType',			// Fixer - Report/Add return types in the function definition (function abc(string $var) (adds string)
434
-		'PhanPluginCanUseNullableParamType',	// Fixer - Report/Add nullable parameter types in the function definition
435
-		'PhanPluginCanUseNullableReturnType',	// Fixer - Report/Add nullable return types in the function definition
432
+		'PhanPluginCanUseParamType', // Fixer - Report/Add types in the function definition (function abc(string $var) (adds string)
433
+		'PhanPluginCanUseReturnType', // Fixer - Report/Add return types in the function definition (function abc(string $var) (adds string)
434
+		'PhanPluginCanUseNullableParamType', // Fixer - Report/Add nullable parameter types in the function definition
435
+		'PhanPluginCanUseNullableReturnType', // Fixer - Report/Add nullable return types in the function definition
436 436
 
437
-		'PhanPluginNonBoolBranch',			// Not essential - 31240+ occurrences
438
-		'PhanPluginNumericalComparison',	// Not essential - 19870+ occurrences
439
-		'PhanTypeMismatchArgument',			// Also reported by phpstan < lvl6 - 12300+ occurrences
440
-		'PhanPluginNonBoolInLogicalArith',	// Not essential - 11040+ occurrences
441
-		'PhanPluginConstantVariableScalar',	// Not essential - 5180+ occurrences
437
+		'PhanPluginNonBoolBranch', // Not essential - 31240+ occurrences
438
+		'PhanPluginNumericalComparison', // Not essential - 19870+ occurrences
439
+		'PhanTypeMismatchArgument', // Also reported by phpstan < lvl6 - 12300+ occurrences
440
+		'PhanPluginNonBoolInLogicalArith', // Not essential - 11040+ occurrences
441
+		'PhanPluginConstantVariableScalar', // Not essential - 5180+ occurrences
442 442
 		'PhanPluginDuplicateAdjacentStatement',
443
-		'PhanPluginDuplicateConditionalTernaryDuplication',		// 2750+ occurrences
444
-		'PhanPluginDuplicateConditionalNullCoalescing',	// Not essential - 990+ occurrences
445
-		'PhanPluginRedundantAssignmentInGlobalScope',	// Not essential, a lot of false warning
446
-		'PhanPluginRedundantAssignment',				// Not essential, useless
447
-		'PhanPluginDuplicateCatchStatementBody',  // Requires PHP7.1 - 50+ occurrences
443
+		'PhanPluginDuplicateConditionalTernaryDuplication', // 2750+ occurrences
444
+		'PhanPluginDuplicateConditionalNullCoalescing', // Not essential - 990+ occurrences
445
+		'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning
446
+		'PhanPluginRedundantAssignment', // Not essential, useless
447
+		'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences
448 448
 
449 449
 		// 'PhanPluginUnknownArrayMethodParamType',	// Too many troubles to manage. Is enabled in config_extended only.
450 450
 		// 'PhanPluginUnknownArrayMethodReturnType',	// Too many troubles to manage. Is enabled in config_extended only.
451 451
 		// 'PhanUndeclaredGlobalVariable',			// Helps identify variables that are not set/defined - add '@phan-var-force TYPE $varname' in tpl or includes to help type the variable
452 452
 		// 'PhanPluginUnknownObjectMethodCall',	// False positive for some class. Is enabled in config_extended only.
453
-		'PhanTypeSuspiciousNonTraversableForeach',  // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code.
453
+		'PhanTypeSuspiciousNonTraversableForeach', // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code.
454 454
 	],
455 455
 	// You can put relative paths to internal stubs in this config option.
456 456
 	// Phan will continue using its detailed type annotations,
@@ -469,31 +469,31 @@  discard block
 block discarded – undo
469 469
 		//'xdebug'	=> 'vendor/phan/phan/.phan/internal_stubs/xdebug.phan_php',
470 470
 		//'memcached'  => PHAN_DIR . '/your_internal_stubs_folder_name/memcached.phan_php',
471 471
 		//'PDO'  => PHAN_DIR . '/stubs/PDO.phan_php',
472
-		'brotli'  => PHAN_DIR . '/stubs/brotli.phan_php',
473
-		'curl'  => PHAN_DIR . '/stubs/curl.phan_php',
474
-		'calendar'  => PHAN_DIR . '/stubs/calendar.phan_php',
475
-		'fileinfo'  => PHAN_DIR . '/stubs/fileinfo.phan_php',
476
-		'ftp'  => PHAN_DIR . '/stubs/ftp.phan_php',
477
-		'gd'  => PHAN_DIR . '/stubs/gd.phan_php',
478
-		'geoip'  => PHAN_DIR . '/stubs/geoip.phan_php',
479
-		'imagick'  => PHAN_DIR . '/stubs/imagick.phan_php',
480
-		'imap'  => PHAN_DIR . '/stubs/imap.phan_php',
481
-		'intl'  => PHAN_DIR . '/stubs/intl.phan_php',
482
-		'ldap'  => PHAN_DIR . '/stubs/ldap.phan_php',
483
-		'mcrypt'  => PHAN_DIR . '/stubs/mcrypt.phan_php',
484
-		'memcache'  => PHAN_DIR . '/stubs/memcache.phan_php',
485
-		'memcached' => PHAN_DIR . '/stubs/memcached.phan_php',
486
-		'mysqli'  => PHAN_DIR . '/stubs/mysqli.phan_php',
487
-		'pdo_cubrid'  => PHAN_DIR . '/stubs/pdo_cubrid.phan_php',
488
-		'pdo_mysql'  => PHAN_DIR . '/stubs/pdo_mysql.phan_php',
489
-		'pdo_pgsql'  => PHAN_DIR . '/stubs/pdo_pgsql.phan_php',
490
-		'pdo_sqlite'  => PHAN_DIR . '/stubs/pdo_sqlite.phan_php',
491
-		'pgsql'  => PHAN_DIR . '/stubs/pgsql.phan_php',
492
-		'session'  => PHAN_DIR . '/stubs/session.phan_php',
493
-		'simplexml'  => PHAN_DIR . '/stubs/SimpleXML.phan_php',
494
-		'soap'  => PHAN_DIR . '/stubs/soap.phan_php',
495
-		'sockets'  => PHAN_DIR . '/stubs/sockets.phan_php',
496
-		'tidy'  => PHAN_DIR . '/stubs/tidy.phan_php',
497
-		'zip'  => PHAN_DIR . '/stubs/zip.phan_php',
472
+		'brotli'  => PHAN_DIR.'/stubs/brotli.phan_php',
473
+		'curl'  => PHAN_DIR.'/stubs/curl.phan_php',
474
+		'calendar'  => PHAN_DIR.'/stubs/calendar.phan_php',
475
+		'fileinfo'  => PHAN_DIR.'/stubs/fileinfo.phan_php',
476
+		'ftp'  => PHAN_DIR.'/stubs/ftp.phan_php',
477
+		'gd'  => PHAN_DIR.'/stubs/gd.phan_php',
478
+		'geoip'  => PHAN_DIR.'/stubs/geoip.phan_php',
479
+		'imagick'  => PHAN_DIR.'/stubs/imagick.phan_php',
480
+		'imap'  => PHAN_DIR.'/stubs/imap.phan_php',
481
+		'intl'  => PHAN_DIR.'/stubs/intl.phan_php',
482
+		'ldap'  => PHAN_DIR.'/stubs/ldap.phan_php',
483
+		'mcrypt'  => PHAN_DIR.'/stubs/mcrypt.phan_php',
484
+		'memcache'  => PHAN_DIR.'/stubs/memcache.phan_php',
485
+		'memcached' => PHAN_DIR.'/stubs/memcached.phan_php',
486
+		'mysqli'  => PHAN_DIR.'/stubs/mysqli.phan_php',
487
+		'pdo_cubrid'  => PHAN_DIR.'/stubs/pdo_cubrid.phan_php',
488
+		'pdo_mysql'  => PHAN_DIR.'/stubs/pdo_mysql.phan_php',
489
+		'pdo_pgsql'  => PHAN_DIR.'/stubs/pdo_pgsql.phan_php',
490
+		'pdo_sqlite'  => PHAN_DIR.'/stubs/pdo_sqlite.phan_php',
491
+		'pgsql'  => PHAN_DIR.'/stubs/pgsql.phan_php',
492
+		'session'  => PHAN_DIR.'/stubs/session.phan_php',
493
+		'simplexml'  => PHAN_DIR.'/stubs/SimpleXML.phan_php',
494
+		'soap'  => PHAN_DIR.'/stubs/soap.phan_php',
495
+		'sockets'  => PHAN_DIR.'/stubs/sockets.phan_php',
496
+		'tidy'  => PHAN_DIR.'/stubs/tidy.phan_php',
497
+		'zip'  => PHAN_DIR.'/stubs/zip.phan_php',
498 498
 	],
499 499
 ];
Please login to merge, or discard this patch.
htdocs/projet/card.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
 $permissiontoadd = $user->hasRight('projet', 'creer');
114 114
 $permissiontodelete = $user->hasRight('projet', 'supprimer');
115
-$permissiondellink = $user->hasRight('projet', 'creer');	// Used by the include of actions_dellink.inc.php
115
+$permissiondellink = $user->hasRight('projet', 'creer'); // Used by the include of actions_dellink.inc.php
116 116
 
117 117
 
118 118
 /*
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		$action = '';
164 164
 	}
165 165
 
166
-	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';		// Must be 'include', not 'include_once'
166
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
167 167
 
168 168
 	// Action setdraft object
169 169
 	if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissiontoadd) {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		$action = '';
178 178
 
179 179
 		// For backward compatibility
180
-		$object->statut = $object::STATUS_DRAFT;	// this already set for $object->status by $object->setStatut()
180
+		$object->statut = $object::STATUS_DRAFT; // this already set for $object->status by $object->setStatut()
181 181
 	}
182 182
 
183 183
 	// Action add
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 			$object->date_end_event   = (!GETPOST('date_end_event')) ? '' : $date_end_event;
327 327
 			$object->location     = $location;
328 328
 			if (GETPOSTISSET('opp_amount')) {
329
-				$object->opp_amount   = price2num(GETPOST('opp_amount', 'alpha'));
329
+				$object->opp_amount = price2num(GETPOST('opp_amount', 'alpha'));
330 330
 			}
331 331
 			if (GETPOSTISSET('budget_amount')) {
332 332
 				$object->budget_amount = price2num(GETPOST('budget_amount', 'alpha'));
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 			if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) {
515 515
 				$tmpurl = $_SESSION['pageforbacktolist']['project'];
516 516
 				$tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl);
517
-				$urlback = $tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1';
517
+				$urlback = $tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?').'restore_lastsearch_values=1';
518 518
 			} else {
519 519
 				$urlback = DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1';
520 520
 			}
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 	$userDelete = $object->restrictedProjectArea($user, 'delete');
966 966
 	//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
967 967
 
968
-	$formconfirm = "" ;
968
+	$formconfirm = "";
969 969
 
970 970
 	// Confirmation validation
971 971
 	if ($action == 'validate') {
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 				print '<br>';
1104 1104
 			}
1105 1105
 			if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
1106
-				print '<input type="checkbox" id="usage_task" name="usage_task"' . (GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')) . '> ';
1106
+				print '<input type="checkbox" id="usage_task" name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'> ';
1107 1107
 				$htmltext = $langs->trans("ProjectFollowTasks");
1108 1108
 				print '<label for="usage_task">'.$form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext).'</label>';
1109 1109
 				print '<script>';
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 				print '<br>';
1130 1130
 			}
1131 1131
 			if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) {
1132
-				print '<input type="checkbox" id="usage_bill_time" name="usage_bill_time"' . (GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')) . '> ';
1132
+				print '<input type="checkbox" id="usage_bill_time" name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'> ';
1133 1133
 				$htmltext = $langs->trans("ProjectBillTimeDescription");
1134 1134
 				print '<label for="usage_bill_time">'.$form->textwithpicto($langs->trans("BillTime"), $htmltext).'</label>';
1135 1135
 				print '<script>';
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 				print '<br>';
1156 1156
 			}
1157 1157
 			if (isModEnabled('eventorganization')) {
1158
-				print '<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'. (GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_organize_event ? ' checked="checked"' : '')) . '> ';
1158
+				print '<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_organize_event ? ' checked="checked"' : '')).'> ';
1159 1159
 				$htmltext = $langs->trans("EventOrganizationDescriptionLong");
1160 1160
 				print '<label for="usage_organize_event">'.$form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext).'</label>';
1161 1161
 				print '<script>';
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 		if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) {
1335 1335
 			$tmpurl = $_SESSION['pageforbacktolist']['project'];
1336 1336
 			$tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl);
1337
-			$linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
1337
+			$linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?').'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
1338 1338
 		} else {
1339 1339
 			$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
1340 1340
 		}
@@ -1422,8 +1422,8 @@  discard block
 block discarded – undo
1422 1422
 				print '<a class="editfielda paddingtop" href="'.$_SERVER["PHP_SELF"].'?action=edit_opp_status&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
1423 1423
 			}
1424 1424
 			print '</td><td>';
1425
-			$html_name_status 	= ($action == 'edit_opp_status') ? 'opp_status' : 'none';
1426
-			$html_name_percent 	= ($action == 'edit_opp_status') ? 'opp_percent' : 'none';
1425
+			$html_name_status = ($action == 'edit_opp_status') ? 'opp_status' : 'none';
1426
+			$html_name_percent = ($action == 'edit_opp_status') ? 'opp_percent' : 'none';
1427 1427
 			$percent_value = (GETPOSTISSET('opp_percent') ? GETPOST('opp_percent') : (strcmp($object->opp_percent, '') ? vatrate($object->opp_percent) : ''));
1428 1428
 			$formproject->formOpportunityStatus($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->opp_status, $percent_value, $html_name_status, $html_name_percent);
1429 1429
 			print '</td></tr>';
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
 					if ($userWrite > 0) {
1637 1637
 						print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?action=confirm_setdraft&amp;confirm=yes&amp;token='.newToken().'&amp;id='.$object->id, '');
1638 1638
 					} else {
1639
-						print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('SetToDraft'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
1639
+						print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('SetToDraft'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
1640 1640
 					}
1641 1641
 				}
1642 1642
 			}
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
 				if ($userWrite > 0) {
1647 1647
 					print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '');
1648 1648
 				} else {
1649
-					print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Modify'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
1649
+					print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Modify'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
1650 1650
 				}
1651 1651
 			}
1652 1652
 
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 				if ($userWrite > 0) {
1656 1656
 					print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&amp;token='.newToken().'&amp;id='.$object->id, '');
1657 1657
 				} else {
1658
-					print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
1658
+					print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
1659 1659
 				}
1660 1660
 			}
1661 1661
 
@@ -1664,7 +1664,7 @@  discard block
 block discarded – undo
1664 1664
 				if ($userWrite > 0) {
1665 1665
 					print dolGetButtonAction('', $langs->trans('Close'), 'default', $_SERVER["PHP_SELF"].'?action=close&amp;token='.newToken().'&amp;id='.$object->id, '');
1666 1666
 				} else {
1667
-					print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Close'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
1667
+					print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Close'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
1668 1668
 				}
1669 1669
 			}
1670 1670
 
@@ -1673,7 +1673,7 @@  discard block
 block discarded – undo
1673 1673
 				if ($userWrite > 0) {
1674 1674
 					print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&amp;token='.newToken().'&amp;id='.$object->id, '');
1675 1675
 				} else {
1676
-					print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('ReOpen'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
1676
+					print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('ReOpen'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
1677 1677
 				}
1678 1678
 			}
1679 1679
 
@@ -1705,7 +1705,7 @@  discard block
 block discarded – undo
1705 1705
 				if ($userWrite > 0) {
1706 1706
 					print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.((int) $object->id), '');
1707 1707
 				} else {
1708
-					print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
1708
+					print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
1709 1709
 				}
1710 1710
 			}
1711 1711
 
@@ -1714,7 +1714,7 @@  discard block
 block discarded – undo
1714 1714
 				if ($userDelete > 0 || ($object->status == Project::STATUS_DRAFT && $user->hasRight('projet', 'creer'))) {
1715 1715
 					print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '');
1716 1716
 				} else {
1717
-					print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
1717
+					print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
1718 1718
 				}
1719 1719
 			}
1720 1720
 		}
Please login to merge, or discard this patch.
modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$this->situationinvoice = false;
168 168
 
169 169
 		if ($mysoc === null) {
170
-			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
170
+			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'.getCallerInfoString(), LOG_ERR);
171 171
 			return;
172 172
 		}
173 173
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 					if (!empty($conf->mycompany->multidir_output[$object->entity])) {
274 274
 						$logodir = $conf->mycompany->multidir_output[$object->entity];
275 275
 					}
276
-					$pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
276
+					$pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
277 277
 					$tplidx = $pdf->importPage(1);
278 278
 				}
279 279
 
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 				// Pagefoot
615 615
 				$this->_pagefoot($pdf, $object, $outputlangs);
616 616
 				if (method_exists($pdf, 'AliasNbPages')) {
617
-					$pdf->AliasNbPages();  // @phan-suppress-current-line PhanUndeclaredMethod
617
+					$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
618 618
 				}
619 619
 
620 620
 				$pdf->Close();
Please login to merge, or discard this patch.
modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		$this->option_draft_watermark = 0; // Support add of a watermark on drafts
99 99
 
100 100
 		if ($mysoc === null) {
101
-			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
101
+			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'.getCallerInfoString(), LOG_ERR);
102 102
 			return;
103 103
 		}
104 104
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		$maxfilesizearray = getMaxFileSizeArray();
194 194
 		$maxmin = $maxfilesizearray['maxmin'];
195 195
 		if ($maxmin > 0) {
196
-			$texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
196
+			$texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
197 197
 		}
198 198
 		$texte .= ' <input type="file" name="uploadfile">';
199 199
 		$texte .= '<input type="hidden" value="RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 				dol_mkdir($conf->recruitment->dir_temp);
303 303
 				if (!is_writable($conf->recruitment->dir_temp)) {
304 304
 					$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->recruitment->dir_temp);
305
-					dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
305
+					dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
306 306
 					return -1;
307 307
 				}
308 308
 
Please login to merge, or discard this patch.
template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		$this->option_draft_watermark = 0; // Support add of a watermark on drafts
99 99
 
100 100
 		if ($mysoc === null) {
101
-			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
101
+			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'.getCallerInfoString(), LOG_ERR);
102 102
 			return;
103 103
 		}
104 104
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		$maxfilesizearray = getMaxFileSizeArray();
201 201
 		$maxmin = $maxfilesizearray['maxmin'];
202 202
 		if ($maxmin > 0) {
203
-			$texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
203
+			$texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
204 204
 		}
205 205
 		$texte .= ' <input type="file" name="uploadfile">';
206 206
 		$texte .= '<input type="hidden" value="MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 				$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
287 287
 				$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
288 288
 
289
-				$newfiletmp = $objectref . '_' . $newfiletmp;
289
+				$newfiletmp = $objectref.'_'.$newfiletmp;
290 290
 				//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
291 291
 
292 292
 				// Get extension (ods or odt)
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
 					if ($format == '1') {
297 297
 						$format = '%Y%m%d%H%M%S';
298 298
 					}
299
-					$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
299
+					$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
300 300
 				} else {
301
-					$filename = $newfiletmp . '.' . $newfileformat;
301
+					$filename = $newfiletmp.'.'.$newfileformat;
302 302
 				}
303
-				$file = $dir . '/' . $filename;
303
+				$file = $dir.'/'.$filename;
304 304
 				//print "newdir=".$dir;
305 305
 				//print "newfile=".$newfile;
306 306
 				//print "file=".$file;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				dol_mkdir($conf->mymodule->dir_temp);
310 310
 				if (!is_writable($conf->mymodule->dir_temp)) {
311 311
 					$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->mymodule->dir_temp);
312
-					dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
312
+					dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
313 313
 					return -1;
314 314
 				}
315 315
 
Please login to merge, or discard this patch.
template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		$this->atleastonediscount = 0;
143 143
 
144 144
 		if ($mysoc === null) {
145
-			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
145
+			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'.getCallerInfoString(), LOG_ERR);
146 146
 			return;
147 147
 		}
148 148
 
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 				// Pagefoot
802 802
 				$this->_pagefoot($pdf, $object, $outputlangs);
803 803
 				if (method_exists($pdf, 'AliasNbPages')) {
804
-					$pdf->AliasNbPages();  // @phan-suppress-current-line PhanUndeclaredMethod
804
+					$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
805 805
 				}
806 806
 
807 807
 				$pdf->Close();
Please login to merge, or discard this patch.
htdocs/comm/action/card.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 $offsetunit = GETPOST('offsetunittype_duration', 'aZ09');
75 75
 $remindertype = GETPOST('selectremindertype', 'aZ09');
76 76
 $modelmail = GETPOSTINT('actioncommsendmodel_mail');
77
-$complete = GETPOST('complete', 'alpha');	// 'na' must be allowed
77
+$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed
78 78
 $private = GETPOST('private', 'alphanohtml');
79 79
 if ($complete == 'na' || $complete == -2) {
80 80
 	$complete = -1;
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 		$datef = dol_mktime(GETPOSTINT("p2hour"), GETPOSTINT("p2min"), GETPOSTINT("apsec"), GETPOSTINT("p2month"), GETPOSTINT("p2day"), GETPOSTINT("p2year"), 'tzuserrel');
333 333
 	}
334 334
 	//set end date to now if percentage is set to 100 and end date not set
335
-	$datef = (!$datef && $percentage == 100)?dol_now():$datef;
335
+	$datef = (!$datef && $percentage == 100) ?dol_now() : $datef;
336 336
 
337 337
 	// Check parameters
338 338
 	if (!$datef && $percentage == 100) {
@@ -614,12 +614,12 @@  discard block
 block discarded – undo
614 614
 			if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) {
615 615
 				$firstdatearray = dol_get_first_day_week(GETPOSTINT("apday"), GETPOSTINT("apmonth"), GETPOSTINT("apyear"));
616 616
 				$datep = dol_mktime($fulldayevent ? '00' : GETPOSTINT("aphour"), $fulldayevent ? '00' : GETPOSTINT("apmin"), $fulldayevent ? '00' : GETPOSTINT("apsec"), $firstdatearray['month'], $firstdatearray['first_day'], $firstdatearray['year'], $tzforfullday ? $tzforfullday : 'tzuserrel');
617
-				$datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd');//We begin the week after
617
+				$datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd'); //We begin the week after
618 618
 				$dayoffset = 7;
619 619
 				$monthoffset = 0;
620 620
 			} elseif ($selectedrecurrulefreq == 'MONTHLY' && !empty($selectedrecurrulebymonthday)) {
621 621
 				$firstday = $selectedrecurrulebymonthday;
622
-				$firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth");//We begin the week after
622
+				$firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth"); //We begin the week after
623 623
 				$datep = dol_mktime($fulldayevent ? '00' : GETPOSTINT("aphour"), $fulldayevent ? '00' : GETPOSTINT("apmin"), $fulldayevent ? '00' : GETPOSTINT("apsec"), $firstmonth, $firstday, GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel');
624 624
 				$dayoffset = 0;
625 625
 				$monthoffset = 1;
@@ -724,9 +724,9 @@  discard block
 block discarded – undo
724 724
 
725 725
 				// increment date for recurrent events
726 726
 				$datep = dol_time_plus_duree($datep, $dayoffset, 'd');
727
-				$datep = dol_time_plus_duree($datep, $monthoffset, 'm');  // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
727
+				$datep = dol_time_plus_duree($datep, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
728 728
 				$datef = dol_time_plus_duree($datef, $dayoffset, 'd');
729
-				$datef = dol_time_plus_duree($datef, $monthoffset, 'm');  // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
729
+				$datef = dol_time_plus_duree($datef, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
730 730
 			}
731 731
 		}
732 732
 		if (!empty($backtopage) && !$error) {
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
 if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') {
1069 1069
 	$error = 0;
1070 1070
 
1071
-	$shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel');		// We take the date visible by user $newdate is also date visible by user.
1071
+	$shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user.
1072 1072
 	$smin = (int) dol_print_date($object->datep, "%M", 'tzuserrel');
1073 1073
 
1074 1074
 	$newdate = GETPOST('newdate', 'alpha');
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 								if (new_startdate > old_enddate) {
1243 1243
 									var timeDiff = old_enddate - old_startdate;
1244 1244
 									var new_enddate = new Date(new_startdate.getTime() + timeDiff);
1245
-									$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '"));
1245
+									$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'"));
1246 1246
 									$("#p2day").val(new_enddate.getDate());
1247 1247
 									$("#p2month").val(new_enddate.getMonth() + 1);
1248 1248
 									$("#p2year").val(new_enddate.getFullYear());
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
 		$default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_RDV');
1301 1301
 		print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
1302 1302
 		$selectedvalue = GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default);
1303
-		print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1);	// TODO Replace 0 with -2 in onlyautoornot
1303
+		print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot
1304 1304
 		print '</td></tr>';
1305 1305
 	}
1306 1306
 
@@ -1633,7 +1633,7 @@  discard block
 block discarded – undo
1633 1633
 		}
1634 1634
 		//var_dump('origin='.$origin.' originid='.$originid.' hasPermissionOnLinkedObject='.$hasPermissionOnLinkedObject);
1635 1635
 
1636
-		if (! in_array($origin, array('societe', 'project', 'task', 'user'))) {
1636
+		if (!in_array($origin, array('societe', 'project', 'task', 'user'))) {
1637 1637
 			// We do not use link for object that already contains a hard coded field to make links with agenda events
1638 1638
 			print '<tr><td class="titlefieldcreate">'.$langs->trans("LinkedObject").'</td>';
1639 1639
 			print '<td colspan="3">';
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
 						$("#addreminder").prop("checked", true);
1723 1723
 
1724 1724
 						// Set period with default reminder period
1725
-						$("[name=\"offsetvalue\"]").val("' . $reminderDefaultOffset . '");
1725
+						$("[name=\"offsetvalue\"]").val("' . $reminderDefaultOffset.'");
1726 1726
 						$("#select_offsetunittype_duration").select2("destroy");
1727 1727
 						$("#select_offsetunittype_duration").val("'.$reminderDefaultUnit.'");
1728 1728
 						$("#select_offsetunittype_duration").select2();
@@ -1819,7 +1819,7 @@  discard block
 block discarded – undo
1819 1819
 			$object->socpeopleassigned[$id] = array('id' => $tmpid);
1820 1820
 		}
1821 1821
 		$object->contact_id   = GETPOSTINT("contactid");
1822
-		$object->fk_project  = GETPOSTINT("projectid");
1822
+		$object->fk_project = GETPOSTINT("projectid");
1823 1823
 
1824 1824
 		$object->note_private = GETPOST("note", 'restricthtml');
1825 1825
 	}
@@ -1893,7 +1893,7 @@  discard block
 block discarded – undo
1893 1893
 									if (new_startdate > old_enddate) {
1894 1894
 										var timeDiff = old_enddate - old_startdate;
1895 1895
 										var new_enddate = new Date(new_startdate.getTime() + timeDiff);
1896
-										$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '"));
1896
+										$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'"));
1897 1897
 										$("#p2day").val(new_enddate.getDate());
1898 1898
 										$("#p2month").val(new_enddate.getMonth() + 1);
1899 1899
 										$("#p2year").val(new_enddate.getFullYear());
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
 		if ($backtopage) {
1919 1919
 			print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : '').'">';
1920 1920
 		}
1921
-		if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) {
1921
+		if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && !preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) {
1922 1922
 			print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
1923 1923
 		}
1924 1924
 
@@ -2340,7 +2340,7 @@  discard block
 block discarded – undo
2340 2340
 					});
2341 2341
 			   })';
2342 2342
 			print '</script>'."\n";
2343
-			print '</div>';		// End of div for reminderparameters
2343
+			print '</div>'; // End of div for reminderparameters
2344 2344
 		}
2345 2345
 
2346 2346
 		print dol_get_fiche_end();
@@ -2612,7 +2612,7 @@  discard block
 block discarded – undo
2612 2612
 
2613 2613
 		// Priority
2614 2614
 		if (getDolGlobalString('AGENDA_SUPPORT_PRIORITY_IN_EVENTS')) {
2615
-			print '<tr><td class="nowrap" class="titlefield">' . $langs->trans("Priority") . '</td><td>';
2615
+			print '<tr><td class="nowrap" class="titlefield">'.$langs->trans("Priority").'</td><td>';
2616 2616
 			print($object->priority ? $object->priority : '');
2617 2617
 			print '</td></tr>';
2618 2618
 		}
Please login to merge, or discard this patch.
htdocs/includes/odtphp/odf.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
31 31
 class Odf
32 32
 {
33 33
 	protected $config = array(
34
-		'ZIP_PROXY' => 'PclZipProxy',	// PclZipProxy, PhpZipProxy
34
+		'ZIP_PROXY' => 'PclZipProxy', // PclZipProxy, PhpZipProxy
35 35
 		'DELIMITER_LEFT' => '{',
36 36
 		'DELIMITER_RIGHT' => '}',
37 37
 		'PATH_TO_TMP' => '/tmp'
38 38
 	);
39 39
 	protected $file;
40
-	protected $contentXml;			// To store content of content.xml file
41
-	protected $metaXml;			    // To store content of meta.xml file
42
-	protected $stylesXml;			// To store content of styles.xml file
43
-	protected $manifestXml;			// To store content of META-INF/manifest.xml file
40
+	protected $contentXml; // To store content of content.xml file
41
+	protected $metaXml; // To store content of meta.xml file
42
+	protected $stylesXml; // To store content of styles.xml file
43
+	protected $manifestXml; // To store content of META-INF/manifest.xml file
44 44
 	protected $tmpfile;
45
-	protected $tmpdir='';
45
+	protected $tmpdir = '';
46 46
 	protected $images = array();
47 47
 	protected $vars = array();
48 48
 	protected $segments = array();
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	public $creator;
51 51
 	public $title;
52 52
 	public $subject;
53
-	public $userdefined=array();
53
+	public $userdefined = array();
54 54
 
55 55
 	const PIXEL_TO_CM = 0.026458333;
56 56
 	const FIND_TAGS_REGEX = '/<([A-Za-z0-9]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/s';
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	{
69 69
 		clearstatcache();
70 70
 
71
-		if (! is_array($config)) {
71
+		if (!is_array($config)) {
72 72
 			throw new OdfException('Configuration data must be provided as array');
73 73
 		}
74 74
 		foreach ($config as $configKey => $configValue) {
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
 		}
79 79
 
80 80
 		$md5uniqid = md5(uniqid());
81
-		if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']);	// Remove last \ or /
82
-		$this->tmpdir .= ($this->tmpdir?'/':'').$md5uniqid;
83
-		$this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt';	// We keep .odt extension to allow OpenOffice usage during debug.
81
+		if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); // Remove last \ or /
82
+		$this->tmpdir .= ($this->tmpdir ? '/' : '').$md5uniqid;
83
+		$this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt'; // We keep .odt extension to allow OpenOffice usage during debug.
84 84
 
85 85
 		// A working directory is required for some zip proxy like PclZipProxy
86
-		if (in_array($this->config['ZIP_PROXY'], array('PclZipProxy')) && ! is_dir($this->config['PATH_TO_TMP'])) {
86
+		if (in_array($this->config['ZIP_PROXY'], array('PclZipProxy')) && !is_dir($this->config['PATH_TO_TMP'])) {
87 87
 			throw new OdfException('Temporary directory '.$this->config['PATH_TO_TMP'].' must exists');
88 88
 		}
89 89
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 		$zipHandler = $this->config['ZIP_PROXY'];
97 97
 		if (!defined('PCLZIP_TEMPORARY_DIR')) define('PCLZIP_TEMPORARY_DIR', $this->tmpdir);
98 98
 		include_once 'zip/'.$zipHandler.'.php';
99
-		if (! class_exists($this->config['ZIP_PROXY'])) {
100
-			throw new OdfException($this->config['ZIP_PROXY'] . ' class not found - check your php settings');
99
+		if (!class_exists($this->config['ZIP_PROXY'])) {
100
+			throw new OdfException($this->config['ZIP_PROXY'].' class not found - check your php settings');
101 101
 		}
102 102
 		$this->file = new $zipHandler($this->tmpdir);
103 103
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function setVars($key, $value, $encode = true, $charset = 'ISO-8859')
146 146
 	{
147
-		$tag = $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT'];
147
+		$tag = $this->config['DELIMITER_LEFT'].$key.$this->config['DELIMITER_RIGHT'];
148 148
 
149 149
 		// TODO Warning string may be:
150 150
 		// <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span>
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
 		// Check if the value includes html tags
181 181
 		if ($this->_hasHtmlTag($value) === true) {
182
-			$value = strip_tags($value, '<br><strong><b><i><em><u><s><sub><sup><span>');	// remove html tags except the one into the list in second parameter
182
+			$value = strip_tags($value, '<br><strong><b><i><em><u><s><sub><sup><span>'); // remove html tags except the one into the list in second parameter
183 183
 
184 184
 			// Default styles for strong/b, i/em, u, s, sub & sup
185 185
 			$automaticStyles = array(
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			$convertedValue = $this->_replaceHtmlWithOdtTag($this->_getDataFromHtml($value), $customStyles, $fontDeclarations, $encode, $charset);
198 198
 
199 199
 			foreach ($customStyles as $key => $val) {
200
-				array_push($automaticStyles, '<style:style style:name="customStyle' . $key . '" style:family="text">' . $val . '</style:style>');
200
+				array_push($automaticStyles, '<style:style style:name="customStyle'.$key.'" style:family="text">'.$val.'</style:style>');
201 201
 			}
202 202
 
203 203
 			// Join the styles and add them to the content xml
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
 					$styles .= $style;
208 208
 				}
209 209
 			}
210
-			$this->contentXml = str_replace('</office:automatic-styles>', $styles . '</office:automatic-styles>', $this->contentXml);
210
+			$this->contentXml = str_replace('</office:automatic-styles>', $styles.'</office:automatic-styles>', $this->contentXml);
211 211
 
212 212
 			// Join the font declarations and add them to the content xml
213 213
 			$fonts = '';
214 214
 			foreach ($fontDeclarations as $font) {
215
-				if (strpos($this->contentXml, 'style:name="' . $font . '"') === false) {
216
-					$fonts .= '<style:font-face style:name="' . $font . '" svg:font-family="\'' . $font . '\'" />';
215
+				if (strpos($this->contentXml, 'style:name="'.$font.'"') === false) {
216
+					$fonts .= '<style:font-face style:name="'.$font.'" svg:font-family="\''.$font.'\'" />';
217 217
 				}
218 218
 			}
219
-			$this->contentXml = str_replace('</office:font-face-decls>', $fonts . '</office:font-face-decls>', $this->contentXml);
219
+			$this->contentXml = str_replace('</office:font-face-decls>', $fonts.'</office:font-face-decls>', $this->contentXml);
220 220
 		} else {
221 221
 			$convertedValue = $this->encode_chars($convertedValue, $encode, $charset);
222 222
 			$convertedValue = preg_replace('/(\r\n|\r|\n)/i', "<text:line-break/>", $convertedValue);
@@ -253,23 +253,23 @@  discard block
 block discarded – undo
253 253
 						break;
254 254
 					case 'strong':
255 255
 					case 'b':
256
-						$odtResult .= '<text:span text:style-name="boldText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
256
+						$odtResult .= '<text:span text:style-name="boldText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
257 257
 						break;
258 258
 					case 'i':
259 259
 					case 'em':
260
-						$odtResult .= '<text:span text:style-name="italicText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
260
+						$odtResult .= '<text:span text:style-name="italicText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
261 261
 						break;
262 262
 					case 'u':
263
-						$odtResult .= '<text:span text:style-name="underlineText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
263
+						$odtResult .= '<text:span text:style-name="underlineText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
264 264
 						break;
265 265
 					case 's':
266
-						$odtResult .= '<text:span text:style-name="strikethroughText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
266
+						$odtResult .= '<text:span text:style-name="strikethroughText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
267 267
 						break;
268 268
 					case 'sub':
269
-						$odtResult .= '<text:span text:style-name="subText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
269
+						$odtResult .= '<text:span text:style-name="subText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
270 270
 						break;
271 271
 					case 'sup':
272
-						$odtResult .= '<text:span text:style-name="supText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
272
+						$odtResult .= '<text:span text:style-name="supText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
273 273
 						break;
274 274
 					case 'span':
275 275
 						if (isset($tag['attributes']['style'])) {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 										if (!in_array($fontName, $fontDeclarations)) {
285 285
 											array_push($fontDeclarations, $fontName);
286 286
 										}
287
-										$odtStyles .= '<style:text-properties style:font-name="' . $fontName . '" />';
287
+										$odtStyles .= '<style:text-properties style:font-name="'.$fontName.'" />';
288 288
 										break;
289 289
 									case 'font-size':
290 290
 										if (preg_match('/([0-9]+)\s?(px|pt)/', $styleValue, $matches)) {
@@ -292,21 +292,21 @@  discard block
 block discarded – undo
292 292
 											if ($matches[2] == 'px') {
293 293
 												$fontSize = round($fontSize * 0.75);
294 294
 											}
295
-											$odtStyles .= '<style:text-properties fo:font-size="' . $fontSize . 'pt" style:font-size-asian="' . $fontSize . 'pt" style:font-size-complex="' . $fontSize . 'pt" />';
295
+											$odtStyles .= '<style:text-properties fo:font-size="'.$fontSize.'pt" style:font-size-asian="'.$fontSize.'pt" style:font-size-complex="'.$fontSize.'pt" />';
296 296
 										}
297 297
 										break;
298 298
 									case 'color':
299 299
 										if (preg_match('/#[0-9A-Fa-f]{3}(?:[0-9A-Fa-f]{3})?/', $styleValue)) {
300
-											$odtStyles .= '<style:text-properties fo:color="' . $styleValue . '" />';
300
+											$odtStyles .= '<style:text-properties fo:color="'.$styleValue.'" />';
301 301
 										}
302 302
 										break;
303 303
 								}
304 304
 							}
305 305
 							if (strlen($odtStyles) > 0) {
306 306
 								// Generate a unique id for the style (using microtime and random because some CPUs are really fast...)
307
-								$key = str_replace('.', '', (string) microtime(true)) . uniqid(mt_rand());
307
+								$key = str_replace('.', '', (string) microtime(true)).uniqid(mt_rand());
308 308
 								$customStyles[$key] = $odtStyles;
309
-								$odtResult .= '<text:span text:style-name="customStyle' . $key . '">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
309
+								$odtResult .= '<text:span text:style-name="customStyle'.$key.'">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
310 310
 							}
311 311
 						}
312 312
 						break;
@@ -443,24 +443,24 @@  discard block
 block discarded – undo
443 443
 	public function htmlToUTFAndPreOdf($value)
444 444
 	{
445 445
 		// We decode into utf8, entities
446
-		$value=dol_html_entity_decode($value, ENT_QUOTES|ENT_HTML5);
446
+		$value = dol_html_entity_decode($value, ENT_QUOTES | ENT_HTML5);
447 447
 
448 448
 		// We convert html tags
449
-		$ishtml=dol_textishtml($value);
449
+		$ishtml = dol_textishtml($value);
450 450
 		if ($ishtml) {
451 451
 			// If string is "MYPODUCT - Desc <strong>bold</strong> with &eacute; accent<br />\n<br />\nUn texto en espa&ntilde;ol ?"
452 452
 			// Result after clean must be "MYPODUCT - Desc bold with é accent\n\nUn texto en espa&ntilde;ol ?"
453 453
 
454 454
 			// We want to ignore \n and we want all <br> to be \n
455
-			$value=preg_replace('/(\r\n|\r|\n)/i', '', $value);
456
-			$value=preg_replace('/<br>/i', "\n", $value);
457
-			$value=preg_replace('/<br\s+[^<>\/]*>/i', "\n", $value);
458
-			$value=preg_replace('/<br\s+[^<>\/]*\/>/i', "\n", $value);
455
+			$value = preg_replace('/(\r\n|\r|\n)/i', '', $value);
456
+			$value = preg_replace('/<br>/i', "\n", $value);
457
+			$value = preg_replace('/<br\s+[^<>\/]*>/i', "\n", $value);
458
+			$value = preg_replace('/<br\s+[^<>\/]*\/>/i', "\n", $value);
459 459
 
460 460
 			//$value=preg_replace('/<strong>/','__lt__text:p text:style-name=__quot__bold__quot____gt__',$value);
461 461
 			//$value=preg_replace('/<\/strong>/','__lt__/text:p__gt__',$value);
462 462
 
463
-			$value=dol_string_nohtmltag($value, 0);
463
+			$value = dol_string_nohtmltag($value, 0);
464 464
 		}
465 465
 
466 466
 		return $value;
@@ -536,10 +536,10 @@  discard block
 block discarded – undo
536 536
 				$balise = str_replace('row.', '', $matches2[1]);
537 537
 				// Move segment tags around the row
538 538
 				$replace = array(
539
-					'[!-- BEGIN ' . $matches2[1] . ' --]'	=> '',
540
-					'[!-- END ' . $matches2[1] . ' --]'		=> '',
541
-					'<table:table-row'							=> '[!-- BEGIN ' . $balise . ' --]<table:table-row',
542
-					'</table:table-row>'						=> '</table:table-row>[!-- END ' . $balise . ' --]'
539
+					'[!-- BEGIN '.$matches2[1].' --]'	=> '',
540
+					'[!-- END '.$matches2[1].' --]'		=> '',
541
+					'<table:table-row'							=> '[!-- BEGIN '.$balise.' --]<table:table-row',
542
+					'</table:table-row>'						=> '</table:table-row>[!-- END '.$balise.' --]'
543 543
 				);
544 544
 				$replacedXML = str_replace(array_keys($replace), array_values($replace), $matches[0][$i]);
545 545
 				$this->contentXml = str_replace($matches[0][$i], $replacedXML, $this->contentXml);
@@ -562,14 +562,14 @@  discard block
 block discarded – undo
562 562
 		else return;
563 563
 
564 564
 		// Search all tags found into condition to complete $this->vars, so we will proceed all tests even if not defined
565
-		$reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
565
+		$reg = '@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
566 566
 		$matches = array();
567 567
 		preg_match_all($reg, $xml, $matches, PREG_SET_ORDER);
568 568
 
569 569
 		//var_dump($this->vars);exit;
570 570
 		foreach ($matches as $match) {   // For each match, if there is no entry into this->vars, we add it
571
-			if (! empty($match[1]) && ! isset($this->vars[$match[1]])) {
572
-				$this->vars[$match[1]] = '';     // Not defined, so we set it to '', we just need entry into this->vars for next loop
571
+			if (!empty($match[1]) && !isset($this->vars[$match[1]])) {
572
+				$this->vars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop
573 573
 			}
574 574
 		}
575 575
 		//var_dump($this->vars);exit;
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 				// Remove the IF tag
585 585
 				$xml = str_replace('[!-- IF '.$key.' --]', '', $xml);
586 586
 				// Remove everything between the ELSE tag (if it exists) and the ENDIF tag
587
-				$reg = '@(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
587
+				$reg = '@(\[!--\sELSE\s'.$key.'\s--\](.*))?\[!--\sENDIF\s'.$key.'\s--\]@smU'; // U modifier = all quantifiers are non-greedy
588 588
 				$xml = preg_replace($reg, '', $xml);
589 589
 				/*if ($sav != $xml)
590 590
 				 {
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 				//dol_syslog("Var ".$key." is not defined, we remove the IF, ELSE and ENDIF ");
598 598
 				//$sav=$xml;
599 599
 				// Find all conditional blocks for this variable: from IF to ELSE and to ENDIF
600
-				$reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
600
+				$reg = '@\[!--\sIF\s'.$key.'\s--\](.*)(\[!--\sELSE\s'.$key.'\s--\](.*))?\[!--\sENDIF\s'.$key.'\s--\]@smU'; // U modifier = all quantifiers are non-greedy
601 601
 				preg_match_all($reg, $xml, $matches, PREG_SET_ORDER);
602 602
 				foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause
603 603
 					if (!empty($match[3])) $xml = str_replace($match[0], $match[3], $xml);
@@ -625,12 +625,12 @@  discard block
 block discarded – undo
625 625
 	 */
626 626
 	public function mergeSegment(Segment $segment)
627 627
 	{
628
-		if (! array_key_exists($segment->getName(), $this->segments)) {
629
-			throw new OdfException($segment->getName() . 'cannot be parsed, has it been set yet ?');
628
+		if (!array_key_exists($segment->getName(), $this->segments)) {
629
+			throw new OdfException($segment->getName().'cannot be parsed, has it been set yet ?');
630 630
 		}
631 631
 		$string = $segment->getName();
632 632
 		// $reg = '@<text:p[^>]*>\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]<\/text:p>@smU';
633
-		$reg = '@\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]@smU';
633
+		$reg = '@\[!--\sBEGIN\s'.$string.'\s--\](.*)\[!--.+END\s'.$string.'\s--\]@smU';
634 634
 		$this->contentXml = preg_replace($reg, $segment->getXmlParsed(), $this->contentXml);
635 635
 		return $this;
636 636
 	}
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 	 */
643 643
 	public function printVars()
644 644
 	{
645
-		return print_r('<pre>' . print_r($this->vars, true) . '</pre>', true);
645
+		return print_r('<pre>'.print_r($this->vars, true).'</pre>', true);
646 646
 	}
647 647
 
648 648
 	/**
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 */
664 664
 	public function printDeclaredSegments()
665 665
 	{
666
-		return '<pre>' . print_r(implode(' ', array_keys($this->segments)), true) . '</pre>';
666
+		return '<pre>'.print_r(implode(' ', array_keys($this->segments)), true).'</pre>';
667 667
 	}
668 668
 
669 669
 	/**
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 	{
700 700
 		if ($file !== null && is_string($file)) {
701 701
 			if (file_exists($file) && !(is_file($file) && is_writable($file))) {
702
-				throw new OdfException('Permission denied : can\'t create ' . $file);
702
+				throw new OdfException('Permission denied : can\'t create '.$file);
703 703
 			}
704 704
 			$this->_save();
705 705
 			copy($this->tmpfile, $file);
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 	 */
717 717
 	private function _save()
718 718
 	{
719
-		$res=$this->file->open($this->tmpfile);    // tmpfile is odt template
719
+		$res = $this->file->open($this->tmpfile); // tmpfile is odt template
720 720
 		$this->_parse('content');
721 721
 		$this->_parse('styles');
722 722
 		$this->_parse('meta');
@@ -724,23 +724,23 @@  discard block
 block discarded – undo
724 724
 		$this->setMetaData();
725 725
 		//print $this->metaXml;exit;
726 726
 
727
-		if (! $this->file->addFromString('content.xml', $this->contentXml)) {
727
+		if (!$this->file->addFromString('content.xml', $this->contentXml)) {
728 728
 			throw new OdfException('Error during file export addFromString content');
729 729
 		}
730
-		if (! $this->file->addFromString('meta.xml', $this->metaXml)) {
730
+		if (!$this->file->addFromString('meta.xml', $this->metaXml)) {
731 731
 			throw new OdfException('Error during file export addFromString meta');
732 732
 		}
733
-		if (! $this->file->addFromString('styles.xml', $this->stylesXml)) {
733
+		if (!$this->file->addFromString('styles.xml', $this->stylesXml)) {
734 734
 			throw new OdfException('Error during file export addFromString styles');
735 735
 		}
736 736
 
737 737
 		foreach ($this->images as $imageKey => $imageValue) {
738 738
 			// Add the image inside the ODT document
739
-			$this->file->addFile($imageKey, 'Pictures/' . $imageValue);
739
+			$this->file->addFile($imageKey, 'Pictures/'.$imageValue);
740 740
 			// Add the image to the Manifest (which maintains a list of images, necessary to avoid "Corrupt ODT file. Repair?" when opening the file with LibreOffice)
741 741
 			$this->addImageToManifest($imageValue);
742 742
 		}
743
-		if (! $this->file->addFromString('META-INF/manifest.xml', $this->manifestXml)) {
743
+		if (!$this->file->addFromString('META-INF/manifest.xml', $this->manifestXml)) {
744 744
 			throw new OdfException('Error during file export: manifest.xml');
745 745
 		}
746 746
 		$this->file->close();
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 	 */
755 755
 	public function setMetaData()
756 756
 	{
757
-		if (empty($this->creator)) $this->creator='';
757
+		if (empty($this->creator)) $this->creator = '';
758 758
 
759 759
 		$this->metaXml = preg_replace('/<dc:date>.*<\/dc:date>/', '<dc:date>'.gmdate("Y-m-d\TH:i:s").'</dc:date>', $this->metaXml);
760 760
 		$this->metaXml = preg_replace('/<dc:creator>.*<\/dc:creator>/', '<dc:creator>'.htmlspecialchars($this->creator).'</dc:creator>', $this->metaXml);
@@ -800,8 +800,8 @@  discard block
 block discarded – undo
800 800
 			throw new OdfException("headers already sent ($filename at $linenum)");
801 801
 		}
802 802
 
803
-		if ( $name == "" ) {
804
-			$name = md5(uniqid()) . ".odt";
803
+		if ($name == "") {
804
+			$name = md5(uniqid()).".odt";
805 805
 		}
806 806
 
807 807
 		header('Content-type: application/vnd.oasis.opendocument.text');
@@ -822,18 +822,18 @@  discard block
 block discarded – undo
822 822
 	{
823 823
 		global $conf;
824 824
 
825
-		if ( $name == "" ) $name = "temp".md5(uniqid());
825
+		if ($name == "") $name = "temp".md5(uniqid());
826 826
 
827 827
 		dol_syslog(get_class($this).'::exportAsAttachedPDF $name='.$name, LOG_DEBUG);
828 828
 		$this->saveToDisk($name);
829 829
 
830
-		$execmethod=(empty($conf->global->MAIN_EXEC_USE_POPEN)?1:2);	// 1 or 2
830
+		$execmethod = (empty($conf->global->MAIN_EXEC_USE_POPEN) ? 1 : 2); // 1 or 2
831 831
 		// Method 1 sometimes hang the server.
832 832
 
833 833
 
834 834
 		// Export to PDF using LibreOffice
835 835
 		if (getDolGlobalString('MAIN_ODT_AS_PDF') == 'libreoffice') {
836
-			dol_mkdir($conf->user->dir_temp);	// We must be sure the directory exists and is writable
836
+			dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable
837 837
 
838 838
 			// We delete and recreate a subdir because the soffice may have change pemrissions on it
839 839
 			dol_delete_dir_recursive($conf->user->dir_temp.'/odtaspdf');
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 			// using windows libreoffice that must be in path
844 844
 			// using linux/mac libreoffice that must be in path
845 845
 			// Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1
846
-			$command ='soffice --headless -env:UserInstallation=file:\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name);
846
+			$command = 'soffice --headless -env:UserInstallation=file:\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '.escapeshellarg(dirname($name))." ".escapeshellarg($name);
847 847
 		} elseif (preg_match('/unoconv/', getDolGlobalString('MAIN_ODT_AS_PDF'))) {
848 848
 			// If issue with unoconv, see https://github.com/dagwieers/unoconv/issues/87
849 849
 
@@ -873,13 +873,13 @@  discard block
 block discarded – undo
873 873
 			//$command = '/usr/bin/unoconv -vvv '.escapeshellcmd($name);
874 874
 		} else {
875 875
 			// deprecated old method using odt2pdf.sh (native, jodconverter, ...)
876
-			$tmpname=preg_replace('/\.odt/i', '', $name);
876
+			$tmpname = preg_replace('/\.odt/i', '', $name);
877 877
 
878 878
 			if (getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT')) {
879
-				$command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF'));
879
+				$command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF')) ? 'jodconverter' : getDolGlobalString('MAIN_ODT_AS_PDF'));
880 880
 			} else {
881 881
 				dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING);
882
-				$command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF'));
882
+				$command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF')) ? 'jodconverter' : getDolGlobalString('MAIN_ODT_AS_PDF'));
883 883
 			}
884 884
 		}
885 885
 
@@ -892,14 +892,14 @@  discard block
 block discarded – undo
892 892
 		// $result = $utils->executeCLI($command, $outputfile);  and replace test on $execmethod.
893 893
 		// $retval will be $result['result']
894 894
 		// $errorstring will be $result['output']
895
-		$retval=0; $output_arr=array();
895
+		$retval = 0; $output_arr = array();
896 896
 		if ($execmethod == 1) {
897 897
 			exec($command, $output_arr, $retval);
898 898
 		}
899 899
 		if ($execmethod == 2) {
900 900
 			$outputfile = DOL_DATA_ROOT.'/odt2pdf.log';
901 901
 
902
-			$ok=0;
902
+			$ok = 0;
903 903
 			$handle = fopen($outputfile, 'w');
904 904
 			if ($handle) {
905 905
 				dol_syslog(get_class($this)."Run command ".$command, LOG_DEBUG);
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 				while (!feof($handlein)) {
909 909
 					$read = fgets($handlein);
910 910
 					fwrite($handle, $read);
911
-					$output_arr[]=$read;
911
+					$output_arr[] = $read;
912 912
 				}
913 913
 				pclose($handlein);
914 914
 				fclose($handle);
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 
919 919
 		if ($retval == 0) {
920 920
 			dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG);
921
-			$filename=''; $linenum=0;
921
+			$filename = ''; $linenum = 0;
922 922
 
923 923
 			if (php_sapi_name() != 'cli') {	// If we are in a web context (not into CLI context)
924 924
 				if (headers_sent($filename, $linenum)) {
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 				}
927 927
 
928 928
 				if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
929
-					$name=preg_replace('/\.od(x|t)/i', '', $name);
929
+					$name = preg_replace('/\.od(x|t)/i', '', $name);
930 930
 					header('Content-type: application/pdf');
931 931
 					header('Content-Disposition: attachment; filename="'.$name.'.pdf"');
932 932
 					readfile($name.".pdf");
@@ -941,13 +941,13 @@  discard block
 block discarded – undo
941 941
 			dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr, true), LOG_DEBUG);
942 942
 
943 943
 			if ($retval == 126) {
944
-				throw new OdfException('Permission execute convert script : ' . $command);
944
+				throw new OdfException('Permission execute convert script : '.$command);
945 945
 			} else {
946
-				$errorstring='';
946
+				$errorstring = '';
947 947
 				foreach ($output_arr as $line) {
948
-					$errorstring.= $line."<br>";
948
+					$errorstring .= $line."<br>";
949 949
 				}
950
-				throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : ' . $errorstring);
950
+				throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : '.$errorstring);
951 951
 			}
952 952
 		}
953 953
 	}
@@ -1001,11 +1001,11 @@  discard block
 block discarded – undo
1001 1001
 		if ($handle = opendir($dir)) {
1002 1002
 			while (($file = readdir($handle)) !== false) {
1003 1003
 				if ($file != '.' && $file != '..') {
1004
-					if (is_dir($dir . '/' . $file)) {
1005
-						$this->_rrmdir($dir . '/' . $file);
1006
-						rmdir($dir . '/' . $file);
1004
+					if (is_dir($dir.'/'.$file)) {
1005
+						$this->_rrmdir($dir.'/'.$file);
1006
+						rmdir($dir.'/'.$file);
1007 1007
 					} else {
1008
-						unlink($dir . '/' . $file);
1008
+						unlink($dir.'/'.$file);
1009 1009
 					}
1010 1010
 				}
1011 1011
 			}
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 	 */
1022 1022
 	public function getvalue($valuename)
1023 1023
 	{
1024
-		$searchreg="/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/";
1024
+		$searchreg = "/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/";
1025 1025
 		$matches = array();
1026 1026
 		preg_match($searchreg, $this->contentXml, $matches);
1027 1027
 		$this->contentXml = preg_replace($searchreg, "", $this->contentXml);
Please login to merge, or discard this patch.
htdocs/core/modules/societe/doc/doc_generic_odt.modules.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		$this->option_draft_watermark = 0; // Support add of a watermark on drafts
76 76
 
77 77
 		if ($mysoc === null) {
78
-			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
78
+			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'.getCallerInfoString(), LOG_ERR);
79 79
 			return;
80 80
 		}
81 81
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		$maxfilesizearray = getMaxFileSizeArray();
184 184
 		$maxmin = $maxfilesizearray['maxmin'];
185 185
 		if ($maxmin > 0) {
186
-			$texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
186
+			$texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
187 187
 		}
188 188
 		$texte .= ' <input type="file" name="uploadfile">';
189 189
 		$texte .= '<input type="hidden" value="COMPANY_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
@@ -261,19 +261,19 @@  discard block
 block discarded – undo
261 261
 				// Get extension (ods or odt)
262 262
 				$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
263 263
 				if (getDolGlobalString('MAIN_DOC_USE_OBJECT_THIRDPARTY_NAME')) {
264
-					$newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)) . '-' . $newfiletmp;
265
-					$newfiletmp = preg_replace('/__+/', '_', $newfiletmp);	// Replace repeated _ into one _ (to avoid string with substitution syntax)
264
+					$newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)).'-'.$newfiletmp;
265
+					$newfiletmp = preg_replace('/__+/', '_', $newfiletmp); // Replace repeated _ into one _ (to avoid string with substitution syntax)
266 266
 				}
267 267
 				if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
268 268
 					$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
269 269
 					if ($format == '1') {
270 270
 						$format = '%Y%m%d%H%M%S';
271 271
 					}
272
-					$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
272
+					$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
273 273
 				} else {
274
-					$filename = $newfiletmp . '.' . $newfileformat;
274
+					$filename = $newfiletmp.'.'.$newfileformat;
275 275
 				}
276
-				$file = $dir . '/' . $filename;
276
+				$file = $dir.'/'.$filename;
277 277
 				$object->builddoc_filename = $filename; // For triggers
278 278
 				$object->context['builddoc_filename'] = $filename; // For triggers
279 279
 				//print "newfileformat=".$newfileformat;
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 				dol_mkdir($conf->societe->multidir_temp[$object->entity]);
287 287
 				if (!is_writable($conf->societe->multidir_temp[$object->entity])) {
288 288
 					$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->societe->multidir_temp[$object->entity]);
289
-					dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
289
+					dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
290 290
 					return -1;
291 291
 				}
292 292
 
Please login to merge, or discard this patch.