@@ -801,7 +801,9 @@ |
||
| 801 | 801 | print '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>'; |
| 802 | 802 | } |
| 803 | 803 | |
| 804 | - if (!empty($resql)) $db->free($resql); |
|
| 804 | + if (!empty($resql)) { |
|
| 805 | + $db->free($resql); |
|
| 806 | + } |
|
| 805 | 807 | |
| 806 | 808 | $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); |
| 807 | 809 | $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $objectline); // Note that $action and $objectline may have been modified by hook |
@@ -146,13 +146,19 @@ |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // Security check (enable the most restrictive one) |
| 149 | -if ($user->socid > 0) accessforbidden(); |
|
| 149 | +if ($user->socid > 0) { |
|
| 150 | + accessforbidden(); |
|
| 151 | +} |
|
| 150 | 152 | //if ($user->socid > 0) accessforbidden(); |
| 151 | 153 | //$socid = 0; if ($user->socid > 0) $socid = $user->socid; |
| 152 | 154 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
| 153 | 155 | //restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
| 154 | -if (!isModEnabled('webhook')) accessforbidden('Module not enabled'); |
|
| 155 | -if (!$permissiontoread) accessforbidden(); |
|
| 156 | +if (!isModEnabled('webhook')) { |
|
| 157 | + accessforbidden('Module not enabled'); |
|
| 158 | +} |
|
| 159 | +if (!$permissiontoread) { |
|
| 160 | + accessforbidden(); |
|
| 161 | +} |
|
| 156 | 162 | |
| 157 | 163 | |
| 158 | 164 | /* |
@@ -118,7 +118,9 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $obj = $this->db->fetch_object($resql); |
| 120 | 120 | if ($obj) { |
| 121 | - if (!empty($partnershipsprocessed[$obj->rowid])) continue; |
|
| 121 | + if (!empty($partnershipsprocessed[$obj->rowid])) { |
|
| 122 | + continue; |
|
| 123 | + } |
|
| 122 | 124 | |
| 123 | 125 | if ($somethingdoneonpartnership >= $MAXPERCALL) { |
| 124 | 126 | dol_syslog("We reach the limit of ".$MAXPERCALL." partnership processed, so we quit loop for this batch doCancelStatusOfMemberPartnership to avoid to reach email quota.", LOG_WARNING); |
@@ -140,8 +142,11 @@ discard block |
||
| 140 | 142 | $error++; |
| 141 | 143 | $this->error = $object->error; |
| 142 | 144 | if (is_array($object->errors) && count($object->errors)) { |
| 143 | - if (is_array($this->errors)) $this->errors = array_merge($this->errors, $object->errors); |
|
| 144 | - else $this->errors = $object->errors; |
|
| 145 | + if (is_array($this->errors)) { |
|
| 146 | + $this->errors = array_merge($this->errors, $object->errors); |
|
| 147 | + } else { |
|
| 148 | + $this->errors = $object->errors; |
|
| 149 | + } |
|
| 145 | 150 | } |
| 146 | 151 | } else { |
| 147 | 152 | $partnershipsprocessed[$object->id] = $object->ref; |
@@ -159,7 +164,9 @@ discard block |
||
| 159 | 164 | // Define output language |
| 160 | 165 | $outputlangs = $langs; |
| 161 | 166 | $newlang = ''; |
| 162 | - if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
| 167 | + if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
| 168 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
| 169 | + } |
|
| 163 | 170 | if (!empty($newlang)) { |
| 164 | 171 | $outputlangs = new Translate("", $conf); |
| 165 | 172 | $outputlangs->setDefaultLang($newlang); |
@@ -184,7 +191,9 @@ discard block |
||
| 184 | 191 | if (!$result || $cmail->error) { |
| 185 | 192 | $erroremail .= ($erroremail ? ', ' : '').$cmail->error; |
| 186 | 193 | $this->errors[] = $cmail->error; |
| 187 | - if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors; |
|
| 194 | + if (is_array($cmail->errors) && count($cmail->errors) > 0) { |
|
| 195 | + $this->errors += $cmail->errors; |
|
| 196 | + } |
|
| 188 | 197 | } |
| 189 | 198 | } |
| 190 | 199 | } |
@@ -198,12 +207,16 @@ discard block |
||
| 198 | 207 | if (!$error) { |
| 199 | 208 | $this->db->commit(); |
| 200 | 209 | $this->output = $numofexpiredmembers.' expired partnership members found'."\n"; |
| 201 | - if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail; |
|
| 210 | + if ($erroremail) { |
|
| 211 | + $this->output .= '. Got errors when sending some email : '.$erroremail; |
|
| 212 | + } |
|
| 202 | 213 | } else { |
| 203 | 214 | $this->db->rollback(); |
| 204 | 215 | $this->output = "Rollback after error\n"; |
| 205 | 216 | $this->output .= $numofexpiredmembers.' expired partnership members found'."\n"; |
| 206 | - if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail; |
|
| 217 | + if ($erroremail) { |
|
| 218 | + $this->output .= '. Got errors when sending some email : '.$erroremail; |
|
| 219 | + } |
|
| 207 | 220 | } |
| 208 | 221 | |
| 209 | 222 | return ($error ? 1 : 0); |
@@ -276,7 +289,9 @@ discard block |
||
| 276 | 289 | |
| 277 | 290 | $obj = $this->db->fetch_object($resql); |
| 278 | 291 | if ($obj) { |
| 279 | - if (!empty($partnershipsprocessed[$obj->rowid])) continue; |
|
| 292 | + if (!empty($partnershipsprocessed[$obj->rowid])) { |
|
| 293 | + continue; |
|
| 294 | + } |
|
| 280 | 295 | |
| 281 | 296 | if ($somethingdoneonpartnership >= $MAXPERCALL) { |
| 282 | 297 | dol_syslog("We reach the limit of ".$MAXPERCALL." partnership processed, so we quit loop for this batch doWarningOfPartnershipIfDolibarrBacklinkNotfound to avoid to reach email quota.", LOG_WARNING); |
@@ -321,7 +336,9 @@ discard block |
||
| 321 | 336 | // Define output language |
| 322 | 337 | $outputlangs = $langs; |
| 323 | 338 | $newlang = ''; |
| 324 | - if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
| 339 | + if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
| 340 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
| 341 | + } |
|
| 325 | 342 | if (!empty($newlang)) { |
| 326 | 343 | $outputlangs = new Translate("", $conf); |
| 327 | 344 | $outputlangs->setDefaultLang($newlang); |
@@ -344,7 +361,9 @@ discard block |
||
| 344 | 361 | if (!$result || $cmail->error) { |
| 345 | 362 | $erroremail .= ($erroremail ? ', ' : '').$cmail->error; |
| 346 | 363 | $this->errors[] = $cmail->error; |
| 347 | - if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors; |
|
| 364 | + if (is_array($cmail->errors) && count($cmail->errors) > 0) { |
|
| 365 | + $this->errors += $cmail->errors; |
|
| 366 | + } |
|
| 348 | 367 | } |
| 349 | 368 | } |
| 350 | 369 | } elseif ($tmpcount > 4) { // Cancel Partnership |
@@ -378,9 +397,15 @@ discard block |
||
| 378 | 397 | $this->output = "Rollback after error\n"; |
| 379 | 398 | } |
| 380 | 399 | $this->output .= $numofexpiredmembers.' partnership checked'."\n"; |
| 381 | - if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail."\n"; |
|
| 382 | - if ($emailnotfound) $this->output .= '. Email not found for some partner : '.$emailnotfound."\n"; |
|
| 383 | - if ($websitenotfound) $this->output .= '. Website not found for some partner : '.$websitenotfound."\n"; |
|
| 400 | + if ($erroremail) { |
|
| 401 | + $this->output .= '. Got errors when sending some email : '.$erroremail."\n"; |
|
| 402 | + } |
|
| 403 | + if ($emailnotfound) { |
|
| 404 | + $this->output .= '. Email not found for some partner : '.$emailnotfound."\n"; |
|
| 405 | + } |
|
| 406 | + if ($websitenotfound) { |
|
| 407 | + $this->output .= '. Website not found for some partner : '.$websitenotfound."\n"; |
|
| 408 | + } |
|
| 384 | 409 | $this->output .= "\nSQL used to find partnerships to scan: ".$sql; |
| 385 | 410 | |
| 386 | 411 | return ($error ? 1 : 0); |