Passed
Push — master ( db7d4f...be8d41 )
by Alxarafe
21:50
created
dolibarr/htdocs/core/filemanagerdol/connectors/php/util.php 3 patches
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function RemoveFromStart($sourceString, $charToRemove)
33 33
 {
34
-	$sPattern = '|^' . $charToRemove . '+|' ;
35
-	return preg_replace($sPattern, '', $sourceString);
34
+    $sPattern = '|^' . $charToRemove . '+|' ;
35
+    return preg_replace($sPattern, '', $sourceString);
36 36
 }
37 37
 
38 38
 /**
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function RemoveFromEnd($sourceString, $charToRemove)
46 46
 {
47
-	$sPattern = '|' . $charToRemove . '+$|' ;
48
-	return preg_replace($sPattern, '', $sourceString);
47
+    $sPattern = '|' . $charToRemove . '+$|' ;
48
+    return preg_replace($sPattern, '', $sourceString);
49 49
 }
50 50
 
51 51
 /**
@@ -56,24 +56,24 @@  discard block
 block discarded – undo
56 56
  */
57 57
 function FindBadUtf8($string)
58 58
 {
59
-	$regex = '([\x00-\x7F]'.
60
-	'|[\xC2-\xDF][\x80-\xBF]'.
61
-	'|\xE0[\xA0-\xBF][\x80-\xBF]'.
62
-	'|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.
63
-	'|\xED[\x80-\x9F][\x80-\xBF]'.
64
-	'|\xF0[\x90-\xBF][\x80-\xBF]{2}'.
65
-	'|[\xF1-\xF3][\x80-\xBF]{3}'.
66
-	'|\xF4[\x80-\x8F][\x80-\xBF]{2}'.
67
-	'|(.{1}))';
68
-
69
-	while (preg_match('/'.$regex.'/S', $string, $matches)) {
70
-		if ( isset($matches[2])) {
71
-			return true;
72
-		}
73
-		$string = substr($string, strlen($matches[0]));
74
-	}
75
-
76
-	return false;
59
+    $regex = '([\x00-\x7F]'.
60
+    '|[\xC2-\xDF][\x80-\xBF]'.
61
+    '|\xE0[\xA0-\xBF][\x80-\xBF]'.
62
+    '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.
63
+    '|\xED[\x80-\x9F][\x80-\xBF]'.
64
+    '|\xF0[\x90-\xBF][\x80-\xBF]{2}'.
65
+    '|[\xF1-\xF3][\x80-\xBF]{3}'.
66
+    '|\xF4[\x80-\x8F][\x80-\xBF]{2}'.
67
+    '|(.{1}))';
68
+
69
+    while (preg_match('/'.$regex.'/S', $string, $matches)) {
70
+        if ( isset($matches[2])) {
71
+            return true;
72
+        }
73
+        $string = substr($string, strlen($matches[0]));
74
+    }
75
+
76
+    return false;
77 77
 }
78 78
 
79 79
 /**
@@ -84,23 +84,23 @@  discard block
 block discarded – undo
84 84
  */
85 85
 function ConvertToXmlAttribute( $value )
86 86
 {
87
-	if ( defined('PHP_OS') )
88
-	{
89
-		$os = PHP_OS ;
90
-	}
91
-	else
92
-	{
93
-		$os = php_uname();
94
-	}
95
-
96
-	if (strtoupper(substr($os, 0, 3)) === 'WIN' || FindBadUtf8($value))
97
-	{
98
-		return (utf8_encode(htmlspecialchars($value)));
99
-	}
100
-	else
101
-	{
102
-		return (htmlspecialchars($value));
103
-	}
87
+    if ( defined('PHP_OS') )
88
+    {
89
+        $os = PHP_OS ;
90
+    }
91
+    else
92
+    {
93
+        $os = php_uname();
94
+    }
95
+
96
+    if (strtoupper(substr($os, 0, 3)) === 'WIN' || FindBadUtf8($value))
97
+    {
98
+        return (utf8_encode(htmlspecialchars($value)));
99
+    }
100
+    else
101
+    {
102
+        return (htmlspecialchars($value));
103
+    }
104 104
 }
105 105
 
106 106
 /**
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function IsHtmlExtension( $ext, $formExtensions )
114 114
 {
115
-	if (!$formExtensions || !is_array($formExtensions) )
116
-	{
117
-		return false ;
118
-	}
119
-	$lcaseHtmlExtensions = array();
120
-	foreach ( $formExtensions as $key => $val )
121
-	{
122
-		$lcaseHtmlExtensions[$key] = strtolower($val);
123
-	}
124
-	return in_array($ext, $lcaseHtmlExtensions);
115
+    if (!$formExtensions || !is_array($formExtensions) )
116
+    {
117
+        return false ;
118
+    }
119
+    $lcaseHtmlExtensions = array();
120
+    foreach ( $formExtensions as $key => $val )
121
+    {
122
+        $lcaseHtmlExtensions[$key] = strtolower($val);
123
+    }
124
+    return in_array($ext, $lcaseHtmlExtensions);
125 125
 }
126 126
 
127 127
 /**
@@ -134,63 +134,63 @@  discard block
 block discarded – undo
134 134
  */
135 135
 function DetectHtml( $filePath )
