@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | public $result; |
| 152 | 152 | |
| 153 | 153 | public $posxref; |
| 154 | - public $posxpicture; // For picture |
|
| 155 | - public $posxdesc; // For description |
|
| 154 | + public $posxpicture; // For picture |
|
| 155 | + public $posxdesc; // For description |
|
| 156 | 156 | public $posxqty; |
| 157 | 157 | public $posxpuht; |
| 158 | 158 | public $posxtva; |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | 'myuser_email'=>$user->email, |
| 205 | 205 | 'myuser_logo'=>$logotouse, |
| 206 | 206 | 'myuser_job'=>$user->job, |
| 207 | - 'myuser_web'=>'', // url not exist in $user object |
|
| 207 | + 'myuser_web'=>'', // url not exist in $user object |
|
| 208 | 208 | 'myuser_birth'=>dol_print_date($user->birth, 'day', 'gmt'), |
| 209 | 209 | 'myuser_dateemployment'=>dol_print_date($user->dateemployment, 'day', 'tzuser'), |
| 210 | 210 | 'myuser_dateemploymentend'=>dol_print_date($user->dateemploymentend, 'day', 'tzuser'), |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | if (get_class($object) == 'CommandeFournisseur') { |
| 522 | 522 | /* @var $object CommandeFournisseur*/ |
| 523 | - $object->date_validation = $object->date_valid; |
|
| 523 | + $object->date_validation = $object->date_valid; |
|
| 524 | 524 | $object->date_commande = $object->date; |
| 525 | 525 | } |
| 526 | 526 | $resarray = array( |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | $resarray[$array_key.'_bank_bic'] = (empty($bank_account) ? '' : $bank_account->bic); |
| 607 | 607 | $resarray[$array_key.'_bank_label'] = (empty($bank_account) ? '' : $bank_account->label); |
| 608 | 608 | $resarray[$array_key.'_bank_number'] = (empty($bank_account) ? '' : $bank_account->number); |
| 609 | - $resarray[$array_key.'_bank_proprio'] =(empty($bank_account) ? '' : $bank_account->proprio); |
|
| 609 | + $resarray[$array_key.'_bank_proprio'] = (empty($bank_account) ? '' : $bank_account->proprio); |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Propal', 'Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) { |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | $resarray[$array_key.'_project_date_start'] = dol_print_date($object->project->date_start, 'day'); |
| 630 | 630 | $resarray[$array_key.'_project_date_end'] = dol_print_date($object->project->date_end, 'day'); |
| 631 | 631 | } else { // empty replacement |
| 632 | - $resarray[$array_key.'_project_ref'] =''; |
|
| 632 | + $resarray[$array_key.'_project_ref'] = ''; |
|
| 633 | 633 | $resarray[$array_key.'_project_title'] = ''; |
| 634 | 634 | $resarray[$array_key.'_project_description'] = ''; |
| 635 | 635 | $resarray[$array_key.'_project_date_start'] = ''; |
@@ -1461,7 +1461,7 @@ discard block |
||
| 1461 | 1461 | |
| 1462 | 1462 | if (!empty($fields)) { |
| 1463 | 1463 | // Sort extrafields by rank |
| 1464 | - uasort($fields, function ($a, $b) { |
|
| 1464 | + uasort($fields, function($a, $b) { |
|
| 1465 | 1465 | return ($a->rank > $b->rank) ? 1 : -1; |
| 1466 | 1466 | }); |
| 1467 | 1467 | |
@@ -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); |