Test Failed
Push — master ( 4378ab...bff6d4 )
by Alxarafe
44:44
created
dolibarr/scripts/invoices/email_unpaid_invoices_to_customers.php 1 patch
Braces   +67 added lines, -35 removed lines patch added patch discarded remove patch
@@ -76,20 +76,34 @@  discard block
 block discarded – undo
76 76
 $error = 0;
77 77
 print $script_file." launched with mode ".$mode." default lang=".$langs->defaultlang.(is_numeric($duration_value)?" delay=".$duration_value:"").(is_numeric($duration_value2)?" after=".$duration_value2:"")."\n";
78 78
 
79
-if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1;
79
+if ($mode != 'confirm') {
80
+    $conf->global->MAIN_DISABLE_ALL_MAILS=1;
81
+}
80 82
 
81 83
 $sql = "SELECT f.ref, f.total_ttc, f.date_lim_reglement as due_date,";
82 84
 $sql.= " s.rowid as sid, s.nom as name, s.email, s.default_lang";
83
-if ($targettype == 'contacts') $sql.= ", sp.rowid as cid, sp.firstname as cfirstname, sp.lastname as clastname, sp.email as cemail";
85
+if ($targettype == 'contacts') {
86
+    $sql.= ", sp.rowid as cid, sp.firstname as cfirstname, sp.lastname as clastname, sp.email as cemail";
87
+}
84 88
 $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
85
-if ($targettype == 'contacts') $sql.= ", ".MAIN_DB_PREFIX."socpeople as sp";
89
+if ($targettype == 'contacts') {
90
+    $sql.= ", ".MAIN_DB_PREFIX."socpeople as sp";
91
+}
86 92
 $sql.= " WHERE f.fk_statut = 1 AND f.paye = 0";
87 93
 $sql.= " AND f.fk_soc = s.rowid";
88
-if (is_numeric($duration_value2)) $sql.= " AND f.date_lim_reglement >= '".$db->idate(dol_time_plus_duree($now, $duration_value2, "d"))."'";
89
-if (is_numeric($duration_value)) $sql.= " AND f.date_lim_reglement < '".$db->idate(dol_time_plus_duree($now, $duration_value, "d"))."'";
90
-if ($targettype == 'contacts') $sql.= " AND s.rowid = sp.fk_soc";
94
+if (is_numeric($duration_value2)) {
95
+    $sql.= " AND f.date_lim_reglement >= '".$db->idate(dol_time_plus_duree($now, $duration_value2, "d"))."'";
96
+}
97
+if (is_numeric($duration_value)) {
98
+    $sql.= " AND f.date_lim_reglement < '".$db->idate(dol_time_plus_duree($now, $duration_value, "d"))."'";
99
+}
100
+if ($targettype == 'contacts') {
101
+    $sql.= " AND s.rowid = sp.fk_soc";
102
+}
91 103
 $sql.= " ORDER BY";
92
-if ($targettype == 'contacts') $sql.= " sp.email, sp.rowid,";
104
+if ($targettype == 'contacts') {
105
+    $sql.= " sp.email, sp.rowid,";
106
+}
93 107
 $sql.= " s.email ASC, s.rowid ASC, f.ref ASC";	// Order by email to allow one message per email
94 108
 
95 109
 //print $sql;
@@ -116,9 +130,15 @@  discard block
 block discarded – undo
116 130
 
117 131
             // Check if this record is a break after previous one
118 132
             $startbreak=false;
119
-			if ($newemail <> $oldemail || $oldemail == 'none') $startbreak=true;
120
-			if ($obj->sid && $obj->sid <> $oldsid) $startbreak=true;
121
-			if ($obj->cid && $obj->cid <> $oldcid) $startbreak=true;
133
+			if ($newemail <> $oldemail || $oldemail == 'none') {
134
+			    $startbreak=true;
135
+			}
136
+			if ($obj->sid && $obj->sid <> $oldsid) {
137
+			    $startbreak=true;
138
+			}
139
+			if ($obj->cid && $obj->cid <> $oldcid) {
140
+			    $startbreak=true;
141
+			}
122 142
 