136 136
 {
137
-	$fp = @fopen($filePath, 'rb');
138
-
139
-	//open_basedir restriction, see #1906
140
-	if ( $fp === false || !flock($fp, LOCK_SH) )
141
-	{
142
-		return -1 ;
143
-	}
144
-
145
-	$chunk = fread($fp, 1024);
146
-	flock($fp, LOCK_UN);
147
-	fclose($fp);
148
-
149
-	$chunk = strtolower($chunk);
150
-
151
-	if (!$chunk)
152
-	{
153
-		return false ;
154
-	}
155
-
156
-	$chunk = trim($chunk);
157
-
158
-	if ( preg_match("/<!DOCTYPE\W*X?HTML/sim", $chunk) )
159
-	{
160
-		return true;
161
-	}
162
-
163
-	$tags = array( '<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title' );
164
-
165
-	foreach( $tags as $tag )
166
-	{
167
-		if( false !== strpos($chunk, $tag) )
168
-		{
169
-			return true ;
170
-		}
171
-	}
172
-
173
-	//type = javascript
174
-	if ( preg_match('!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk) )
175
-	{
176
-		return true ;
177
-	}
178
-
179
-	//href = javascript
180
-	//src = javascript
181
-	//data = javascript
182
-	if ( preg_match('!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk) )
183
-	{
184
-		return true ;
185
-	}
186
-
187
-	//url(javascript
188
-	if ( preg_match('!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk) )
189
-	{
190
-		return true ;
191
-	}
192
-
193
-	return false ;
137
+    $fp = @fopen($filePath, 'rb');
138
+
139
+    //open_basedir restriction, see #1906
140
+    if ( $fp === false || !flock($fp, LOCK_SH) )
141
+    {
142
+        return -1 ;
143
+    }
144
+
145
+    $chunk = fread($fp, 1024);
146
+    flock($fp, LOCK_UN);
147
+    fclose($fp);
148
+
149
+    $chunk = strtolower($chunk);
150
+
151
+    if (!$chunk)
152
+    {
153
+        return false ;
154
+    }
155
+
156
+    $chunk = trim($chunk);
157
+
158
+    if ( preg_match("/<!DOCTYPE\W*X?HTML/sim", $chunk) )
159
+    {
160
+        return true;
161
+    }
162
+
163
+    $tags = array( '<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title' );
164
+
165
+    foreach( $tags as $tag )
166
+    {
167
+        if( false !== strpos($chunk, $tag) )
168
+        {
169
+            return true ;
170
+        }
171
+    }
172
+
173
+    //type = javascript
174
+    if ( preg_match('!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk) )
175
+    {
176
+        return true ;
177
+    }
178
+
179
+    //href = javascript
180
+    //src = javascript
181
+    //data = javascript
182
+    if ( preg_match('!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk) )
183
+    {
184
+        return true ;
185
+    }
186
+
187
+    //url(javascript
188
+    if ( preg_match('!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk) )
189
+    {
190
+        return true ;
191
+    }
192
+
193
+    return false ;
194 194
 }
195 195
 
196 196
 /**
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
  */
205 205
 function IsImageValid( $filePath, $extension )
206 206
 {
207
-	if (!@is_readable($filePath)) {
208
-		return -1;
209
-	}
207
+    if (!@is_readable($filePath)) {
208
+        return -1;
209
+    }
210 210
 
211
-	$imageCheckExtensions = array(
211
+    $imageCheckExtensions = array(
212 212
         'gif',
213 213
         'jpeg',
214 214
         'jpg',
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
         'wbmp'
229 229
     );
230 230
 
231
-	if (!in_array($extension, $imageCheckExtensions) ) {
232
-		return true;
233
-	}
231
+    if (!in_array($extension, $imageCheckExtensions) ) {
232
+        return true;
233
+    }
234 234
 
235
-	if (@getimagesize($filePath) === false) {
236
-		return false ;
237
-	}
235
+    if (@getimagesize($filePath) === false) {
236
+        return false ;
237
+    }
238 238
 
239
-	return true;
239
+    return true;
240 240
 }
241 241
 
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function RemoveFromStart($sourceString, $charToRemove)
33 33
 {
34
-	$sPattern = '|^' . $charToRemove . '+|' ;
34
+	$sPattern = '|^'.$charToRemove.'+|';
35 35
 	return preg_replace($sPattern, '', $sourceString);
36 36
 }
37 37
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function RemoveFromEnd($sourceString, $charToRemove)
46 46
 {
47
-	$sPattern = '|' . $charToRemove . '+$|' ;
47
+	$sPattern = '|'.$charToRemove.'+$|';
48 48
 	return preg_replace($sPattern, '', $sourceString);
49 49
 }
50 50
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	'|(.{1}))';
68 68
 
69 69
 	while (preg_match('/'.$regex.'/S', $string, $matches)) {
70
-		if ( isset($matches[2])) {
70
+		if (isset($matches[2])) {
71 71
 			return true;
72 72
 		}
73 73
 		$string = substr($string, strlen($matches[0]));
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
  * @param 	string		$value		Value
83 83
  * @return	string
84 84
  */
85
-function ConvertToXmlAttribute( $value )
85
+function ConvertToXmlAttribute($value)
86 86
 {
87
-	if ( defined('PHP_OS') )
87
+	if (defined('PHP_OS'))
88 88
 	{
89
-		$os = PHP_OS ;
89
+		$os = PHP_OS;
90 90
 	}
91 91
 	else
92 92
 	{
@@ -110,14 +110,14 @@  discard block
 block discarded – undo
110 110
  * @param 	array 		$formExtensions		Array of extensions
111 111
  * @return 	boolean
112 112
  */
113
-function IsHtmlExtension( $ext, $formExtensions )
113
+function IsHtmlExtension($ext, $formExtensions)
114 114
 {
115
-	if (!$formExtensions || !is_array($formExtensions) )
115
+	if (!$formExtensions || !is_array($formExtensions))
116 116
 	{
117
-		return false ;
117
+		return false;
118 118
 	}
119 119
 	$lcaseHtmlExtensions = array();
120
-	foreach ( $formExtensions as $key => $val )
120
+	foreach ($formExtensions as $key => $val)
121 121
 	{
122 122
 		$lcaseHtmlExtensions[$key] = strtolower($val);
123 123
 	}
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
  * @param string $filePath absolute path to file
133 133
  * @return boolean
134 134
  */
135
-function DetectHtml( $filePath )
135
+function DetectHtml($filePath)
136 136
 {
137 137
 	$fp = @fopen($filePath, 'rb');
138 138
 
139 139
 	//open_basedir restriction, see #1906
140
-	if ( $fp === false || !flock($fp, LOCK_SH) )
140
+	if ($fp === false || !flock($fp, LOCK_SH))
141 141
 	{
142
-		return -1 ;
142
+		return -1;
143 143
 	}
144 144
 
145 145
 	$chunk = fread($fp, 1024);
@@ -150,47 +150,47 @@  discard block
 block discarded – undo
150 150
 
151 151
 	if (!$chunk)
152 152
 	{
153
-		return false ;
153
+		return false;
154 154
 	}
155 155
 
156 156
 	$chunk = trim($chunk);
157 157
 
158
-	if ( preg_match("/<!DOCTYPE\W*X?HTML/sim", $chunk) )
158
+	if (preg_match("/<!DOCTYPE\W*X?HTML/sim", $chunk))
159 159
 	{
160 160
 		return true;
161 161
 	}
162 162
 
163
-	$tags = array( '<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title' );
163
+	$tags = array('<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title');
164 164
 
165
-	foreach( $tags as $tag )
165
+	foreach ($tags as $tag)
166 166
 	{
167
-		if( false !== strpos($chunk, $tag) )
167
+		if (false !== strpos($chunk, $tag))
168 168
 		{
169
-			return true ;
169
+			return true;
170 170
 		}
171 171
 	}
172 172
 
173 173
 	//type = javascript
174
-	if ( preg_match('!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk) )
174
+	if (preg_match('!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk))
175 175
 	{
176
-		return true ;
176
+		return true;
177 177
 	}
178 178
 
179 179
 	//href = javascript
180 180
 	//src = javascript
181 181
 	//data = javascript
182
-	if ( preg_match('!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk) )
182
+	if (preg_match('!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk))
183 183
 	{
184
-		return true ;
184
+		return true;
185 185
 	}
186 186
 
187 187
 	//url(javascript
188
-	if ( preg_match('!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk) )
188
+	if (preg_match('!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk))
189 189
 	{
190
-		return true ;
190
+		return true;
191 191
 	}
192 192
 
193
-	return false ;
193
+	return false;
194 194
 }
195 195
 
196 196
 /**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
  * @param 	string 	$extension 		File extension
203 203
  * @return 	boolean					True or false
204 204
  */
205
-function IsImageValid( $filePath, $extension )
205
+function IsImageValid($filePath, $extension)
206 206
 {
207 207
 	if (!@is_readable($filePath)) {
208 208
 		return -1;
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
         'wbmp'
229 229
     );
230 230
 
231
-	if (!in_array($extension, $imageCheckExtensions) ) {
231
+	if (!in_array($extension, $imageCheckExtensions)) {
232 232
 		return true;
233 233
 	}
234 234
 
235 235
 	if (@getimagesize($filePath) === false) {
236
-		return false ;
236
+		return false;
237 237
 	}
238 238
 
239 239
 	return true;
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -87,8 +87,7 @@  discard block
 block discarded – undo
87 87
 	if ( defined('PHP_OS') )
88 88
 	{
89 89
 		$os = PHP_OS ;
90
-	}
91
-	else
90
+	} else
92 91
 	{
93 92
 		$os = php_uname();
94 93
 	}
@@ -96,8 +95,7 @@  discard block
 block discarded – undo
96 95
 	if (strtoupper(substr($os, 0, 3)) === 'WIN' || FindBadUtf8($value))
97 96
 	{
98 97
 		return (utf8_encode(htmlspecialchars($value)));
99
-	}
100
-	else
98
+	} else
101 99
 	{
102 100
 		return (htmlspecialchars($value));
103 101
 	}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/usergroups.lib.php 3 patches
Indentation   +704 added lines, -704 removed lines patch added patch discarded remove patch
@@ -33,162 +33,162 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function user_prepare_head($object)
35 35
 {
36
-	global $langs, $conf, $user, $db;
37
-
38
-	$langs->load("users");
39
-
40
-	$canreadperms=true;
41
-	if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
42
-	{
43
-		$canreadperms=($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms));
44
-	}
45
-
46
-	$h = 0;
47
-	$head = array();
48
-
49
-	$head[$h][0] = DOL_URL_ROOT.'/user/card.php?id='.$object->id;
50
-	$head[$h][1] = $langs->trans("UserCard");
51
-	$head[$h][2] = 'user';
52
-	$h++;
53
-
54
-	if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE))
55
-		&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
56
-	{
57
-		$langs->load("ldap");
58
-		$head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id;
59
-		$head[$h][1] = $langs->trans("LDAPCard");
60
-		$head[$h][2] = 'ldap';
61
-		$h++;
62
-	}
63
-
64
-	if ($canreadperms)
65
-	{
66
-		$head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
67
-		$head[$h][1] = $langs->trans("Rights"). ' <span class="badge">'.($object->nb_rights).'</span>';
68
-		$head[$h][2] = 'rights';
69
-		$h++;
70
-	}
71
-
72
-	$head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
73
-	$head[$h][1] = $langs->trans("UserGUISetup");
74
-	$head[$h][2] = 'guisetup';
75
-	$h++;
76
-
77
-	if (! empty($conf->agenda->enabled))
78
-	{
79
-		if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
80
-		$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
81
-
82
-		$i=1;
83
-		$nbagenda = 0;
84
-		while ($i <= $MAXAGENDA)
85
-		{
86
-			$key=$i;
87
-			$name='AGENDA_EXT_NAME_'.$object->id.'_'.$key;
88
-			$src='AGENDA_EXT_SRC_'.$object->id.'_'.$key;
89
-			$offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key;
90
-			$color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
91
-			$i++;
92
-
93
-			if (! empty($object->conf->$name)) $nbagenda++;
94
-		}
95
-
96
-		$head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
97
-		$head[$h][1] = $langs->trans("ExtSites").($nbagenda ? ' <span class="badge">'.$nbagenda.'</span>' : '');
98
-		$head[$h][2] = 'extsites';
99
-		$h++;
100
-	}
101
-
102
-	if (! empty($conf->clicktodial->enabled))
103
-	{
104
-		$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
105
-		$head[$h][1] = $langs->trans("ClickToDial");
106
-		$head[$h][2] = 'clicktodial';
107
-		$h++;
108
-	}
109
-
110
-	// Notifications
111
-	if ($user->societe_id == 0 && ! empty($conf->notification->enabled))
112
-	{
113
-		$nbNote = 0;
114
-		$sql = "SELECT COUNT(n.rowid) as nb";
115
-		$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n";
116
-		$sql.= " WHERE fk_user = ".$object->id;
117
-		$resql=$db->query($sql);
118
-		if ($resql)
119
-		{
120
-			$num = $db->num_rows($resql);
121
-			$i = 0;
122
-			while ($i < $num)
123
-			{
124
-				$obj = $db->fetch_object($resql);
125
-				$nbNote=$obj->nb;
126
-				$i++;
127
-			}
128
-		}
129
-		else {
130
-			dol_print_error($db);
131
-		}
132
-
133
-		$head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id;
134
-		$head[$h][1] = $langs->trans("Notifications");
135
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
136
-		$head[$h][2] = 'notify';
137
-		$h++;
138
-	}
139
-
140
-	// Show more tabs from modules
141
-	// Entries must be declared in modules descriptor with line
142
-	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
143
-	// $this->tabs = array('entity:-tabname);   												to remove a tab
144
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'user');
145
-
146
-	if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
147
-		|| (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))
148
-		|| (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && $user->id == $object->id)
149
-		|| (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && $user->id == $object->id )
150
-		)
151
-	{
152
-		// Bank
153
-		$head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;
154
-		$head[$h][1] = $langs->trans("HRAndBank");
155
-		$head[$h][2] = 'bank';
156
-		$h++;
157
-	}
158
-
159
-	// Such info on users is visible only by internal user
160
-	if (empty($user->societe_id))
161
-	{
162
-		// Notes
163
-		$nbNote = 0;
164
-		if(!empty($object->note)) $nbNote++;
165
-		$head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
166
-		$head[$h][1] = $langs->trans("Note");
167
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
168
-		$head[$h][2] = 'note';
169
-		$h++;
170
-
171
-		// Attached files
172
-		require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
173
-		require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
174
-		$upload_dir = $conf->user->dir_output . "/" . $object->id;
175
-		$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
176
-		$nbLinks=Link::count($db, $object->element, $object->id);
177
-		$head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id;
178
-		$head[$h][1] = $langs->trans("Documents");
179
-		if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
180
-		$head[$h][2] = 'document';
181
-		$h++;
182
-
183
-		$head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$object->id;
184
-		$head[$h][1] = $langs->trans("Info");
185
-		$head[$h][2] = 'info';
186
-		$h++;
187
-	}
188
-
189
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove');
190
-
191
-	return $head;
36
+    global $langs, $conf, $user, $db;
37
+
38
+    $langs->load("users");
39
+
40
+    $canreadperms=true;
41
+    if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
42
+    {
43
+        $canreadperms=($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms));
44
+    }
45
+
46
+    $h = 0;
47
+    $head = array();
48
+
49
+    $head[$h][0] = DOL_URL_ROOT.'/user/card.php?id='.$object->id;
50
+    $head[$h][1] = $langs->trans("UserCard");
51
+    $head[$h][2] = 'user';
52
+    $h++;
53
+
54
+    if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE))
55
+        && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
56
+    {
57
+        $langs->load("ldap");
58
+        $head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id;
59
+        $head[$h][1] = $langs->trans("LDAPCard");
60
+        $head[$h][2] = 'ldap';
61
+        $h++;
62
+    }
63
+
64
+    if ($canreadperms)
65
+    {
66
+        $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
67
+        $head[$h][1] = $langs->trans("Rights"). ' <span class="badge">'.($object->nb_rights).'</span>';
68
+        $head[$h][2] = 'rights';
69
+        $h++;
70
+    }
71
+
72
+    $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
73
+    $head[$h][1] = $langs->trans("UserGUISetup");
74
+    $head[$h][2] = 'guisetup';
75
+    $h++;
76
+
77
+    if (! empty($conf->agenda->enabled))
78
+    {
79
+        if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
80
+        $MAXAGENDA=$conf->global->AGENDA_EXT_NB;
81
+
82
+        $i=1;
83
+        $nbagenda = 0;
84
+        while ($i <= $MAXAGENDA)
85
+        {
86
+            $key=$i;
87
+            $name='AGENDA_EXT_NAME_'.$object->id.'_'.$key;
88
+            $src='AGENDA_EXT_SRC_'.$object->id.'_'.$key;
89
+            $offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key;
90
+            $color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
91
+            $i++;
92
+
93
+            if (! empty($object->conf->$name)) $nbagenda++;
94
+        }
95
+
96
+        $head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
97
+        $head[$h][1] = $langs->trans("ExtSites").($nbagenda ? ' <span class="badge">'.$nbagenda.'</span>' : '');
98
+        $head[$h][2] = 'extsites';
99
+        $h++;
100
+    }
101
+
102
+    if (! empty($conf->clicktodial->enabled))
103
+    {
104
+        $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
105
+        $head[$h][1] = $langs->trans("ClickToDial");
106
+        $head[$h][2] = 'clicktodial';
107
+        $h++;
108
+    }
109
+
110
+    // Notifications
111
+    if ($user->societe_id == 0 && ! empty($conf->notification->enabled))
112
+    {
113
+        $nbNote = 0;
114
+        $sql = "SELECT COUNT(n.rowid) as nb";
115
+        $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n";
116
+        $sql.= " WHERE fk_user = ".$object->id;
117
+        $resql=$db->query($sql);
118
+        if ($resql)
119
+        {
120
+            $num = $db->num_rows($resql);
121
+            $i = 0;
122
+            while ($i < $num)
123
+            {
124
+                $obj = $db->fetch_object($resql);
125
+                $nbNote=$obj->nb;
126
+                $i++;
127
+            }
128
+        }
129
+        else {
130
+            dol_print_error($db);
131
+        }
132
+
133
+        $head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id;
134
+        $head[$h][1] = $langs->trans("Notifications");
135
+        if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
136
+        $head[$h][2] = 'notify';
137
+        $h++;
138
+    }
139
+
140
+    // Show more tabs from modules
141
+    // Entries must be declared in modules descriptor with line
142
+    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
143
+    // $this->tabs = array('entity:-tabname);   												to remove a tab
144
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'user');
145
+
146
+    if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
147
+        || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))
148
+        || (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && $user->id == $object->id)
149
+        || (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && $user->id == $object->id )
150
+        )
151
+    {
152
+        // Bank
153
+        $head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;
154
+        $head[$h][1] = $langs->trans("HRAndBank");
155
+        $head[$h][2] = 'bank';
156
+        $h++;
157
+    }
158
+
159
+    // Such info on users is visible only by internal user
160
+    if (empty($user->societe_id))
161
+    {
162
+        // Notes
163
+        $nbNote = 0;
164
+        if(!empty($object->note)) $nbNote++;
165
+        $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
166
+        $head[$h][1] = $langs->trans("Note");
167
+        if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
168
+        $head[$h][2] = 'note';
169
+        $h++;
170
+
171
+        // Attached files
172
+        require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
173
+        require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
174
+        $upload_dir = $conf->user->dir_output . "/" . $object->id;
175
+        $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
176
+        $nbLinks=Link::count($db, $object->element, $object->id);
177
+        $head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id;
178
+        $head[$h][1] = $langs->trans("Documents");
179
+        if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
180
+        $head[$h][2] = 'document';
181
+        $h++;
182
+
183
+        $head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$object->id;
184
+        $head[$h][1] = $langs->trans("Info");
185
+        $head[$h][2] = 'info';
186
+        $h++;
187
+    }
188
+
189
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove');
190
+
191
+    return $head;
192 192
 }
193 193
 
194 194
 /**
@@ -199,49 +199,49 @@  discard block
 block discarded – undo
199 199
  */
200 200
 function group_prepare_head($object)
201 201
 {
202
-	global $langs, $conf, $user;
203
-
204
-	$canreadperms=true;
205
-	if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
206
-	{
207
-		$canreadperms=($user->admin || $user->rights->user->group_advance->readperms);
208
-	}
209
-
210
-	$h = 0;
211
-	$head = array();
212
-
213
-	$head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id;
214
-	$head[$h][1] = $langs->trans("GroupCard");
215
-	$head[$h][2] = 'group';
216
-	$h++;
217
-
218
-	if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE))
219
-		&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
220
-	{
221
-		$langs->load("ldap");
222
-		$head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id;
223
-		$head[$h][1] = $langs->trans("LDAPCard");
224
-		$head[$h][2] = 'ldap';
225
-		$h++;
226
-	}
227
-
228
-	if ($canreadperms)
229
-	{
230
-		$head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id;
231
-		$head[$h][1] = $langs->trans("GroupRights"). ' <span class="badge">'.($object->nb_rights).'</span>';
232
-		$head[$h][2] = 'rights';
233
-		$h++;
234
-	}
235
-
236
-	// Show more tabs from modules
237
-	// Entries must be declared in modules descriptor with line
238
-	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
239
-	// $this->tabs = array('entity:-tabname);   												to remove a tab
240
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'group');
241
-
242
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'group','remove');
243
-
244
-	return $head;
202
+    global $langs, $conf, $user;
203
+
204
+    $canreadperms=true;
205
+    if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
206
+    {
207
+        $canreadperms=($user->admin || $user->rights->user->group_advance->readperms);
208
+    }
209
+
210
+    $h = 0;
211
+    $head = array();
212
+
213
+    $head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id;
214
+    $head[$h][1] = $langs->trans("GroupCard");
215
+    $head[$h][2] = 'group';
216
+    $h++;
217
+
218
+    if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE))
219
+        && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
220
+    {
221
+        $langs->load("ldap");
222
+        $head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id;
223
+        $head[$h][1] = $langs->trans("LDAPCard");
224
+        $head[$h][2] = 'ldap';
225
+        $h++;
226
+    }
227
+
228
+    if ($canreadperms)
229
+    {
230
+        $head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id;
231
+        $head[$h][1] = $langs->trans("GroupRights"). ' <span class="badge">'.($object->nb_rights).'</span>';
232
+        $head[$h][2] = 'rights';
233
+        $h++;
234
+    }
235
+
236
+    // Show more tabs from modules
237
+    // Entries must be declared in modules descriptor with line
238
+    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
239
+    // $this->tabs = array('entity:-tabname);   												to remove a tab
240
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'group');
241
+
242
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'group','remove');
243
+
244
+    return $head;
245 245
 }
246 246
 
247 247
 /**
@@ -251,40 +251,40 @@  discard block
 block discarded – undo
251 251
  */
252 252
 function user_admin_prepare_head()
253 253
 {
254
-	global $langs, $conf, $user;
254
+    global $langs, $conf, $user;
255 255
 
256
-	$langs->load("users");
257
-	$h=0;
256
+    $langs->load("users");
257
+    $h=0;
258 258
 
259
-	$head[$h][0] = DOL_URL_ROOT.'/admin/user.php';
260
-	$head[$h][1] = $langs->trans("Parameters");
261
-	$head[$h][2] = 'card';
262
-	$h++;
259
+    $head[$h][0] = DOL_URL_ROOT.'/admin/user.php';
260
+    $head[$h][1] = $langs->trans("Parameters");
261
+    $head[$h][2] = 'card';
262
+    $h++;
263 263
 
264
-	$head[$h][0] = DOL_URL_ROOT.'/admin/usergroup.php';
265
-	$head[$h][1] = $langs->trans("Group");
266
-	$head[$h][2] = 'usergroupcard';
267
-	$h++;
264
+    $head[$h][0] = DOL_URL_ROOT.'/admin/usergroup.php';
265
+    $head[$h][1] = $langs->trans("Group");
266
+    $head[$h][2] = 'usergroupcard';
267
+    $h++;
268 268
 
269
-	$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
270
-	$head[$h][1] = $langs->trans("ExtraFields");
271
-	$head[$h][2] = 'attributes';
272
-	$h++;
269
+    $head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
270
+    $head[$h][1] = $langs->trans("ExtraFields");
271
+    $head[$h][2] = 'attributes';
272
+    $h++;
273 273
 
274
-	$head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
275
-	$head[$h][1] = $langs->trans("ExtraFields")." ".$langs->trans("Groups");
276
-	$head[$h][2] = 'attributes_group';
277
-	$h++;
274
+    $head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
275
+    $head[$h][1] = $langs->trans("ExtraFields")." ".$langs->trans("Groups");
276
+    $head[$h][2] = 'attributes_group';
277
+    $h++;
278 278
 
279
-	// Show more tabs from modules
280
-	// Entries must be declared in modules descriptor with line
281
-	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
282
-	// $this->tabs = array('entity:-tabname);   												to remove a tab
283
-	complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin');
279
+    // Show more tabs from modules
280
+    // Entries must be declared in modules descriptor with line
281
+    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
282
+    // $this->tabs = array('entity:-tabname);   												to remove a tab
283
+    complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin');
284 284
 
285
-	complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin','remove');
285
+    complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin','remove');
286 286
 
287
-	return $head;
287
+    return $head;
288 288
 }
289 289
 
290 290
 /**
@@ -297,138 +297,138 @@  discard block
 block discarded – undo
297 297
  */
298 298
 function show_theme($fuser,$edit=0,$foruserprofile=false)
299 299
 {
300
-	global $conf,$langs,$db,$form;
301
-	global $bc;
302
-
303
-	require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
304
-
305
-	$formother = new FormOther($db);
306
-
307
-	$dirthemes=array('/theme');
308
-	if (! empty($conf->modules_parts['theme']))		// Using this feature slow down application
309
-	{
310
-		foreach($conf->modules_parts['theme'] as $reldir)
311
-		{
312
-			$dirthemes=array_merge($dirthemes,(array) ($reldir.'theme'));
313
-		}
314
-	}
315
-	$dirthemes=array_unique($dirthemes);
316
-	// Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
317
-
318
-	$selected_theme='';
319
-	if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME;
320
-	else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:'');
321
-
322
-	$hoverdisabled='';
323
-	if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0');
324
-	else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):'');
325
-
326
-	$checkeddisabled='';
327
-	if (empty($foruserprofile)) $checkeddisabled=(isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0');
328
-	else $checkeddisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0'):'');
329
-
330
-	$colspan=2;
331
-	if ($foruserprofile) $colspan=4;
332
-
333
-	$thumbsbyrow=6;
334
-	print '<table class="noborder" width="100%">';
335
-
336
-	// Title
337
-	if ($foruserprofile)
338
-	{
339
-		print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("Parameter").'</th><th>'.$langs->trans("DefaultValue").'</th>';
340
-		print '<th colspan="2">&nbsp;</th>';
341
-		print '</tr>';
342
-
343
-		print '<tr>';
344
-		print '<td>'.$langs->trans("DefaultSkin").'</td>';
345
-		print '<td>'.$conf->global->MAIN_THEME.'</td>';
346
-		print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
347
-		print '<td>&nbsp;</td>';
348
-		print '</tr>';
349
-	}
350
-	else
351
-	{
352
-		print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>';
353
-		print '<th align="right">';
354
-		$url='https://www.dolistore.com/lang-en/4-skins';
355
-		if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes';
356
-		//if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes';
357
-		print '<a href="'.$url.'" target="_blank">';
358
-		print $langs->trans('DownloadMoreSkins');
359
-		print '</a>';
360
-		print '</th></tr>';
361
-
362
-		print '<tr>';
363
-		print '<td>'.$langs->trans("ThemeDir").'</td>';
364
-		print '<td>';
365
-		foreach($dirthemes as $dirtheme)
366
-		{
367
-			echo '"'.$dirtheme.'" ';
368
-		}
369
-		print '</td>';
370
-		print '</tr>';
371
-	}
372
-
373
-	print '<tr><td colspan="'.$colspan.'">';
374
-
375
-	print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">';
376
-
377
-	$i=0;
378
-	foreach($dirthemes as $dir)
379
-	{
380
-		//print $dirroot.$dir;exit;
381
-		$dirtheme=dol_buildpath($dir,0);	// This include loop on $conf->file->dol_document_root
382
-		$urltheme=dol_buildpath($dir,1);
383
-
384
-		if (is_dir($dirtheme))
385
-		{
386
-			$handle=opendir($dirtheme);
387
-			if (is_resource($handle))
388
-			{
389
-				while (($subdir = readdir($handle))!==false)
390
-				{
391
-					if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
392
-							&& substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir))
393
-					{
394
-						// Disable not stable themes (dir ends with _exp or _dev)
395
-						if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) continue;
396
-						if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) continue;
397
-
398
-						print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
399
-						$file=$dirtheme."/".$subdir."/thumb.png";
400
-						$url=$urltheme."/".$subdir."/thumb.png";
401
-						if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png';
402
-						print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST('optioncss','alpha',1)?'&optioncss='.GETPOST('optioncss','alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
403
-						if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive");
404
-						else $title=$langs->trans("ShowPreview");
405
-						print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">';
406
-						print '</a><br>';
407
-						if ($subdir == $selected_theme)
408
-						{
409
-							print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
410
-						}
411
-						else
412
-						{
413
-							print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
414
-						}
415
-						print '</div>';
416
-
417
-						$i++;
418
-					}
419
-				}
420
-			}
421
-		}
422
-	}
423
-
424
-	print '</div></td></tr></table>';
425
-
426
-	print '</td></tr>';
427
-
428
-	// TopMenuDisableImages
429
-	if ($foruserprofile)
430
-	{
431
-		/*
300
+    global $conf,$langs,$db,$form;
301
+    global $bc;
302
+
303
+    require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
304
+
305
+    $formother = new FormOther($db);
306
+
307
+    $dirthemes=array('/theme');
308
+    if (! empty($conf->modules_parts['theme']))		// Using this feature slow down application
309
+    {
310
+        foreach($conf->modules_parts['theme'] as $reldir)
311
+        {
312
+            $dirthemes=array_merge($dirthemes,(array) ($reldir.'theme'));
313
+        }
314
+    }
315
+    $dirthemes=array_unique($dirthemes);
316
+    // Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
317
+
318
+    $selected_theme='';
319
+    if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME;
320
+    else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:'');
321
+
322
+    $hoverdisabled='';
323
+    if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0');
324
+    else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):'');
325
+
326
+    $checkeddisabled='';
327
+    if (empty($foruserprofile)) $checkeddisabled=(isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0');
328
+    else $checkeddisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0'):'');
329
+
330
+    $colspan=2;
331
+    if ($foruserprofile) $colspan=4;
332
+
333
+    $thumbsbyrow=6;
334
+    print '<table class="noborder" width="100%">';
335
+
336
+    // Title
337
+    if ($foruserprofile)
338
+    {
339
+        print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("Parameter").'</th><th>'.$langs->trans("DefaultValue").'</th>';
340
+        print '<th colspan="2">&nbsp;</th>';
341
+        print '</tr>';
342
+
343
+        print '<tr>';
344
+        print '<td>'.$langs->trans("DefaultSkin").'</td>';
345
+        print '<td>'.$conf->global->MAIN_THEME.'</td>';
346
+        print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
347
+        print '<td>&nbsp;</td>';
348
+        print '</tr>';
349
+    }
350
+    else
351
+    {
352
+        print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>';
353
+        print '<th align="right">';
354
+        $url='https://www.dolistore.com/lang-en/4-skins';
355
+        if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes';
356
+        //if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes';
357
+        print '<a href="'.$url.'" target="_blank">';
358
+        print $langs->trans('DownloadMoreSkins');
359
+        print '</a>';
360
+        print '</th></tr>';
361
+
362
+        print '<tr>';
363
+        print '<td>'.$langs->trans("ThemeDir").'</td>';
364
+        print '<td>';
365
+        foreach($dirthemes as $dirtheme)
366
+        {
367
+            echo '"'.$dirtheme.'" ';
368
+        }
369
+        print '</td>';
370
+        print '</tr>';
371
+    }
372
+
373
+    print '<tr><td colspan="'.$colspan.'">';
374
+
375
+    print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">';
376
+
377
+    $i=0;
378
+    foreach($dirthemes as $dir)
379
+    {
380
+        //print $dirroot.$dir;exit;
381
+        $dirtheme=dol_buildpath($dir,0);	// This include loop on $conf->file->dol_document_root
382
+        $urltheme=dol_buildpath($dir,1);
383
+
384
+        if (is_dir($dirtheme))
385
+        {
386
+            $handle=opendir($dirtheme);
387
+            if (is_resource($handle))
388
+            {
389
+                while (($subdir = readdir($handle))!==false)
390
+                {
391
+                    if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
392
+                            && substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir))
393
+                    {
394
+                        // Disable not stable themes (dir ends with _exp or _dev)
395
+                        if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) continue;
396
+                        if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) continue;
397
+
398
+                        print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
399
+                        $file=$dirtheme."/".$subdir."/thumb.png";
400
+                        $url=$urltheme."/".$subdir."/thumb.png";
401
+                        if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png';
402
+                        print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST('optioncss','alpha',1)?'&optioncss='.GETPOST('optioncss','alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
403
+                        if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive");
404
+                        else $title=$langs->trans("ShowPreview");
405
+                        print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">';
406
+                        print '</a><br>';
407
+                        if ($subdir == $selected_theme)
408
+                        {
409
+                            print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
410
+                        }
411
+                        else
412
+                        {
413
+                            print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
414
+                        }
415
+                        print '</div>';
416
+
417
+                        $i++;
418
+                    }
419
+                }
420
+            }
421
+        }
422
+    }
423
+
424
+    print '</div></td></tr></table>';
425
+
426
+    print '</td></tr>';
427
+
428
+    // TopMenuDisableImages
429
+    if ($foruserprofile)
430
+    {
431
+        /*
432 432
          print '<tr class="oddeven">';
433 433
          print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
434 434
          print '<td>'.($conf->global->THEME_TOPMENU_DISABLE_IMAGE?$conf->global->THEME_TOPMENU_DISABLE_IMAGE:$langs->trans("Default")).'</td>';
@@ -448,31 +448,31 @@  discard block
 block discarded – undo
448 448
          }
449 449
          if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
450 450
          print '</td>';*/
451
-	}
452
-	else
453
-	{
454
-		$default=$langs->trans('No');
455
-		print '<tr class="oddeven">';
456
-		print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
457
-		print '<td colspan="'.($colspan-1).'">';
458
-		if ($edit)
459
-		{
460
-			print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1);
461
-		}
462
-		else
463
-		{
464
-			print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE);
465
-		}
466
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
467
-		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
468
-		print '</span>';
469
-		print '</td>';
470
-	}
471
-
472
-	// Background color THEME_ELDY_BACKBODY
473
-	if ($foruserprofile)
474
-	{
475
-		/*
451
+    }
452
+    else
453
+    {
454
+        $default=$langs->trans('No');
455
+        print '<tr class="oddeven">';
456
+        print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
457
+        print '<td colspan="'.($colspan-1).'">';
458
+        if ($edit)
459
+        {
460
+            print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1);
461
+        }
462
+        else
463
+        {
464
+            print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE);
465
+        }
466
+        print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
467
+        print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
468
+        print '</span>';
469
+        print '</td>';
470
+    }
471
+
472
+    // Background color THEME_ELDY_BACKBODY
473
+    if ($foruserprofile)
474
+    {
475
+        /*
476 476
 	    print '<tr class="oddeven">';
477 477
 	    print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
478 478
         print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
@@ -492,33 +492,33 @@  discard block
 block discarded – undo
492 492
 	   	}
493 493
     	if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
494 494
 	    print '</td>';*/
495
-	}
496
-	else
497
-	{
498
-		print '<tr class="oddeven">';
499
-		print '<td>'.$langs->trans("BackgroundColor").'</td>';
500
-		print '<td colspan="'.($colspan-1).'">';
501
-		//var_dump($conf->global->THEME_ELDY_BACKBODY);
502
-		if ($edit)
503
-		{
504
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''),'THEME_ELDY_BACKBODY','formcolor',1).' ';
505
-		}
506
-	   	else
507
-	   	{
508
-	   		$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),'');
509
-			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
510
-			else print $langs->trans("Default");
511
-	   	}
512
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>ffffff</strong>) ';
513
-		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
514
-		print '</span>';
515
-		print '</td>';
516
-	}
517
-
518
-	// TopMenuBackgroundColor
519
-	if ($foruserprofile)
520
-	{
521
-		/*
495
+    }
496
+    else
497
+    {
498
+        print '<tr class="oddeven">';
499
+        print '<td>'.$langs->trans("BackgroundColor").'</td>';
500
+        print '<td colspan="'.($colspan-1).'">';
501
+        //var_dump($conf->global->THEME_ELDY_BACKBODY);
502
+        if ($edit)
503
+        {
504
+            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''),'THEME_ELDY_BACKBODY','formcolor',1).' ';
505
+        }
506
+            else
507
+            {
508
+                $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),'');
509
+            if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
510
+            else print $langs->trans("Default");
511
+            }
512
+        print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>ffffff</strong>) ';
513
+        print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
514
+        print '</span>';
515
+        print '</td>';
516
+    }
517
+
518
+    // TopMenuBackgroundColor
519
+    if ($foruserprofile)
520
+    {
521
+        /*
522 522
 	    print '<tr class="oddeven">';
523 523
 	    print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
524 524
         print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
@@ -538,35 +538,35 @@  discard block
 block discarded – undo
538 538
 	   	}
539 539
     	if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
540 540
 	    print '</td>';*/
541
-	}
542
-	else
543
-	{
544
-		$default='5a6482';
545
-		if ($conf->theme == 'md') $default='5a3278';
546
-
547
-		print '<tr class="oddeven">';
548
-		print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
549
-		print '<td colspan="'.($colspan-1).'">';
550
-		if ($edit)
551
-		{
552
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
553
-		}
554
-	   	else
555
-	   	{
556
-	   		$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
557
-			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
558
-			else print $langs->trans("Default");
559
-	   	}
560
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
561
-		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
562
-		print '</span>';
563
-		print '</td>';
564
-	}
565
-
566
-	// LeftMenuBackgroundColor
567
-	if ($foruserprofile)
568
-	{
569
-		/*
541
+    }
542
+    else
543
+    {
544
+        $default='5a6482';
545
+        if ($conf->theme == 'md') $default='5a3278';
546
+
547
+        print '<tr class="oddeven">';
548
+        print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
549
+        print '<td colspan="'.($colspan-1).'">';
550
+        if ($edit)
551
+        {
552
+            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
553
+        }
554
+            else
555
+            {
556
+                $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
557
+            if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
558
+            else print $langs->trans("Default");
559
+            }
560
+        print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
561
+        print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
562
+        print '</span>';
563
+        print '</td>';
564
+    }
565
+
566
+    // LeftMenuBackgroundColor
567
+    if ($foruserprofile)
568
+    {
569
+        /*
570 570
 		 print '<tr class="oddeven">';
571 571
 		 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
572 572
 		 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_VERMENU_BACK1:$langs->trans("Default")).'</td>';
@@ -586,174 +586,174 @@  discard block
 block discarded – undo
586 586
 		 }
587 587
 		 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
588 588
 		 print '</td>';*/
589
-	}
590
-	else
591
-	{
592
-		$default='f0f0f0';
593
-		if ($conf->theme == 'md') $default='ffffff';
594
-
595
-		print '<tr class="oddeven">';
596
-		print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
597
-		print '<td colspan="'.($colspan-1).'">';
598
-		if ($edit)
599
-		{
600
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' ';
601
-		}
602
-		else
603
-		{
604
-			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),'');
605
-			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
606
-			else print $langs->trans("Default");
607
-		}
608
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
609
-		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
610
-		print '</span>';
611
-		print '</td>';
612
-	}
613
-
614
-	// TextTitleColor for title of Pages
615
-	if ($foruserprofile)
616
-	{
617
-
618
-
619
-	}
620
-	else
621
-	{
622
-		print '<tr class="oddeven">';
623
-		print '<td>'.$langs->trans("TextTitleColor").'</td>';
624
-		print '<td colspan="'.($colspan-1).'">';
625
-		if ($edit)
626
-		{
627
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' ';
628
-		}
629
-		else
630
-		{
631
-			print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
632
-		}
633
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #643c14">643c14</span></strong>) ';
634
-		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
635
-		print '</span>';
636
-		print '</td>';
637
-
638
-		print '</tr>';
639
-	}
640
-
641
-	// BackgroundTableTitleColor
642
-	if ($foruserprofile)
643
-	{
644
-
645
-
646
-	}
647
-	else
648
-	{
649
-		print '<tr class="oddeven">';
650
-		print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
651
-		print '<td colspan="'.($colspan-1).'">';
652
-		if ($edit)
653
-		{
654
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' ';
655
-		}
656
-	   	else
657
-	   	{
658
-	   		print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
659
-	   	}
660
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>f0f0f0</strong>) ';  // $colorbacktitle1 in CSS
661
-		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
662
-		print '</span>';
663
-		print '</td>';
664
-
665
-		print '</tr>';
666
-	}
667
-
668
-	// TextTitleColor
669
-	if ($foruserprofile)
670
-	{
671
-
672
-
673
-	}
674
-	else
675
-	{
676
-		print '<tr class="oddeven">';
677
-		print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
678
-		print '<td colspan="'.($colspan-1).'">';
679
-		if ($edit)
680
-		{
681
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE,array()),''),'THEME_ELDY_TEXTTITLE','formcolor',1).' ';
682
-		}
683
-		else
684
-		{
685
-			print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
686
-		}
687
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #000000">000000</span></strong>) ';
688
-		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
689
-		print '</span>';
690
-		print '</td>';
691
-
692
-		print '</tr>';
693
-	}
694
-
695
-	// BackgroundTableLineOddColor
696
-	if ($foruserprofile)
697
-	{
698
-
699
-	}
700
-	else
701
-	{
702
-		$default='ffffff';
703
-		if ($conf->theme == 'md') $default='ffffff';
704
-
705
-		print '<tr class="oddeven">';
706
-		print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
707
-		print '<td colspan="'.($colspan-1).'">';
708
-		if ($edit)
709
-		{
710
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' ';
711
-		}
712
-		else
713
-		{
714
-			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),'');
715
-			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
716
-			else print $langs->trans("Default");
717
-		}
718
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
719
-		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
720
-		print '</span>';
721
-		print '</td>';
722
-	}
723
-
724
-	// BackgroundTableLineEvenColor
725
-	if ($foruserprofile)
726
-	{
727
-
728
-	}
729
-	else
730
-	{
731
-		$default='f8f8f8';
732
-		if ($conf->theme == 'md') $default='f8f8f8';
733
-
734
-		print '<tr class="oddeven">';
735
-		print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
736
-		print '<td colspan="'.($colspan-1).'">';
737
-		if ($edit)
738
-		{
739
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' ';
740
-		}
741
-		else
742
-		{
743
-			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),'');
744
-			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
745
-			else print $langs->trans("Default");
746
-		}
747
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
748
-		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
749
-		print '</span>';
750
-		print '</td>';
751
-	}
752
-
753
-	// Text LinkColor
754
-	if ($foruserprofile)
755
-	{
756
-		/*
589
+    }
590
+    else
591
+    {
592
+        $default='f0f0f0';
593
+        if ($conf->theme == 'md') $default='ffffff';
594
+
595
+        print '<tr class="oddeven">';
596
+        print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
597
+        print '<td colspan="'.($colspan-1).'">';
598
+        if ($edit)
599
+        {
600
+            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' ';
601
+        }
602
+        else
603
+        {
604
+            $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),'');
605
+            if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
606
+            else print $langs->trans("Default");
607
+        }
608
+        print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
609
+        print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
610
+        print '</span>';
611
+        print '</td>';
612
+    }
613
+
614
+    // TextTitleColor for title of Pages
615
+    if ($foruserprofile)
616
+    {
617
+
618
+
619
+    }
620
+    else
621
+    {
622
+        print '<tr class="oddeven">';
623
+        print '<td>'.$langs->trans("TextTitleColor").'</td>';
624
+        print '<td colspan="'.($colspan-1).'">';
625
+        if ($edit)
626
+        {
627
+            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' ';
628
+        }
629
+        else
630
+        {
631
+            print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
632
+        }
633
+        print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #643c14">643c14</span></strong>) ';
634
+        print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
635
+        print '</span>';
636
+        print '</td>';
637
+
638
+        print '</tr>';
639
+    }
640
+
641
+    // BackgroundTableTitleColor
642
+    if ($foruserprofile)
643
+    {
644
+
645
+
646
+    }
647
+    else
648
+    {
649
+        print '<tr class="oddeven">';
650
+        print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
651
+        print '<td colspan="'.($colspan-1).'">';
652
+        if ($edit)
653
+        {
654
+            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' ';
655
+        }
656
+            else
657
+            {
658
+                print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
659
+            }
660
+        print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>f0f0f0</strong>) ';  // $colorbacktitle1 in CSS
661
+        print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
662
+        print '</span>';
663
+        print '</td>';
664
+
665
+        print '</tr>';
666
+    }
667
+
668
+    // TextTitleColor
669
+    if ($foruserprofile)
670
+    {
671
+
672
+
673
+    }
674
+    else
675
+    {
676
+        print '<tr class="oddeven">';
677
+        print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
678
+        print '<td colspan="'.($colspan-1).'">';
679
+        if ($edit)
680
+        {
681
+            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE,array()),''),'THEME_ELDY_TEXTTITLE','formcolor',1).' ';
682
+        }
683
+        else
684
+        {
685
+            print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
686
+        }
687
+        print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #000000">000000</span></strong>) ';
688
+        print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
689
+        print '</span>';
690
+        print '</td>';
691
+
692
+        print '</tr>';
693
+    }
694
+
695
+    // BackgroundTableLineOddColor
696
+    if ($foruserprofile)
697
+    {
698
+
699
+    }
700
+    else
701
+    {
702
+        $default='ffffff';
703
+        if ($conf->theme == 'md') $default='ffffff';
704
+
705
+        print '<tr class="oddeven">';
706
+        print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
707
+        print '<td colspan="'.($colspan-1).'">';
708
+        if ($edit)
709
+        {
710
+            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' ';
711
+        }
712
+        else
713
+        {
714
+            $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),'');
715
+            if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
716
+            else print $langs->trans("Default");
717
+        }
718
+        print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
719
+        print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
720
+        print '</span>';
721
+        print '</td>';
722
+    }
723
+
724
+    // BackgroundTableLineEvenColor
725
+    if ($foruserprofile)
726
+    {
727
+
728
+    }
729
+    else
730
+    {
731
+        $default='f8f8f8';
732
+        if ($conf->theme == 'md') $default='f8f8f8';
733
+
734
+        print '<tr class="oddeven">';
735
+        print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
736
+        print '<td colspan="'.($colspan-1).'">';
737
+        if ($edit)
738
+        {
739
+            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' ';
740
+        }
741
+        else
742
+        {
743
+            $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),'');
744
+            if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
745
+            else print $langs->trans("Default");
746
+        }
747
+        print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
748
+        print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
749
+        print '</span>';
750
+        print '</td>';
751
+    }
752
+
753
+    // Text LinkColor
754
+    if ($foruserprofile)
755
+    {
756
+        /*
757 757
 	     print '<tr class="oddeven">';
758 758
 	     print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
759 759
 	     print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTLINK:$langs->trans("Default")).'</td>';
@@ -773,37 +773,37 @@  discard block
 block discarded – undo
773 773
 	     }
774 774
 	    	if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
775 775
 	    	print '</td>';*/
776
-	}
777
-	else
778
-	{
779
-		print '<tr class="oddeven">';
780
-		print '<td>'.$langs->trans("LinkColor").'</td>';
781
-		print '<td colspan="'.($colspan-1).'">';
782
-		if ($edit)
783
-		{
784
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' ';
785
-		}
786
-		else
787
-		{
788
-			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
789
-			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
790
-			else
791
-			{
792
-				//print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
793
-				//print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
794
-				print $langs->trans("Default");
795
-			}
796
-		}
797
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #000078">000078</span></strong>) ';
798
-		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
799
-		print '</span>';
800
-		print '</td>';
801
-	}
802
-
803
-	// Use Hover
804
-	if ($foruserprofile)
805
-	{
806
-		/* Must first change option to choose color of highlight instead of yes or no.
776
+    }
777
+    else
778
+    {
779
+        print '<tr class="oddeven">';
780
+        print '<td>'.$langs->trans("LinkColor").'</td>';
781
+        print '<td colspan="'.($colspan-1).'">';
782
+        if ($edit)
783
+        {
784
+            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' ';
785
+        }
786
+        else
787
+        {
788
+            $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
789
+            if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
790
+            else
791
+            {
792
+                //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
793
+                //print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
794
+                print $langs->trans("Default");
795
+            }
796
+        }
797
+        print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #000078">000078</span></strong>) ';
798
+        print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
799
+        print '</span>';
800
+        print '</td>';
801
+    }
802
+
803
+    // Use Hover
804
+    if ($foruserprofile)
805
+    {
806
+        /* Must first change option to choose color of highlight instead of yes or no.
807 807
 	     print '<tr class="oddeven">';
808 808
 	     print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
809 809
 	     print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
@@ -813,40 +813,40 @@  discard block
 block discarded – undo
813 813
 	     print '</td>';
814 814
 	     print '</tr>';
815 815
 	     */
816
-	}
817
-	else {
818
-		print '<tr class="oddeven">';
819
-		print '<td>'.$langs->trans("HighlightLinesColor").'</td>';
820
-		print '<td colspan="'.($colspan-1).'">';
821
-		//print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
822
-		//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
823
-		if ($edit)
824
-		{
825
-			if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
826
-			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
827
-			print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' ';
828
-		}
829
-		else
830
-		{
831
-			if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
832
-			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
833
-			if ($color)
834
-			{
835
-				if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
836
-				else print $langs->trans("Default");
837
-			}
838
-			else print $langs->trans("None");
839
-		}
840
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
841
-		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
842
-		print '</span>';
843
-		print '</td>';
844
-	}
845
-
846
-	// Use Checked
847
-	if ($foruserprofile)
848
-	{
849
-		/* Must first change option to choose color of highlight instead of yes or no.
816
+    }
817
+    else {
818
+        print '<tr class="oddeven">';
819
+        print '<td>'.$langs->trans("HighlightLinesColor").'</td>';
820
+        print '<td colspan="'.($colspan-1).'">';
821
+        //print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
822
+        //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
823
+        if ($edit)
824
+        {
825
+            if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
826
+            else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
827
+            print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' ';
828
+        }
829
+        else
830
+        {
831
+            if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
832
+            else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
833
+            if ($color)
834
+            {
835
+                if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
836
+                else print $langs->trans("Default");
837
+            }
838
+            else print $langs->trans("None");
839
+        }
840
+        print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
841
+        print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
842
+        print '</span>';
843
+        print '</td>';
844
+    }
845
+
846
+    // Use Checked
847
+    if ($foruserprofile)
848
+    {
849
+        /* Must first change option to choose color of highlight instead of yes or no.
850 850
 	     print '<tr class="oddeven">';
851 851
 	     print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
852 852
 	     print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
@@ -856,37 +856,37 @@  discard block
 block discarded – undo
856 856
 	     print '</td>';
857 857
 	     print '</tr>';
858 858
 	     */
859
-	}
860
-	else
861
-	{
862
-		print '<tr class="oddeven">';
863
-		print '<td>'.$langs->trans("HighlightLinesChecked").'</td>';
864
-		print '<td colspan="'.($colspan-1).'">';
865
-		//print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
866
-		//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
867
-		if ($edit)
868
-		{
869
-			if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
870
-			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
871
-			print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' ';
872
-		}
873
-		else
874
-		{
875
-			if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
876
-			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
877
-			if ($color)
878
-			{
879
-				if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
880
-				else print $langs->trans("Default");
881
-			}
882
-			else print $langs->trans("None");
883
-		}
884
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
885
-		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
886
-		print '</span>';
887
-		print '</td>';
888
-		print '</tr>';
889
-	}
890
-
891
-	print '</table>';
859
+    }
860
+    else
861
+    {
862
+        print '<tr class="oddeven">';
863
+        print '<td>'.$langs->trans("HighlightLinesChecked").'</td>';
864
+        print '<td colspan="'.($colspan-1).'">';
865
+        //print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
866
+        //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
867
+        if ($edit)
868
+        {
869
+            if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
870
+            else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
871
+            print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' ';
872
+        }
873
+        else
874
+        {
875
+            if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
876
+            else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
877
+            if ($color)
878
+            {
879
+                if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
880
+                else print $langs->trans("Default");
881
+            }
882
+            else print $langs->trans("None");
883
+        }
884
+        print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
885
+        print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
886
+        print '</span>';
887
+        print '</td>';
888
+        print '</tr>';
889
+    }
890
+
891
+    print '</table>';
892 892
 }
