@@ -240,9 +240,12 @@ discard block |
||
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
243 | - if ($error) return -1; |
|
244 | - else return 1; |
|
245 | -} |
|
243 | + if ($error) { |
|
244 | + return -1; |
|
245 | + } else { |
|
246 | + return 1; |
|
247 | + } |
|
248 | + } |
|
246 | 249 | |
247 | 250 | |
248 | 251 | $db->begin(); |
@@ -250,9 +253,13 @@ discard block |
||
250 | 253 | $oldfamily=''; |
251 | 254 | foreach($sqls as $family => $familysql) |
252 | 255 | { |
253 | - if ($option && $option != 'all' && $option != $family) continue; |
|
256 | + if ($option && $option != 'all' && $option != $family) { |
|
257 | + continue; |
|
258 | + } |
|
254 | 259 | |
255 | - if ($family != $oldfamily) print "Process action for family ".$family."\n"; |
|
260 | + if ($family != $oldfamily) { |
|
261 | + print "Process action for family ".$family."\n"; |
|
262 | + } |
|
256 | 263 | $oldfamily = $family; |
257 | 264 | |
258 | 265 | $result=processfamily($family); |
@@ -267,8 +274,7 @@ discard block |
||
267 | 274 | { |
268 | 275 | print "Rollback any changes.\n"; |
269 | 276 | $db->rollback(); |
270 | -} |
|
271 | -else |
|
277 | +} else |
|
272 | 278 | { |
273 | 279 | print "Commit all changes.\n"; |
274 | 280 | $db->commit(); |
@@ -175,13 +175,11 @@ |
||
175 | 175 | if ($result) |
176 | 176 | { |
177 | 177 | print " OK with ref ".$object->ref."\n";; |
178 | - } |
|
179 | - else |
|
178 | + } else |
|
180 | 179 | { |
181 | 180 | dol_print_error($db,$object->error); |
182 | 181 | } |
183 | - } |
|
184 | - else |
|
182 | + } else |
|
185 | 183 | { |
186 | 184 | dol_print_error($db,$object->error); |
187 | 185 | } |
@@ -99,7 +99,9 @@ discard block |
||
99 | 99 | $soc->country_id=1; |
100 | 100 | $soc->country_code='FR'; |
101 | 101 | // Un client sur 3 a une remise de 5% |
102 | - $user_remise=mt_rand(1,3); if ($user_remise==3) $soc->remise_percent=5; |
|
102 | + $user_remise=mt_rand(1,3); if ($user_remise==3) { |
|
103 | + $soc->remise_percent=5; |
|
104 | + } |
|
103 | 105 | print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n"; |
104 | 106 | $soc->note_private = 'Company created by the script generate-societe.php'; |
105 | 107 | $socid = $soc->create(); |
@@ -121,8 +123,7 @@ discard block |
||
121 | 123 | } |
122 | 124 | |
123 | 125 | print "Company ".$s." created nom=".$soc->name."\n"; |
124 | - } |
|
125 | - else |
|
126 | + } else |
|
126 | 127 | { |
127 | 128 | print "Error: ".$soc->error."\n"; |
128 | 129 | } |
@@ -119,8 +119,12 @@ discard block |
||
119 | 119 | $i++; |
120 | 120 | $errorrecord=0; |
121 | 121 | |
122 | - if ($startlinenb && $i < $startlinenb) continue; |
|
123 | - if ($endlinenb && $i > $endlinenb) continue; |
|
122 | + if ($startlinenb && $i < $startlinenb) { |
|
123 | + continue; |
|
124 | + } |
|
125 | + if ($endlinenb && $i > $endlinenb) { |
|
126 | + continue; |
|
127 | + } |
|
124 | 128 | |
125 | 129 | $nboflines++; |
126 | 130 | |
@@ -147,8 +151,12 @@ discard block |
||
147 | 151 | if ($fields[36]) |
148 | 152 | { |
149 | 153 | $condpayment = trim($fields[36]); |
150 | - if ($condpayment == 'A la commande') $condpayment = 'A réception de commande'; |
|
151 | - if ($condpayment == 'A reception facture') $condpayment = 'Réception de facture'; |
|
154 | + if ($condpayment == 'A la commande') { |
|
155 | + $condpayment = 'A réception de commande'; |
|
156 | + } |
|
157 | + if ($condpayment == 'A reception facture') { |
|
158 | + $condpayment = 'Réception de facture'; |
|
159 | + } |
|
152 | 160 | $object->cond_reglement_id = dol_getIdFromCode($db, $condpayment, 'c_payment_term', 'libelle_facture', 'rowid', 1); |
153 | 161 | if (empty($object->cond_reglement_id)) |
154 | 162 | { |
@@ -165,7 +173,9 @@ discard block |
||
165 | 173 | |
166 | 174 | // Set price level |
167 | 175 | $object->price_level = 1; |
168 | - if ($labeltype == 'Revendeur') $object->price_level = 2; |
|
176 | + if ($labeltype == 'Revendeur') { |
|
177 | + $object->price_level = 2; |
|
178 | + } |
|
169 | 179 | |
170 | 180 | print "Process line nb ".$i.", name ".$object->name; |
171 | 181 | |
@@ -181,8 +191,7 @@ discard block |
||
181 | 191 | { |
182 | 192 | print " - Error in create result code = ".$ret." - ".$object->errorsToString(); |
183 | 193 | $errorrecord++; |
184 | - } |
|
185 | - else |
|
194 | + } else |
|
186 | 195 | { |
187 | 196 | print " - Creation OK with name ".$object->name." - id = ".$ret; |
188 | 197 | } |
@@ -202,8 +211,11 @@ discard block |
||
202 | 211 | $tmp=explode(' ',$fields[3],2); |
203 | 212 | $salesrep->firstname = trim($tmp[0]); |
204 | 213 | $salesrep->lastname = trim($tmp[1]); |
205 | - if ($salesrep->lastname) $salesrep->login = strtolower(substr($salesrep->firstname, 0, 1)) . strtolower(substr($salesrep->lastname, 0)); |
|
206 | - else $salesrep->login=strtolower($salesrep->firstname); |
|
214 | + if ($salesrep->lastname) { |
|
215 | + $salesrep->login = strtolower(substr($salesrep->firstname, 0, 1)) . strtolower(substr($salesrep->lastname, 0)); |
|
216 | + } else { |
|
217 | + $salesrep->login=strtolower($salesrep->firstname); |
|
218 | + } |
|
207 | 219 | $salesrep->login=preg_replace('/ /','',$salesrep->login); |
208 | 220 | $salesrep->fetch(0,$salesrep->login); |
209 | 221 | |
@@ -212,8 +224,7 @@ discard block |
||
212 | 224 | { |
213 | 225 | print " - Error in create link with sale representative result code = ".$result." - ".$object->errorsToString(); |
214 | 226 | $errorrecord++; |
215 | - } |
|
216 | - else |
|
227 | + } else |
|
217 | 228 | { |
218 | 229 | print " - create link sale representative OK"; |
219 | 230 | } |
@@ -243,8 +254,7 @@ discard block |
||
243 | 254 | { |
244 | 255 | print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString(); |
245 | 256 | $errorrecord++; |
246 | - } |
|
247 | - else |
|
257 | + } else |
|
248 | 258 | { |
249 | 259 | print " - create contact OK"; |
250 | 260 | } |
@@ -277,8 +287,7 @@ discard block |
||
277 | 287 | { |
278 | 288 | print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString(); |
279 | 289 | $errorrecord++; |
280 | - } |
|
281 | - else |
|
290 | + } else |
|
282 | 291 | { |
283 | 292 | print " - create contact OK"; |
284 | 293 | } |
@@ -305,8 +314,7 @@ discard block |
||
305 | 314 | { |
306 | 315 | print "Rollback any changes.\n"; |
307 | 316 | $db->rollback(); |
308 | -} |
|
309 | -else |
|
317 | +} else |
|
310 | 318 | { |
311 | 319 | print "Commit all changes.\n"; |
312 | 320 | $db->commit(); |
@@ -119,8 +119,12 @@ discard block |
||
119 | 119 | $i++; |
120 | 120 | $errorrecord=0; |
121 | 121 | |
122 | - if ($startlinenb && $i < $startlinenb) continue; |
|
123 | - if ($endlinenb && $i > $endlinenb) continue; |
|
122 | + if ($startlinenb && $i < $startlinenb) { |
|
123 | + continue; |
|
124 | + } |
|
125 | + if ($endlinenb && $i > $endlinenb) { |
|
126 | + continue; |
|
127 | + } |
|
124 | 128 | |
125 | 129 | $nboflines++; |
126 | 130 | |
@@ -130,8 +134,11 @@ discard block |
||
130 | 134 | $tmp=explode(' ',$fields[3],2); |
131 | 135 | $object->firstname = trim($tmp[0]); |
132 | 136 | $object->lastname = trim($tmp[1]); |
133 | - if ($object->lastname) $object->login = strtolower(substr($object->firstname, 0, 1)) . strtolower(substr($object->lastname, 0)); |
|
134 | - else $object->login=strtolower($object->firstname); |
|
137 | + if ($object->lastname) { |
|
138 | + $object->login = strtolower(substr($object->firstname, 0, 1)) . strtolower(substr($object->lastname, 0)); |
|
139 | + } else { |
|
140 | + $object->login=strtolower($object->firstname); |
|
141 | + } |
|
135 | 142 | $object->login=preg_replace('/ /','',$object->login); |
136 | 143 | $object->password = 'init'; |
137 | 144 | |
@@ -142,8 +149,7 @@ discard block |
||
142 | 149 | { |
143 | 150 | print " - Error in create result code = ".$ret." - ".$object->errorsToString(); |
144 | 151 | $errorrecord++; |
145 | - } |
|
146 | - else |
|
152 | + } else |
|
147 | 153 | { |
148 | 154 | print " - Creation OK with login ".$object->login." - id = ".$ret; |
149 | 155 | } |
@@ -168,8 +174,7 @@ discard block |
||
168 | 174 | { |
169 | 175 | print "Rollback any changes.\n"; |
170 | 176 | $db->rollback(); |
171 | -} |
|
172 | -else |
|
177 | +} else |
|
173 | 178 | { |
174 | 179 | print "Commit all changes.\n"; |
175 | 180 | $db->commit(); |
@@ -119,8 +119,12 @@ discard block |
||
119 | 119 | $i++; |
120 | 120 | $errorrecord=0; |
121 | 121 | |
122 | - if ($startlinenb && $i < $startlinenb) continue; |
|
123 | - if ($endlinenb && $i > $endlinenb) continue; |
|
122 | + if ($startlinenb && $i < $startlinenb) { |
|
123 | + continue; |
|
124 | + } |
|
125 | + if ($endlinenb && $i > $endlinenb) { |
|
126 | + continue; |
|
127 | + } |
|
124 | 128 | |
125 | 129 | $nboflines++; |
126 | 130 | |
@@ -163,8 +167,7 @@ discard block |
||
163 | 167 | { |
164 | 168 | print " - Error in create result code = ".$ret." - ".$produit->errorsToString(); |
165 | 169 | $errorrecord++; |
166 | - } |
|
167 | - else |
|
170 | + } else |
|
168 | 171 | { |
169 | 172 | print " - Creation OK with ref ".$produit->ref." - id = ".$ret; |
170 | 173 | } |
@@ -180,8 +183,7 @@ discard block |
||
180 | 183 | { |
181 | 184 | print " - Error in updatePrice result code = ".$ret1." ".$ret2." - ".$produit->errorsToString(); |
182 | 185 | $errorrecord++; |
183 | - } |
|
184 | - else |
|
186 | + } else |
|
185 | 187 | { |
186 | 188 | print " - updatePrice OK"; |
187 | 189 | } |
@@ -200,8 +202,7 @@ discard block |
||
200 | 202 | { |
201 | 203 | print " - Error in setMultiLangs result code = ".$ret." - ".$produit->errorsToString(); |
202 | 204 | $errorrecord++; |
203 | - } |
|
204 | - else |
|
205 | + } else |
|
205 | 206 | { |
206 | 207 | print " - setMultiLangs OK"; |
207 | 208 | } |
@@ -227,8 +228,7 @@ discard block |
||
227 | 228 | { |
228 | 229 | print "Rollback any changes.\n"; |
229 | 230 | $db->rollback(); |
230 | -} |
|
231 | -else |
|
231 | +} else |
|
232 | 232 | { |
233 | 233 | print "Commit all changes.\n"; |
234 | 234 | $db->commit(); |
@@ -93,8 +93,11 @@ |
||
93 | 93 | $produit->price = mt_rand(1,1000); |
94 | 94 | $produit->tva_tx = "19.6"; |
95 | 95 | $ret=$produit->create($user); |
96 | - if ($ret < 0) print "Error $ret - ".$produit->error."\n"; |
|
97 | - else print " OK with ref ".$produit->ref."\n"; |
|
98 | -} |
|
96 | + if ($ret < 0) { |
|
97 | + print "Error $ret - ".$produit->error."\n"; |
|
98 | + } else { |
|
99 | + print " OK with ref ".$produit->ref."\n"; |
|
100 | + } |
|
101 | + } |
|
99 | 102 | |
100 | 103 |
@@ -206,15 +206,13 @@ |
||
206 | 206 | { |
207 | 207 | $db->commit(); |
208 | 208 | print " OK with ref ".$object->ref."\n"; |
209 | - } |
|
210 | - else |
|
209 | + } else |
|
211 | 210 | { |
212 | 211 | print " KO\n"; |
213 | 212 | $db->rollback(); |
214 | 213 | dol_print_error($db,$object->error); |
215 | 214 | } |
216 | - } |
|
217 | - else |
|
215 | + } else |
|
218 | 216 | { |
219 | 217 | dol_print_error($db,$object->error); |
220 | 218 | } |
@@ -249,8 +249,7 @@ discard block |
||
249 | 249 | print __METHOD__." call method ".$WS_METHOD."\n"; |
250 | 250 | try { |
251 | 251 | $result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,''); |
252 | - } |
|
253 | - catch(SoapFault $exception) |
|
252 | + } catch(SoapFault $exception) |
|
254 | 253 | { |
255 | 254 | echo $exception; |
256 | 255 | $result=0; |
@@ -307,8 +306,7 @@ discard block |
||
307 | 306 | print __METHOD__." call method ".$WS_METHOD."\n"; |
308 | 307 | try { |
309 | 308 | $result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,''); |
310 | - } |
|
311 | - catch(SoapFault $exception) |
|
309 | + } catch(SoapFault $exception) |
|
312 | 310 | { |
313 | 311 | echo $exception; |
314 | 312 | $result=0; |
@@ -407,8 +405,7 @@ discard block |
||
407 | 405 | print __METHOD__." call method ".$WS_METHOD."\n"; |
408 | 406 | try { |
409 | 407 | $result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,''); |
410 | - } |
|
411 | - catch(SoapFault $exception) |
|
408 | + } catch(SoapFault $exception) |
|
412 | 409 | { |
413 | 410 | echo $exception; |
414 | 411 | $result=0; |