123 143
             if ($startbreak)
124 144
             {
@@ -127,13 +147,15 @@  discard block
 block discarded – undo
127 147
                 {
128 148
                    	envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldtarget);
129 149
                    	$trackthirdpartiessent[$oldsid.'|'.$oldemail]='contact id '.$oldcid;
130
-                }
131
-                else
150
+                } else
132 151
 				{
133 152
                 	if ($oldemail != 'none')
134 153
                 	{
135
-                		if (empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) print "- No email sent for '".$oldtarget."', total: ".$total."\n";
136
-                		else print "- No email sent for '".$oldtarget."', total: ".$total." (already sent to ".$trackthirdpartiessent[$oldsid.'|'.$oldemail].")\n";
154
+                		if (empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) {
155
+                		    print "- No email sent for '".$oldtarget."', total: ".$total."\n";
156
+                		} else {
157
+                		    print "- No email sent for '".$oldtarget."', total: ".$total." (already sent to ".$trackthirdpartiessent[$oldsid.'|'.$oldemail].")\n";
158
+                		}
137 159
                 	}
138 160
                 }
139 161
                 $oldemail = $newemail;
@@ -162,8 +184,11 @@  discard block
 block discarded – undo
162 184
             	$foundtoprocess++;
163 185
             }
164 186
             print "Unpaid invoice ".$obj->ref.", price ".price2num($obj->total_ttc).", due date ".dol_print_date($db->jdate($obj->due_date),'day').", customer id ".$obj->sid." ".$obj->name.", ".($obj->cid?"contact id ".$obj->cid." ".$obj->clastname." ".$obj->cfirstname.", ":"")."email ".$newemail.", lang ".$outputlangs->defaultlang.": ";
165
-            if (dol_strlen($newemail)) print "qualified.";
166
-            else print "disqualified (no email).";
187
+            if (dol_strlen($newemail)) {
188
+                print "qualified.";
189
+            } else {
190
+                print "disqualified (no email).";
191
+            }
167 192
             print "\n";
168 193
 
169 194
             unset($outputlangs);
@@ -176,29 +201,31 @@  discard block
 block discarded – undo
176 201
         // Si il reste des envois en buffer
177 202
         if ($foundtoprocess)
178 203
         {
179
-            if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail]))	// Break onto email (new email)
204
+            if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) {
205
+                // Break onto email (new email)
180 206
             {
181 207
        			envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldtarget);
182
-       			$trackthirdpartiessent[$oldsid.'|'.$oldemail]='contact id '.$oldcid;
183 208
             }
184
-            else
209
+       			$trackthirdpartiessent[$oldsid.'|'.$oldemail]='contact id '.$oldcid;
210
+            } else
185 211
 			{
186 212
             	if ($oldemail != 'none')
187 213
             	{
188
-            		if (empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) print "- No email sent for '".$oldtarget."', total: ".$total."\n";
189
-            		else print "- No email sent for '".$oldtarget."', total: ".$total." (already sent to ".$trackthirdpartiessent[$oldsid.'|'.$oldemail].")\n";
214
+            		if (empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) {
215
+            		    print "- No email sent for '".$oldtarget."', total: ".$total."\n";
216
+            		} else {
217
+            		    print "- No email sent for '".$oldtarget."', total: ".$total." (already sent to ".$trackthirdpartiessent[$oldsid.'|'.$oldemail].")\n";
218
+            		}
190 219
             	}
191 220
             }
192 221
         }
193
-    }
194
-    else
222
+    } else
195 223
 	{
196 224
         print "No unpaid invoices found\n";
197 225
     }
198 226
 
199 227
     exit(0);