Please login to merge, or discard this patch.
Spacing   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 
38 38
 	$langs->load("users");
39 39
 
40
-	$canreadperms=true;
41
-	if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
40
+	$canreadperms = true;
41
+	if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
42 42
 	{
43
-		$canreadperms=($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms));
43
+		$canreadperms = ($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms));
44 44
 	}
45 45
 
46 46
 	$h = 0;
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	$head[$h][2] = 'user';
52 52
 	$h++;
53 53
 
54
-	if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE))
55
-		&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
54
+	if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_SYNCHRO_ACTIVE))
55
+		&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin)))
56 56
 	{
57 57
 		$langs->load("ldap");
58 58
 		$head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	if ($canreadperms)
65 65
 	{
66 66
 		$head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
67
-		$head[$h][1] = $langs->trans("Rights"). ' <span class="badge">'.($object->nb_rights).'</span>';
67
+		$head[$h][1] = $langs->trans("Rights").' <span class="badge">'.($object->nb_rights).'</span>';
68 68
 		$head[$h][2] = 'rights';
69 69
 		$h++;
70 70
 	}
@@ -74,23 +74,23 @@  discard block
 block discarded – undo
74 74
 	$head[$h][2] = 'guisetup';
75 75
 	$h++;
76 76
 
77
-	if (! empty($conf->agenda->enabled))
77
+	if (!empty($conf->agenda->enabled))
78 78
 	{
79
-		if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
80
-		$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
79
+		if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5;
80
+		$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
81 81
 
82
-		$i=1;
82
+		$i = 1;
83 83
 		$nbagenda = 0;
84 84
 		while ($i <= $MAXAGENDA)
85 85
 		{
86
-			$key=$i;
87
-			$name='AGENDA_EXT_NAME_'.$object->id.'_'.$key;
88
-			$src='AGENDA_EXT_SRC_'.$object->id.'_'.$key;
89
-			$offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key;
90
-			$color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
86
+			$key = $i;
87
+			$name = 'AGENDA_EXT_NAME_'.$object->id.'_'.$key;
88
+			$src = 'AGENDA_EXT_SRC_'.$object->id.'_'.$key;
89
+			$offsettz = 'AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key;
90
+			$color = 'AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
91 91
 			$i++;
92 92
 
93
-			if (! empty($object->conf->$name)) $nbagenda++;
93
+			if (!empty($object->conf->$name)) $nbagenda++;
94 94
 		}
95 95
 
96 96
 		$head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		$h++;
100 100
 	}
101 101
 
102
-	if (! empty($conf->clicktodial->enabled))
102
+	if (!empty($conf->clicktodial->enabled))
103 103
 	{
104 104
 		$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
105 105
 		$head[$h][1] = $langs->trans("ClickToDial");
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 	}
109 109
 
110 110
 	// Notifications
111
-	if ($user->societe_id == 0 && ! empty($conf->notification->enabled))
111
+	if ($user->societe_id == 0 && !empty($conf->notification->enabled))
112 112
 	{
113 113
 		$nbNote = 0;
114 114
 		$sql = "SELECT COUNT(n.rowid) as nb";
115
-		$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n";
116
-		$sql.= " WHERE fk_user = ".$object->id;
117
-		$resql=$db->query($sql);
115
+		$sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n";
116
+		$sql .= " WHERE fk_user = ".$object->id;
117
+		$resql = $db->query($sql);
118 118
 		if ($resql)
119 119
 		{
120 120
 			$num = $db->num_rows($resql);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			while ($i < $num)
123 123
 			{
124 124
 				$obj = $db->fetch_object($resql);
125
-				$nbNote=$obj->nb;
125
+				$nbNote = $obj->nb;
126 126
 				$i++;
127 127
 			}
128 128
 		}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 		$head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id;
134 134
 		$head[$h][1] = $langs->trans("Notifications");
135
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
135
+		if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>';
136 136
 		$head[$h][2] = 'notify';
137 137
 		$h++;
138 138
 	}
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
 	// Entries must be declared in modules descriptor with line
142 142
 	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
143 143
 	// $this->tabs = array('entity:-tabname);   												to remove a tab
144
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'user');
144
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'user');
145 145
 
146
-	if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
147
-		|| (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))
148
-		|| (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && $user->id == $object->id)
149
-		|| (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && $user->id == $object->id )
146
+	if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read))
147
+		|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))
148
+		|| (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && $user->id == $object->id)
149
+		|| (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && $user->id == $object->id)
150 150
 		)
151 151
 	{
152 152
 		// Bank
@@ -161,22 +161,22 @@  discard block
 block discarded – undo
161 161
 	{
162 162
 		// Notes
163 163
 		$nbNote = 0;
164
-		if(!empty($object->note)) $nbNote++;
164
+		if (!empty($object->note)) $nbNote++;
165 165
 		$head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
166 166
 		$head[$h][1] = $langs->trans("Note");
167
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
167
+		if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>';
168 168
 		$head[$h][2] = 'note';
169 169
 		$h++;
170 170
 
171 171
 		// Attached files
172 172
 		require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
173 173
 		require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
174
-		$upload_dir = $conf->user->dir_output . "/" . $object->id;
175
-		$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
176
-		$nbLinks=Link::count($db, $object->element, $object->id);
174
+		$upload_dir = $conf->user->dir_output."/".$object->id;
175
+		$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
176
+		$nbLinks = Link::count($db, $object->element, $object->id);
177 177
 		$head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id;
178 178
 		$head[$h][1] = $langs->trans("Documents");
179
-		if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
179
+		if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>';
180 180
 		$head[$h][2] = 'document';
181 181
 		$h++;
182 182
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		$h++;
187 187
 	}
188 188
 
189
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove');
189
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'user', 'remove');
190 190
 
191 191
 	return $head;
192 192
 }
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 {
202 202
 	global $langs, $conf, $user;
203 203
 
204
-	$canreadperms=true;
205
-	if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
204
+	$canreadperms = true;
205
+	if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
206 206
 	{
207
-		$canreadperms=($user->admin || $user->rights->user->group_advance->readperms);
207
+		$canreadperms = ($user->admin || $user->rights->user->group_advance->readperms);
208 208
 	}
209 209
 
210 210
 	$h = 0;
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 	$head[$h][2] = 'group';
216 216
 	$h++;
217 217
 
218
-	if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE))
219
-		&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
218
+	if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_SYNCHRO_ACTIVE))
219
+		&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin)))
220 220
 	{
221 221
 		$langs->load("ldap");
222 222
 		$head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	if ($canreadperms)
229 229
 	{
230 230
 		$head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id;
231
-		$head[$h][1] = $langs->trans("GroupRights"). ' <span class="badge">'.($object->nb_rights).'</span>';
231
+		$head[$h][1] = $langs->trans("GroupRights").' <span class="badge">'.($object->nb_rights).'</span>';
232 232
 		$head[$h][2] = 'rights';
233 233
 		$h++;
234 234
 	}
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
 	// Entries must be declared in modules descriptor with line
238 238
 	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
239 239
 	// $this->tabs = array('entity:-tabname);   												to remove a tab
240
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'group');
240
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'group');
241 241
 
242
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'group','remove');
242
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'group', 'remove');
243 243
 
244 244
 	return $head;
245 245
 }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	global $langs, $conf, $user;
255 255
 
256 256
 	$langs->load("users");
257
-	$h=0;
257
+	$h = 0;
258 258
 
259 259
 	$head[$h][0] = DOL_URL_ROOT.'/admin/user.php';
260 260
 	$head[$h][1] = $langs->trans("Parameters");
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 	// Entries must be declared in modules descriptor with line
281 281
 	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
282 282
 	// $this->tabs = array('entity:-tabname);   												to remove a tab
283
-	complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin');
283
+	complete_head_from_modules($conf, $langs, null, $head, $h, 'useradmin');
284 284
 
285
-	complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin','remove');
285
+	complete_head_from_modules($conf, $langs, null, $head, $h, 'useradmin', 'remove');
286 286
 
287 287
 	return $head;
288 288
 }
@@ -295,42 +295,42 @@  discard block
 block discarded – undo
295 295
  * 	@param	boolean		$foruserprofile		Show for user profile view
296 296
  * 	@return	void
297 297
  */
298
-function show_theme($fuser,$edit=0,$foruserprofile=false)
298
+function show_theme($fuser, $edit = 0, $foruserprofile = false)
299 299
 {
300
-	global $conf,$langs,$db,$form;
300
+	global $conf, $langs, $db, $form;
301 301
 	global $bc;
302 302
 
303
-	require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
303
+	require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
304 304
 
305 305
 	$formother = new FormOther($db);
306 306
 
307
-	$dirthemes=array('/theme');
308
-	if (! empty($conf->modules_parts['theme']))		// Using this feature slow down application
307
+	$dirthemes = array('/theme');
308
+	if (!empty($conf->modules_parts['theme']))		// Using this feature slow down application
309 309
 	{
310
-		foreach($conf->modules_parts['theme'] as $reldir)
310
+		foreach ($conf->modules_parts['theme'] as $reldir)
311 311
 		{
312
-			$dirthemes=array_merge($dirthemes,(array) ($reldir.'theme'));
312
+			$dirthemes = array_merge($dirthemes, (array) ($reldir.'theme'));
313 313
 		}
314 314
 	}
315
-	$dirthemes=array_unique($dirthemes);
315
+	$dirthemes = array_unique($dirthemes);
316 316
 	// Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
317 317
 
318
-	$selected_theme='';
319
-	if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME;
320
-	else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:'');
318
+	$selected_theme = '';
319
+	if (empty($foruserprofile)) $selected_theme = $conf->global->MAIN_THEME;
320
+	else $selected_theme = ((is_object($fuser) && !empty($fuser->conf->MAIN_THEME)) ? $fuser->conf->MAIN_THEME : '');
321 321
 
322
-	$hoverdisabled='';
323
-	if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0');
324
-	else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):'');
322
+	$hoverdisabled = '';
323
+	if (empty($foruserprofile)) $hoverdisabled = (isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0');
324
+	else $hoverdisabled = (is_object($fuser) ? (empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0') : '');
325 325
 
326
-	$checkeddisabled='';
327
-	if (empty($foruserprofile)) $checkeddisabled=(isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0');
328
-	else $checkeddisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0'):'');
326
+	$checkeddisabled = '';
327
+	if (empty($foruserprofile)) $checkeddisabled = (isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0');
328
+	else $checkeddisabled = (is_object($fuser) ? (empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0') : '');
329 329
 
330
-	$colspan=2;
331
-	if ($foruserprofile) $colspan=4;
330
+	$colspan = 2;
331
+	if ($foruserprofile) $colspan = 4;
332 332
 
333
-	$thumbsbyrow=6;
333
+	$thumbsbyrow = 6;
334 334
 	print '<table class="noborder" width="100%">';
335 335
 
336 336
 	// Title
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		print '<tr>';
344 344
 		print '<td>'.$langs->trans("DefaultSkin").'</td>';
345 345
 		print '<td>'.$conf->global->MAIN_THEME.'</td>';
346
-		print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
346
+		print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit ? '' : ' disabled').' type="checkbox" '.($selected_theme ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
347 347
 		print '<td>&nbsp;</td>';
348 348
 		print '</tr>';
349 349
 	}
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
 	{
352 352
 		print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>';
353 353
 		print '<th align="right">';
354
-		$url='https://www.dolistore.com/lang-en/4-skins';
355
-		if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes';
354
+		$url = 'https://www.dolistore.com/lang-en/4-skins';
355
+		if (preg_match('/fr/i', $langs->defaultlang)) $url = 'https://www.dolistore.com/fr/4-themes';
356 356
 		//if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes';
357 357
 		print '<a href="'.$url.'" target="_blank">';
358 358
 		print $langs->trans('DownloadMoreSkins');
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 		print '<tr>';
363 363
 		print '<td>'.$langs->trans("ThemeDir").'</td>';
364 364
 		print '<td>';
365
-		foreach($dirthemes as $dirtheme)
365
+		foreach ($dirthemes as $dirtheme)
366 366
 		{
367 367
 			echo '"'.$dirtheme.'" ';
368 368
 		}
@@ -374,43 +374,43 @@  discard block
 block discarded – undo
374 374
 
375 375
 	print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">';
376 376
 
377
-	$i=0;
378
-	foreach($dirthemes as $dir)
377
+	$i = 0;
378
+	foreach ($dirthemes as $dir)
379 379
 	{
380 380
 		//print $dirroot.$dir;exit;
381
-		$dirtheme=dol_buildpath($dir,0);	// This include loop on $conf->file->dol_document_root
382
-		$urltheme=dol_buildpath($dir,1);
381
+		$dirtheme = dol_buildpath($dir, 0); // This include loop on $conf->file->dol_document_root
382
+		$urltheme = dol_buildpath($dir, 1);
383 383
 
384 384
 		if (is_dir($dirtheme))
385 385
 		{
386
-			$handle=opendir($dirtheme);
386
+			$handle = opendir($dirtheme);
387 387
 			if (is_resource($handle))
388 388
 			{
389
-				while (($subdir = readdir($handle))!==false)
389
+				while (($subdir = readdir($handle)) !== false)
390 390
 				{
391 391
 					if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
392
-							&& substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir))
392
+							&& substr($subdir, 0, 3) <> 'CVS' && !preg_match('/common|phones/i', $subdir))
393 393
 					{
394 394
 						// Disable not stable themes (dir ends with _exp or _dev)
395
-						if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) continue;
396
-						if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) continue;
395
+						if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) continue;
396
+						if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) continue;
397 397
 
398 398
 						print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
399
-						$file=$dirtheme."/".$subdir."/thumb.png";
400
-						$url=$urltheme."/".$subdir."/thumb.png";
401
-						if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png';
402
-						print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST('optioncss','alpha',1)?'&optioncss='.GETPOST('optioncss','alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
403
-						if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive");
404
-						else $title=$langs->trans("ShowPreview");
399
+						$file = $dirtheme."/".$subdir."/thumb.png";
400
+						$url = $urltheme."/".$subdir."/thumb.png";
401
+						if (!file_exists($file)) $url = DOL_URL_ROOT.'/public/theme/common/nophoto.png';
402
+						print '<a href="'.$_SERVER["PHP_SELF"].($edit ? '?action=edit&theme=' : '?theme=').$subdir.(GETPOST('optioncss', 'alpha', 1) ? '&optioncss='.GETPOST('optioncss', 'alpha', 1) : '').($fuser ? '&id='.$fuser->id : '').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
403
+						if ($subdir == $conf->global->MAIN_THEME) $title = $langs->trans("ThemeCurrentlyActive");
404
+						else $title = $langs->trans("ShowPreview");
405 405
 						print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">';
406 406
 						print '</a><br>';
407 407
 						if ($subdir == $selected_theme)
408 408
 						{
409
-							print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
409
+							print '<input '.($edit ? '' : 'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
410 410
 						}
411 411
 						else
412 412
 						{
413
-							print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
413
+							print '<input '.($edit ? '' : 'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
414 414
 						}
415 415
 						print '</div>';
416 416
 
@@ -451,10 +451,10 @@  discard block
 block discarded – undo
451 451
 	}
452 452
 	else
453 453
 	{
454
-		$default=$langs->trans('No');
454
+		$default = $langs->trans('No');
455 455
 		print '<tr class="oddeven">';
456 456
 		print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
457
-		print '<td colspan="'.($colspan-1).'">';
457
+		print '<td colspan="'.($colspan - 1).'">';
458 458
 		if ($edit)
459 459
 		{
460 460
 			print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1);
@@ -497,15 +497,15 @@  discard block
 block discarded – undo
497 497
 	{
498 498
 		print '<tr class="oddeven">';
499 499
 		print '<td>'.$langs->trans("BackgroundColor").'</td>';
500
-		print '<td colspan="'.($colspan-1).'">';
500
+		print '<td colspan="'.($colspan - 1).'">';
501 501
 		//var_dump($conf->global->THEME_ELDY_BACKBODY);
502 502
 		if ($edit)
503 503
 		{
504
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''),'THEME_ELDY_BACKBODY','formcolor',1).' ';
504
+			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''), 'THEME_ELDY_BACKBODY', 'formcolor', 1).' ';
505 505
 		}
506 506
 	   	else
507 507
 	   	{
508
-	   		$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),'');
508
+	   		$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), '');
509 509
 			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
510 510
 			else print $langs->trans("Default");
511 511
 	   	}
@@ -541,19 +541,19 @@  discard block
 block discarded – undo
541 541
 	}
542 542
 	else
543 543
 	{
544
-		$default='5a6482';
545
-		if ($conf->theme == 'md') $default='5a3278';
544
+		$default = '5a6482';
545
+		if ($conf->theme == 'md') $default = '5a3278';
546 546
 
547 547
 		print '<tr class="oddeven">';
548 548
 		print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
549
-		print '<td colspan="'.($colspan-1).'">';
549
+		print '<td colspan="'.($colspan - 1).'">';
550 550
 		if ($edit)
551 551
 		{
552
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
552
+			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''), 'THEME_ELDY_TOPMENU_BACK1', 'formcolor', 1).' ';
553 553
 		}
554 554
 	   	else
555 555
 	   	{
556
-	   		$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
556
+	   		$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), '');
557 557
 			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
558 558
 			else print $langs->trans("Default");
559 559
 	   	}
@@ -589,19 +589,19 @@  discard block
 block discarded – undo
589 589
 	}
590 590
 	else
591 591
 	{
592
-		$default='f0f0f0';
593
-		if ($conf->theme == 'md') $default='ffffff';
592
+		$default = 'f0f0f0';
593
+		if ($conf->theme == 'md') $default = 'ffffff';
594 594
 
595 595
 		print '<tr class="oddeven">';
596 596
 		print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
597
-		print '<td colspan="'.($colspan-1).'">';
597
+		print '<td colspan="'.($colspan - 1).'">';
598 598
 		if ($edit)
599 599
 		{
600
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' ';
600
+			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''), 'THEME_ELDY_VERMENU_BACK1', 'formcolor', 1).' ';
601 601
 		}
602 602
 		else
603 603
 		{
604
-			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),'');
604
+			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), '');
605 605
 			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
606 606
 			else print $langs->trans("Default");
607 607
 		}
@@ -621,10 +621,10 @@  discard block
 block discarded – undo
621 621
 	{
622 622
 		print '<tr class="oddeven">';
623 623
 		print '<td>'.$langs->trans("TextTitleColor").'</td>';
624
-		print '<td colspan="'.($colspan-1).'">';
624
+		print '<td colspan="'.($colspan - 1).'">';
625 625
 		if ($edit)
626 626
 		{
627
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' ';
627
+			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB, array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', 'formcolor', 1).' ';
628 628
 		}
629 629
 		else
630 630
 		{
@@ -648,16 +648,16 @@  discard block
 block discarded – undo
648 648
 	{
649 649
 		print '<tr class="oddeven">';
650 650
 		print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
651
-		print '<td colspan="'.($colspan-1).'">';
651
+		print '<td colspan="'.($colspan - 1).'">';
652 652
 		if ($edit)
653 653
 		{
654
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' ';
654
+			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1, array()), ''), 'THEME_ELDY_BACKTITLE1', 'formcolor', 1).' ';
655 655
 		}
656 656
 	   	else
657 657
 	   	{
658 658
 	   		print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
659 659
 	   	}
660
-		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>f0f0f0</strong>) ';  // $colorbacktitle1 in CSS
660
+		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>f0f0f0</strong>) '; // $colorbacktitle1 in CSS
661 661
 		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
662 662
 		print '</span>';
663 663
 		print '</td>';
@@ -675,10 +675,10 @@  discard block
 block discarded – undo
675 675
 	{
676 676
 		print '<tr class="oddeven">';
677 677
 		print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
678
-		print '<td colspan="'.($colspan-1).'">';
678
+		print '<td colspan="'.($colspan - 1).'">';
679 679
 		if ($edit)
680 680
 		{
681
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE,array()),''),'THEME_ELDY_TEXTTITLE','formcolor',1).' ';
681
+			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE, array()), ''), 'THEME_ELDY_TEXTTITLE', 'formcolor', 1).' ';
682 682
 		}
683 683
 		else
684 684
 		{
@@ -699,19 +699,19 @@  discard block
 block discarded – undo
699 699
 	}
700 700
 	else
701 701
 	{
702
-		$default='ffffff';
703
-		if ($conf->theme == 'md') $default='ffffff';
702
+		$default = 'ffffff';
703
+		if ($conf->theme == 'md') $default = 'ffffff';
704 704
 
705 705
 		print '<tr class="oddeven">';
706 706
 		print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
707
-		print '<td colspan="'.($colspan-1).'">';
707
+		print '<td colspan="'.($colspan - 1).'">';
708 708
 		if ($edit)
709 709
 		{
710
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' ';
710
+			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''), 'THEME_ELDY_LINEIMPAIR1', 'formcolor', 1).' ';
711 711
 		}
712 712
 		else
713 713
 		{
714
-			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),'');
714
+			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), '');
715 715
 			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
716 716
 			else print $langs->trans("Default");
717 717
 		}
@@ -728,19 +728,19 @@  discard block
 block discarded – undo
728 728
 	}
729 729
 	else
730 730
 	{
731
-		$default='f8f8f8';
732
-		if ($conf->theme == 'md') $default='f8f8f8';
731
+		$default = 'f8f8f8';
732
+		if ($conf->theme == 'md') $default = 'f8f8f8';
733 733
 
734 734
 		print '<tr class="oddeven">';
735 735
 		print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
736
-		print '<td colspan="'.($colspan-1).'">';
736
+		print '<td colspan="'.($colspan - 1).'">';
737 737
 		if ($edit)
738 738
 		{
739
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' ';
739
+			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''), 'THEME_ELDY_LINEPAIR1', 'formcolor', 1).' ';
740 740
 		}
741 741
 		else
742 742
 		{
743
-			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),'');
743
+			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), '');
744 744
 			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
745 745
 			else print $langs->trans("Default");
746 746
 		}
@@ -778,14 +778,14 @@  discard block
 block discarded – undo
778 778
 	{
779 779
 		print '<tr class="oddeven">';
780 780
 		print '<td>'.$langs->trans("LinkColor").'</td>';
781
-		print '<td colspan="'.($colspan-1).'">';
781
+		print '<td colspan="'.($colspan - 1).'">';
782 782
 		if ($edit)
783 783
 		{
784
-			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' ';
784
+			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''), 'THEME_ELDY_TEXTLINK', 'formcolor', 1).' ';
785 785
 		}
786 786
 		else
787 787
 		{
788
-			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
788
+			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), '');
789 789
 			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
790 790
 			else
791 791
 			{
@@ -817,19 +817,19 @@  discard block
 block discarded – undo
817 817
 	else {
818 818
 		print '<tr class="oddeven">';
819 819
 		print '<td>'.$langs->trans("HighlightLinesColor").'</td>';
820
-		print '<td colspan="'.($colspan-1).'">';
820
+		print '<td colspan="'.($colspan - 1).'">';
821 821
 		//print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
822 822
 		//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
823 823
 		if ($edit)
824 824
 		{
825
-			if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
826
-			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
827
-			print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' ';
825
+			if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = 'e6edf0';
826
+			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
827
+			print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', 'formcolor', 1).' ';
828 828
 		}
829 829
 		else
830 830
 		{
831
-			if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
832
-			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
831
+			if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = 'e6edf0';
832
+			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
833 833
 			if ($color)
834 834
 			{
835 835
 				if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -861,19 +861,19 @@  discard block
 block discarded – undo
861 861
 	{
862 862
 		print '<tr class="oddeven">';
863 863
 		print '<td>'.$langs->trans("HighlightLinesChecked").'</td>';
864
-		print '<td colspan="'.($colspan-1).'">';
864
+		print '<td colspan="'.($colspan - 1).'">';
865 865
 		//print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
866 866
 		//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
867 867
 		if ($edit)
868 868
 		{
869
-			if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
870
-			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
871
-			print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' ';
869
+			if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0';
870
+			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), '');
871
+			print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', 'formcolor', 1).' ';
872 872
 		}
873 873
 		else
874 874
 		{
875
-			if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
876
-			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
875
+			if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0';
876
+			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), '');
877 877
 			if ($color)
878 878
 			{
879 879
 				if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
Please login to merge, or discard this patch.
Braces   +157 added lines, -104 removed lines patch added patch discarded remove patch
@@ -76,7 +76,9 @@  discard block
 block discarded – undo
76 76
 
77 77
 	if (! empty($conf->agenda->enabled))
78 78
 	{
79
-		if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
79
+		if (empty($conf->global->AGENDA_EXT_NB)) {
80
+		    $conf->global->AGENDA_EXT_NB=5;
81
+		}
80 82
 		$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
81 83
 
82 84
 		$i=1;
@@ -90,7 +92,9 @@  discard block
 block discarded – undo
90 92
 			$color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
91 93
 			$i++;
92 94
 
93
-			if (! empty($object->conf->$name)) $nbagenda++;
95
+			if (! empty($object->conf->$name)) {
96
+			    $nbagenda++;
97
+			}
94 98
 		}
95 99
 
96 100
 		$head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
@@ -125,14 +129,15 @@  discard block
 block discarded – undo
125 129
 				$nbNote=$obj->nb;
126 130
 				$i++;
127 131
 			}
128
-		}
129
-		else {
132
+		} else {
130 133
 			dol_print_error($db);
131 134
 		}
132 135
 
133 136
 		$head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id;
134 137
 		$head[$h][1] = $langs->trans("Notifications");
135
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
138
+		if ($nbNote > 0) {
139
+		    $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
140
+		}
136 141
 		$head[$h][2] = 'notify';
137 142
 		$h++;
138 143
 	}
@@ -161,10 +166,14 @@  discard block
 block discarded – undo
