@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | // 'user' to add a tab in user view |
| 212 | 212 | |
| 213 | 213 | // Dictionaries |
| 214 | - $this->dictionaries=array( |
|
| 214 | + $this->dictionaries = array( |
|
| 215 | 215 | 'langs'=>'partnership', |
| 216 | 216 | // List of tables we want to see into dictonnary editor |
| 217 | 217 | 'tabname'=>array("c_partnership_type"), |
@@ -249,12 +249,12 @@ discard block |
||
| 249 | 249 | // Cronjobs (List of cron jobs entries to add when module is enabled) |
| 250 | 250 | // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week |
| 251 | 251 | |
| 252 | - $arraydate=dol_getdate(dol_now()); |
|
| 253 | - $datestart=dol_mktime(21, 15, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); |
|
| 252 | + $arraydate = dol_getdate(dol_now()); |
|
| 253 | + $datestart = dol_mktime(21, 15, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); |
|
| 254 | 254 | |
| 255 | 255 | $this->cronjobs = array( |
| 256 | - 0 => array('priority'=>60, 'label'=>'CancelPartnershipForExpiredMembers', 'jobtype'=>'method', 'class'=>'/partnership/class/partnershiputils.class.php', 'objectname'=>'PartnershipUtils', 'method'=>'doCancelStatusOfMemberPartnership', 'parameters'=>'', 'comment'=>'Cancel status of partnership when subscription is expired + x days.', 'frequency'=>1, 'unitfrequency'=>86400, 'status'=>1, 'test'=>'isModEnabled("partnership")', 'datestart'=>$datestart), |
|
| 257 | - 1 => array('priority'=>61, 'label'=>'PartnershipCheckBacklink', 'jobtype'=>'method', 'class'=>'/partnership/class/partnershiputils.class.php', 'objectname'=>'PartnershipUtils', 'method'=>'doWarningOfPartnershipIfDolibarrBacklinkNotfound', 'parameters'=>'', 'comment'=>'Add a warning on partnership record if the backlink keyword is not found on the partner website.', 'frequency'=>1, 'unitfrequency'=>86400, 'status'=>0, 'test'=>'isModEnabled("partnership")', 'datestart'=>$datestart), |
|
| 256 | + 0 => array('priority'=>60, 'label'=>'CancelPartnershipForExpiredMembers', 'jobtype'=>'method', 'class'=>'/partnership/class/partnershiputils.class.php', 'objectname'=>'PartnershipUtils', 'method'=>'doCancelStatusOfMemberPartnership', 'parameters'=>'', 'comment'=>'Cancel status of partnership when subscription is expired + x days.', 'frequency'=>1, 'unitfrequency'=>86400, 'status'=>1, 'test'=>'isModEnabled("partnership")', 'datestart'=>$datestart), |
|
| 257 | + 1 => array('priority'=>61, 'label'=>'PartnershipCheckBacklink', 'jobtype'=>'method', 'class'=>'/partnership/class/partnershiputils.class.php', 'objectname'=>'PartnershipUtils', 'method'=>'doWarningOfPartnershipIfDolibarrBacklinkNotfound', 'parameters'=>'', 'comment'=>'Add a warning on partnership record if the backlink keyword is not found on the partner website.', 'frequency'=>1, 'unitfrequency'=>86400, 'status'=>0, 'test'=>'isModEnabled("partnership")', 'datestart'=>$datestart), |
|
| 258 | 258 | ); |
| 259 | 259 | |
| 260 | 260 | // Permissions provided by this module |
@@ -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); |