200
-}
201
-else
228
+} else
202 229
 {
203 230
     dol_print_error($db);
204 231
     dol_syslog("email_unpaid_invoices_to_customers.php: Error");
@@ -222,7 +249,9 @@  discard block
 block discarded – undo
222 249
 {
223 250
     global $conf,$langs;
224 251
 
225
-    if (getenv('DOL_FORCE_EMAIL_TO')) $oldemail=getenv('DOL_FORCE_EMAIL_TO');
252
+    if (getenv('DOL_FORCE_EMAIL_TO')) {
253
+        $oldemail=getenv('DOL_FORCE_EMAIL_TO');
254
+    }
226 255
 
227 256
     $newlangs=new Translate('',$conf);
228 257
     $newlangs->setDefaultLang(empty($userlang)?(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT):$userlang);
@@ -239,15 +268,18 @@  discard block
 block discarded – undo
239 268
     dol_syslog("email_unpaid_invoices_to_customers.php: send mail to ".$oldemail);
240 269
 
241 270
     $usehtml=0;
242
-    if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) $usehtml+=1;
243
-    if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER)) $usehtml+=1;
271
+    if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) {
272
+        $usehtml+=1;
273
+    }
274
+    if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER)) {
275
+        $usehtml+=1;
276
+    }
244 277
 
245 278
     $allmessage='';
246 279
     if (! empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER))
247 280
     {
248 281
     	$allmessage.=$conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER;
249
-    }
250
-    else
282
+    } else
251 283
     {
252 284
     	$allmessage.= "Dear customer".($usehtml?"<br>\n":"\n").($usehtml?"<br>\n":"\n");
253 285
     	$allmessage.= "Please, find a summary of the bills with pending payments from you.".($usehtml?"<br>\n":"\n").($usehtml?"<br>\n":"\n");
@@ -258,7 +290,9 @@  discard block
 block discarded – undo
258 290
     if (! empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER))
259 291
     {
260 292
     	$allmessage.=$conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER;
261
-    	if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) $usehtml+=1;
293
+    	if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) {
294
+    	    $usehtml+=1;
295
+    	}
262 296
     }
263 297
 
264 298
     $mail = new CMailFile(
@@ -286,8 +320,7 @@  discard block
 block discarded – undo
286 320
     		print "Error sending email ".$mail->error."\n";
287 321
     		dol_syslog("Error sending email ".$mail->error."\n");
288 322
     	}
289
-    }
290
-    else
323
+    } else
291 324
     {
292 325
     	print "No email sent (test mode)\n";
293 326
     	dol_syslog("No email sent (test mode)");
@@ -299,8 +332,7 @@  discard block
 block discarded – undo
299 332
     if ($result)
300 333
     {
301 334
         return 1;
302
-    }
303
-    else
335
+    } else
304 336
     {
305 337
         return -1;
306 338
     }
Please login to merge, or discard this patch.
dolibarr/scripts/user/sync_users_dolibarr2ldap.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@  discard block
 block discarded – undo
101 101
 		if ($result > 0)
102 102
 		{
103 103
 			print " - ".$langs->trans("OK");
104
-		}
105
-		else
104
+		} else
106 105
 		{
107 106
 			$error++;
108 107
 			print " - ".$langs->trans("KO").' - '.$ldap->error;
@@ -114,8 +113,7 @@  discard block
 block discarded – undo
114 113
 
115 114
 	$ldap->unbind();
116 115
 	$ldap->close();
117
-}
118
-else
116
+} else
119 117
 {
120 118
 	dol_print_error($db);
121 119
 }
Please login to merge, or discard this patch.
dolibarr/scripts/user/sync_users_ldap2dolibarr.php 1 patch
Braces   +31 added lines, -21 removed lines patch added patch discarded remove patch
@@ -89,11 +89,19 @@  discard block
 block discarded – undo
89 89
 
90 90
 foreach($argv as $key => $val)
91 91
 {
92
-	if ($val == 'commitiferror') $forcecommit=1;
93
-	if (preg_match('/--server=([^\s]+)$/',$val,$reg)) $conf->global->LDAP_SERVER_HOST=$reg[1];
94
-	if (preg_match('/--excludeuser=([^\s]+)$/',$val,$reg)) $excludeuser=explode(',',$reg[1]);
95
-	if (preg_match('/-y$/',$val,$reg)) $confirmed=1;
96
-}
92
+	if ($val == 'commitiferror') {
93
+	    $forcecommit=1;
94
+	}
95
+	if (preg_match('/--server=([^\s]+)$/',$val,$reg)) {
96
+	    $conf->global->LDAP_SERVER_HOST=$reg[1];
97
+	}
98
+	if (preg_match('/--excludeuser=([^\s]+)$/',$val,$reg)) {
99
+	    $excludeuser=explode(',',$reg[1]);
100
+	}
101
+	if (preg_match('/-y$/',$val,$reg)) {
102
+	    $confirmed=1;
103
+	}
104
+	}
97 105
 