161 166
 	{
162 167
 		// Notes
163 168
 		$nbNote = 0;
164
-		if(!empty($object->note)) $nbNote++;
169
+		if(!empty($object->note)) {
170
+		    $nbNote++;
171
+		}
165 172
 		$head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
166 173
 		$head[$h][1] = $langs->trans("Note");
167
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
174
+		if ($nbNote > 0) {
175
+		    $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
176
+		}
168 177
 		$head[$h][2] = 'note';
169 178
 		$h++;
170 179
 
@@ -176,7 +185,9 @@  discard block
 block discarded – undo
176 185
 		$nbLinks=Link::count($db, $object->element, $object->id);
177 186
 		$head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id;
178 187
 		$head[$h][1] = $langs->trans("Documents");
179
-		if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
188
+		if (($nbFiles+$nbLinks) > 0) {
189
+		    $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
190
+		}
180 191
 		$head[$h][2] = 'document';
181 192
 		$h++;
182 193
 
@@ -305,30 +316,43 @@  discard block
 block discarded – undo
305 316
 	$formother = new FormOther($db);
306 317
 
307 318
 	$dirthemes=array('/theme');
308
-	if (! empty($conf->modules_parts['theme']))		// Using this feature slow down application
319
+	if (! empty($conf->modules_parts['theme'])) {
320
+	    // Using this feature slow down application
309 321
 	{
310 322
 		foreach($conf->modules_parts['theme'] as $reldir)
311 323
 		{
312 324
 			$dirthemes=array_merge($dirthemes,(array) ($reldir.'theme'));
325
+	}
313 326
 		}
314 327
 	}
315 328
 	$dirthemes=array_unique($dirthemes);
316 329
 	// Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
317 330
 
318 331
 	$selected_theme='';
319
-	if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME;
320
-	else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:'');
332
+	if (empty($foruserprofile)) {
333
+	    $selected_theme=$conf->global->MAIN_THEME;
334
+	} else {
335
+	    $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:'');
336
+	}
321 337
 
322 338
 	$hoverdisabled='';
323
-	if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0');
324
-	else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):'');
339
+	if (empty($foruserprofile)) {
340
+	    $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0');
341
+	} else {
342
+	    $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):'');
343
+	}
325 344
 
326 345
 	$checkeddisabled='';
327
-	if (empty($foruserprofile)) $checkeddisabled=(isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0');
328
-	else $checkeddisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0'):'');
346
+	if (empty($foruserprofile)) {
347
+	    $checkeddisabled=(isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0');
348
+	} else {
349
+	    $checkeddisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0'):'');
350
+	}
329 351
 
330 352
 	$colspan=2;
331
-	if ($foruserprofile) $colspan=4;
353
+	if ($foruserprofile) {
354
+	    $colspan=4;
355
+	}
332 356
 
333 357
 	$thumbsbyrow=6;
334 358
 	print '<table class="noborder" width="100%">';
@@ -346,13 +370,14 @@  discard block
 block discarded – undo
346 370
 		print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
347 371
 		print '<td>&nbsp;</td>';
348 372
 		print '</tr>';
349
-	}
350
-	else
373
+	} else
351 374
 	{
352 375
 		print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>';
353 376
 		print '<th align="right">';
354 377
 		$url='https://www.dolistore.com/lang-en/4-skins';
355
-		if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes';
378
+		if (preg_match('/fr/i',$langs->defaultlang)) {
379
+		    $url='https://www.dolistore.com/fr/4-themes';
380
+		}
356 381
 		//if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes';
357 382
 		print '<a href="'.$url.'" target="_blank">';
358 383
 		print $langs->trans('DownloadMoreSkins');
@@ -392,23 +417,31 @@  discard block
 block discarded – undo
392 417
 							&& substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir))
393 418
 					{
394 419
 						// Disable not stable themes (dir ends with _exp or _dev)
395
-						if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) continue;
396
-						if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) continue;
420
+						if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) {
421
+						    continue;
422
+						}
423
+						if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) {
424
+						    continue;
425
+						}
397 426
 
398 427
 						print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
399 428
 						$file=$dirtheme."/".$subdir."/thumb.png";
400 429
 						$url=$urltheme."/".$subdir."/thumb.png";
401
-						if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png';
430
+						if (! file_exists($file)) {
431
+						    $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png';
432
+						}
402 433
 						print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST('optioncss','alpha',1)?'&optioncss='.GETPOST('optioncss','alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
403
-						if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive");
404
-						else $title=$langs->trans("ShowPreview");
434
+						if ($subdir == $conf->global->MAIN_THEME) {
435
+						    $title=$langs->trans("ThemeCurrentlyActive");
436
+						} else {
437
+						    $title=$langs->trans("ShowPreview");
438
+						}
405 439
 						print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">';
406 440
 						print '</a><br>';
407 441
 						if ($subdir == $selected_theme)
408 442
 						{
409 443
 							print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
410
-						}
411
-						else
444
+						} else
412 445
 						{
413 446
 							print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
414 447
 						}
@@ -448,8 +481,7 @@  discard block
 block discarded – undo
448 481
          }
449 482
          if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
450 483
          print '</td>';*/
451
-	}
452
-	else
484
+	} else
453 485
 	{
454 486
 		$default=$langs->trans('No');
455 487
 		print '<tr class="oddeven">';
@@ -458,8 +490,7 @@  discard block
 block discarded – undo
458 490
 		if ($edit)
459 491
 		{
460 492
 			print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1);
461
-		}
462
-		else
493
+		} else
463 494
 		{
464 495
 			print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE);
465 496
 		}
@@ -492,8 +523,7 @@  discard block
 block discarded – undo
492 523
 	   	}
493 524
     	if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
494 525
 	    print '</td>';*/
495
-	}
496
-	else
526
+	} else
497 527
 	{
498 528
 		print '<tr class="oddeven">';
499 529
 		print '<td>'.$langs->trans("BackgroundColor").'</td>';
@@ -502,12 +532,14 @@  discard block
 block discarded – undo
502 532
 		if ($edit)
503 533
 		{
504 534
 			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''),'THEME_ELDY_BACKBODY','formcolor',1).' ';
505
-		}
506
-	   	else
535
+		} else
507 536
 	   	{
508 537
 	   		$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),'');
509
-			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
510
-			else print $langs->trans("Default");
538
+			if ($color) {
539
+			    print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
540
+			} else {
541
+			    print $langs->trans("Default");
542
+			}
511 543
 	   	}
512 544
 		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>ffffff</strong>) ';
513 545
 		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
@@ -538,11 +570,12 @@  discard block
 block discarded – undo
538 570
 	   	}
539 571
     	if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
540 572
 	    print '</td>';*/
541
-	}
542
-	else
573
+	} else
543 574
 	{
544 575
 		$default='5a6482';
545
-		if ($conf->theme == 'md') $default='5a3278';
576
+		if ($conf->theme == 'md') {
577
+		    $default='5a3278';
578
+		}
546 579
 
547 580
 		print '<tr class="oddeven">';
548 581
 		print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
@@ -550,12 +583,14 @@  discard block
 block discarded – undo
550 583
 		if ($edit)
551 584
 		{
552 585
 			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
553
-		}
554
-	   	else
586
+		} else
555 587
 	   	{
556 588
 	   		$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
557
-			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
558
-			else print $langs->trans("Default");
589
+			if ($color) {
590
+			    print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
591
+			} else {
592
+			    print $langs->trans("Default");
593
+			}
559 594
 	   	}
560 595
 		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
561 596
 		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
@@ -586,11 +621,12 @@  discard block
 block discarded – undo
586 621
 		 }
587 622
 		 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
588 623
 		 print '</td>';*/
589
-	}
590
-	else
624
+	} else
591 625
 	{
592 626
 		$default='f0f0f0';
593
-		if ($conf->theme == 'md') $default='ffffff';
627
+		if ($conf->theme == 'md') {
628
+		    $default='ffffff';
629
+		}
594 630
 
595 631
 		print '<tr class="oddeven">';
596 632
 		print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
@@ -598,12 +634,14 @@  discard block
 block discarded – undo
598 634
 		if ($edit)
599 635
 		{
600 636
 			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' ';
601
-		}
602
-		else
637
+		} else
603 638
 		{
604 639
 			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),'');
605
-			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
606
-			else print $langs->trans("Default");
640
+			if ($color) {
641
+			    print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
642
+			} else {
643
+			    print $langs->trans("Default");
644
+			}
607 645
 		}
608 646
 		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
609 647
 		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
@@ -616,8 +654,7 @@  discard block
 block discarded – undo
616 654
 	{
617 655
 
618 656
 
619
-	}
620
-	else
657
+	} else
621 658
 	{
622 659
 		print '<tr class="oddeven">';
623 660
 		print '<td>'.$langs->trans("TextTitleColor").'</td>';
@@ -625,8 +662,7 @@  discard block
 block discarded – undo
625 662
 		if ($edit)
626 663
 		{
627 664
 			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' ';
628
-		}
629
-		else
665
+		} else
630 666
 		{
631 667
 			print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
632 668
 		}
@@ -643,8 +679,7 @@  discard block
 block discarded – undo
643 679
 	{
644 680
 
645 681
 
646
-	}
647
-	else
682
+	} else
648 683
 	{
649 684
 		print '<tr class="oddeven">';
650 685
 		print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
@@ -652,8 +687,7 @@  discard block
 block discarded – undo
652 687
 		if ($edit)
653 688
 		{
654 689
 			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' ';
655
-		}
656
-	   	else
690
+		} else
657 691
 	   	{
658 692
 	   		print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
659 693
 	   	}
@@ -670,8 +704,7 @@  discard block
 block discarded – undo
670 704
 	{
671 705
 
672 706
 
673
-	}
674
-	else
707
+	} else
675 708
 	{
676 709
 		print '<tr class="oddeven">';
677 710
 		print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
@@ -679,8 +712,7 @@  discard block
 block discarded – undo
679 712
 		if ($edit)
680 713
 		{
681 714
 			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE,array()),''),'THEME_ELDY_TEXTTITLE','formcolor',1).' ';
682
-		}
683
-		else
715
+		} else
684 716
 		{
685 717
 			print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
686 718
 		}
@@ -696,11 +728,12 @@  discard block
 block discarded – undo
696 728
 	if ($foruserprofile)
697 729
 	{
698 730
 
699
-	}
700
-	else
731
+	} else
701 732
 	{
702 733
 		$default='ffffff';
703
-		if ($conf->theme == 'md') $default='ffffff';
734
+		if ($conf->theme == 'md') {
735
+		    $default='ffffff';
736
+		}
704 737
 
705 738
 		print '<tr class="oddeven">';
706 739
 		print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
@@ -708,12 +741,14 @@  discard block
 block discarded – undo
708 741
 		if ($edit)
709 742
 		{
710 743
 			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' ';
711
-		}
712
-		else
744
+		} else
713 745
 		{
714 746
 			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),'');
715
-			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
716
-			else print $langs->trans("Default");
747
+			if ($color) {
748
+			    print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
749
+			} else {
750
+			    print $langs->trans("Default");
751
+			}
717 752
 		}
718 753
 		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
719 754
 		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
@@ -725,11 +760,12 @@  discard block
 block discarded – undo
725 760
 	if ($foruserprofile)
726 761
 	{
727 762
 
728
-	}
729
-	else
763
+	} else
730 764
 	{
731 765
 		$default='f8f8f8';
732
-		if ($conf->theme == 'md') $default='f8f8f8';
766
+		if ($conf->theme == 'md') {
767
+		    $default='f8f8f8';
768
+		}
733 769
 
734 770
 		print '<tr class="oddeven">';
735 771
 		print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
@@ -737,12 +773,14 @@  discard block
 block discarded – undo
737 773
 		if ($edit)
738 774
 		{
739 775
 			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' ';
740
-		}
741
-		else
776
+		} else
742 777
 		{
743 778
 			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),'');
744
-			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
745
-			else print $langs->trans("Default");
779
+			if ($color) {
780
+			    print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
781
+			} else {
782
+			    print $langs->trans("Default");
783
+			}
746 784
 		}
747 785
 		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
748 786
 		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
@@ -773,8 +811,7 @@  discard block
 block discarded – undo
773 811
 	     }
774 812
 	    	if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
775 813
 	    	print '</td>';*/
776
-	}
777
-	else
814
+	} else
778 815
 	{
779 816
 		print '<tr class="oddeven">';
780 817
 		print '<td>'.$langs->trans("LinkColor").'</td>';
@@ -782,12 +819,12 @@  discard block
 block discarded – undo
782 819
 		if ($edit)
783 820
 		{
784 821
 			print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' ';
785
-		}
786
-		else
822
+		} else
787 823
 		{
788 824
 			$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
789
-			if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
790
-			else
825
+			if ($color) {
826
+			    print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
827
+			} else
791 828
 			{
792 829
 				//print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
793 830
 				//print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
@@ -813,8 +850,7 @@  discard block
 block discarded – undo
813 850
 	     print '</td>';
814 851
 	     print '</tr>';
815 852
 	     */
816
-	}
817
-	else {
853
+	} else {
818 854
 		print '<tr class="oddeven">';
819 855
 		print '<td>'.$langs->trans("HighlightLinesColor").'</td>';
820 856
 		print '<td colspan="'.($colspan-1).'">';
@@ -822,20 +858,29 @@  discard block
 block discarded – undo
822 858
 		//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
823 859
 		if ($edit)
824 860
 		{
825
-			if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
826
-			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
861
+			if ($conf->global->THEME_ELDY_USE_HOVER == '1') {
862
+			    $color='e6edf0';
863
+			} else {
864
+			    $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
865
+			}
827 866
 			print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' ';
828
-		}
829
-		else
867
+		} else
830 868
 		{
831
-			if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
832
-			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
869
+			if ($conf->global->THEME_ELDY_USE_HOVER == '1') {
870
+			    $color='e6edf0';
871
+			} else {
872
+			    $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
873
+			}
833 874
 			if ($color)
834 875
 			{
835
-				if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
836
-				else print $langs->trans("Default");
876
+				if ($color != 'e6edf0') {
877
+				    print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
878
+				} else {
879
+				    print $langs->trans("Default");
880
+				}
881
+			} else {
882
+			    print $langs->trans("None");
837 883
 			}
838
-			else print $langs->trans("None");
839 884
 		}
840 885
 		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
841 886
 		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
@@ -856,8 +901,7 @@  discard block
 block discarded – undo
856 901
 	     print '</td>';
857 902
 	     print '</tr>';
858 903
 	     */
859
-	}
860
-	else
904
+	} else
861 905
 	{
862 906
 		print '<tr class="oddeven">';
863 907
 		print '<td>'.$langs->trans("HighlightLinesChecked").'</td>';
@@ -866,20 +910,29 @@  discard block
 block discarded – undo
866 910
 		//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
867 911
 		if ($edit)
868 912
 		{
869
-			if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
870
-			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
913
+			if ($conf->global->THEME_ELDY_USE_CHECKED == '1') {
914
+			    $color='e6edf0';
915
+			} else {
916
+			    $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
917
+			}
871 918
 			print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' ';
872
-		}
873
-		else
919
+		} else
874 920
 		{
875
-			if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
876
-			else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
921
+			if ($conf->global->THEME_ELDY_USE_CHECKED == '1') {
922
+			    $color='e6edf0';
923
+			} else {
924
+			    $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
925
+			}
877 926
 			if ($color)
878 927
 			{
879
-				if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
880
-				else print $langs->trans("Default");
928
+				if ($color != 'e6edf0') {
929
+				    print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
930
+				} else {
931
+				    print $langs->trans("Default");
932
+				}
933
+			} else {
934
+			    print $langs->trans("None");
881 935
 			}
882
-			else print $langs->trans("None");
883 936
 		}
884 937
 		print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
885 938
 		print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/import.lib.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,22 +34,22 @@
 block discarded – undo
34 34
  */
35 35
 function import_prepare_head($param, $maxstep=0)
36 36
 {
37
-	global $langs;
37
+    global $langs;
38 38
 
39
-	if (empty($maxstep)) $maxstep=6;
39
+    if (empty($maxstep)) $maxstep=6;
40 40
 
41
-	$h=0;
42
-	$head = array();
43
-	$i=1;
44
-	while($i <= $maxstep)
45
-	{
46
-    	$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
47
-    	$head[$h][1] = $langs->trans("Step")." ".$i;
48
-    	$head[$h][2] = 'step'.$i;
49
-    	$h++;
50
-    	$i++;
51
-	}
41
+    $h=0;
42
+    $head = array();
43
+    $i=1;
44
+    while($i <= $maxstep)
45
+    {
46
+        $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
47
+        $head[$h][1] = $langs->trans("Step")." ".$i;
48
+        $head[$h][2] = 'step'.$i;
49
+        $h++;
50
+        $i++;
51
+    }
52 52
 
53
-	return $head;
53
+    return $head;
54 54
 }
55 55
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,16 +32,16 @@
 block discarded – undo
32 32
  * @param	int			$maxstep	Limit steps to maxstep or no limit if 0
33 33
  * @return	array					Array of tabs
34 34
  */
35
-function import_prepare_head($param, $maxstep=0)
35
+function import_prepare_head($param, $maxstep = 0)
36 36
 {
37 37
 	global $langs;
38 38
 
39
-	if (empty($maxstep)) $maxstep=6;
39
+	if (empty($maxstep)) $maxstep = 6;
40 40
 
41
-	$h=0;
41
+	$h = 0;
42 42
 	$head = array();
43
-	$i=1;
44
-	while($i <= $maxstep)
43
+	$i = 1;
44
+	while ($i <= $maxstep)
45 45
 	{
46 46
     	$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
47 47
     	$head[$h][1] = $langs->trans("Step")." ".$i;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@
 block discarded – undo
36 36
 {
37 37
 	global $langs;
38 38
 
39
-	if (empty($maxstep)) $maxstep=6;
39
+	if (empty($maxstep)) {
40
+	    $maxstep=6;
41
+	}
40 42
 
41 43
 	$h=0;
42 44
 	$head = array();
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/agenda.lib.php 3 patches
Indentation   +317 added lines, -317 removed lines patch added patch discarded remove patch
@@ -49,157 +49,157 @@  discard block
 block discarded – undo
49 49
  */
50 50
 function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='', $excludetype='', $resourceid=0)
51 51
 {
52
-	global $conf, $user, $langs, $db, $hookmanager;
53
-	global $begin_h, $end_h, $begin_d, $end_d;
54
-
55
-	$langs->load("companies");
56
-
57
-	include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
58
-	$formactions=new FormActions($db);
59
-
60
-	// Filters
61
-	//print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="get">';
62
-	print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
63
-	print '<input type="hidden" name="year" value="' . $year . '">';
64
-	print '<input type="hidden" name="month" value="' . $month . '">';
65
-	print '<input type="hidden" name="day" value="' . $day . '">';
66
-	print '<input type="hidden" name="action" value="' . $action . '">';
67
-	print '<input type="hidden" name="search_showbirthday" value="' . $showbirthday . '">';
68
-
69
-	print '<div class="fichecenter">';
70
-
71
-	if ($conf->browser->layout == 'phone') print '<div class="fichehalfleft">';
72
-	else print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">';
73
-
74
-	print '<table class="nobordernopadding centpercent">';
75
-
76
-	if ($canedit)
77
-	{
78
-		print '<tr>';
79
-		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
80
-		print $langs->trans("ActionsToDoBy").' &nbsp; ';
81
-		print '</td><td style="padding-bottom: 2px; padding-right: 4px;">';
82
-		print $form->select_dolusers($filtert, 'search_filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
83
-		if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
84
-		print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
85
-		print '</td></tr>';
86
-
87
-		if ($conf->resource->enabled)
88
-		{
89
-		    include_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php';
90
-		    $formresource=new FormResource($db);
91
-
92
-    		// Resource
93
-    		print '<tr>';
94
-    		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
95
-    		print $langs->trans("Resource");
96
-    		print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
52
+    global $conf, $user, $langs, $db, $hookmanager;
53
+    global $begin_h, $end_h, $begin_d, $end_d;
54
+
55
+    $langs->load("companies");
56
+
57
+    include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
58
+    $formactions=new FormActions($db);
59
+
60
+    // Filters
61
+    //print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="get">';
62
+    print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
63
+    print '<input type="hidden" name="year" value="' . $year . '">';
64
+    print '<input type="hidden" name="month" value="' . $month . '">';
65
+    print '<input type="hidden" name="day" value="' . $day . '">';
66
+    print '<input type="hidden" name="action" value="' . $action . '">';
67
+    print '<input type="hidden" name="search_showbirthday" value="' . $showbirthday . '">';
68
+
69
+    print '<div class="fichecenter">';
70
+
71
+    if ($conf->browser->layout == 'phone') print '<div class="fichehalfleft">';
72
+    else print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">';
73
+
74
+    print '<table class="nobordernopadding centpercent">';
75
+
76
+    if ($canedit)
77
+    {
78
+        print '<tr>';
79
+        print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
80
+        print $langs->trans("ActionsToDoBy").' &nbsp; ';
81
+        print '</td><td style="padding-bottom: 2px; padding-right: 4px;">';
82
+        print $form->select_dolusers($filtert, 'search_filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
83
+        if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
84
+        print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
85
+        print '</td></tr>';
86
+
87
+        if ($conf->resource->enabled)
88
+        {
89
+            include_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php';
90
+            $formresource=new FormResource($db);
91
+
92
+            // Resource
93
+            print '<tr>';
94
+            print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
95
+            print $langs->trans("Resource");
96
+            print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
97 97
             print $formresource->select_resource_list($resourceid, "search_resourceid", '', 1, 0, 0, null, '', 2);
98
-    		print '</td></tr>';
99
-		}
100
-
101
-		// Type
102
-		print '<tr>';
103
-		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
104
-		print $langs->trans("Type");
105
-		print ' &nbsp;</td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
106
-		$multiselect=0;
107
-		if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE))     // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
108
-		{
98
+            print '</td></tr>';
99
+        }
100
+
101
+        // Type
102
+        print '<tr>';
103
+        print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
104
+        print $langs->trans("Type");
105
+        print ' &nbsp;</td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
106
+        $multiselect=0;
107
+        if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE))     // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
108
+        {
109 109
             $multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE));
110
-		}
110
+        }
111 111
         print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect);
112
-		print '</td></tr>';
113
-	}
114
-
115
-	if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
116
-	{
117
-		print '<tr>';
118
-		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
119
-		print $langs->trans("ThirdParty").' &nbsp; ';
120
-		print '</td><td class="nowrap" style="padding-bottom: 2px;">';
121
-		print $form->select_company($socid, 'search_socid', '', 'SelectThirdParty', 0, 0, null, 0);
122
-		print '</td></tr>';
123
-	}
124
-
125
-	if (! empty($conf->projet->enabled) && $user->rights->projet->lire)
126
-	{
127
-		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
128
-		$formproject=new FormProjets($db);
129
-
130
-		print '<tr>';
131
-		print '<td class="nowrap" style="padding-bottom: 2px;">';
132
-		print $langs->trans("Project").' &nbsp; ';
133
-		print '</td><td class="nowrap" style="padding-bottom: 2px;">';
134
-		print $formproject->select_projects($socid?$socid:-1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
135
-		print '</td></tr>';
136
-	}
137
-
138
-	if ($canedit && ! preg_match('/list/', $_SERVER["PHP_SELF"]))
139
-	{
140
-		// Status
141
-		print '<tr>';
142
-		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
143
-		print $langs->trans("Status");
144
-		print ' &nbsp;</td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
145
-		$formactions->form_select_status_action('formaction', $status, 1, 'search_status', 1, 2, 'minwidth100');
146
-		print '</td></tr>';
147
-	}
148
-
149
-	if ($canedit && $action == 'show_peruser')
150
-	{
151
-		// Filter on hours
152
-		print '<tr>';
153
-		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'.$langs->trans("VisibleTimeRange").'</td>';
154
-		print "<td class='nowrap'>";
155
-		print '<div class="ui-grid-a"><div class="ui-block-a">';
156
-		print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
157
-		if (empty($conf->dol_use_jmobile)) print ' - ';
158
-		else print '</div><div class="ui-block-b">';
159
-		print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">';
160
-		if (empty($conf->dol_use_jmobile)) print ' '.$langs->trans("H");
161
-		print '</div></div>';
162
-		print '</td></tr>';
163
-
164
-		// Filter on days
165
-		print '<tr>';
166
-		print '<td class="nowrap">'.$langs->trans("VisibleDaysRange").'</td>';
167
-		print "<td class='nowrap'>";
168
-		print '<div class="ui-grid-a"><div class="ui-block-a">';
169
-		print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">';
170
-		if (empty($conf->dol_use_jmobile)) print ' - ';
171
-		else print '</div><div class="ui-block-b">';
172
-		print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
173
-		print '</div></div>';
174
-		print '</td></tr>';
175
-	}
176
-
177
-	// Hooks
178
-	$parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid);
179
-	$reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been
180
-
181
-	print '</table>';
182
-
183
-	if ($conf->browser->layout == 'phone') print '</div>';
184
-	else print '</td>';
185
-
186
-	if ($conf->browser->layout == 'phone') print '<div class="fichehalfright">';
187
-	else print '<td align="center" valign="middle" class="nowrap">';
188
-
189
-	print '<table class="centpercent"><tr><td align="center">';
190
-	print '<div class="formleftzone">';
191
-	print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="' . $langs->trans("Refresh") . '">';
192
-	print '</div>';
193
-	print '</td></tr>';
194
-	print '</table>';
195
-
196
-	if ($conf->browser->layout == 'phone') print '</div>';
197
-	else print '</td></tr></table>';
198
-
199
-	print '</div>';	// Close fichecenter
200
-	print '<div style="clear:both"></div>';
201
-
202
-	//print '</form>';
112
+        print '</td></tr>';
113
+    }
114
+
115
+    if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
116
+    {
117
+        print '<tr>';
118
+        print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
119
+        print $langs->trans("ThirdParty").' &nbsp; ';
120
+        print '</td><td class="nowrap" style="padding-bottom: 2px;">';
121
+        print $form->select_company($socid, 'search_socid', '', 'SelectThirdParty', 0, 0, null, 0);
122
+        print '</td></tr>';
123
+    }
124
+
125
+    if (! empty($conf->projet->enabled) && $user->rights->projet->lire)
126
+    {
127
+        require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
128
+        $formproject=new FormProjets($db);
129
+
130
+        print '<tr>';
131
+        print '<td class="nowrap" style="padding-bottom: 2px;">';
132
+        print $langs->trans("Project").' &nbsp; ';
133
+        print '</td><td class="nowrap" style="padding-bottom: 2px;">';
134
+        print $formproject->select_projects($socid?$socid:-1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
135
+        print '</td></tr>';
136
+    }
137
+
138
+    if ($canedit && ! preg_match('/list/', $_SERVER["PHP_SELF"]))
139
+    {
140
+        // Status
141
+        print '<tr>';
142
+        print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
143
+        print $langs->trans("Status");
144
+        print ' &nbsp;</td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
145
+        $formactions->form_select_status_action('formaction', $status, 1, 'search_status', 1, 2, 'minwidth100');
146
+        print '</td></tr>';
147
+    }
148
+
149
+    if ($canedit && $action == 'show_peruser')
150
+    {
151
+        // Filter on hours
152
+        print '<tr>';
153
+        print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'.$langs->trans("VisibleTimeRange").'</td>';
154
+        print "<td class='nowrap'>";
155
+        print '<div class="ui-grid-a"><div class="ui-block-a">';
156
+        print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
157
+        if (empty($conf->dol_use_jmobile)) print ' - ';
158
+        else print '</div><div class="ui-block-b">';
159
+        print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">';
160
+        if (empty($conf->dol_use_jmobile)) print ' '.$langs->trans("H");
161
+        print '</div></div>';
162
+        print '</td></tr>';
163
+
164
+        // Filter on days
165
+        print '<tr>';
166
+        print '<td class="nowrap">'.$langs->trans("VisibleDaysRange").'</td>';
167
+        print "<td class='nowrap'>";
168
+        print '<div class="ui-grid-a"><div class="ui-block-a">';
169
+        print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">';
170
+        if (empty($conf->dol_use_jmobile)) print ' - ';
171
+        else print '</div><div class="ui-block-b">';
172
+        print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
173
+        print '</div></div>';
174
+        print '</td></tr>';
175
+    }
176
+
177
+    // Hooks
178
+    $parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid);
179
+    $reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been
180
+
181
+    print '</table>';
182
+
183
+    if ($conf->browser->layout == 'phone') print '</div>';
184
+    else print '</td>';
185
+
186
+    if ($conf->browser->layout == 'phone') print '<div class="fichehalfright">';
187
+    else print '<td align="center" valign="middle" class="nowrap">';
188
+
189
+    print '<table class="centpercent"><tr><td align="center">';
190
+    print '<div class="formleftzone">';
191
+    print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="' . $langs->trans("Refresh") . '">';
192
+    print '</div>';
193
+    print '</td></tr>';
194
+    print '</table>';
195
+
196
+    if ($conf->browser->layout == 'phone') print '</div>';
197
+    else print '</td></tr></table>';
198
+
199
+    print '</div>';	// Close fichecenter
200
+    print '<div style="clear:both"></div>';
201
+
202
+    //print '</form>';
203 203
 }
204 204
 
205 205
 
@@ -211,42 +211,42 @@  discard block
 block discarded – undo
211 211
  */
212 212
 function show_array_actions_to_do($max=5)
213 213
 {
214
-	global $langs, $conf, $user, $db, $bc, $socid;
214
+    global $langs, $conf, $user, $db, $bc, $socid;
215 215
 
216
-	$now=dol_now();
216
+    $now=dol_now();
217 217
 
218
-	include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
219
-	include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
218
+    include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
219
+    include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
220 220
 
221
-	$sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,";
222
-	$sql.= " c.code, c.libelle as type_label,";
223
-	$sql.= " s.nom as sname, s.rowid, s.client";
224
-	$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
225
-	$sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
221
+    $sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,";
222
+    $sql.= " c.code, c.libelle as type_label,";
223
+    $sql.= " s.nom as sname, s.rowid, s.client";
224
+    $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
225
+    $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
226 226
     $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
227
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
228
-	$sql.= " WHERE a.entity = ".$conf->entity;
227
+    if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
228
+    $sql.= " WHERE a.entity = ".$conf->entity;
229 229
     $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))";
230
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
231
-	if ($socid) $sql.= " AND s.rowid = ".$socid;
232
-	$sql.= " ORDER BY a.datep DESC, a.id DESC";
233
-	$sql.= $db->plimit($max, 0);
230
+    if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
231
+    if ($socid) $sql.= " AND s.rowid = ".$socid;
232
+    $sql.= " ORDER BY a.datep DESC, a.id DESC";
233
+    $sql.= $db->plimit($max, 0);
234 234
 
235
-	$resql=$db->query($sql);
236
-	if ($resql)
237
-	{
238
-	    $num = $db->num_rows($resql);
235
+    $resql=$db->query($sql);
236
+    if ($resql)
237
+    {
238
+        $num = $db->num_rows($resql);
239 239
 
240
-	    print '<table class="noborder" width="100%">';
241
-	    print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo",$max).'</th>';
242
-		print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=todo">'.$langs->trans("FullList").'</a></th>';
243
-		print '</tr>';
240
+        print '<table class="noborder" width="100%">';
241
+        print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo",$max).'</th>';
242
+        print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=todo">'.$langs->trans("FullList").'</a></th>';
243
+        print '</tr>';
244 244
 
245
-		$var = true;
246
-	    $i = 0;
245
+        $var = true;
246
+        $i = 0;
247 247
 
248
-		$staticaction=new ActionComm($db);
249
-	    $customerstatic=new Client($db);
248
+        $staticaction=new ActionComm($db);
249
+        $customerstatic=new Client($db);
250 250
 
251 251
         while ($i < $num)
252 252
         {
@@ -260,15 +260,15 @@  discard block
 block discarded – undo
260 260
             $staticaction->id=$obj->id;
261 261
             print '<td>'.$staticaction->getNomUrl(1,34).'</td>';
262 262
 
263
-           // print '<td>'.dol_trunc($obj->label,22).'</td>';
263
+            // print '<td>'.dol_trunc($obj->label,22).'</td>';
264 264
 
265 265
             print '<td>';
266 266
             if ($obj->rowid > 0)
267 267
             {
268
-            	$customerstatic->id=$obj->rowid;
269
-            	$customerstatic->name=$obj->sname;
270
-            	$customerstatic->client=$obj->client;
271
-            	print $customerstatic->getNomUrl(1,'',16);
268
+                $customerstatic->id=$obj->rowid;
269
+                $customerstatic->name=$obj->sname;
270
+                $customerstatic->client=$obj->client;
271
+                print $customerstatic->getNomUrl(1,'',16);
272 272
             }
273 273
             print '</td>';
274 274
 
@@ -276,30 +276,30 @@  discard block
 block discarded – undo
276 276
             $datep2=$db->jdate($obj->dp2);
277 277
 
278 278
             // Date
279
-			print '<td width="100" align="right">'.dol_print_date($datep,'day').'&nbsp;';
280
-			$late=0;
281
-			if ($obj->percent == 0 && $datep && $datep < time()) $late=1;
282
-			if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1;
283
-			if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) $late=1;
284
-			if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) $late=1;
285
-			if ($late) print img_warning($langs->trans("Late"));
286
-			print "</td>";
279
+            print '<td width="100" align="right">'.dol_print_date($datep,'day').'&nbsp;';
280
+            $late=0;
281
+            if ($obj->percent == 0 && $datep && $datep < time()) $late=1;
282
+            if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1;
283
+            if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) $late=1;
284
+            if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) $late=1;
285
+            if ($late) print img_warning($langs->trans("Late"));
286
+            print "</td>";
287 287
 
288
-			// Statut
289
-			print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
288
+            // Statut
289
+            print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
290 290
 
291
-			print "</tr>\n";
291
+            print "</tr>\n";
292 292
 
293 293
             $i++;
294 294
         }
295
-	    print "</table><br>";
296
-
297
-	    $db->free($resql);
298
-	}
299
-	else
300
-	{
301
-	    dol_print_error($db);
302
-	}
295
+        print "</table><br>";
296
+
297
+        $db->free($resql);
298
+    }
299
+    else
300
+    {
301
+        dol_print_error($db);
302
+    }
303 303
 }
304 304
 
305 305
 
@@ -311,83 +311,83 @@  discard block
 block discarded – undo
311 311
  */
312 312
 function show_array_last_actions_done($max=5)
313 313
 {
314
-	global $langs, $conf, $user, $db, $bc, $socid;
314
+    global $langs, $conf, $user, $db, $bc, $socid;
315 315
 
316
-	$now=dol_now();
316
+    $now=dol_now();
317 317
 
318
-	$sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label,";
319
-	$sql.= " c.code, c.libelle,";
320
-	$sql.= " s.rowid, s.nom as sname, s.client";
321
-	$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
322
-	$sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action ";
318
+    $sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label,";
319
+    $sql.= " c.code, c.libelle,";
320
+    $sql.= " s.rowid, s.nom as sname, s.client";
321
+    $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
322
+    $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action ";
323 323
     $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
324
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
325
-	$sql.= " WHERE a.entity = ".$conf->entity;
324
+    if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
325
+    $sql.= " WHERE a.entity = ".$conf->entity;
326 326
     $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";
327
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
327
+    if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
328 328
     if ($socid) $sql.= " AND s.rowid = ".$socid;
329
-	$sql .= " ORDER BY a.datep2 DESC";
330
-	$sql .= $db->plimit($max, 0);
329
+    $sql .= " ORDER BY a.datep2 DESC";
330
+    $sql .= $db->plimit($max, 0);
331 331
 
332
-	$resql=$db->query($sql);
333
-	if ($resql)
334
-	{
335
-		$num = $db->num_rows($resql);
332
+    $resql=$db->query($sql);
333
+    if ($resql)
334
+    {
335
+        $num = $db->num_rows($resql);
336 336
 
337
-		print '<table class="noborder" width="100%">';
338
-		print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks",$max).'</th>';
339
-		print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=done">'.$langs->trans("FullList").'</a></th>';
340
-		print '</tr>';
341
-		$var = true;
342
-		$i = 0;
337
+        print '<table class="noborder" width="100%">';
338
+        print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks",$max).'</th>';
339
+        print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=done">'.$langs->trans("FullList").'</a></th>';
340
+        print '</tr>';
341
+        $var = true;
342
+        $i = 0;
343 343
 
344
-	    $staticaction=new ActionComm($db);
345
-	    $customerstatic=new Societe($db);
344
+        $staticaction=new ActionComm($db);
345
+        $customerstatic=new Societe($db);
346 346
 
347
-		while ($i < $num)
348
-		{
349
-			$obj = $db->fetch_object($resql);
347
+        while ($i < $num)
348
+        {
349
+            $obj = $db->fetch_object($resql);
350 350
 
351 351
 
352
-			print '<tr class="oddeven">';
352
+            print '<tr class="oddeven">';
353 353
 
354
-			$staticaction->type_code=$obj->code;
355
-			$staticaction->libelle=$obj->label;
356
-			$staticaction->id=$obj->id;
357
-			print '<td>'.$staticaction->getNomUrl(1,34).'</td>';
354
+            $staticaction->type_code=$obj->code;
355
+            $staticaction->libelle=$obj->label;
356
+            $staticaction->id=$obj->id;
357
+            print '<td>'.$staticaction->getNomUrl(1,34).'</td>';
358 358
 
359 359
             //print '<td>'.dol_trunc($obj->label,24).'</td>';
360 360
 
361
-			print '<td>';
362
-			if ($obj->rowid > 0)
363
-			{
361
+            print '<td>';
362
+            if ($obj->rowid > 0)
363
+            {
364 364
                 $customerstatic->id=$obj->rowid;
365 365
                 $customerstatic->name=$obj->sname;
366 366
                 $customerstatic->client=$obj->client;
367
-			    print $customerstatic->getNomUrl(1,'',24);
368
-			}
369
-			print '</td>';
370
-
371
-			// Date
372
-			print '<td width="100" align="right">'.dol_print_date($db->jdate($obj->da2),'day');
373
-			print "</td>";
374
-
375
-			// Statut
376
-			print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
377
-
378
-			print "</tr>\n";
379
-			$i++;
380
-		}
381
-		// TODO Ajouter rappel pour "il y a des contrats a mettre en service"
382
-		// TODO Ajouter rappel pour "il y a des contrats qui arrivent a expiration"
383
-		print "</table><br>";
384
-
385
-		$db->free($resql);
386
-	}
387
-	else
388
-	{
389
-		dol_print_error($db);
390
-	}
367
+                print $customerstatic->getNomUrl(1,'',24);
368
+            }
369
+            print '</td>';
370
+
371
+            // Date
372
+            print '<td width="100" align="right">'.dol_print_date($db->jdate($obj->da2),'day');
373
+            print "</td>";
374
+
375
+            // Statut
376
+            print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
377
+
378
+            print "</tr>\n";
379
+            $i++;
380
+        }
381
+        // TODO Ajouter rappel pour "il y a des contrats a mettre en service"
382
+        // TODO Ajouter rappel pour "il y a des contrats qui arrivent a expiration"
383
+        print "</table><br>";
384
+
385
+        $db->free($resql);
386
+    }
387
+    else
388
+    {
389
+        dol_print_error($db);
390
+    }
391 391
 }
392 392
 
393 393
 
@@ -398,49 +398,49 @@  discard block
 block discarded – undo
398 398
  */
399 399
 function agenda_prepare_head()
400 400
 {
401
-	global $langs, $conf, $user;
402
-	$h = 0;
403
-	$head = array();
401
+    global $langs, $conf, $user;
402
+    $h = 0;
403
+    $head = array();
404 404
 
405
-	$head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php";
406
-	$head[$h][1] = $langs->trans("Miscellaneous");
407
-	$head[$h][2] = 'other';
408
-	$h++;
405
+    $head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php";
406
+    $head[$h][1] = $langs->trans("Miscellaneous");
407
+    $head[$h][2] = 'other';
408
+    $h++;
409 409
 
410
-	$head[$h][0] = DOL_URL_ROOT."/admin/agenda.php";
411
-	$head[$h][1] = $langs->trans("AutoActions");
412
-	$head[$h][2] = 'autoactions';
413
-	$h++;
410
+    $head[$h][0] = DOL_URL_ROOT."/admin/agenda.php";
411
+    $head[$h][1] = $langs->trans("AutoActions");
412
+    $head[$h][2] = 'autoactions';
413
+    $h++;
414 414
 
415
-	if ($conf->global->MAIN_FEATURES_LEVEL > 0)
416
-	{
417
-	$head[$h][0] = DOL_URL_ROOT."/admin/agenda_reminder.php";
418
-	$head[$h][1] = $langs->trans("Reminders");
419
-	$head[$h][2] = 'reminders';
420
-	$h++;
421
-	}
415
+    if ($conf->global->MAIN_FEATURES_LEVEL > 0)
416
+    {
417
+    $head[$h][0] = DOL_URL_ROOT."/admin/agenda_reminder.php";
418
+    $head[$h][1] = $langs->trans("Reminders");
419
+    $head[$h][2] = 'reminders';
420
+    $h++;
421
+    }
422 422
 
423
-	$head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php";
424
-	$head[$h][1] = $langs->trans("ExportCal");
425
-	$head[$h][2] = 'xcal';
426
-	$h++;
423
+    $head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php";
424
+    $head[$h][1] = $langs->trans("ExportCal");
425
+    $head[$h][2] = 'xcal';
426
+    $h++;
427 427
 
428
-	$head[$h][0] = DOL_URL_ROOT."/admin/agenda_extsites.php";
429
-	$head[$h][1] = $langs->trans("ExtSites");
430
-	$head[$h][2] = 'extsites';
431
-	$h++;
428
+    $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extsites.php";
429
+    $head[$h][1] = $langs->trans("ExtSites");
430
+    $head[$h][2] = 'extsites';
431
+    $h++;
432 432
 
433
-	complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin');
433
+    complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin');
434 434
 
435
-	$head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";
436
-	$head[$h][1] = $langs->trans("ExtraFields");
437
-	$head[$h][2] = 'attributes';
438
-	$h++;
435
+    $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";
436
+    $head[$h][1] = $langs->trans("ExtraFields");
437
+    $head[$h][2] = 'attributes';
438
+    $h++;
439 439
 
440
-	complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin','remove');
440
+    complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin','remove');
441 441
 
442 442
 
443
-	return $head;
443
+    return $head;
444 444
 }
445 445
 
446 446
 /**
@@ -451,30 +451,30 @@  discard block
 block discarded – undo
451 451
  */
452 452
 function actions_prepare_head($object)
453 453
 {
454
-	global $db, $langs, $conf, $user;
454
+    global $db, $langs, $conf, $user;
455 455
 
456
-	$h = 0;
457
-	$head = array();
456
+    $h = 0;
457
+    $head = array();
458 458
 
459
-	$head[$h][0] = DOL_URL_ROOT.'/comm/action/card.php?id='.$object->id;
460
-	$head[$h][1] = $langs->trans("CardAction");
461
-	$head[$h][2] = 'card';
462
-	$h++;
459
+    $head[$h][0] = DOL_URL_ROOT.'/comm/action/card.php?id='.$object->id;
460
+    $head[$h][1] = $langs->trans("CardAction");
461
+    $head[$h][2] = 'card';
462
+    $h++;
463 463
 
464 464
     // Tab to link resources
465
-	if ($conf->resource->enabled)
466
-	{
467
-	    include_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
468
-	    $resource=new DolResource($db);
465
+    if ($conf->resource->enabled)
466
+    {
467
+        include_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
468
+        $resource=new DolResource($db);
469 469
 
470
-		$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id;
470
+        $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id;
471 471
         $listofresourcelinked = $resource->getElementResources($object->element, $object->id);
472 472
         $nbResources=count($listofresourcelinked);
473
-		$head[$h][1] = $langs->trans("Resources");
474
-		if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>';
475
-		$head[$h][2] = 'resources';
476
-		$h++;
477
-	}
473
+        $head[$h][1] = $langs->trans("Resources");
474
+        if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>';
475
+        $head[$h][2] = 'resources';
476
+        $h++;
477
+    }
478 478
 
479 479
     // Attached files
480 480
     require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -484,20 +484,20 @@  discard block
 block discarded – undo
484 484
     $nbLinks=Link::count($db, $object->element, $object->id);
485 485
     $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
486 486
     $head[$h][1] = $langs->trans("Documents");
487
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
487
+    if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
488 488
     $head[$h][2] = 'documents';
489 489
     $h++;
490 490
 
491
-	$head[$h][0] = DOL_URL_ROOT.'/comm/action/info.php?id='.$object->id;
492
-	$head[$h][1] = $langs->trans('Info');
493
-	$head[$h][2] = 'info';
494
-	$h++;
491
+    $head[$h][0] = DOL_URL_ROOT.'/comm/action/info.php?id='.$object->id;
492
+    $head[$h][1] = $langs->trans('Info');
493
+    $head[$h][2] = 'info';
494
+    $h++;
495 495
 
496
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'action');
496
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'action');
497 497
 
498
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove');
498
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove');
499 499
 
500
-	return $head;
500
+    return $head;
501 501
 }
502 502
 
503 503
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
     $h++;
550 550
 
551 551
 
552
-	$object=new stdClass();
552
+    $object=new stdClass();
553 553
 
554 554
     // Show more tabs from modules
555 555
     // Entries must be declared in modules descriptor with line
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -47,24 +47,24 @@  discard block
 block discarded – undo
47 47
  * @param	int   	$resourceid	    Preselected value of resource for filter on resource
48 48
  * @return	void
49 49
  */
50
-function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='', $excludetype='', $resourceid=0)
50
+function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals = array(), $actioncode = '', $usergroupid = '', $excludetype = '', $resourceid = 0)
51 51
 {
52 52
 	global $conf, $user, $langs, $db, $hookmanager;
53 53
 	global $begin_h, $end_h, $begin_d, $end_d;
54 54
 
55 55
 	$langs->load("companies");
56 56
 
57
-	include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
58
-	$formactions=new FormActions($db);
57
+	include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
58
+	$formactions = new FormActions($db);
59 59
 
60 60
 	// Filters
61 61
 	//print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="get">';
62
-	print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
63
-	print '<input type="hidden" name="year" value="' . $year . '">';
64
-	print '<input type="hidden" name="month" value="' . $month . '">';
65
-	print '<input type="hidden" name="day" value="' . $day . '">';
66
-	print '<input type="hidden" name="action" value="' . $action . '">';
67
-	print '<input type="hidden" name="search_showbirthday" value="' . $showbirthday . '">';
62
+	print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">';
63
+	print '<input type="hidden" name="year" value="'.$year.'">';
64
+	print '<input type="hidden" name="month" value="'.$month.'">';
65
+	print '<input type="hidden" name="day" value="'.$day.'">';
66
+	print '<input type="hidden" name="action" value="'.$action.'">';
67
+	print '<input type="hidden" name="search_showbirthday" value="'.$showbirthday.'">';
68 68
 
69 69
 	print '<div class="fichecenter">';
70 70
 
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
80 80
 		print $langs->trans("ActionsToDoBy").' &nbsp; ';
81 81
 		print '</td><td style="padding-bottom: 2px; padding-right: 4px;">';
82
-		print $form->select_dolusers($filtert, 'search_filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
83
-		if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
84
-		print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
82
+		print $form->select_dolusers($filtert, 'search_filtert', 1, '', !$canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
83
+		if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or").' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
84
+		print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', !$canedit);
85 85
 		print '</td></tr>';
86 86
 
87 87
 		if ($conf->resource->enabled)
88 88
 		{
89
-		    include_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php';
90
-		    $formresource=new FormResource($db);
89
+		    include_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
90
+		    $formresource = new FormResource($db);
91 91
 
92 92
     		// Resource
93 93
     		print '<tr>';
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
 		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
104 104
 		print $langs->trans("Type");
105 105
 		print ' &nbsp;</td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
106
-		$multiselect=0;
107
-		if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE))     // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
106
+		$multiselect = 0;
107
+		if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE))     // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
108 108
 		{
109
-            $multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE));
109
+            $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE));
110 110
 		}
111
-        print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect);
111
+        print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 0, $multiselect);
112 112
 		print '</td></tr>';
113 113
 	}
114 114
 
115
-	if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
115
+	if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
116 116
 	{
117 117
 		print '<tr>';
118 118
 		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
 		print '</td></tr>';
123 123
 	}
124 124
 
125
-	if (! empty($conf->projet->enabled) && $user->rights->projet->lire)
125
+	if (!empty($conf->projet->enabled) && $user->rights->projet->lire)
126 126
 	{
127 127
 		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
128
-		$formproject=new FormProjets($db);
128
+		$formproject = new FormProjets($db);
129 129
 
130 130
 		print '<tr>';
131 131
 		print '<td class="nowrap" style="padding-bottom: 2px;">';
132 132
 		print $langs->trans("Project").' &nbsp; ';
133 133
 		print '</td><td class="nowrap" style="padding-bottom: 2px;">';
134
-		print $formproject->select_projects($socid?$socid:-1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
134
+		print $formproject->select_projects($socid ? $socid : -1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
135 135
 		print '</td></tr>';
136 136
 	}
137 137
 
138
-	if ($canedit && ! preg_match('/list/', $_SERVER["PHP_SELF"]))
138
+	if ($canedit && !preg_match('/list/', $_SERVER["PHP_SELF"]))
139 139
 	{
140 140
 		// Status
141 141
 		print '<tr>';
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
 	print '<table class="centpercent"><tr><td align="center">';
190 190
 	print '<div class="formleftzone">';
191
-	print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="' . $langs->trans("Refresh") . '">';
191
+	print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="'.$langs->trans("Refresh").'">';
192 192
 	print '</div>';
193 193
 	print '</td></tr>';
194 194
 	print '</table>';
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	if ($conf->browser->layout == 'phone') print '</div>';
197 197
 	else print '</td></tr></table>';
198 198
 
199
-	print '</div>';	// Close fichecenter
199
+	print '</div>'; // Close fichecenter
200 200
 	print '<div style="clear:both"></div>';
201 201
 
202 202
 	//print '</form>';
@@ -209,44 +209,44 @@  discard block
 block discarded – undo
209 209
  *  @param	int		$max		Max nb of records
210 210
  *  @return	void
211 211
  */
212
-function show_array_actions_to_do($max=5)
212
+function show_array_actions_to_do($max = 5)
213 213
 {
214 214
 	global $langs, $conf, $user, $db, $bc, $socid;
215 215
 
216
-	$now=dol_now();
216
+	$now = dol_now();
217 217
 
218 218
 	include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
219 219
 	include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
220 220
 
221 221
 	$sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,";
222
-	$sql.= " c.code, c.libelle as type_label,";
223
-	$sql.= " s.nom as sname, s.rowid, s.client";
224
-	$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
225
-	$sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
226
-    $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
227
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
228
-	$sql.= " WHERE a.entity = ".$conf->entity;
229
-    $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))";
230
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
231
-	if ($socid) $sql.= " AND s.rowid = ".$socid;
232
-	$sql.= " ORDER BY a.datep DESC, a.id DESC";
233
-	$sql.= $db->plimit($max, 0);
234
-
235
-	$resql=$db->query($sql);
222
+	$sql .= " c.code, c.libelle as type_label,";
223
+	$sql .= " s.nom as sname, s.rowid, s.client";
224
+	$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
225
+	$sql .= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
226
+    $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
227
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
228
+	$sql .= " WHERE a.entity = ".$conf->entity;
229
+    $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))";
230
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
231
+	if ($socid) $sql .= " AND s.rowid = ".$socid;
232
+	$sql .= " ORDER BY a.datep DESC, a.id DESC";
233
+	$sql .= $db->plimit($max, 0);
234
+
235
+	$resql = $db->query($sql);
236 236
 	if ($resql)
237 237
 	{
238 238
 	    $num = $db->num_rows($resql);
239 239
 
240 240
 	    print '<table class="noborder" width="100%">';
241
-	    print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo",$max).'</th>';
241
+	    print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo", $max).'</th>';
242 242
 		print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=todo">'.$langs->trans("FullList").'</a></th>';
243 243
 		print '</tr>';
244 244
 
245 245
 		$var = true;
246 246
 	    $i = 0;
247 247
 
248
-		$staticaction=new ActionComm($db);
249
-	    $customerstatic=new Client($db);
248
+		$staticaction = new ActionComm($db);
249
+	    $customerstatic = new Client($db);
250 250
 
251 251
         while ($i < $num)
252 252
         {
@@ -255,38 +255,38 @@  discard block
 block discarded – undo
255 255
 
256 256
             print '<tr class="oddeven">';
257 257
 
258
-            $staticaction->type_code=$obj->code;
259
-            $staticaction->label=($obj->label?$obj->label:$obj->type_label);
260
-            $staticaction->id=$obj->id;
261
-            print '<td>'.$staticaction->getNomUrl(1,34).'</td>';
258
+            $staticaction->type_code = $obj->code;
259
+            $staticaction->label = ($obj->label ? $obj->label : $obj->type_label);
260
+            $staticaction->id = $obj->id;
261
+            print '<td>'.$staticaction->getNomUrl(1, 34).'</td>';
262 262
 
263 263
            // print '<td>'.dol_trunc($obj->label,22).'</td>';
264 264
 
265 265
             print '<td>';
266 266
             if ($obj->rowid > 0)
267 267
             {
268
-            	$customerstatic->id=$obj->rowid;
269
-            	$customerstatic->name=$obj->sname;
270
-            	$customerstatic->client=$obj->client;
271
-            	print $customerstatic->getNomUrl(1,'',16);
268
+            	$customerstatic->id = $obj->rowid;
269
+            	$customerstatic->name = $obj->sname;
270
+            	$customerstatic->client = $obj->client;
271
+            	print $customerstatic->getNomUrl(1, '', 16);
272 272
             }
273 273
             print '</td>';
274 274
 
275
-            $datep=$db->jdate($obj->dp);
276
-            $datep2=$db->jdate($obj->dp2);
275
+            $datep = $db->jdate($obj->dp);
276
+            $datep2 = $db->jdate($obj->dp2);
277 277
 
278 278
             // Date
279
-			print '<td width="100" align="right">'.dol_print_date($datep,'day').'&nbsp;';
280
-			$late=0;
281
-			if ($obj->percent == 0 && $datep && $datep < time()) $late=1;
282
-			if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1;
283
-			if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) $late=1;
284
-			if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) $late=1;
279
+			print '<td width="100" align="right">'.dol_print_date($datep, 'day').'&nbsp;';
280
+			$late = 0;
281
+			if ($obj->percent == 0 && $datep && $datep < time()) $late = 1;
282
+			if ($obj->percent == 0 && !$datep && $datep2 && $datep2 < time()) $late = 1;
283
+			if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) $late = 1;
284
+			if ($obj->percent > 0 && $obj->percent < 100 && !$datep2 && $datep && $datep < time()) $late = 1;
285 285
 			if ($late) print img_warning($langs->trans("Late"));
286 286
 			print "</td>";
287 287
 
288 288
 			// Statut
289
-			print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
289
+			print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent, 3)."</td>\n";
290 290
 
291 291
 			print "</tr>\n";
292 292
 
@@ -309,40 +309,40 @@  discard block
 block discarded – undo
309 309
  *  @param	int		$max		Max nb of records
310 310
  *  @return	void
311 311
  */