98 106
 print "Mails sending disabled (useless in batch mode)\n";
99 107
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;	// On bloque les mails
@@ -104,8 +112,13 @@  discard block
 block discarded – undo
104 112
 print "login=".$conf->global->LDAP_ADMIN_DN."\n";
105 113
 print "pass=".preg_replace('/./i','*',$conf->global->LDAP_ADMIN_PASS)."\n";
106 114
 print "DN to extract=".$conf->global->LDAP_USER_DN."\n";
107
-if (! empty($conf->global->LDAP_FILTER_CONNECTION)) print 'Filter=('.$conf->global->LDAP_FILTER_CONNECTION.')'."\n";	// Note: filter is defined into function getRecords
108
-else print 'Filter=('.$conf->global->LDAP_KEY_USERS.'=*)'."\n";
115
+if (! empty($conf->global->LDAP_FILTER_CONNECTION)) {
116
+    print 'Filter=('.$conf->global->LDAP_FILTER_CONNECTION.')'."\n";
117
+}
118
+// Note: filter is defined into function getRecords
119
+else {
120
+    print 'Filter=('.$conf->global->LDAP_KEY_USERS.'=*)'."\n";
121
+}
109 122
 print "----- To Dolibarr database:\n";
110 123
 print "type=".$conf->db->type."\n";
111 124
 print "host=".$conf->db->host."\n";
@@ -157,8 +170,7 @@  discard block
 block discarded – undo
157 170
 			$i++;
158 171
 		}
159 172
 	}
160
-}
161
-else
173
+} else
162 174
 {
163 175
 	dol_print_error($db);
164 176
 	exit(-1);
@@ -249,8 +261,7 @@  discard block
 block discarded – undo
249 261
 				{
250 262
 					$error++;
251 263
 					print ' --> '.$res.' '.$fuser->error;
252
-				}
253
-				else
264
+				} else
254 265
 				{
255 266
 					print ' --> Updated user id='.$fuser->id.' login='.$fuser->login;
256 267
 				}
@@ -261,8 +272,7 @@  discard block
 block discarded – undo
261 272
 				if ($res > 0)
262 273
 				{
263 274
 					print ' --> Created user id='.$fuser->id.' login='.$fuser->login;
264
-				}
265
-				else
275
+				} else
266 276
 				{
267 277
 					$error++;
268 278
 					print ' --> '.$res.' '.$fuser->error;
@@ -282,24 +292,24 @@  discard block
 block discarded – undo
282 292
 
283 293
 		if (! $error || $forcecommit)
284 294
 		{
285
-			if (! $error) print $langs->transnoentities("NoErrorCommitIsDone")."\n";
286
-			else print $langs->transnoentities("ErrorButCommitIsDone")."\n";
295
+			if (! $error) {
296
+			    print $langs->transnoentities("NoErrorCommitIsDone")."\n";
297
+			} else {
298
+			    print $langs->transnoentities("ErrorButCommitIsDone")."\n";
299
+			}
287 300
 			$db->commit();
288
-		}
289
-		else
301
+		} else
290 302
 		{
291 303
 			print $langs->transnoentities("ErrorSomeErrorWereFoundRollbackIsDone",$error)."\n";
292 304
 			$db->rollback();
293 305
 		}
294 306
 		print "\n";
295
-	}
296
-	else
307
+	} else
297 308
 	{
298 309
 		dol_print_error('',$ldap->error);
299 310
 		$error++;
300 311
 	}