312
-function show_array_last_actions_done($max=5)
312
+function show_array_last_actions_done($max = 5)
313 313
 {
314 314
 	global $langs, $conf, $user, $db, $bc, $socid;
315 315
 
316
-	$now=dol_now();
316
+	$now = dol_now();
317 317
 
318 318
 	$sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label,";
319
-	$sql.= " c.code, c.libelle,";
320
-	$sql.= " s.rowid, s.nom as sname, s.client";
321
-	$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
322
-	$sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action ";
323
-    $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
324
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
325
-	$sql.= " WHERE a.entity = ".$conf->entity;
326
-    $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";
327
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
328
-    if ($socid) $sql.= " AND s.rowid = ".$socid;
319
+	$sql .= " c.code, c.libelle,";
320
+	$sql .= " s.rowid, s.nom as sname, s.client";
321
+	$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
322
+	$sql .= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action ";
323
+    $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
324
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
325
+	$sql .= " WHERE a.entity = ".$conf->entity;
326
+    $sql .= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";
327
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
328
+    if ($socid) $sql .= " AND s.rowid = ".$socid;
329 329
 	$sql .= " ORDER BY a.datep2 DESC";
330 330
 	$sql .= $db->plimit($max, 0);
331 331
 
332
-	$resql=$db->query($sql);
332
+	$resql = $db->query($sql);
333 333
 	if ($resql)
334 334
 	{
335 335
 		$num = $db->num_rows($resql);
336 336
 
337 337
 		print '<table class="noborder" width="100%">';
338
-		print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks",$max).'</th>';
338
+		print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks", $max).'</th>';
339 339
 		print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=done">'.$langs->trans("FullList").'</a></th>';
340 340
 		print '</tr>';
341 341
 		$var = true;
342 342
 		$i = 0;
343 343
 
344
-	    $staticaction=new ActionComm($db);
345
-	    $customerstatic=new Societe($db);
344
+	    $staticaction = new ActionComm($db);
345
+	    $customerstatic = new Societe($db);
346 346
 
347 347
 		while ($i < $num)
348 348
 		{
@@ -351,29 +351,29 @@  discard block
 block discarded – undo
351 351
 
352 352
 			print '<tr class="oddeven">';
353 353
 
354
-			$staticaction->type_code=$obj->code;
355
-			$staticaction->libelle=$obj->label;
356
-			$staticaction->id=$obj->id;
357
-			print '<td>'.$staticaction->getNomUrl(1,34).'</td>';
354
+			$staticaction->type_code = $obj->code;
355
+			$staticaction->libelle = $obj->label;
356
+			$staticaction->id = $obj->id;
357
+			print '<td>'.$staticaction->getNomUrl(1, 34).'</td>';
358 358
 
359 359
             //print '<td>'.dol_trunc($obj->label,24).'</td>';
360 360
 
361 361
 			print '<td>';
362 362
 			if ($obj->rowid > 0)
363 363
 			{
364
-                $customerstatic->id=$obj->rowid;
365
-                $customerstatic->name=$obj->sname;
366
-                $customerstatic->client=$obj->client;
367
-			    print $customerstatic->getNomUrl(1,'',24);
364
+                $customerstatic->id = $obj->rowid;
365
+                $customerstatic->name = $obj->sname;
366
+                $customerstatic->client = $obj->client;
367
+			    print $customerstatic->getNomUrl(1, '', 24);
368 368
 			}
369 369
 			print '</td>';
370 370
 
371 371
 			// Date
372
-			print '<td width="100" align="right">'.dol_print_date($db->jdate($obj->da2),'day');
372
+			print '<td width="100" align="right">'.dol_print_date($db->jdate($obj->da2), 'day');
373 373
 			print "</td>";
374 374
 
375 375
 			// Statut
376
-			print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
376
+			print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent, 3)."</td>\n";
377 377
 
378 378
 			print "</tr>\n";
379 379
 			$i++;
@@ -430,14 +430,14 @@  discard block
 block discarded – undo
430 430
 	$head[$h][2] = 'extsites';
431 431
 	$h++;
432 432
 
433
-	complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin');
433
+	complete_head_from_modules($conf, $langs, null, $head, $h, 'agenda_admin');
434 434
 
435 435
 	$head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";
436 436
 	$head[$h][1] = $langs->trans("ExtraFields");
437 437
 	$head[$h][2] = 'attributes';
438 438
 	$h++;
439 439
 
440
-	complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin','remove');
440
+	complete_head_from_modules($conf, $langs, null, $head, $h, 'agenda_admin', 'remove');
441 441
 
442 442
 
443 443
 	return $head;
@@ -465,13 +465,13 @@  discard block
 block discarded – undo
465 465
 	if ($conf->resource->enabled)
466 466
 	{
467 467
 	    include_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
468
-	    $resource=new DolResource($db);
468
+	    $resource = new DolResource($db);
469 469
 
470 470
 		$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id;
471 471
         $listofresourcelinked = $resource->getElementResources($object->element, $object->id);
472
-        $nbResources=count($listofresourcelinked);
472
+        $nbResources = count($listofresourcelinked);
473 473
 		$head[$h][1] = $langs->trans("Resources");
474
-		if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>';
474
+		if ($nbResources > 0) $head[$h][1] .= ' <span class="badge">'.($nbResources).'</span>';
475 475
 		$head[$h][2] = 'resources';
476 476
 		$h++;
477 477
 	}
@@ -479,12 +479,12 @@  discard block
 block discarded – undo
479 479
     // Attached files
480 480
     require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
481 481
     require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
482
-    $upload_dir = $conf->agenda->dir_output . "/" . $object->id;
483
-    $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
484
-    $nbLinks=Link::count($db, $object->element, $object->id);
482
+    $upload_dir = $conf->agenda->dir_output."/".$object->id;
483
+    $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
484
+    $nbLinks = Link::count($db, $object->element, $object->id);
485 485
     $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
486 486
     $head[$h][1] = $langs->trans("Documents");
487
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
487
+	if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>';
488 488
     $head[$h][2] = 'documents';
489 489
     $h++;
490 490
 
@@ -493,9 +493,9 @@  discard block
 block discarded – undo
493 493
 	$head[$h][2] = 'info';
494 494
 	$h++;
495 495
 
496
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'action');
496
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'action');
497 497
 
498
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove');
498
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'action', 'remove');
499 499
 
500 500
 	return $head;
501 501
 }
@@ -514,50 +514,50 @@  discard block
 block discarded – undo
514 514
     $h = 0;
515 515
     $head = array();
516 516
 
517
-    $head[$h][0] = DOL_URL_ROOT.'/comm/action/list.php'.($param?'?'.$param:'');
517
+    $head[$h][0] = DOL_URL_ROOT.'/comm/action/list.php'.($param ? '?'.$param : '');
518 518
     $head[$h][1] = $langs->trans("ViewList");
519 519
     $head[$h][2] = 'cardlist';
520 520
     $h++;
521 521
 
522
-    $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_month'.($param?'&'.$param:'');
522
+    $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_month'.($param ? '&'.$param : '');
523 523
     $head[$h][1] = $langs->trans("ViewCal");
524 524
     $head[$h][2] = 'cardmonth';
525 525
     $h++;
526 526
 
527
-    $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_week'.($param?'&'.$param:'');
527
+    $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_week'.($param ? '&'.$param : '');
528 528
     $head[$h][1] = $langs->trans("ViewWeek");
529 529
     $head[$h][2] = 'cardweek';
530 530
     $h++;
531 531
 
532
-    $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:'');
532
+    $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param ? '&'.$param : '');
533 533
     $head[$h][1] = $langs->trans("ViewDay");
534 534
     $head[$h][2] = 'cardday';
535 535
     $h++;
536 536
 
537 537
     //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
538
-    if (! empty($conf->global->AGENDA_SHOW_PERTYPE))
538
+    if (!empty($conf->global->AGENDA_SHOW_PERTYPE))
539 539
     {
540
-        $head[$h][0] = DOL_URL_ROOT.'/comm/action/pertype.php'.($param?'?'.$param:'');
540
+        $head[$h][0] = DOL_URL_ROOT.'/comm/action/pertype.php'.($param ? '?'.$param : '');
541 541
         $head[$h][1] = $langs->trans("ViewPerType");
542 542
         $head[$h][2] = 'cardpertype';
543 543
         $h++;
544 544
     }
545 545
 
546
-    $head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param?'?'.$param:'');
546
+    $head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param ? '?'.$param : '');
547 547
     $head[$h][1] = $langs->trans("ViewPerUser");
548 548
     $head[$h][2] = 'cardperuser';
549 549
     $h++;
550 550
 
551 551
 
552
-	$object=new stdClass();
552
+	$object = new stdClass();
553 553
 
554 554
     // Show more tabs from modules
555 555
     // Entries must be declared in modules descriptor with line
556 556
     // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
557 557
     // $this->tabs = array('entity:-tabname);   												to remove a tab
558
-    complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda');
558
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'agenda');
559 559
 
560
-    complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda','remove');
560
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'agenda', 'remove');
561 561
 
562 562
     return $head;
563 563
 }
Please login to merge, or discard this patch.
Braces   +80 added lines, -32 removed lines patch added patch discarded remove patch
@@ -68,8 +68,11 @@  discard block
 block discarded – undo
68 68
 
69 69
 	print '<div class="fichecenter">';
70 70
 
71
-	if ($conf->browser->layout == 'phone') print '<div class="fichehalfleft">';
72
-	else print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">';
71
+	if ($conf->browser->layout == 'phone') {
72
+	    print '<div class="fichehalfleft">';
73
+	} else {
74
+	    print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">';
75
+	}
73 76
 
74 77
 	print '<table class="nobordernopadding centpercent">';
75 78
 
@@ -80,7 +83,9 @@  discard block
 block discarded – undo
80 83
 		print $langs->trans("ActionsToDoBy").' &nbsp; ';
81 84
 		print '</td><td style="padding-bottom: 2px; padding-right: 4px;">';
82 85
 		print $form->select_dolusers($filtert, 'search_filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
83
-		if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
86
+		if (empty($conf->dol_optimize_smallscreen)) {
87
+		    print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
88
+		}
84 89
 		print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
85 90
 		print '</td></tr>';
86 91
 
@@ -104,10 +109,12 @@  discard block
 block discarded – undo
104 109
 		print $langs->trans("Type");
105 110
 		print ' &nbsp;</td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
106 111
 		$multiselect=0;
107
-		if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE))     // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
112
+		if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) {
113
+		    // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
108 114
 		{
109 115
             $multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE));
110 116
 		}
117
+		}
111 118
         print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect);
112 119
 		print '</td></tr>';
113 120
 	}
@@ -154,10 +161,15 @@  discard block
 block discarded – undo
154 161
 		print "<td class='nowrap'>";
155 162
 		print '<div class="ui-grid-a"><div class="ui-block-a">';
156 163
 		print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
157
-		if (empty($conf->dol_use_jmobile)) print ' - ';
158
-		else print '</div><div class="ui-block-b">';
164
+		if (empty($conf->dol_use_jmobile)) {
165
+		    print ' - ';
166
+		} else {
167
+		    print '</div><div class="ui-block-b">';
168
+		}
159 169
 		print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">';
160
-		if (empty($conf->dol_use_jmobile)) print ' '.$langs->trans("H");
170
+		if (empty($conf->dol_use_jmobile)) {
171
+		    print ' '.$langs->trans("H");
172
+		}
161 173
 		print '</div></div>';
162 174
 		print '</td></tr>';
163 175
 
@@ -167,8 +179,11 @@  discard block
 block discarded – undo
167 179
 		print "<td class='nowrap'>";
168 180
 		print '<div class="ui-grid-a"><div class="ui-block-a">';
169 181
 		print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">';
170
-		if (empty($conf->dol_use_jmobile)) print ' - ';
171
-		else print '</div><div class="ui-block-b">';
182
+		if (empty($conf->dol_use_jmobile)) {
183
+		    print ' - ';
184
+		} else {
185
+		    print '</div><div class="ui-block-b">';
186
+		}
172 187
 		print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
173 188
 		print '</div></div>';
174 189
 		print '</td></tr>';
@@ -180,11 +195,17 @@  discard block
 block discarded – undo
180 195
 
181 196
 	print '</table>';
182 197
 
183
-	if ($conf->browser->layout == 'phone') print '</div>';
184
-	else print '</td>';
198
+	if ($conf->browser->layout == 'phone') {
199
+	    print '</div>';
200
+	} else {
201
+	    print '</td>';
202
+	}
185 203
 
186
-	if ($conf->browser->layout == 'phone') print '<div class="fichehalfright">';
187
-	else print '<td align="center" valign="middle" class="nowrap">';
204
+	if ($conf->browser->layout == 'phone') {
205
+	    print '<div class="fichehalfright">';
206
+	} else {
207
+	    print '<td align="center" valign="middle" class="nowrap">';
208
+	}
188 209
 
189 210
 	print '<table class="centpercent"><tr><td align="center">';
190 211
 	print '<div class="formleftzone">';
@@ -193,8 +214,11 @@  discard block
 block discarded – undo
193 214
 	print '</td></tr>';
194 215
 	print '</table>';
195 216
 
196
-	if ($conf->browser->layout == 'phone') print '</div>';
197
-	else print '</td></tr></table>';
217
+	if ($conf->browser->layout == 'phone') {
218
+	    print '</div>';
219
+	} else {
220
+	    print '</td></tr></table>';
221
+	}
198 222
 
199 223
 	print '</div>';	// Close fichecenter
200 224
 	print '<div style="clear:both"></div>';
@@ -224,11 +248,17 @@  discard block
 block discarded – undo
224 248
 	$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
225 249
 	$sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
226 250
     $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
227
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
251
+	if (!$user->rights->societe->client->voir && !$socid) {
252
+	    $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
253
+	}
228 254
 	$sql.= " WHERE a.entity = ".$conf->entity;
229 255
     $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))";
230
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
231
-	if ($socid) $sql.= " AND s.rowid = ".$socid;
256
+	if (!$user->rights->societe->client->voir && !$socid) {
257
+	    $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
258
+	}
259
+	if ($socid) {
260
+	    $sql.= " AND s.rowid = ".$socid;
261
+	}
232 262
 	$sql.= " ORDER BY a.datep DESC, a.id DESC";
233 263
 	$sql.= $db->plimit($max, 0);
234 264
 
@@ -278,11 +308,21 @@  discard block
 block discarded – undo
278 308
             // Date
279 309
 			print '<td width="100" align="right">'.dol_print_date($datep,'day').'&nbsp;';
280 310
 			$late=0;
281
-			if ($obj->percent == 0 && $datep && $datep < time()) $late=1;
282
-			if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1;
283
-			if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) $late=1;
284
-			if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) $late=1;
285
-			if ($late) print img_warning($langs->trans("Late"));
311
+			if ($obj->percent == 0 && $datep && $datep < time()) {
312
+			    $late=1;
313
+			}
314
+			if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) {
315
+			    $late=1;
316
+			}
317
+			if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) {
318
+			    $late=1;
319
+			}
320
+			if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) {
321
+			    $late=1;
322
+			}
323
+			if ($late) {
324
+			    print img_warning($langs->trans("Late"));
325
+			}
286 326
 			print "</td>";
287 327
 
288 328
 			// Statut
@@ -295,8 +335,7 @@  discard block
 block discarded – undo
295 335
 	    print "</table><br>";
296 336
 
297 337
 	    $db->free($resql);
298
-	}
299
-	else
338
+	} else
300 339
 	{
301 340
 	    dol_print_error($db);
302 341
 	}
@@ -321,11 +360,17 @@  discard block
 block discarded – undo
321 360
 	$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
322 361
 	$sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action ";
323 362
     $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
324
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
363
+	if (!$user->rights->societe->client->voir && !$socid) {
364
+	    $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
365
+	}
325 366
 	$sql.= " WHERE a.entity = ".$conf->entity;
326 367
     $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";
327
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
328
-    if ($socid) $sql.= " AND s.rowid = ".$socid;
368
+	if (!$user->rights->societe->client->voir && !$socid) {
369
+	    $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
370
+	}
371
+    if ($socid) {
372
+        $sql.= " AND s.rowid = ".$socid;
373
+    }
329 374
 	$sql .= " ORDER BY a.datep2 DESC";
330 375
 	$sql .= $db->plimit($max, 0);
331 376
 
@@ -383,8 +428,7 @@  discard block
 block discarded – undo
383 428
 		print "</table><br>";
384 429
 
385 430
 		$db->free($resql);
386
-	}
387
-	else
431
+	} else
388 432
 	{
389 433
 		dol_print_error($db);
390 434
 	}
@@ -471,7 +515,9 @@  discard block
 block discarded – undo
471 515
         $listofresourcelinked = $resource->getElementResources($object->element, $object->id);
472 516
         $nbResources=count($listofresourcelinked);
473 517
 		$head[$h][1] = $langs->trans("Resources");
474
-		if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>';
518
+		if ($nbResources > 0) {
519
+		    $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>';
520
+		}
475 521
 		$head[$h][2] = 'resources';
476 522
 		$h++;
477 523
 	}
@@ -484,7 +530,9 @@  discard block
 block discarded – undo
484 530
     $nbLinks=Link::count($db, $object->element, $object->id);
485 531
     $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
486 532
     $head[$h][1] = $langs->trans("Documents");
487
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
533
+	if (($nbFiles+$nbLinks) > 0) {
534
+	    $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
535
+	}
488 536
     $head[$h][2] = 'documents';
489 537
     $h++;
490 538
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/invoice.lib.php 3 patches
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -35,33 +35,33 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function facture_prepare_head($object)
37 37
 {
38
-	global $db, $langs, $conf;
39
-
40
-	$h = 0;
41
-	$head = array();
42
-
43
-	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$object->id;
44
-	$head[$h][1] = $langs->trans('Card');
45
-	$head[$h][2] = 'compta';
46
-	$h++;
47
-
48
-	if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
49
-	{
50
-	    $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
51
-	    $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id;
52
-		$head[$h][1] = $langs->trans('ContactsAddresses');
53
-		if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
54
-		$head[$h][2] = 'contact';
55
-		$h++;
56
-	}
57
-
58
-	//if ($fac->mode_reglement_code == 'PRE')
59
-	if (! empty($conf->prelevement->enabled))
60
-	{
61
-	    $nbStandingOrders=0;
62
-	    $sql = "SELECT COUNT(pfd.rowid) as nb";
63
-	    $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
64
-	    $sql .= " WHERE pfd.fk_facture = ".$object->id;
38
+    global $db, $langs, $conf;
39
+
40
+    $h = 0;
41
+    $head = array();
42
+
43
+    $head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$object->id;
44
+    $head[$h][1] = $langs->trans('Card');
45
+    $head[$h][2] = 'compta';
46
+    $h++;
47
+
48
+    if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
49
+    {
50
+        $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
51
+        $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id;
52
+        $head[$h][1] = $langs->trans('ContactsAddresses');
53
+        if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
54
+        $head[$h][2] = 'contact';
55
+        $h++;
56
+    }
57
+
58
+    //if ($fac->mode_reglement_code == 'PRE')
59
+    if (! empty($conf->prelevement->enabled))
60
+    {
61
+        $nbStandingOrders=0;
62
+        $sql = "SELECT COUNT(pfd.rowid) as nb";
63
+        $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
64
+        $sql .= " WHERE pfd.fk_facture = ".$object->id;
65 65
         $resql=$db->query($sql);
66 66
         if ($resql)
67 67
         {
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
             if ($obj) $nbStandingOrders = $obj->nb;
70 70
         }
71 71
         else dol_print_error($db);
72
-		$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id;
73
-		$head[$h][1] = $langs->trans('StandingOrders');
74
-		if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>';
75
-		$head[$h][2] = 'standingorders';
76
-		$h++;
77
-	}
72
+        $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id;
73
+        $head[$h][1] = $langs->trans('StandingOrders');
74
+        if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>';
75
+        $head[$h][2] = 'standingorders';
76
+        $h++;
77
+    }
78 78
 
79 79
     // Show more tabs from modules
80 80
     // Entries must be declared in modules descriptor with line
@@ -84,35 +84,35 @@  discard block
 block discarded – undo
84 84
 
85 85
     if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
86 86
     {
87
-    	$nbNote = 0;
87
+        $nbNote = 0;
88 88
         if(!empty($object->note_private)) $nbNote++;
89
-		if(!empty($object->note_public)) $nbNote++;
90
-    	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id;
91
-    	$head[$h][1] = $langs->trans('Notes');
92
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
93
-    	$head[$h][2] = 'note';
94
-    	$h++;
89
+        if(!empty($object->note_public)) $nbNote++;
90
+        $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id;
91
+        $head[$h][1] = $langs->trans('Notes');
92
+        if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
93
+        $head[$h][2] = 'note';
94
+        $h++;
95 95
     }
96 96
 
97
-	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
97
+    require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
98 98
     require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
99
-	$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
100
-	$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
99
+    $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
100
+    $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
101 101
     $nbLinks=Link::count($db, $object->element, $object->id);
102
-	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id;
103
-	$head[$h][1] = $langs->trans('Documents');
104
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
105
-	$head[$h][2] = 'documents';
106
-	$h++;
102
+    $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id;
103
+    $head[$h][1] = $langs->trans('Documents');
104
+    if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
105
+    $head[$h][2] = 'documents';
106
+    $h++;
107 107
 
108
-	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$object->id;
109
-	$head[$h][1] = $langs->trans('Info');
110
-	$head[$h][2] = 'info';
111
-	$h++;
108
+    $head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$object->id;
109
+    $head[$h][1] = $langs->trans('Info');
110
+    $head[$h][2] = 'info';
111
+    $h++;
112 112
 
113
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice','remove');
113
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice','remove');
114 114
 
115
-	return $head;
115
+    return $head;
116 116
 }
117 117
 
118 118
 /**
@@ -122,50 +122,50 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function invoice_admin_prepare_head()
124 124
 {
125
-	global $langs, $conf, $user;
126
-
127
-	$h = 0;
128
-	$head = array();
129
-
130
-	$head[$h][0] = DOL_URL_ROOT.'/admin/facture.php';
131
-	$head[$h][1] = $langs->trans("Miscellaneous");
132
-	$head[$h][2] = 'general';
133
-	$h++;
134
-
135
-	$head[$h][0] = DOL_URL_ROOT.'/admin/payment.php';
136
-	$head[$h][1] = $langs->trans("Payments");
137
-	$head[$h][2] = 'payment';
138
-	$h++;
139
-
140
-	// Show more tabs from modules
141
-	// Entries must be declared in modules descriptor with line
142
-	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
143
-	// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
144
-	complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin');
145
-
146
-	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php';
147
-	$head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices");
148
-	$head[$h][2] = 'attributes';
149
-	$h++;
150
-
151
-	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php';
152
-	$head[$h][1] = $langs->trans("ExtraFieldsLines");
153
-	$head[$h][2] = 'attributeslines';
154
-	$h++;
155
-
156
-	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_rec_cust_extrafields.php';
157
-	$head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoicesRec");
158
-	$head[$h][2] = 'attributesrec';
159
-	$h++;
160
-
161
-	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_rec_cust_extrafields.php';
162
-	$head[$h][1] = $langs->trans("ExtraFieldsLinesRec");
163
-	$head[$h][2] = 'attributeslinesrec';
164
-	$h++;
165
-
166
-	complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove');
167
-
168
-	return $head;
125
+    global $langs, $conf, $user;
126
+
127
+    $h = 0;
128
+    $head = array();
129
+
130
+    $head[$h][0] = DOL_URL_ROOT.'/admin/facture.php';
131
+    $head[$h][1] = $langs->trans("Miscellaneous");
132
+    $head[$h][2] = 'general';
133
+    $h++;
134
+
135
+    $head[$h][0] = DOL_URL_ROOT.'/admin/payment.php';
136
+    $head[$h][1] = $langs->trans("Payments");
137
+    $head[$h][2] = 'payment';
138
+    $h++;
139
+
140
+    // Show more tabs from modules
141
+    // Entries must be declared in modules descriptor with line
142
+    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
143
+    // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
144
+    complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin');
145
+
146
+    $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php';
147
+    $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices");
148
+    $head[$h][2] = 'attributes';
149
+    $h++;
150
+
151
+    $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php';
152
+    $head[$h][1] = $langs->trans("ExtraFieldsLines");
153
+    $head[$h][2] = 'attributeslines';
154
+    $h++;
155
+
156
+    $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_rec_cust_extrafields.php';
157
+    $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoicesRec");
158
+    $head[$h][2] = 'attributesrec';
159
+    $h++;
160
+
161
+    $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_rec_cust_extrafields.php';
162
+    $head[$h][1] = $langs->trans("ExtraFieldsLinesRec");
163
+    $head[$h][2] = 'attributeslinesrec';
164
+    $h++;
165
+
166
+    complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove');
167
+
168
+    return $head;
169 169
 }
170 170
 
171 171
 
@@ -177,15 +177,15 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function invoice_rec_prepare_head($object)
179 179
 {
180
-	global $db, $langs, $conf;
180
+    global $db, $langs, $conf;
181 181
 
182
-	$h = 0;
183
-	$head = array();
182
+    $h = 0;
183
+    $head = array();
184 184
 
185
-	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?id='.$object->id;
186
-	$head[$h][1] = $langs->trans("CardBill");
187
-	$head[$h][2] = 'card';
188
-	$h++;
185
+    $head[$h][0] = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?id='.$object->id;
186
+    $head[$h][1] = $langs->trans("CardBill");
187
+    $head[$h][2] = 'card';
188
+    $h++;
189 189
 
190 190
     // Show more tabs from modules
191 191
     // Entries must be declared in modules descriptor with line
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     // $this->tabs = array('entity:-tabname);   												to remove a tab
194 194
     complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec');
195 195
 
196
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec','remove');
196
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec','remove');
197 197
 
198
-	return $head;
198
+    return $head;
199 199
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -47,31 +47,31 @@  discard block
 block discarded – undo
47 47
 
48 48
 	if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
49 49
 	{
50
-	    $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
50
+	    $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
51 51
 	    $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id;
52 52
 		$head[$h][1] = $langs->trans('ContactsAddresses');
53
-		if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
53
+		if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>';
54 54
 		$head[$h][2] = 'contact';
55 55
 		$h++;
56 56
 	}
57 57
 
58 58
 	//if ($fac->mode_reglement_code == 'PRE')
59
-	if (! empty($conf->prelevement->enabled))
59
+	if (!empty($conf->prelevement->enabled))
60 60
 	{
61
-	    $nbStandingOrders=0;
61
+	    $nbStandingOrders = 0;
62 62
 	    $sql = "SELECT COUNT(pfd.rowid) as nb";
63 63
 	    $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
64 64
 	    $sql .= " WHERE pfd.fk_facture = ".$object->id;
65
-        $resql=$db->query($sql);
65
+        $resql = $db->query($sql);
66 66
         if ($resql)
67 67
         {
68
-            $obj=$db->fetch_object($resql);
68
+            $obj = $db->fetch_object($resql);
69 69
             if ($obj) $nbStandingOrders = $obj->nb;
70 70
         }
71 71
         else dol_print_error($db);
72 72
 		$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id;
73 73
 		$head[$h][1] = $langs->trans('StandingOrders');
74
-		if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>';
74
+		if ($nbStandingOrders > 0) $head[$h][1] .= ' <span class="badge">'.$nbStandingOrders.'</span>';
75 75
 		$head[$h][2] = 'standingorders';
76 76
 		$h++;
77 77
 	}
@@ -80,28 +80,28 @@  discard block
 block discarded – undo
80 80
     // Entries must be declared in modules descriptor with line
81 81
     // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
82 82
     // $this->tabs = array('entity:-tabname);   												to remove a tab
83
-    complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice');
83
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice');
84 84
 
85 85
     if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
86 86
     {
87 87
     	$nbNote = 0;
88
-        if(!empty($object->note_private)) $nbNote++;
89
-		if(!empty($object->note_public)) $nbNote++;
88
+        if (!empty($object->note_private)) $nbNote++;
89
+		if (!empty($object->note_public)) $nbNote++;
90 90
     	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id;
91 91
     	$head[$h][1] = $langs->trans('Notes');
92
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
92
+		if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>';
93 93
     	$head[$h][2] = 'note';
94 94
     	$h++;
95 95
     }
96 96
 
97 97
 	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
98 98
     require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
99
-	$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
100
-	$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
101
-    $nbLinks=Link::count($db, $object->element, $object->id);
99
+	$upload_dir = $conf->facture->dir_output."/".dol_sanitizeFileName($object->ref);
100
+	$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
101
+    $nbLinks = Link::count($db, $object->element, $object->id);
102 102
 	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id;
103 103
 	$head[$h][1] = $langs->trans('Documents');
104
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
104
+	if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>';
105 105
 	$head[$h][2] = 'documents';
106 106
 	$h++;
107 107
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	$head[$h][2] = 'info';
111 111
 	$h++;
112 112
 
113
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice','remove');
113
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice', 'remove');
114 114
 
115 115
 	return $head;
116 116
 }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	// Entries must be declared in modules descriptor with line
142 142
 	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
143 143
 	// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
144
-	complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin');
144
+	complete_head_from_modules($conf, $langs, null, $head, $h, 'invoice_admin');
145 145
 
146 146
 	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php';
147 147
 	$head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices");
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	$head[$h][2] = 'attributeslinesrec';
164 164
 	$h++;
165 165
 
166
-	complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove');
166
+	complete_head_from_modules($conf, $langs, null, $head, $h, 'invoice_admin', 'remove');
167 167
 
168 168
 	return $head;
169 169
 }
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
     // Entries must be declared in modules descriptor with line
192 192
     // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
193 193
     // $this->tabs = array('entity:-tabname);   												to remove a tab
194
-    complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec');
194
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice-rec');
195 195
 
196
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec','remove');
196
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice-rec', 'remove');
197 197
 
198 198
 	return $head;
199 199
 }
Please login to merge, or discard this patch.
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -50,7 +50,9 @@  discard block
 block discarded – undo
50 50
 	    $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
51 51
 	    $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id;
52 52
 		$head[$h][1] = $langs->trans('ContactsAddresses');
53
-		if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
53
+		if ($nbContact > 0) {
54
+		    $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
55
+		}
54 56
 		$head[$h][2] = 'contact';
55 57
 		$h++;
56 58
 	}
@@ -66,12 +68,17 @@  discard block
 block discarded – undo
66 68
         if ($resql)
67 69
         {
68 70
             $obj=$db->fetch_object($resql);
69
-            if ($obj) $nbStandingOrders = $obj->nb;
71
+            if ($obj) {
72
+                $nbStandingOrders = $obj->nb;
73
+            }
74
+        } else {
75
+            dol_print_error($db);
70 76
         }
71
-        else dol_print_error($db);
72 77
 		$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id;
73 78
 		$head[$h][1] = $langs->trans('StandingOrders');
74
-		if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>';
79
+		if ($nbStandingOrders > 0) {
80
+		    $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>';
81
+		}
75 82
 		$head[$h][2] = 'standingorders';
76 83
 		$h++;
77 84
 	}
@@ -85,11 +92,17 @@  discard block
 block discarded – undo
85 92
     if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
86 93
     {
87 94
     	$nbNote = 0;
88
-        if(!empty($object->note_private)) $nbNote++;
89
-		if(!empty($object->note_public)) $nbNote++;
95
+        if(!empty($object->note_private)) {
96
+            $nbNote++;
97
+        }
98
+		if(!empty($object->note_public)) {
99
+		    $nbNote++;
100
+		}
90 101
     	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id;
91 102
     	$head[$h][1] = $langs->trans('Notes');
92
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
103
+		if ($nbNote > 0) {
104
+		    $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
105
+		}
93 106
     	$head[$h][2] = 'note';
94 107
     	$h++;
95 108
     }
@@ -101,7 +114,9 @@  discard block
 block discarded – undo
101 114
     $nbLinks=Link::count($db, $object->element, $object->id);
102 115
 	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id;
103 116
 	$head[$h][1] = $langs->trans('Documents');
104
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
117
+	if (($nbFiles+$nbLinks) > 0) {
118
+	    $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
119
+	}
105 120
 	$head[$h][2] = 'documents';
106 121
 	$h++;
107 122
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/hrm.lib.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@  discard block
 block discarded – undo
30 30
  */
31 31
 function establishment_prepare_head($object)
32 32
 {
33
-	global $langs, $conf;
33
+    global $langs, $conf;
34 34
 
35
-	$h = 0;
36
-	$head = array();
35
+    $h = 0;
36
+    $head = array();
37 37
 
38
-	$head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id=' . $object->id;
39
-	$head[$h][1] = $langs->trans("Card");
40
-	$head[$h][2] = 'card';
41
-	$h++;
38
+    $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id=' . $object->id;
39
+    $head[$h][1] = $langs->trans("Card");
40
+    $head[$h][2] = 'card';
41
+    $h++;
42 42
 
43
-	// Show more tabs from modules
44
-	// Entries must be declared in modules descriptor with line
43
+    // Show more tabs from modules
44
+    // Entries must be declared in modules descriptor with line
45 45
     // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
46 46
     // $this->tabs = array('entity:-tabname);   												to remove a tab
47
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment');
47
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment');
48 48
 
49
-	$head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id=' . $object->id;
50
-	$head[$h][1] = $langs->trans("Info");
51
-	$head[$h][2] = 'info';
52
-	$h++;
49
+    $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id=' . $object->id;
50
+    $head[$h][1] = $langs->trans("Info");
51
+    $head[$h][2] = 'info';
52
+    $h++;
53 53
 
54
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment','remove');
54
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment','remove');
55 55
 
56
-	return $head;
56
+    return $head;
57 57
 }
58 58
 
59 59
 /**
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
     $h = 0;
69 69
     $head = array();
70 70
 
71
-	$head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_hrm.php';
71
+    $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_hrm.php';
72 72
     $head[$h][1] = $langs->trans("Parameters");
73 73
     $head[$h][2] = 'parameters';
74 74
     $h++;
75 75
 
76
-	$head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php';
76
+    $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php';
77 77
     $head[$h][1] = $langs->trans("Establishments");
78 78
     $head[$h][2] = 'establishments';
79 79
     $h++;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	$h = 0;
36 36
 	$head = array();
37 37
 
38
-	$head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id=' . $object->id;
38
+	$head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id='.$object->id;
39 39
 	$head[$h][1] = $langs->trans("Card");
40 40
 	$head[$h][2] = 'card';
41 41
 	$h++;
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
 	// Entries must be declared in modules descriptor with line
45 45
     // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
46 46
     // $this->tabs = array('entity:-tabname);   												to remove a tab
47
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment');
47
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'establishment');
48 48
 
49
-	$head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id=' . $object->id;
49
+	$head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id='.$object->id;
50 50
 	$head[$h][1] = $langs->trans("Info");
51 51
 	$head[$h][2] = 'info';
52 52
 	$h++;
53 53
 
54
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment','remove');
54
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'establishment', 'remove');
55 55
 
56 56
 	return $head;
57 57
 }
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
     // Entries must be declared in modules descriptor with line
83 83
     // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
84 84
     // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
85
-    complete_head_from_modules($conf,$langs,'',$head,$h,'hrm_admin');
85
+    complete_head_from_modules($conf, $langs, '', $head, $h, 'hrm_admin');
86 86
 
87
-    complete_head_from_modules($conf,$langs,'',$head,$h,'hrm_admin','remove');
87
+    complete_head_from_modules($conf, $langs, '', $head, $h, 'hrm_admin', 'remove');
88 88
 
89 89
     return $head;
90 90
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/payments.lib.php 3 patches
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 function payment_prepare_head(Paiement $object)
29 29
 {
30 30
 
31
-	global $langs, $conf;
31
+    global $langs, $conf;
32 32
 
33
-	$h = 0;
34
-	$head = array();
33
+    $h = 0;
34
+    $head = array();
35 35
 
36
-	$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id;
37
-	$head[$h][1] = $langs->trans("Card");
38
-	$head[$h][2] = 'payment';
39
-	$h++;
36
+    $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id;
37
+    $head[$h][1] = $langs->trans("Card");
38
+    $head[$h][2] = 'payment';
39
+    $h++;
40 40
 
41 41
     // Show more tabs from modules
42 42
     // Entries must be declared in modules descriptor with line
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
     // $this->tabs = array('entity:-tabname);   												to remove a tab
45 45
     complete_head_from_modules($conf,$langs,$object,$head,$h,'payment');
46 46
 
47
-	$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id;
48
-	$head[$h][1] = $langs->trans("Info");
49
-	$head[$h][2] = 'info';
50
-	$h++;
47
+    $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id;
48
+    $head[$h][1] = $langs->trans("Info");
49
+    $head[$h][2] = 'info';
50
+    $h++;
51 51
 
52
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'payment', 'remove');
52
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'payment', 'remove');
53 53
 
54
-	return $head;
54
+    return $head;
55 55
 }
56 56
 
57 57
 /**
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
  */
64 64
 function payment_supplier_prepare_head(Paiement $object)
65 65
 {
66
-	global $langs, $conf;
66
+    global $langs, $conf;
67 67
 
68
-	$h = 0;
69
-	$head = array();
68
+    $h = 0;
69
+    $head = array();
70 70
 
71
-	$head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$object->id;
72
-	$head[$h][1] = $langs->trans("Card");
73
-	$head[$h][2] = 'payment';
74
-	$h++;
71
+    $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$object->id;
72
+    $head[$h][1] = $langs->trans("Card");
73
+    $head[$h][2] = 'payment';
74
+    $h++;
75 75
 
76 76
     // Show more tabs from modules
77 77
     // Entries must be declared in modules descriptor with line
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
     // $this->tabs = array('entity:-tabname);   												to remove a tab
80 80
     complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier');
81 81
 
82
-	$head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id;
83
-	$head[$h][1] = $langs->trans('Info');
84
-	$head[$h][2] = 'info';
85
-	$h++;
82
+    $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id;
83
+    $head[$h][1] = $langs->trans('Info');
84
+    $head[$h][2] = 'info';
85
+    $h++;
86 86
 
87
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier', 'remove');
87
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier', 'remove');
88 88
 
89
-	return $head;
89
+    return $head;
90 90
 }
91 91
 
92 92
 /**
@@ -97,23 +97,23 @@  discard block
 block discarded – undo
97 97
  */
98 98
 function getValidOnlinePaymentMethods($paymentmethod='')
99 99
 {
100
-	global $conf;
101
-
102
-	$validpaymentmethod=array();
103
-
104
-	if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled))
105
-	{
106
-		$validpaymentmethod['paypal']='valid';
107
-	}
108
-	if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled))
109
-	{
110
-		$validpaymentmethod['paybox']='valid';
111
-	}
112
-	if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled))
113
-	{
114
-		$validpaymentmethod['stripe']='valid';
115
-	}
116
-	return $validpaymentmethod;
100
+    global $conf;
101
+
102
+    $validpaymentmethod=array();
103
+
104
+    if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled))
105
+    {
106
+        $validpaymentmethod['paypal']='valid';
107
+    }
108
+    if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled))
109
+    {
110
+        $validpaymentmethod['paybox']='valid';
111
+    }
112
+    if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled))
113
+    {
114
+        $validpaymentmethod['stripe']='valid';
115
+    }
116
+    return $validpaymentmethod;
117 117
 }
118 118
 
119 119
 /**
@@ -125,18 +125,18 @@  discard block
 block discarded – undo
125 125
  */
126 126
 function showOnlinePaymentUrl($type,$ref)
127 127
 {
128
-	global $conf, $langs;
128
+    global $conf, $langs;
129 129
 
130
-	// Load translation files required by the page
130
+    // Load translation files required by the page
131 131
     $langs->loadLangs(array('payment', 'paybox'));
132 132
 
133
-	$servicename='Online';
133
+    $servicename='Online';
134 134
 
135
-	$out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>';
136
-	$url = getOnlinePaymentUrl(0,$type,$ref);
137
-	$out.= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">';
138
-	$out.= ajax_autoselect("onlinepaymenturl", 0);
139
-	return $out;
135
+    $out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>';
136
+    $url = getOnlinePaymentUrl(0,$type,$ref);
137
+    $out.= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">';
138
+    $out.= ajax_autoselect("onlinepaymenturl", 0);
139
+    return $out;
140 140
 }
141 141
 
142 142
 /**
@@ -151,115 +151,115 @@  discard block
 block discarded – undo
151 151
  */
152 152
 function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='your_free_tag')
153 153
 {
154
-	global $conf;
155
-
156
-	$ref=str_replace(' ','',$ref);
157
-	$out='';
158
-
159
-	if ($type == 'free')
160
-	{
161
-		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':'');
162
-		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
163
-		{
164
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
165
-			else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
166
-		}
167
-	}
168
-	elseif ($type == 'order')
169
-	{
170
-		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':'');
171
-		if ($mode == 1) $out.='order_ref';
172
-		if ($mode == 0) $out.=urlencode($ref);
173
-		$out.=($mode?'</font>':'');
174
-		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
175
-		{
176
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
177
-			else
178
-			{
179
-				$out.='&securekey='.($mode?'<font color="#666666">':'');
180
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)";
181
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
182
-				$out.=($mode?'</font>':'');
183
-			}
184
-		}
185
-	}
186
-	elseif ($type == 'invoice')
187
-	{
188
-		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':'');
189
-		if ($mode == 1) $out.='invoice_ref';
190
-		if ($mode == 0) $out.=urlencode($ref);
191
-		$out.=($mode?'</font>':'');
192
-		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
193
-		{
194
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
195
-			else
196
-			{
197
-				$out.='&securekey='.($mode?'<font color="#666666">':'');
198
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)";
199
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
200
-				$out.=($mode?'</font>':'');
201
-			}
202
-		}
203
-	}
204
-	elseif ($type == 'contractline')
205
-	{
206
-		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':'');
207
-		if ($mode == 1) $out.='contractline_ref';
208
-		if ($mode == 0) $out.=urlencode($ref);
209
-		$out.=($mode?'</font>':'');
210
-		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
211
-		{
212
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
213
-			else
214
-			{
215
-				$out.='&securekey='.($mode?'<font color="#666666">':'');
216
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)";
217
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
218
-				$out.=($mode?'</font>':'');
219
-			}
220
-		}
221
-	}
222
-	elseif ($type == 'member' || $type == 'membersubscription')
223
-	{
224
-		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':'');
225
-		if ($mode == 1) $out.='member_ref';
226
-		if ($mode == 0) $out.=urlencode($ref);
227
-		$out.=($mode?'</font>':'');
228
-		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
229
-		{
230
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
231
-			else
232
-			{
233
-				$out.='&securekey='.($mode?'<font color="#666666">':'');
234
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)";
235
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
236
-				$out.=($mode?'</font>':'');
237
-			}
238
-		}
239
-	}
240
-	if ($type == 'donation')
241
-	{
242
-		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':'');
243
-		if ($mode == 1) $out.='donation_ref';
244
-		if ($mode == 0) $out.=urlencode($ref);
245
-		$out.=($mode?'</font>':'');
246
-		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
247
-		{
248
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
249
-			else
250
-			{
251
-				$out.='&securekey='.($mode?'<font color="#666666">':'');
252
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)";
253
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
254
-				$out.=($mode?'</font>':'');
255
-			}
256
-		}
257
-	}
258
-
259
-	// For multicompany
260
-	if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities
261
-
262
-	return $out;
154
+    global $conf;
155
+
156
+    $ref=str_replace(' ','',$ref);
157
+    $out='';
158
+
159
+    if ($type == 'free')
160
+    {
161
+        $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':'');
162
+        if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
163
+        {
164
+            if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
165
+            else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
166
+        }
167
+    }
168
+    elseif ($type == 'order')
169
+    {
170
+        $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':'');
171
+        if ($mode == 1) $out.='order_ref';
172
+        if ($mode == 0) $out.=urlencode($ref);
173
+        $out.=($mode?'</font>':'');
174
+        if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
175
+        {
176
+            if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
177
+            else
178
+            {
179
+                $out.='&securekey='.($mode?'<font color="#666666">':'');
180
+                if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)";
181
+                if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
182
+                $out.=($mode?'</font>':'');
183
+            }
184
+        }
185
+    }
186
+    elseif ($type == 'invoice')
187
+    {
188
+        $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':'');
189
+        if ($mode == 1) $out.='invoice_ref';
190
+        if ($mode == 0) $out.=urlencode($ref);
191
+        $out.=($mode?'</font>':'');
192
+        if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
193
+        {
194
+            if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
195
+            else
196
+            {
197
+                $out.='&securekey='.($mode?'<font color="#666666">':'');
198
+                if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)";
199
+                if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
200
+                $out.=($mode?'</font>':'');
201
+            }
202
+        }
203
+    }
204
+    elseif ($type == 'contractline')
205
+    {
206
+        $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':'');
207
+        if ($mode == 1) $out.='contractline_ref';
208
+        if ($mode == 0) $out.=urlencode($ref);
209
+        $out.=($mode?'</font>':'');
210
+        if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
211
+        {
212
+            if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
213
+            else
214
+            {
215
+                $out.='&securekey='.($mode?'<font color="#666666">':'');
216
+                if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)";
217
+                if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
218
+                $out.=($mode?'</font>':'');
219
+            }
220
+        }
221
+    }
222
+    elseif ($type == 'member' || $type == 'membersubscription')
223
+    {
224
+        $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':'');
225
+        if ($mode == 1) $out.='member_ref';
226
+        if ($mode == 0) $out.=urlencode($ref);
227
+        $out.=($mode?'</font>':'');
228
+        if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
229
+        {
230
+            if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
231
+            else
232
+            {
233
+                $out.='&securekey='.($mode?'<font color="#666666">':'');
234
+                if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)";
235
+                if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
236
+                $out.=($mode?'</font>':'');
237
+            }
238
+        }
239
+    }
240
+    if ($type == 'donation')
241
+    {
242
+        $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':'');
243
+        if ($mode == 1) $out.='donation_ref';
244
+        if ($mode == 0) $out.=urlencode($ref);
245
+        $out.=($mode?'</font>':'');
246
+        if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
247
+        {
248
+            if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
249
+            else
250
+            {
251
+                $out.='&securekey='.($mode?'<font color="#666666">':'');
252
+                if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)";
253
+                if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
254
+                $out.=($mode?'</font>':'');
255
+            }
256
+        }
257
+    }
258
+
259
+    // For multicompany
260
+    if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities
261
+
262
+    return $out;
263 263
 }
264 264
 
265 265
 
@@ -331,20 +331,20 @@  discard block
 block discarded – undo
331 331
     print '<div class="center">'."\n";
332 332
     if ($addformmessage)
333 333
     {
334
-    	print '<!-- object = '.$object->element.' -->';
335
-    	print '<br>';
336
-
337
-    	$parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
338
-    	if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
339
-    	elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
340
-
341
-    	// Add other message if VAT exists
342
-    	if ($object->total_vat != 0 || $object->total_tva != 0)
343
-    	{
344
-    		$parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
345
-    		if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
346
-    		elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
347
-    	}
334
+        print '<!-- object = '.$object->element.' -->';
335
+        print '<br>';
336
+
337
+        $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
338
+        if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
339
+        elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
340
+
341
+        // Add other message if VAT exists
342
+        if ($object->total_vat != 0 || $object->total_tva != 0)
343
+        {
344
+            $parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
345
+            if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
346
+            elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
347
+        }
348 348
     }
349 349
 
350 350
     print '<font style="font-size: 10px;"><br><hr>'."\n";
Please login to merge, or discard this patch.
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
     // Entries must be declared in modules descriptor with line
43 43
     // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
44 44
     // $this->tabs = array('entity:-tabname);   												to remove a tab
45
-    complete_head_from_modules($conf,$langs,$object,$head,$h,'payment');
45
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment');
46 46
 
47 47
 	$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id;
48 48
 	$head[$h][1] = $langs->trans("Info");
49 49
 	$head[$h][2] = 'info';
50 50
 	$h++;
51 51
 
52
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'payment', 'remove');
52
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment', 'remove');
53 53
 
54 54
 	return $head;
55 55
 }
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
     // Entries must be declared in modules descriptor with line
78 78
     // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
79 79
     // $this->tabs = array('entity:-tabname);   												to remove a tab
80
-    complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier');
80
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment_supplier');
81 81
 
82 82
 	$head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id;
83 83
 	$head[$h][1] = $langs->trans('Info');
84 84
 	$head[$h][2] = 'info';
85 85
 	$h++;
86 86
 
87
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier', 'remove');
87
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment_supplier', 'remove');
88 88
 
89 89
 	return $head;
90 90
 }
@@ -95,23 +95,23 @@  discard block
 block discarded – undo
95 95
  * @param	string	$paymentmethod		Filter on this payment method (''=none, 'paypal', ...)
96 96
  * @return	array						Array of valid payment method
97 97
  */
98
-function getValidOnlinePaymentMethods($paymentmethod='')
98
+function getValidOnlinePaymentMethods($paymentmethod = '')
99 99
 {
100 100
 	global $conf;
101 101
 
102
-	$validpaymentmethod=array();
102
+	$validpaymentmethod = array();
103 103
 
104
-	if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled))
104
+	if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled))
105 105
 	{
106
-		$validpaymentmethod['paypal']='valid';
106
+		$validpaymentmethod['paypal'] = 'valid';
107 107
 	}
108
-	if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled))
108
+	if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled))
109 109
 	{
110
-		$validpaymentmethod['paybox']='valid';
110
+		$validpaymentmethod['paybox'] = 'valid';
111 111
 	}
112
-	if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled))
112
+	if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled))
113 113
 	{
114
-		$validpaymentmethod['stripe']='valid';
114
+		$validpaymentmethod['stripe'] = 'valid';
115 115
 	}
116 116
 	return $validpaymentmethod;
117 117
 }
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
  * @param	string	$ref		Ref of object
124 124
  * @return	string				Url string
125 125
  */
126
-function showOnlinePaymentUrl($type,$ref)
126
+function showOnlinePaymentUrl($type, $ref)
127 127
 {
128 128
 	global $conf, $langs;
129 129
 
130 130
 	// Load translation files required by the page
131 131
     $langs->loadLangs(array('payment', 'paybox'));
132 132
 
133
-	$servicename='Online';
133
+	$servicename = 'Online';
134 134
 
135
-	$out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>';
136
-	$url = getOnlinePaymentUrl(0,$type,$ref);
137
-	$out.= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">';
138
-	$out.= ajax_autoselect("onlinepaymenturl", 0);
135
+	$out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'<br>';
136
+	$url = getOnlinePaymentUrl(0, $type, $ref);
137
+	$out .= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">';
138
+	$out .= ajax_autoselect("onlinepaymenturl", 0);
139 139
 	return $out;
140 140
 }
141 141
 
@@ -149,115 +149,115 @@  discard block
 block discarded – undo
149 149
  * @param	string	$freetag	Free tag
150 150
  * @return	string				Url string
151 151
  */
152
-function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='your_free_tag')
152
+function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_free_tag')
153 153
 {
154 154
 	global $conf;
155 155
 
156
-	$ref=str_replace(' ','',$ref);
157
-	$out='';
156
+	$ref = str_replace(' ', '', $ref);
157
+	$out = '';
158 158
 
159 159
 	if ($type == 'free')
160 160
 	{
161
-		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':'');
162
-		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
161
+		$out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode ? '<font color="#666666">' : '').$amount.($mode ? '</font>' : '').'&tag='.($mode ? '<font color="#666666">' : '').$freetag.($mode ? '</font>' : '');
162
+		if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
163 163
 		{
164
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
165
-			else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
164
+			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
165
+			else $out .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
166 166
 		}
167 167
 	}
168 168
 	elseif ($type == 'order')
169 169
 	{
170
-		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':'');
171
-		if ($mode == 1) $out.='order_ref';
172
-		if ($mode == 0) $out.=urlencode($ref);
173
-		$out.=($mode?'</font>':'');
174
-		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
170
+		$out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode ? '<font color="#666666">' : '');
171
+		if ($mode == 1) $out .= 'order_ref';
172
+		if ($mode == 0) $out .= urlencode($ref);
173
+		$out .= ($mode ? '</font>' : '');
174
+		if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
175 175
 		{
176
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
176
+			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
177 177
 			else
178 178
 			{
179
-				$out.='&securekey='.($mode?'<font color="#666666">':'');
180
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)";
181
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
182
-				$out.=($mode?'</font>':'');
179
+				$out .= '&securekey='.($mode ? '<font color="#666666">' : '');
180
+				if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)";
181
+				if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
182
+				$out .= ($mode ? '</font>' : '');
183 183
 			}
184 184
 		}
185 185
 	}
186 186
 	elseif ($type == 'invoice')
187 187
 	{
188
-		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':'');
189
-		if ($mode == 1) $out.='invoice_ref';
190
-		if ($mode == 0) $out.=urlencode($ref);
191
-		$out.=($mode?'</font>':'');
192
-		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
188
+		$out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode ? '<font color="#666666">' : '');
189
+		if ($mode == 1) $out .= 'invoice_ref';
190
+		if ($mode == 0) $out .= urlencode($ref);
191
+		$out .= ($mode ? '</font>' : '');
192
+		if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
193 193
 		{
194
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
194
+			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
195 195
 			else
196 196
 			{
197
-				$out.='&securekey='.($mode?'<font color="#666666">':'');
198
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)";
199
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
200
-				$out.=($mode?'</font>':'');
197
+				$out .= '&securekey='.($mode ? '<font color="#666666">' : '');
198
+				if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)";
199
+				if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
200
+				$out .= ($mode ? '</font>' : '');
201 201
 			}
202 202
 		}
203 203
 	}
204 204
 	elseif ($type == 'contractline')
205 205
 	{
206
-		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':'');
207
-		if ($mode == 1) $out.='contractline_ref';
208
-		if ($mode == 0) $out.=urlencode($ref);
209
-		$out.=($mode?'</font>':'');
210
-		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
206
+		$out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode ? '<font color="#666666">' : '');
207
+		if ($mode == 1) $out .= 'contractline_ref';
208
+		if ($mode == 0) $out .= urlencode($ref);
209
+		$out .= ($mode ? '</font>' : '');
210
+		if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
211 211
 		{
212
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
212
+			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
213 213
 			else
214 214
 			{
215
-				$out.='&securekey='.($mode?'<font color="#666666">':'');
216
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)";
217
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
218
-				$out.=($mode?'</font>':'');
215
+				$out .= '&securekey='.($mode ? '<font color="#666666">' : '');
216
+				if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)";
217
+				if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
218
+				$out .= ($mode ? '</font>' : '');
219 219
 			}
220 220
 		}
221 221
 	}
222 222
 	elseif ($type == 'member' || $type == 'membersubscription')
223 223
 	{
224
-		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':'');
225
-		if ($mode == 1) $out.='member_ref';
226
-		if ($mode == 0) $out.=urlencode($ref);
227
-		$out.=($mode?'</font>':'');
228
-		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
224
+		$out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode ? '<font color="#666666">' : '');
225
+		if ($mode == 1) $out .= 'member_ref';
226
+		if ($mode == 0) $out .= urlencode($ref);
227
+		$out .= ($mode ? '</font>' : '');
228
+		if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
229 229
 		{
230
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
230
+			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
231 231
 			else
232 232
 			{
233
-				$out.='&securekey='.($mode?'<font color="#666666">':'');
234
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)";
235
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
236
-				$out.=($mode?'</font>':'');
233
+				$out .= '&securekey='.($mode ? '<font color="#666666">' : '');
234
+				if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)";
235
+				if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
236
+				$out .= ($mode ? '</font>' : '');
237 237
 			}
238 238
 		}
239 239
 	}
240 240
 	if ($type == 'donation')