301
-}
302
-else
312
+} else
303 313
 {
304 314
 	dol_print_error('',$ldap->error);
305 315
 	$error++;
Please login to merge, or discard this patch.
dolibarr/scripts/user/sync_groups_ldap2dolibarr.php 1 patch
Braces   +29 added lines, -19 removed lines patch added patch discarded remove patch
@@ -78,11 +78,19 @@  discard block
 block discarded – undo
78 78
 
79 79
 foreach($argv as $key => $val)
80 80
 {
81
-	if ($val == 'commitiferror') $forcecommit=1;
82
-	if (preg_match('/--server=([^\s]+)$/',$val,$reg)) $conf->global->LDAP_SERVER_HOST=$reg[1];
83
-	if (preg_match('/--excludeuser=([^\s]+)$/',$val,$reg)) $excludeuser=explode(',',$reg[1]);
84
-	if (preg_match('/-y$/',$val,$reg)) $confirmed=1;
85
-}
81
+	if ($val == 'commitiferror') {
82
+	    $forcecommit=1;
83
+	}
84
+	if (preg_match('/--server=([^\s]+)$/',$val,$reg)) {
85
+	    $conf->global->LDAP_SERVER_HOST=$reg[1];
86
+	}
87
+	if (preg_match('/--excludeuser=([^\s]+)$/',$val,$reg)) {
88
+	    $excludeuser=explode(',',$reg[1]);
89
+	}
90
+	if (preg_match('/-y$/',$val,$reg)) {
91
+	    $confirmed=1;
92
+	}
93
+	}
86 94
 
87 95
 print "Mails sending disabled (useless in batch mode)\n";
88 96
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;	// On bloque les mails
@@ -152,8 +160,7 @@  discard block
 block discarded – undo
152 160
 				if ($res > 0)
153 161
 				{
154 162
 					print ' --> Updated group id='.$group->id.' name='.$group->name;
155
-				}
156
-				else
163
+				} else
157 164
 				{
158 165
 					$error++;
159 166
 					print ' --> '.$res.' '.$group->error;
@@ -166,8 +173,7 @@  discard block
 block discarded – undo
166 173
 				if ($res > 0)
167 174
 				{
168 175
 					print ' --> Created group id='.$group->id.' name='.$group->name;
169
-				}
170
-				else
176
+				} else
171 177
 				{
172 178
 					$error++;
173 179
 					print ' --> '.$res.' '.$group->error;
@@ -182,7 +188,9 @@  discard block
 block discarded – undo
182 188
 			$userList = array();
183 189
 			$userIdList = array();
184 190
 			foreach($ldapgroup[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] as $key => $userdn) {
185
-				if($key === 'count') continue;
191
+				if($key === 'count') {
192
+				    continue;
193
+				}
186 194
 				if(empty($userList[$userdn])) { // Récupération de l'utilisateur
187 195
 					// Schéma rfc2307: les membres sont listés dans l'attribut memberUid sous form de login uniquement
188 196
 					if ($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS === 'memberUid'){
@@ -191,7 +199,9 @@  discard block
 block discarded – undo
191 199
 						$userFilter = explode(',', $userdn);
192 200
 						$userKey = $ldap->getAttributeValues('('.$userFilter[0].')', $conf->global->LDAP_KEY_USERS);
193 201
 					}
194
-					if(!is_array($userKey)) continue;
202
+					if(!is_array($userKey)) {
203
+					    continue;
204
+					}
195 205
 
196 206
 					$fuser = new User($db);
197 207
 
@@ -226,24 +236,24 @@  discard block
 block discarded – undo
226 236
 
227 237
 		if (! $error || $forcecommit)
228 238
 		{
229
-			if (! $error) print $langs->transnoentities("NoErrorCommitIsDone")."\n";
230
-			else print $langs->transnoentities("ErrorButCommitIsDone")."\n";
239
+			if (! $error) {
240
+			    print $langs->transnoentities("NoErrorCommitIsDone")."\n";
241
+			} else {
242
+			    print $langs->transnoentities("ErrorButCommitIsDone")."\n";
243
+			}
231 244
 			$db->commit();
232
-		}
233
-		else
245
+		} else
234 246
 		{
235 247
 			print $langs->transnoentities("ErrorSomeErrorWereFoundRollbackIsDone",$error)."\n";
236 248
 			$db->rollback();
237 249
 		}
238 250
 		print "\n";
239
-	}
240
-	else
251
+	} else
241 252
 	{
242 253
 		dol_print_error('',$ldap->error);
243 254
 		$error++;
244 255
 	}
245
-}
246
-else
256
+} else
247 257
 {
248 258
 	dol_print_error('',$ldap->error);
249 259
 	$error++;
Please login to merge, or discard this patch.
dolibarr/scripts/members/sync_members_ldap2dolibarr.php 1 patch
Braces   +31 added lines, -21 removed lines patch added patch discarded remove patch
@@ -99,10 +99,16 @@  discard block
 block discarded – undo
99 99
 $typeid=$argv[2];
100 100
 foreach($argv as $key => $val)
101 101
 {
102
-	if ($val == 'commitiferror') $forcecommit=1;
103
-	if (preg_match('/--server=([^\s]+)$/',$val,$reg)) $conf->global->LDAP_SERVER_HOST=$reg[1];
104
-	if (preg_match('/-y$/',$val,$reg)) $confirmed=1;
105
-}
102
+	if ($val == 'commitiferror') {
103
+	    $forcecommit=1;
104
+	}
105
+	if (preg_match('/--server=([^\s]+)$/',$val,$reg)) {
106
+	    $conf->global->LDAP_SERVER_HOST=$reg[1];
107
+	}
108
+	if (preg_match('/-y$/',$val,$reg)) {
109
+	    $confirmed=1;
110
+	}
111
+	}
106 112
 
107 113
 print "Mails sending disabled (useless in batch mode)\n";
108 114
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;	// On bloque les mails
@@ -113,8 +119,13 @@  discard block
 block discarded – undo
113 119
 print "login=".$conf->global->LDAP_ADMIN_DN."\n";
114 120
 print "pass=".preg_replace('/./i','*',$conf->global->LDAP_ADMIN_PASS)."\n";
115 121
 print "DN to extract=".$conf->global->LDAP_MEMBER_DN."\n";
116
-if (! empty($conf->global->LDAP_MEMBER_FILTER)) print 'Filter=('.$conf->global->LDAP_MEMBER_FILTER.')'."\n";	// Note: filter is defined into function getRecords
117
-else print 'Filter=('.$conf->global->LDAP_KEY_MEMBERS.'=*)'."\n";
122
+if (! empty($conf->global->LDAP_MEMBER_FILTER)) {
123
+    print 'Filter=('.$conf->global->LDAP_MEMBER_FILTER.')'."\n";
124
+}
125
+// Note: filter is defined into function getRecords
126
+else {
127
+    print 'Filter=('.$conf->global->LDAP_KEY_MEMBERS.'=*)'."\n";
128
+}
118 129
 print "----- To Dolibarr database:\n";
119 130
 print "type=".$conf->db->type."\n";
120 131
 print "host=".$conf->db->host."\n";
@@ -171,8 +182,7 @@  discard block
 block discarded – undo
171 182
 			$i++;
172 183
 		}
173 184
 	}
174
-}
175
-else
185
+} else
176 186
 {
177 187
 	dol_print_error($db);
178 188
 	exit(-1);
@@ -246,8 +256,7 @@  discard block
 block discarded – undo
246 256
 			if ($member_id > 0)
247 257
 			{
248 258
 				print ' --> Created member id='.$member_id.' login='.$member->login;
249
-			}
250
-			else
259
+			} else
251 260
 			{
252 261
 				$error++;
253 262
 				print ' --> '.$member->error;
@@ -268,8 +277,7 @@  discard block
 block discarded – undo
268 277
 			{
269 278
 				$datelast=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE]);
270 279
 				$pricelast=price2num($ldapuser[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT]);
271
-			}
272
-			elseif ($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)
280
+			} elseif ($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)
273 281
 			{
274 282
 				$datelast=dol_time_plus_duree(dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION]),-1,'y')+60*60*24;