241 241
 	{
242
-		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':'');
243
-		if ($mode == 1) $out.='donation_ref';
244
-		if ($mode == 0) $out.=urlencode($ref);
245
-		$out.=($mode?'</font>':'');
246
-		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
242
+		$out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode ? '<font color="#666666">' : '');
243
+		if ($mode == 1) $out .= 'donation_ref';
244
+		if ($mode == 0) $out .= urlencode($ref);
245
+		$out .= ($mode ? '</font>' : '');
246
+		if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
247 247
 		{
248
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
248
+			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
249 249
 			else
250 250
 			{
251
-				$out.='&securekey='.($mode?'<font color="#666666">':'');
252
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)";
253
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
254
-				$out.=($mode?'</font>':'');
251
+				$out .= '&securekey='.($mode ? '<font color="#666666">' : '');
252
+				if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)";
253
+				if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
254
+				$out .= ($mode ? '</font>' : '');
255 255
 			}
256 256
 		}
257 257
 	}
258 258
 
259 259
 	// For multicompany
260
-	if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities
260
+	if (!empty($out) && !empty($conf->multicompany->enabled)) $out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities
261 261
 
262 262
 	return $out;
263 263
 }
@@ -274,56 +274,56 @@  discard block
 block discarded – undo
274 274
  * @param	Object		$object			Object related to payment
275 275
  * @return	void
276 276
  */
277
-function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
277
+function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, $suffix = '', $object = null)
278 278
 {
279 279
     global $conf;
280 280
 
281 281
     // Juridical status
282
-    $line1="";
282
+    $line1 = "";
283 283
     if ($fromcompany->forme_juridique_code)
284 284
     {
285
-        $line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
285
+        $line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
286 286
     }
287 287
     // Capital
288 288
     if ($fromcompany->capital)
289 289
     {
290
-        $line1.=($line1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency);
290
+        $line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency);
291 291
     }
292 292
     // Prof Id 1
293
-    if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2))
293
+    if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2))
294 294
     {
295
-        $field=$langs->transcountrynoentities("ProfId1",$fromcompany->country_code);
296
-        if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
297
-        $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
295
+        $field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code);
296
+        if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
297
+        $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1;
298 298
     }
299 299
     // Prof Id 2
300 300
     if ($fromcompany->idprof2)
301 301
     {
302
-        $field=$langs->transcountrynoentities("ProfId2",$fromcompany->country_code);
303
-        if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
304
-        $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2;
302
+        $field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code);
303
+        if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
304
+        $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2;
305 305
     }
306 306
 
307 307
     // Second line of company infos
308
-    $line2="";
308
+    $line2 = "";
309 309
     // Prof Id 3
310 310
     if ($fromcompany->idprof3)
311 311
     {
312
-        $field=$langs->transcountrynoentities("ProfId3",$fromcompany->country_code);
313
-        if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
314
-        $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
312
+        $field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code);
313
+        if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
314
+        $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3;
315 315
     }
316 316
     // Prof Id 4
317 317
     if ($fromcompany->idprof4)
318 318
     {
319
-        $field=$langs->transcountrynoentities("ProfId4",$fromcompany->country_code);
320
-        if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
321
-        $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
319
+        $field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code);
320
+        if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
321
+        $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4;
322 322
     }
323 323
     // IntraCommunautary VAT
324 324
     if ($fromcompany->tva_intra != '')
325 325
     {
326
-        $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
326
+        $line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
327 327
     }
328 328
 
329 329
     print '<br>';
@@ -334,16 +334,16 @@  discard block
 block discarded – undo
334 334
     	print '<!-- object = '.$object->element.' -->';
335 335
     	print '<br>';
336 336
 
337
-    	$parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
338
-    	if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
339
-    	elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
337
+    	$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
338
+    	if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
339
+    	elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
340 340
 
341 341
     	// Add other message if VAT exists
342 342
     	if ($object->total_vat != 0 || $object->total_tva != 0)
343 343
     	{
344
-    		$parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
345
-    		if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
346
-    		elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
344
+    		$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
345
+    		if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
346
+    		elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
347 347
     	}
348 348
     }
349 349
 
Please login to merge, or discard this patch.
Braces   +115 added lines, -51 removed lines patch added patch discarded remove patch
@@ -161,78 +161,113 @@  discard block
 block discarded – undo
161 161
 		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':'');
162 162
 		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
163 163
 		{
164
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
165
-			else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
164
+			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
165
+			    $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
166
+			} else {
167
+			    $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
168
+			}
166 169
 		}
167
-	}
168
-	elseif ($type == 'order')
170
+	} elseif ($type == 'order')
169 171
 	{
170 172
 		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':'');
171
-		if ($mode == 1) $out.='order_ref';
172
-		if ($mode == 0) $out.=urlencode($ref);
173
+		if ($mode == 1) {
174
+		    $out.='order_ref';
175
+		}
176
+		if ($mode == 0) {
177
+		    $out.=urlencode($ref);
178
+		}
173 179
 		$out.=($mode?'</font>':'');
174 180
 		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
175 181
 		{
176
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
177
-			else
182
+			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
183
+			    $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
184
+			} else
178 185
 			{
179 186
 				$out.='&securekey='.($mode?'<font color="#666666">':'');
180
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)";
181
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
187
+				if ($mode == 1) {
188
+				    $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)";
189
+				}
190
+				if ($mode == 0) {
191
+				    $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
192
+				}
182 193
 				$out.=($mode?'</font>':'');
183 194
 			}
184 195
 		}
185
-	}
186
-	elseif ($type == 'invoice')
196
+	} elseif ($type == 'invoice')
187 197
 	{
188 198
 		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':'');
189
-		if ($mode == 1) $out.='invoice_ref';
190
-		if ($mode == 0) $out.=urlencode($ref);
199
+		if ($mode == 1) {
200
+		    $out.='invoice_ref';
201
+		}
202
+		if ($mode == 0) {
203
+		    $out.=urlencode($ref);
204
+		}
191 205
 		$out.=($mode?'</font>':'');
192 206
 		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
193 207
 		{
194
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
195
-			else
208
+			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
209
+			    $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
210
+			} else
196 211
 			{
197 212
 				$out.='&securekey='.($mode?'<font color="#666666">':'');
198
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)";
199
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
213
+				if ($mode == 1) {
214
+				    $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)";
215
+				}
216
+				if ($mode == 0) {
217
+				    $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
218
+				}
200 219
 				$out.=($mode?'</font>':'');
201 220
 			}
202 221
 		}
203
-	}
204
-	elseif ($type == 'contractline')
222
+	} elseif ($type == 'contractline')
205 223
 	{
206 224
 		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':'');
207
-		if ($mode == 1) $out.='contractline_ref';
208
-		if ($mode == 0) $out.=urlencode($ref);
225
+		if ($mode == 1) {
226
+		    $out.='contractline_ref';
227
+		}
228
+		if ($mode == 0) {
229
+		    $out.=urlencode($ref);
230
+		}
209 231
 		$out.=($mode?'</font>':'');
210 232
 		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
211 233
 		{
212
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
213
-			else
234
+			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
235
+			    $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
236
+			} else
214 237
 			{
215 238
 				$out.='&securekey='.($mode?'<font color="#666666">':'');
216
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)";
217
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
239
+				if ($mode == 1) {
240
+				    $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)";
241
+				}
242
+				if ($mode == 0) {
243
+				    $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
244
+				}
218 245
 				$out.=($mode?'</font>':'');
219 246
 			}
220 247
 		}
221
-	}
222
-	elseif ($type == 'member' || $type == 'membersubscription')
248
+	} elseif ($type == 'member' || $type == 'membersubscription')
223 249
 	{
224 250
 		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':'');
225
-		if ($mode == 1) $out.='member_ref';
226
-		if ($mode == 0) $out.=urlencode($ref);
251
+		if ($mode == 1) {
252
+		    $out.='member_ref';
253
+		}
254
+		if ($mode == 0) {
255
+		    $out.=urlencode($ref);
256
+		}
227 257
 		$out.=($mode?'</font>':'');
228 258
 		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
229 259
 		{
230
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
231
-			else
260
+			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
261
+			    $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
262
+			} else
232 263
 			{
233 264
 				$out.='&securekey='.($mode?'<font color="#666666">':'');
234
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)";
235
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
265
+				if ($mode == 1) {
266
+				    $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)";
267
+				}
268
+				if ($mode == 0) {
269
+				    $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
270
+				}
236 271
 				$out.=($mode?'</font>':'');
237 272
 			}
238 273
 		}
@@ -240,24 +275,36 @@  discard block
 block discarded – undo
240 275
 	if ($type == 'donation')
241 276
 	{
242 277
 		$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':'');
243
-		if ($mode == 1) $out.='donation_ref';
244
-		if ($mode == 0) $out.=urlencode($ref);
278
+		if ($mode == 1) {
279
+		    $out.='donation_ref';
280
+		}
281
+		if ($mode == 0) {
282
+		    $out.=urlencode($ref);
283
+		}
245 284
 		$out.=($mode?'</font>':'');
246 285
 		if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
247 286
 		{
248
-			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
249
-			else
287
+			if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
288
+			    $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
289
+			} else
250 290
 			{
251 291
 				$out.='&securekey='.($mode?'<font color="#666666">':'');
252
-				if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)";
253
-				if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
292
+				if ($mode == 1) {
293
+				    $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)";
294
+				}
295
+				if ($mode == 0) {
296
+				    $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
297
+				}
254 298
 				$out.=($mode?'</font>':'');
255 299
 			}
256 300
 		}
257 301
 	}
258 302
 
259 303
 	// For multicompany
260
-	if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities
304
+	if (! empty($out) && ! empty($conf->multicompany->enabled)) {
305
+	    $out.="&entity=".$conf->entity;
306
+	}
307
+	// Check the entity because we may have the same reference in several entities
261 308
 
262 309
 	return $out;
263 310
 }
@@ -293,14 +340,18 @@  discard block
 block discarded – undo
293 340
     if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2))
294 341
     {
295 342
         $field=$langs->transcountrynoentities("ProfId1",$fromcompany->country_code);
296
-        if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
343
+        if (preg_match('/\((.*)\)/i',$field,$reg)) {
344
+            $field=$reg[1];
345
+        }
297 346
         $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
298 347
     }
299 348
     // Prof Id 2
300 349
     if ($fromcompany->idprof2)
301 350
     {
302 351
         $field=$langs->transcountrynoentities("ProfId2",$fromcompany->country_code);
303
-        if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
352
+        if (preg_match('/\((.*)\)/i',$field,$reg)) {
353
+            $field=$reg[1];
354
+        }
304 355
         $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2;
305 356
     }
306 357
 
@@ -310,14 +361,18 @@  discard block
 block discarded – undo
310 361
     if ($fromcompany->idprof3)
311 362
     {
312 363
         $field=$langs->transcountrynoentities("ProfId3",$fromcompany->country_code);
313
-        if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
364
+        if (preg_match('/\((.*)\)/i',$field,$reg)) {
365
+            $field=$reg[1];
366
+        }
314 367
         $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
315 368
     }
316 369
     // Prof Id 4
317 370
     if ($fromcompany->idprof4)
318 371
     {
319 372
         $field=$langs->transcountrynoentities("ProfId4",$fromcompany->country_code);
320
-        if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
373
+        if (preg_match('/\((.*)\)/i',$field,$reg)) {
374
+            $field=$reg[1];
375
+        }
321 376
         $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
322 377
     }
323 378
     // IntraCommunautary VAT
@@ -335,23 +390,32 @@  discard block
 block discarded – undo
335 390
     	print '<br>';
336 391
 
337 392
     	$parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
338
-    	if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
339
-    	elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
393
+    	if (! empty($conf->global->$parammessageform)) {
394
+    	    print $langs->transnoentities($conf->global->$parammessageform);
395
+    	} elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) {
396
+    	    print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
397
+    	}
340 398
 
341 399
     	// Add other message if VAT exists
342 400
     	if ($object->total_vat != 0 || $object->total_tva != 0)
343 401
     	{
344 402
     		$parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
345
-    		if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
346
-    		elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
403
+    		if (! empty($conf->global->$parammessageform)) {
404
+    		    print $langs->transnoentities($conf->global->$parammessageform);
405
+    		} elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) {
406
+    		    print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
407
+    		}
347 408
     	}
348 409
     }
349 410
 
350 411
     print '<font style="font-size: 10px;"><br><hr>'."\n";
351 412
     print $fromcompany->name.'<br>';
352 413
     print $line1;
353
-    if (strlen($line1.$line2) > 50) print '<br>';
354
-    else print ' - ';
414
+    if (strlen($line1.$line2) > 50) {
415
+        print '<br>';
416
+    } else {
417
+        print ' - ';
418
+    }
355 419
     print $line2;
356 420
     print '</font></div>'."\n";
357 421
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/asset.lib.php 3 patches
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -28,41 +28,41 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function asset_admin_prepare_head()
30 30
 {
31
-	global $langs, $conf;
31
+    global $langs, $conf;
32 32
 
33
-	$langs->load("assets");
33
+    $langs->load("assets");
34 34
 
35
-	$h = 0;
36
-	$head = array();
35
+    $h = 0;
36
+    $head = array();
37 37
 
38
-	$head[$h][0] = DOL_URL_ROOT . '/asset/admin/setup.php';
39
-	$head[$h][1] = $langs->trans("Settings");
40
-	$head[$h][2] = 'settings';
41
-	$h++;
38
+    $head[$h][0] = DOL_URL_ROOT . '/asset/admin/setup.php';
39
+    $head[$h][1] = $langs->trans("Settings");
40
+    $head[$h][2] = 'settings';
41
+    $h++;
42 42
 
43
-	// Show more tabs from modules
44
-	// Entries must be declared in modules descriptor with line
45
-	//$this->tabs = array(
46
-	//	'entity:+tabname:Title:@assets:/asset/mypage.php?id=__ID__'
47
-	//); // to add new tab
48
-	//$this->tabs = array(
49
-	//	'entity:-tabname:Title:@assets:/asset/mypage.php?id=__ID__'
50
-	//); // to remove a tab
51
-	complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin');
43
+    // Show more tabs from modules
44
+    // Entries must be declared in modules descriptor with line
45
+    //$this->tabs = array(
46
+    //	'entity:+tabname:Title:@assets:/asset/mypage.php?id=__ID__'
47
+    //); // to add new tab
48
+    //$this->tabs = array(
49
+    //	'entity:-tabname:Title:@assets:/asset/mypage.php?id=__ID__'
50
+    //); // to remove a tab
51
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin');
52 52
 
53
-	$head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_extrafields.php';
54
-	$head[$h][1] = $langs->trans("ExtraFields");
55
-	$head[$h][2] = 'attributes';
56
-	$h++;
53
+    $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_extrafields.php';
54
+    $head[$h][1] = $langs->trans("ExtraFields");
55
+    $head[$h][2] = 'attributes';
56
+    $h++;
57 57
 
58
-	$head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_type_extrafields.php';
59
-	$head[$h][1] = $langs->trans("ExtraFieldsAssetsType");
60
-	$head[$h][2] = 'attributes_type';
61
-	$h++;
58
+    $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_type_extrafields.php';
59
+    $head[$h][1] = $langs->trans("ExtraFieldsAssetsType");
60
+    $head[$h][2] = 'attributes_type';
61
+    $h++;
62 62
 
63
-	complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin', 'remove');
63
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin', 'remove');
64 64
 
65
-	return $head;
65
+    return $head;
66 66
 }
67 67
 
68 68
 /**
@@ -72,56 +72,56 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function asset_prepare_head()
74 74
 {
75
-	global $langs, $conf;
76
-
77
-	$langs->load("assets");
78
-
79
-	$h = 0;
80
-	$head = array();
81
-
82
-	$head[$h][0] = DOL_URL_ROOT . '/asset/card.php';
83
-	$head[$h][1] = $langs->trans("Card");
84
-	$head[$h][2] = 'card';
85
-	$h++;
86
-
87
-	// Show more tabs from modules
88
-	// Entries must be declared in modules descriptor with line
89
-	//$this->tabs = array(
90
-	//	'entity:+tabname:Title:@assets:/assets/mypage.php?id=__ID__'
91
-	//); // to add new tab
92
-	//$this->tabs = array(
93
-	//	'entity:-tabname:Title:@assets:/assets/mypage.php?id=__ID__'
94
-	//); // to remove a tab
95
-	complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets');
96
-
97
-	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
98
-	require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
99
-	$upload_dir = $conf->assets->dir_output . '/' . get_exdir($filename,2,0,1,$object,'assets'). '/'. dol_sanitizeFileName($object->ref);
100
-	$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
101
-	$nbLinks=Link::count($db, $object->element, $object->id);
102
-	$head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id;
103
-	$head[$h][1] = $langs->trans('Documents');
104
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
105
-	$head[$h][2] = 'documents';
106
-	$h++;
107
-
108
-	$nbNote = 0;
109
-	if(!empty($object->note_private)) $nbNote++;
110
-	if(!empty($object->note_public)) $nbNote++;
111
-	$head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id;
112
-	$head[$h][1] = $langs->trans("Notes");
113
-	if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
114
-	$head[$h][2] = 'note';
115
-	$h++;
116
-
117
-	$head[$h][0] = DOL_URL_ROOT . '/asset/info.php?id=' . $object->id;
118
-	$head[$h][1] = $langs->trans("Info");
119
-	$head[$h][2] = 'info';
120
-	$h++;
121
-
122
-	complete_head_from_modules($conf, $langs, $object, $head, $h, 'asset', 'remove');
123
-
124
-	return $head;
75
+    global $langs, $conf;
76
+
77
+    $langs->load("assets");
78
+
79
+    $h = 0;
80
+    $head = array();
81
+
82
+    $head[$h][0] = DOL_URL_ROOT . '/asset/card.php';
83
+    $head[$h][1] = $langs->trans("Card");
84
+    $head[$h][2] = 'card';
85
+    $h++;
86
+
87
+    // Show more tabs from modules
88
+    // Entries must be declared in modules descriptor with line
89
+    //$this->tabs = array(
90
+    //	'entity:+tabname:Title:@assets:/assets/mypage.php?id=__ID__'
91
+    //); // to add new tab
92
+    //$this->tabs = array(
93
+    //	'entity:-tabname:Title:@assets:/assets/mypage.php?id=__ID__'
94
+    //); // to remove a tab
95
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets');
96
+
97
+    require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
98
+    require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
99
+    $upload_dir = $conf->assets->dir_output . '/' . get_exdir($filename,2,0,1,$object,'assets'). '/'. dol_sanitizeFileName($object->ref);
100
+    $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
101
+    $nbLinks=Link::count($db, $object->element, $object->id);
102
+    $head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id;
103
+    $head[$h][1] = $langs->trans('Documents');
104
+    if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
105
+    $head[$h][2] = 'documents';
106
+    $h++;
107
+
108
+    $nbNote = 0;
109
+    if(!empty($object->note_private)) $nbNote++;
110
+    if(!empty($object->note_public)) $nbNote++;
111
+    $head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id;
112
+    $head[$h][1] = $langs->trans("Notes");
113
+    if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
114
+    $head[$h][2] = 'note';
115
+    $h++;
116
+
117
+    $head[$h][0] = DOL_URL_ROOT . '/asset/info.php?id=' . $object->id;
118
+    $head[$h][1] = $langs->trans("Info");
119
+    $head[$h][2] = 'info';
120
+    $h++;
121
+
122
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'asset', 'remove');
123
+
124
+    return $head;
125 125
 }
126 126
 
127 127
 /**
@@ -132,23 +132,23 @@  discard block
 block discarded – undo
132 132
  */
133 133
 function asset_type_prepare_head(AssetType $object)
134 134
 {
135
-	global $langs, $conf, $user;
135
+    global $langs, $conf, $user;
136 136
 
137
-	$h=0;
138
-	$head = array();
137
+    $h=0;
138
+    $head = array();
139 139
 
140
-	$head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id;
141
-	$head[$h][1] = $langs->trans("Card");
142
-	$head[$h][2] = 'card';
143
-	$h++;
140
+    $head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id;
141
+    $head[$h][1] = $langs->trans("Card");
142
+    $head[$h][2] = 'card';
143
+    $h++;
144 144
 
145
-	// Show more tabs from modules
146
-	// Entries must be declared in modules descriptor with line
147
-	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
148
-	// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
149
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype');
145
+    // Show more tabs from modules
146
+    // Entries must be declared in modules descriptor with line
147
+    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
148
+    // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
149
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype');
150 150
 
151
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove');
151
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove');
152 152
 
153
-	return $head;
153
+    return $head;
154 154
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	$h = 0;
36 36
 	$head = array();
37 37
 
38
-	$head[$h][0] = DOL_URL_ROOT . '/asset/admin/setup.php';
38
+	$head[$h][0] = DOL_URL_ROOT.'/asset/admin/setup.php';
39 39
 	$head[$h][1] = $langs->trans("Settings");
40 40
 	$head[$h][2] = 'settings';
41 41
 	$h++;
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	//); // to remove a tab
51 51
 	complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin');
52 52
 
53
-	$head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_extrafields.php';
53
+	$head[$h][0] = DOL_URL_ROOT.'/asset/admin/assets_extrafields.php';
54 54
 	$head[$h][1] = $langs->trans("ExtraFields");
55 55
 	$head[$h][2] = 'attributes';
56 56
 	$h++;
57 57
 
58
-	$head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_type_extrafields.php';
58
+	$head[$h][0] = DOL_URL_ROOT.'/asset/admin/assets_type_extrafields.php';
59 59
 	$head[$h][1] = $langs->trans("ExtraFieldsAssetsType");
60 60
 	$head[$h][2] = 'attributes_type';
61 61
 	$h++;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	$h = 0;
80 80
 	$head = array();
81 81
 
82
-	$head[$h][0] = DOL_URL_ROOT . '/asset/card.php';
82
+	$head[$h][0] = DOL_URL_ROOT.'/asset/card.php';
83 83
 	$head[$h][1] = $langs->trans("Card");
84 84
 	$head[$h][2] = 'card';
85 85
 	$h++;
@@ -96,25 +96,25 @@  discard block
 block discarded – undo
96 96
 
97 97
 	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
98 98
 	require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
99
-	$upload_dir = $conf->assets->dir_output . '/' . get_exdir($filename,2,0,1,$object,'assets'). '/'. dol_sanitizeFileName($object->ref);
100
-	$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
101
-	$nbLinks=Link::count($db, $object->element, $object->id);
99
+	$upload_dir = $conf->assets->dir_output.'/'.get_exdir($filename, 2, 0, 1, $object, 'assets').'/'.dol_sanitizeFileName($object->ref);
100
+	$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
101
+	$nbLinks = Link::count($db, $object->element, $object->id);
102 102
 	$head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id;
103 103
 	$head[$h][1] = $langs->trans('Documents');
104
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
104
+	if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>';
105 105
 	$head[$h][2] = 'documents';
106 106
 	$h++;
107 107
 
108 108
 	$nbNote = 0;
109
-	if(!empty($object->note_private)) $nbNote++;
110
-	if(!empty($object->note_public)) $nbNote++;
109
+	if (!empty($object->note_private)) $nbNote++;
110
+	if (!empty($object->note_public)) $nbNote++;
111 111
 	$head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id;
112 112
 	$head[$h][1] = $langs->trans("Notes");
113
-	if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
113
+	if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>';
114 114
 	$head[$h][2] = 'note';
115 115
 	$h++;
116 116
 
117
-	$head[$h][0] = DOL_URL_ROOT . '/asset/info.php?id=' . $object->id;
117
+	$head[$h][0] = DOL_URL_ROOT.'/asset/info.php?id='.$object->id;
118 118
 	$head[$h][1] = $langs->trans("Info");
119 119
 	$head[$h][2] = 'info';
120 120
 	$h++;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 {
135 135
 	global $langs, $conf, $user;
136 136
 
137
-	$h=0;
137
+	$h = 0;
138 138
 	$head = array();
139 139
 
140 140
 	$head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id;
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	// Entries must be declared in modules descriptor with line
147 147
 	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
148 148
 	// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
149
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype');
149
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'assettype');
150 150
 
151
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove');
151
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'assettype', 'remove');
152 152
 
153 153
 	return $head;
154 154
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -101,16 +101,24 @@
 block discarded – undo
101 101
 	$nbLinks=Link::count($db, $object->element, $object->id);
102 102
 	$head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id;
103 103
 	$head[$h][1] = $langs->trans('Documents');
104
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
104
+	if (($nbFiles+$nbLinks) > 0) {
105
+	    $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
106
+	}
105 107
 	$head[$h][2] = 'documents';
106 108
 	$h++;
107 109
 
108 110
 	$nbNote = 0;
109
-	if(!empty($object->note_private)) $nbNote++;
110
-	if(!empty($object->note_public)) $nbNote++;
111
+	if(!empty($object->note_private)) {
112
+	    $nbNote++;
113
+	}
114
+	if(!empty($object->note_public)) {
115
+	    $nbNote++;
116
+	}
111 117
 	$head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id;
112 118
 	$head[$h][1] = $langs->trans("Notes");
113
-	if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
119
+	if ($nbNote > 0) {
120
+	    $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
121
+	}
114 122
 	$head[$h][2] = 'note';
115 123
 	$h++;
116 124
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/vat.lib.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
     $tab = 0;
37 37
     $head = array();
38 38
 
39
-	$head[$tab][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id;
40
-	$head[$tab][1] = $langs->trans('Card');
41
-	$head[$tab][2] = 'card';
42
-	$tab++;
39
+    $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id;
40
+    $head[$tab][1] = $langs->trans('Card');
41
+    $head[$tab][2] = 'card';
42
+    $tab++;
43 43
 
44 44
     // Show more tabs from modules
45 45
     // Entries must be declared in modules descriptor with line
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
     // $this->tabs = array('entity:-tabname);   												to remove a tab
48 48
     complete_head_from_modules($conf, $langs, $object, $head, $tab,'vat');
49 49
 	
50
-	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
50
+    require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
51 51
     require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
52
-	$upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref);
53
-	$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
52
+    $upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref);
53
+    $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
54 54
     $nbLinks=Link::count($db, $object->element, $object->id);
55
-	$head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id;
56
-	$head[$tab][1] = $langs->trans("Documents");
57
-	if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
58
-	$head[$tab][2] = 'documents';
59
-	$tab++;
55
+    $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id;
56
+    $head[$tab][1] = $langs->trans("Documents");
57
+    if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
58
+    $head[$tab][2] = 'documents';
59
+    $tab++;
60 60
 
61 61
     $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/info.php?id='.$object->id;
62 62
     $head[$tab][1] = $langs->trans("Info");
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
     // Entries must be declared in modules descriptor with line
46 46
     // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
47 47
     // $this->tabs = array('entity:-tabname);   												to remove a tab
48
-    complete_head_from_modules($conf, $langs, $object, $head, $tab,'vat');
48
+    complete_head_from_modules($conf, $langs, $object, $head, $tab, 'vat');
49 49
 	
50 50
 	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
51 51
     require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
52
-	$upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref);
53
-	$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
54
-    $nbLinks=Link::count($db, $object->element, $object->id);
52
+	$upload_dir = $conf->tax->dir_output."/".dol_sanitizeFileName($object->ref);
53
+	$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
54
+    $nbLinks = Link::count($db, $object->element, $object->id);
55 55
 	$head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id;
56 56
 	$head[$tab][1] = $langs->trans("Documents");
57
-	if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
57
+	if (($nbFiles + $nbLinks) > 0) $head[$tab][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>';
58 58
 	$head[$tab][2] = 'documents';
59 59
 	$tab++;
60 60
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     $head[$tab][2] = 'info';
64 64
     $tab++;
65 65
 
66
-    complete_head_from_modules($conf,$langs,$object,$head,$tab,'vat','remove');
66
+    complete_head_from_modules($conf, $langs, $object, $head, $tab, 'vat', 'remove');
67 67
 
68 68
     return $head;
69 69
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@
 block discarded – undo
54 54
     $nbLinks=Link::count($db, $object->element, $object->id);
55 55
 	$head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id;
56 56
 	$head[$tab][1] = $langs->trans("Documents");
57
-	if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
57
+	if (($nbFiles+$nbLinks) > 0) {
58
+	    $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
59
+	}
58 60
 	$head[$tab][2] = 'documents';
59 61
 	$tab++;
60 62
 
Please login to merge, or discard this patch.