275 283
 				$pricelast=price2num($ldapuser[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT]);
@@ -279,7 +287,9 @@  discard block
 block discarded – undo
279 287
 				{
280 288
 					// On ne va inserer que la premiere
281 289
 					$datelast=0;
282
-					if (! $pricefirst && $pricelast) $pricefirst = $pricelast;
290
+					if (! $pricefirst && $pricelast) {
291
+					    $pricefirst = $pricelast;
292
+					}
283 293
 				}
284 294
 			}
285 295
 
@@ -303,24 +313,24 @@  discard block
 block discarded – undo
303 313
 
304 314
 		if (! $error || $forcecommit)
305 315
 		{
306
-			if (! $error) print $langs->transnoentities("NoErrorCommitIsDone")."\n";
307
-			else print $langs->transnoentities("ErrorButCommitIsDone")."\n";
316
+			if (! $error) {
317
+			    print $langs->transnoentities("NoErrorCommitIsDone")."\n";
318
+			} else {
319
+			    print $langs->transnoentities("ErrorButCommitIsDone")."\n";
320
+			}
308 321
 			$db->commit();
309
-		}
310
-		else
322
+		} else
311 323
 		{
312 324
 			print $langs->transnoentities("ErrorSomeErrorWereFoundRollbackIsDone",$error)."\n";
313 325
 			$db->rollback();
314 326
 		}
315 327
 		print "\n";
316
-	}
317
-	else
328
+	} else
318 329
 	{
319 330
 		dol_print_error('',$ldap->error);
320 331
 		$error++;
321 332
 	}
322
-}
323
-else
333
+} else
324 334
 {
325 335
 	dol_print_error('',$ldap->error);
326 336
 	$error++;
Please login to merge, or discard this patch.
dolibarr/scripts/members/sync_members_dolibarr2ldap.php 1 patch
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,8 +61,10 @@  discard block
 block discarded – undo
61 61
 
62 62
 foreach($argv as $key => $val)
63 63
 {
64
-	if (preg_match('/-y$/',$val,$reg)) $confirmed=1;
65
-}
64
+	if (preg_match('/-y$/',$val,$reg)) {
65
+	    $confirmed=1;
66
+	}
67
+	}
66 68
 
67 69
 $now=$argv[1];
68 70
 
@@ -150,8 +152,7 @@  discard block
 block discarded – undo
150 152
 		if ($result > 0)
151 153
 		{
152 154
 			print " - ".$langs->transnoentities("OK");
153
-		}
154
-		else
155
+		} else
155 156
 		{
156 157
 			$error++;
157 158
 			print " - ".$langs->transnoentities("KO").' - '.$ldap->error;
@@ -163,8 +164,7 @@  discard block
 block discarded – undo
163 164
 
164 165
 	$ldap->unbind();
165 166
 	$ldap->close();
166
-}
167
-else
167
+} else
168 168
 {
169 169
 	dol_print_error($db);
170 170
 }
Please login to merge, or discard this patch.
dolibarr/scripts/members/sync_members_types_dolibarr2ldap.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -105,8 +105,7 @@  discard block
 block discarded – undo
105 105
 			if ($result > 0)
106 106
 			{
107 107
 				print " - ".$langs->trans("OK");
108
-			}
109
-			else
108
+			} else
110 109
 			{
111 110
 				$error++;
112 111
 				print " - ".$langs->trans("KO").' - '.$ldap->error;
@@ -118,12 +117,10 @@  discard block
 block discarded – undo
118 117
 
119 118
 		$ldap->unbind();
120 119
 		$ldap->close();
121
-	}
122
-	else {
120
+	} else {
123 121
 		print $ldap->error;
124 122
 	}
125
-}
126
-else
123
+} else
127 124
 {
128 125
 	dol_print_error($db);
129 126
 }
Please login to merge, or discard this patch.
dolibarr/scripts/members/sync_members_types_ldap2dolibarr.php 1 patch
Braces   +23 added lines, -17 removed lines patch added patch discarded remove patch
@@ -78,11 +78,19 @@  discard block
 block discarded – undo
78 78
 
79 79
 foreach($argv as $key => $val)
80 80
 {
81
-	if ($val == 'commitiferror') $forcecommit=1;
82
-	if (preg_match('/--server=([^\s]+)$/',$val,$reg)) $conf->global->LDAP_SERVER_HOST=$reg[1];
83
-	if (preg_match('/--excludeuser=([^\s]+)$/',$val,$reg)) $excludeuser=explode(',',$reg[1]);
84
-	if (preg_match('/-y$/',$val,$reg)) $confirmed=1;
85
-}
81
+	if ($val == 'commitiferror') {
82
+	    $forcecommit=1;
83
+	}
84
+	if (preg_match('/--server=([^\s]+)$/',$val,$reg)) {
85
+	    $conf->global->LDAP_SERVER_HOST=$reg[1];
86
+	}
87
+	if (preg_match('/--excludeuser=([^\s]+)$/',$val,$reg)) {
88
+	    $excludeuser=explode(',',$reg[1]);
89
+	}
90
+	if (preg_match('/-y$/',$val,$reg)) {
91
+	    $confirmed=1;
92
+	}
93
+	}
86 94
 
87 95
 print "Mails sending disabled (useless in batch mode)\n";
88 96
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;	// On bloque les mails
@@ -151,8 +159,7 @@  discard block
 block discarded – undo
151 159
 				if ($res > 0)
152 160
 				{
153 161
 					print ' --> Updated member type id='.$membertype->id.' name='.$membertype->label;
154
-				}
155
-				else
162
+				} else
156 163
 				{
157 164
 					$error++;
158 165
 					print ' --> '.$res.' '.$membertype->error;
@@ -165,8 +172,7 @@  discard block
 block discarded – undo
165 172
 				if ($res > 0)
166 173
 				{
167 174
 					print ' --> Created member type id='.$membertype->id.' name='.$membertype->label;
168
-				}
169
-				else
175
+				} else
170 176
 				{
171 177
 					$error++;
172 178
 					print ' --> '.$res.' '.$membertype->error;
@@ -179,24 +185,24 @@  discard block
 block discarded – undo
179 185
 
180 186
 		if (! $error || $forcecommit)
181 187
 		{
182
-			if (! $error) print $langs->transnoentities("NoErrorCommitIsDone")."\n";
183
-			else print $langs->transnoentities("ErrorButCommitIsDone")."\n";
188
+			if (! $error) {
189
+			    print $langs->transnoentities("NoErrorCommitIsDone")."\n";
190
+			} else {
191
+			    print $langs->transnoentities("ErrorButCommitIsDone")."\n";
192
+			}
184 193
 			$db->commit();
185
-		}
186
-		else
194
+		} else
187 195
 		{
188 196
 			print $langs->transnoentities("ErrorSomeErrorWereFoundRollbackIsDone",$error)."\n";
189 197
 			$db->rollback();
190 198
 		}
191 199
 		print "\n";
192
-	}
193
-	else
200
+	} else
194 201
 	{
195 202
 		dol_print_error('',$ldap->error);
196 203
 		$error++;
197 204
 	}
198
-}
199
-else
205
+} else
200 206
 {
201 207
 	dol_print_error('',$ldap->error);
202 208
 	$error++;
Please login to merge, or discard this patch.
dolibarr/scripts/product/migrate_picture_path.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,8 +78,7 @@  discard block
 block discarded – undo
78 78
 			print " migrating product id=".$product->id." ref=".$product->ref."\n";
79 79
 			migrate_product_photospath($product);
80 80
 		}
81
-	}
82
-	else
81
+	} else
83 82
 	{
84 83
 		print "\n sql error ".$sql;
85 84
 		exit;
@@ -133,8 +132,7 @@  discard block
 block discarded – undo
133 132
 		    			}
134 133
 //		    			dol_delete_dir($origin.'/'.$file);
135 134
         			}
136
-    			}
137
-    			else
135
+    			} else
138 136
     			{
139 137
     				if (dol_is_file($origin.'/'.$file) )
140 138
     				{
Please login to merge, or discard this patch.