Completed
Branch develop (8f3b65)
by
unknown
27:06
created
htdocs/commande/class/orderline.class.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  */
38 38
 
39 39
 require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
40
-require_once DOL_DOCUMENT_ROOT.'/core/class/commonorder.class.php';		// Because the CommonOrderLine is still in commonorder.class.php file
40
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonorder.class.php'; // Because the CommonOrderLine is still in commonorder.class.php file
41 41
 require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
42 42
 
43 43
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 			$objp = $this->db->fetch_object($result);
222 222
 
223 223
 			if (!$objp) {
224
-				$this->error = 'OrderLine with id '. $rowid .' not found sql='.$sql;
224
+				$this->error = 'OrderLine with id '.$rowid.' not found sql='.$sql;
225 225
 				return 0;
226 226
 			}
227 227
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 			$this->product_desc     = $objp->product_desc;
267 267
 			$this->product_tobatch  = $objp->product_tobatch;
268 268
 			$this->fk_unit          = $objp->fk_unit;
269
-			$this->packaging      	= $objp->packaging;
269
+			$this->packaging = $objp->packaging;
270 270
 
271 271
 			$this->date_start       = $this->db->jdate($objp->date_start);
272 272
 			$this->date_end         = $this->db->jdate($objp->date_end);
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
 		// check if order line is not in a shipment line before deleting
312 312
 		$sqlCheckShipmentLine = "SELECT";
313 313
 		$sqlCheckShipmentLine .= " ed.rowid";
314
-		$sqlCheckShipmentLine .= " FROM " . MAIN_DB_PREFIX . "expeditiondet ed";
315
-		$sqlCheckShipmentLine .= " WHERE ed.fk_elementdet = " . ((int) $this->id);
314
+		$sqlCheckShipmentLine .= " FROM ".MAIN_DB_PREFIX."expeditiondet ed";
315
+		$sqlCheckShipmentLine .= " WHERE ed.fk_elementdet = ".((int) $this->id);
316 316
 
317 317
 		$resqlCheckShipmentLine = $this->db->query($sqlCheckShipmentLine);
318 318
 		if (!$resqlCheckShipmentLine) {
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
 			if ($num > 0) {
326 326
 				$error++;
327 327
 				$objCheckShipmentLine = $this->db->fetch_object($resqlCheckShipmentLine);
328
-				$this->error = $langs->trans('ErrorRecordAlreadyExists') . ' : ' . $langs->trans('ShipmentLine') . ' ' . $objCheckShipmentLine->rowid;
328
+				$this->error = $langs->trans('ErrorRecordAlreadyExists').' : '.$langs->trans('ShipmentLine').' '.$objCheckShipmentLine->rowid;
329 329
 				$this->errors[] = $this->error;
330 330
 			}
331 331
 			$this->db->free($resqlCheckShipmentLine);
332 332
 		}
333 333
 		if ($error) {
334
-			dol_syslog(__METHOD__ . 'Error ; ' . $this->error, LOG_ERR);
334
+			dol_syslog(__METHOD__.'Error ; '.$this->error, LOG_ERR);
335 335
 			return -1;
336 336
 		}
337 337
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 		}
348 348
 
349 349
 		if (!$error) {
350
-			$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . "commandedet WHERE rowid = " . ((int) $this->id);
350
+			$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid = ".((int) $this->id);
351 351
 
352 352
 			dol_syslog("OrderLine::delete", LOG_DEBUG);
353 353
 			$resql = $this->db->query($sql);
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 			$result = $this->deleteExtraFields();
363 363
 			if ($result < 0) {
364 364
 				$error++;
365
-				dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR);
365
+				dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
366 366
 			}
367 367
 		}
368 368
 
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
 		}
373 373
 
374 374
 		foreach ($this->errors as $errmsg) {
375
-			dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
376
-			$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
375
+			dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
376
+			$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
377 377
 		}
378 378
 		$this->db->rollback();
379 379
 		return -1 * $error;
Please login to merge, or discard this patch.
htdocs/emailcollector/class/emailcollector.class.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
  */
25 25
 
26 26
 // Put here all includes required by your class file
27
-include_once DOL_DOCUMENT_ROOT .'/emailcollector/lib/emailcollector.lib.php';
28
-
29
-require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
30
-require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
31
-require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
32
-
33
-require_once DOL_DOCUMENT_ROOT .'/comm/propal/class/propal.class.php';                   // Customer Proposal
34
-require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php';                    // Sale Order
35
-require_once DOL_DOCUMENT_ROOT .'/compta/facture/class/facture.class.php';               // Customer Invoice
36
-require_once DOL_DOCUMENT_ROOT .'/contact/class/contact.class.php';                      // Contact / Address
37
-require_once DOL_DOCUMENT_ROOT .'/expedition/class/expedition.class.php';                // Shipping / Delivery
38
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.commande.class.php';           // Purchase Order
39
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.facture.class.php';            // Purchase Invoice
40
-require_once DOL_DOCUMENT_ROOT .'/projet/class/project.class.php';                       // Project
41
-require_once DOL_DOCUMENT_ROOT .'/reception/class/reception.class.php';                  // Reception
42
-require_once DOL_DOCUMENT_ROOT .'/recruitment/class/recruitmentcandidature.class.php';   // Recruiting
43
-require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php';                      // Third-Party
44
-require_once DOL_DOCUMENT_ROOT .'/supplier_proposal/class/supplier_proposal.class.php';  // Supplier Proposal
45
-require_once DOL_DOCUMENT_ROOT .'/ticket/class/ticket.class.php';                        // Ticket
27
+include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
28
+
29
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
30
+require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
31
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
32
+
33
+require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; // Customer Proposal
34
+require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; // Sale Order
35
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Customer Invoice
36
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; // Contact / Address
37
+require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; // Shipping / Delivery
38
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // Purchase Order
39
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // Purchase Invoice
40
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Project
41
+require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; // Reception
42
+require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; // Recruiting
43
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; // Third-Party
44
+require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // Supplier Proposal
45
+require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; // Ticket
46 46
 //require_once DOL_DOCUMENT_ROOT .'/expensereport/class/expensereport.class.php';        // Expense Report
47 47
 //require_once DOL_DOCUMENT_ROOT .'/holiday/class/holiday.class.php';                    // Holidays (leave request)
48 48
 
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		} elseif (empty($this->imap_encryption) || ($this->imap_encryption == 'ssl' && getDolGlobalString('IMAP_FORCE_NOSSL'))) {
835 835
 			$flags .= '';
836 836
 		} else {
837
-			$flags .= '/' . $this->imap_encryption;
837
+			$flags .= '/'.$this->imap_encryption;
838 838
 		}
839 839
 
840 840
 		$flags .= '/novalidate-cert';
@@ -864,9 +864,9 @@  discard block
 block discarded – undo
864 864
 	{
865 865
 		if (function_exists('mb_convert_encoding')) {
866 866
 			// change spaces by entropy because mb_convert fail with spaces
867
-			$str = preg_replace("/ /", "xxxSPACExxx", $str);		// the replacement string must be valid in utf7 so _ can't be used
867
+			$str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used
868 868
 			$str = preg_replace("/_/", "xxxUNDERSCORExxx", $str); // encode underscore to avoid encoding issues with mb_convert
869
-			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str);	// the replacement string must be valid in utf7 so _ can't be used
869
+			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used
870 870
 			// if mb_convert work
871 871
 			if ($str = mb_convert_encoding($str, "UTF-7")) {
872 872
 				// change characters
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
 				}
1489 1489
 				if ($fromdate > 0) {
1490 1490
 					// $search .= ($search ? ' ' : '').'SINCE '.date('j-M-Y', $fromdate - 1); // SENTSINCE not supported. Date must be X-Abc-9999 (X on 1 digit if < 10)
1491
-					array_push($criteria, array("SINCE" => date('j-M-Y', $fromdate - 1)));	// -1 is to add a security to no forgot some email
1491
+					array_push($criteria, array("SINCE" => date('j-M-Y', $fromdate - 1))); // -1 is to add a security to no forgot some email
1492 1492
 				}
1493 1493
 				//$search.=($search?' ':'').'SINCE 8-Apr-2022';
1494 1494
 			}
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
 				}
1516 1516
 
1517 1517
 				if ($rule['type'] == 'from') {
1518
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1518
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1519 1519
 					if (count($tmprulevaluearray) >= 2) {
1520 1520
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1521 1521
 							$search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
 					}
1526 1526
 				}
1527 1527
 				if ($rule['type'] == 'to') {
1528
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1528
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1529 1529
 					if (count($tmprulevaluearray) >= 2) {
1530 1530
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1531 1531
 							$search .= ($search ? ' ' : '').$not.'TO "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1654,7 +1654,7 @@  discard block
 block discarded – undo
1654 1654
 					$tmpsourcedir = $this->getEncodedUtf7($sourcedir);
1655 1655
 				}
1656 1656
 
1657
-				$f = $client->getFolders(false, $tmpsourcedir);	// Note the search of directory do a search on sourcedir*
1657
+				$f = $client->getFolders(false, $tmpsourcedir); // Note the search of directory do a search on sourcedir*
1658 1658
 				if ($f) {
1659 1659
 					$folder = $f[0];
1660 1660
 					if ($folder instanceof Webklex\PHPIMAP\Folder) {
@@ -1692,7 +1692,7 @@  discard block
 block discarded – undo
1692 1692
 					$Query->leaveUnread();
1693 1693
 				}
1694 1694
 				$arrayofemail = $Query->limit($this->maxemailpercollect)->setFetchOrder("asc")->get();
1695
-				dol_syslog("EmailCollector::doCollectOneCollector nb arrayofemail ".(is_array($arrayofemail) ? count($arrayofemail) : 'Not array'));	// @phpstan-ignore-line
1695
+				dol_syslog("EmailCollector::doCollectOneCollector nb arrayofemail ".(is_array($arrayofemail) ? count($arrayofemail) : 'Not array')); // @phpstan-ignore-line
1696 1696
 				//var_dump($arrayofemail);
1697 1697
 			} catch (Exception $e) {
1698 1698
 				$this->error = $e->getMessage();
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
 			}
1716 1716
 		}
1717 1717
 
1718
-		$arrayofemailtodelete = array();	// Track email to delete to make the deletion at end.
1718
+		$arrayofemailtodelete = array(); // Track email to delete to make the deletion at end.
1719 1719
 
1720 1720
 		// Loop on each email found
1721 1721
 		if (!$error && !empty($arrayofemail) && count($arrayofemail) > 0 && $connection !== false) {
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
 				// GET header and overview datas
1748 1748
 				if (getDolGlobalString('MAIN_IMAP_USE_PHPIMAP')) {
1749 1749
 					'@phan-var-force Webklex\PHPIMAP\Message $imapemail';
1750
-					$header = $imapemail->getHeader()->raw;  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
1750
+					$header = $imapemail->getHeader()->raw; // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
1751 1751
 					$overview = $imapemail->getAttributes();
1752 1752
 				} else {
1753 1753
 					$header = imap_fetchheader($connection, $imapemail, FT_UID);
@@ -1944,7 +1944,7 @@  discard block
 block discarded – undo
1944 1944
 
1945 1945
 
1946 1946
 				if (getDolGlobalString('MAIN_IMAP_USE_PHPIMAP')) {
1947
-					$dateformated = dol_print_date($overview['date'], 'dayrfc', 'gmt');		// May generate a warning "dol_print_date($overview['date'], 'dayrfc', 'gmt')" in log
1947
+					$dateformated = dol_print_date($overview['date'], 'dayrfc', 'gmt'); // May generate a warning "dol_print_date($overview['date'], 'dayrfc', 'gmt')" in log
1948 1948
 					dol_syslog("msgid=".$overview['message_id']." date=".$dateformated." from=".$overview['from']." to=".$overview['to']." subject=".$overview['subject']);
1949 1949
 
1950 1950
 					// Removed emojis
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 						$attachments = [];
1978 1978
 					}
1979 1979
 				} else {
1980
-					$this->getmsg($connection, $imapemail);	// This set global var $charset, $htmlmsg, $plainmsg, $attachments
1980
+					$this->getmsg($connection, $imapemail); // This set global var $charset, $htmlmsg, $plainmsg, $attachments
1981 1981
 				}
1982 1982
 				'@phan-var-force Webklex\PHPIMAP\Attachment[] $attachments';
1983 1983
 
@@ -2074,10 +2074,10 @@  discard block
 block discarded – undo
2074 2074
 					$sendtocc = empty($overview['cc']) ? '' : $overview['cc'];
2075 2075
 					$sendtobcc = empty($overview['bcc']) ? '' : $overview['bcc'];
2076 2076
 
2077
-					$tmpdate = $overview['date']->toDate();  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
2078
-					$tmptimezone = $tmpdate->getTimezone()->getName();  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
2077
+					$tmpdate = $overview['date']->toDate(); // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
2078
+					$tmptimezone = $tmpdate->getTimezone()->getName(); // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
2079 2079
 
2080
-					$dateemail = dol_stringtotime((string) $overview['date'], 'gmt');    // if $overview['timezone'] is "+00:00"
2080
+					$dateemail = dol_stringtotime((string) $overview['date'], 'gmt'); // if $overview['timezone'] is "+00:00"
2081 2081
 					if (preg_match('/^([+\-])(\d\d):(\d\d)/', $tmptimezone, $reg)) {
2082 2082
 						if ($reg[1] == '+' && ($reg[2] != '00' || $reg[3] != '00')) {
2083 2083
 							$dateemail -= (3600 * (int) $reg[2]);
@@ -2091,7 +2091,7 @@  discard block
 block discarded – undo
2091 2091
 					$subject = $overview['subject'];
2092 2092
 				} else {
2093 2093
 					$fromstring = $overview[0]->from;
2094
-					$replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : "")) ;
2094
+					$replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : ""));
2095 2095
 
2096 2096
 					$sender = !empty($overview[0]->sender) ? $overview[0]->sender : '';
2097 2097
 					$to = $overview[0]->to;
@@ -2164,17 +2164,17 @@  discard block
 block discarded – undo
2164 2164
 				foreach ($arrayofreferences as $reference) {
2165 2165
 					//print "Process mail ".$iforemailloop." email_msgid ".$msgid.", date ".dol_print_date($dateemail, 'dayhour', 'gmt').", subject ".$subject.", reference ".dol_escape_htmltag($reference)."<br>\n";
2166 2166
 					if (!empty($trackidfoundintorecipienttype)) {
2167
-						$resultsearchtrackid = -1;		// trackid found
2167
+						$resultsearchtrackid = -1; // trackid found
2168 2168
 						$reg[1] = $trackidfoundintorecipienttype;
2169 2169
 						$reg[2] = $trackidfoundintorecipientid;
2170 2170
 					} elseif (!empty($trackidfoundintomsgidtype)) {
2171
-						$resultsearchtrackid = -1;		// trackid found
2171
+						$resultsearchtrackid = -1; // trackid found
2172 2172
 						$reg[1] = $trackidfoundintomsgidtype;
2173 2173
 						$reg[2] = $trackidfoundintomsgidid;
2174 2174
 					} else {
2175
-						$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg);	// trackid found or not
2175
+						$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg); // trackid found or not
2176 2176
 						if (empty($resultsearchtrackid) && getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE')) {
2177
-							$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg);	// trackid found
2177
+							$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg); // trackid found
2178 2178
 						}
2179 2179
 					}
2180 2180
 
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
 								}
2343 2343
 								if ($changeonticket_references) {
2344 2344
 									$operationslog .= '<br>We complete ticket ID='.$ticketid.' with property origin_references='.$objectemail->origin_references;
2345
-									$objectemail->update($user, 1);		// We complete the references field with all references mentioned into this email. This field is for technical tracking purpose, not a user field, so no need to execute triggers
2345
+									$objectemail->update($user, 1); // We complete the references field with all references mentioned into this email. This field is for technical tracking purpose, not a user field, so no need to execute triggers
2346 2346
 								}
2347 2347
 							}
2348 2348
 						}
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
 
2473 2473
 						// Make Operation
2474 2474
 						dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id);
2475
-						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type);	// If a Dolibarr tracker id is found, we should now the id of object
2475
+						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object
2476 2476
 
2477 2477
 						// Try to guess if this is an email in or out.
2478 2478
 						$actioncode = 'EMAIL_IN';
@@ -2530,7 +2530,7 @@  discard block
 block discarded – undo
2530 2530
 									$operationslog .= '<br>Ticket not found using trackid='.$trackid.' or msgid='.$msgid;
2531 2531
 									$ticketalreadyexists = 0;
2532 2532
 								} else {
2533
-									$operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid.", we replace operation 'ticket' with 'recordevent' to add a new message";	// We change the operation type to do
2533
+									$operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid.", we replace operation 'ticket' with 'recordevent' to add a new message"; // We change the operation type to do
2534 2534
 									$ticketalreadyexists = 1;
2535 2535
 									$operation['type'] = 'recordevent';
2536 2536
 								}
@@ -2776,11 +2776,11 @@  discard block
 block discarded – undo
2776 2776
 									$result = $contactstatic->fetch(0, null, '', $from);
2777 2777
 									if ($result < 0) {
2778 2778
 										$errorforactions++;
2779
-										$this->error = 'Error when getting contact with email ' . $from;
2779
+										$this->error = 'Error when getting contact with email '.$from;
2780 2780
 										$this->errors[] = $this->error;
2781 2781
 										break;
2782 2782
 									} elseif ($result == 0) {
2783
-										dol_syslog("Contact with email " . $from . " was not found. We try to create it.");
2783
+										dol_syslog("Contact with email ".$from." was not found. We try to create it.");
2784 2784
 										$contactstatic = new Contact($this->db);
2785 2785
 
2786 2786
 										// Create contact
@@ -2795,28 +2795,28 @@  discard block
 block discarded – undo
2795 2795
 										} else {
2796 2796
 											// Search country by name or code
2797 2797
 											if (!empty($contactstatic->country)) {
2798
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2798
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2799 2799
 												$result = getCountry('', '3', $this->db, null, 1, $contactstatic->country);
2800 2800
 												if ($result == 'NotDefined') {
2801 2801
 													$errorforactions++;
2802
-													$this->error = "Error country not found by this name '" . $contactstatic->country . "'";
2802
+													$this->error = "Error country not found by this name '".$contactstatic->country."'";
2803 2803
 												} elseif (!($result > 0)) {
2804 2804
 													$errorforactions++;
2805
-													$this->error = "Error when search country by this name '" . $contactstatic->country . "'";
2805
+													$this->error = "Error when search country by this name '".$contactstatic->country."'";
2806 2806
 													$this->errors[] = $this->db->lasterror();
2807 2807
 												} else {
2808 2808
 													$contactstatic->country_id = $result;
2809 2809
 													$operationslog .= '<br>We set property country_id='.dol_escape_htmltag($result);
2810 2810
 												}
2811 2811
 											} elseif (!empty($contactstatic->country_code)) {
2812
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2812
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2813 2813
 												$result = getCountry($contactstatic->country_code, '3', $this->db);
2814 2814
 												if ($result == 'NotDefined') {
2815 2815
 													$errorforactions++;
2816
-													$this->error = "Error country not found by this code '" . $contactstatic->country_code . "'";
2816
+													$this->error = "Error country not found by this code '".$contactstatic->country_code."'";
2817 2817
 												} elseif (!($result > 0)) {
2818 2818
 													$errorforactions++;
2819
-													$this->error = "Error when search country by this code '" . $contactstatic->country_code . "'";
2819
+													$this->error = "Error when search country by this code '".$contactstatic->country_code."'";
2820 2820
 													$this->errors[] = $this->db->lasterror();
2821 2821
 												} else {
2822 2822
 													$contactstatic->country_id = $result;
@@ -2827,28 +2827,28 @@  discard block
 block discarded – undo
2827 2827
 											if (!$errorforactions) {
2828 2828
 												// Search state by name or code (for country if defined)
2829 2829
 												if (!empty($contactstatic->state)) {
2830
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2830
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2831 2831
 													$result = dol_getIdFromCode($this->db, $contactstatic->state, 'c_departements', 'nom', 'rowid');
2832 2832
 													if (empty($result)) {
2833 2833
 														$errorforactions++;
2834
-														$this->error = "Error state not found by this name '" . $contactstatic->state . "'";
2834
+														$this->error = "Error state not found by this name '".$contactstatic->state."'";
2835 2835
 													} elseif (!($result > 0)) {
2836 2836
 														$errorforactions++;
2837
-														$this->error = "Error when search state by this name '" . $contactstatic->state . "'";
2837
+														$this->error = "Error when search state by this name '".$contactstatic->state."'";
2838 2838
 														$this->errors[] = $this->db->lasterror();
2839 2839
 													} else {
2840 2840
 														$contactstatic->state_id = $result;
2841 2841
 														$operationslog .= '<br>We set property state_id='.dol_escape_htmltag($result);
2842 2842
 													}
2843 2843
 												} elseif (!empty($contactstatic->state_code)) {
2844
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2844
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2845 2845
 													$result = dol_getIdFromCode($this->db, $contactstatic->state_code, 'c_departements', 'code_departement', 'rowid');
2846 2846
 													if (empty($result)) {
2847 2847
 														$errorforactions++;
2848
-														$this->error = "Error state not found by this code '" . $contactstatic->state_code . "'";
2848
+														$this->error = "Error state not found by this code '".$contactstatic->state_code."'";
2849 2849
 													} elseif (!($result > 0)) {
2850 2850
 														$errorforactions++;
2851
-														$this->error = "Error when search state by this code '" . $contactstatic->state_code . "'";
2851
+														$this->error = "Error when search state by this code '".$contactstatic->state_code."'";
2852 2852
 														$this->errors[] = $this->db->lasterror();
2853 2853
 													} else {
2854 2854
 														$contactstatic->state_id = $result;
@@ -2913,8 +2913,8 @@  discard block
 block discarded – undo
2913 2913
 								$actioncomm->label       = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
2914 2914
 								$actioncomm->note_private = $descriptionfull;
2915 2915
 								$actioncomm->fk_project  = $projectstatic->id;
2916
-								$actioncomm->datep       = $dateemail;	// date of email
2917
-								$actioncomm->datef       = $dateemail;	// date of email
2916
+								$actioncomm->datep       = $dateemail; // date of email
2917
+								$actioncomm->datef       = $dateemail; // date of email
2918 2918
 								$actioncomm->percentage  = -1; // Not applicable
2919 2919
 								$actioncomm->socid       = $thirdpartystatic->id;
2920 2920
 								$actioncomm->contact_id = $contactstatic->id;
@@ -3115,7 +3115,7 @@  discard block
 block discarded – undo
3115 3115
 								}
3116 3116
 								$hookmanager->initHooks(array('emailcolector'));
3117 3117
 								$parameters = array('arrayobject' => $arrayobject);
3118
-								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters);    // Note that $action and $object may have been modified by some hooks
3118
+								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks
3119 3119
 								if ($reshook > 0) {
3120 3120
 									$arrayobject = $hookmanager->resArray;
3121 3121
 								}
@@ -3124,10 +3124,10 @@  discard block
 block discarded – undo
3124 3124
 
3125 3125
 								foreach ($arrayobject as $key => $objectdesc) {
3126 3126
 									$sql = 'SELECT DISTINCT t.rowid ';
3127
-									$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->db->sanitize($objectdesc['table']) . ' AS t';
3127
+									$sql .= ' FROM '.MAIN_DB_PREFIX.$this->db->sanitize($objectdesc['table']).' AS t';
3128 3128
 									$sql .= ' WHERE ';
3129 3129
 									foreach ($objectdesc['fields'] as $field) {
3130
-										$sql .= "('" .$this->db->escape($subject) . "'  LIKE CONCAT('%',  t." . $this->db->sanitize($field) . ", '%') AND t." . $this->db->sanitize($field) . " <> '') OR ";
3130
+										$sql .= "('".$this->db->escape($subject)."'  LIKE CONCAT('%',  t.".$this->db->sanitize($field).", '%') AND t.".$this->db->sanitize($field)." <> '') OR ";
3131 3131
 									}
3132 3132
 									$sql = substr($sql, 0, -4);
3133 3133
 
@@ -3148,8 +3148,8 @@  discard block
 block discarded – undo
3148 3148
 									foreach ($ids as $val) {
3149 3149
 										$res = $objectmanaged->fetch($val);
3150 3150
 										if ($res) {
3151
-											$path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : '');
3152
-											$dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/';
3151
+											$path = ($objectmanaged->entity > 1 ? "/".$objectmanaged->entity : '');
3152
+											$dirs[] = DOL_DATA_ROOT.$path."/".$elementpath.'/'.dol_sanitizeFileName($objectmanaged->ref).'/';
3153 3153
 										} else {
3154 3154
 											$this->errors[] = 'object not found';
3155 3155
 										}
@@ -3158,7 +3158,7 @@  discard block
 block discarded – undo
3158 3158
 								foreach ($dirs as $target) {
3159 3159
 									$prefix = $this->actions[$this->id]['actionparam'];
3160 3160
 									foreach ($data as $filename => $content) {
3161
-										$resr = saveAttachment($target, $prefix . '_' . $filename, $content);
3161
+										$resr = saveAttachment($target, $prefix.'_'.$filename, $content);
3162 3162
 										if ($resr == -1) {
3163 3163
 											$this->errors[] = 'Doc not saved';
3164 3164
 										}
@@ -3205,7 +3205,7 @@  discard block
 block discarded – undo
3205 3205
 								$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent');
3206 3206
 
3207 3207
 								$projecttocreate->title = $subject;
3208
-								$projecttocreate->date_start = $dateemail;	// date of email
3208
+								$projecttocreate->date_start = $dateemail; // date of email
3209 3209
 								$projecttocreate->date_end = 0;
3210 3210
 								$projecttocreate->opp_status = $id_opp_status;
3211 3211
 								$projecttocreate->opp_percent = $percent_opp_status;
@@ -3505,7 +3505,7 @@  discard block
 block discarded – undo
3505 3505
 								$candidaturetocreate->note_private = $descriptionfull;
3506 3506
 								$candidaturetocreate->entity = $conf->entity;
3507 3507
 								$candidaturetocreate->email_msgid = $msgid;
3508
-								$candidaturetocreate->email_date = $dateemail;		// date of email
3508
+								$candidaturetocreate->email_date = $dateemail; // date of email
3509 3509
 								$candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT;
3510 3510
 								//$candidaturetocreate->fk_contact = $contactstatic->id;
3511 3511
 
@@ -3915,8 +3915,8 @@  discard block
 block discarded – undo
3915 3915
 				 * append increment number to the original filename
3916 3916
 				 */
3917 3917
 				while (file_exists($destdir.$file_name.".".$extension)) {
3918
-					$file_name = $file_name_original . ' (' . $num . ')';
3919
-					$file_name_complete = $file_name . "." . $extension;
3918
+					$file_name = $file_name_original.' ('.$num.')';
3919
+					$file_name_complete = $file_name.".".$extension;
3920 3920
 					$destination = $destdir.$file_name_complete;
3921 3921
 					$num++;
3922 3922
 				}
@@ -4030,7 +4030,7 @@  discard block
 block discarded – undo
4030 4030
 	 */
4031 4031
 	private function saveAttachment($destdir, $filename, $content)
4032 4032
 	{
4033
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
4033
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
4034 4034
 
4035 4035
 		$tmparraysize = getDefaultImageSizes();
4036 4036
 		$maxwidthsmall = $tmparraysize['maxwidthsmall'];
Please login to merge, or discard this patch.
htdocs/ticket/class/ticket.class.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
 	/**
255 255
 	 * Status
256 256
 	 */
257
-	const STATUS_NOT_READ = 0;			// Draft. Not take into account yet.
258
-	const STATUS_READ = 1;				// Ticket was read.
259
-	const STATUS_ASSIGNED = 2;			// Ticket was just assigned to someone. Not in progress yet.
260
-	const STATUS_IN_PROGRESS = 3;		// In progress
261
-	const STATUS_NEED_MORE_INFO = 5;	// Waiting requester feedback
262
-	const STATUS_WAITING = 7;			// On hold
263
-	const STATUS_CLOSED = 8;			// Closed - Solved
264
-	const STATUS_CANCELED = 9;			// Closed - Not solved
257
+	const STATUS_NOT_READ = 0; // Draft. Not take into account yet.
258
+	const STATUS_READ = 1; // Ticket was read.
259
+	const STATUS_ASSIGNED = 2; // Ticket was just assigned to someone. Not in progress yet.
260
+	const STATUS_IN_PROGRESS = 3; // In progress
261
+	const STATUS_NEED_MORE_INFO = 5; // Waiting requester feedback
262
+	const STATUS_WAITING = 7; // On hold
263
+	const STATUS_CLOSED = 8; // Closed - Solved
264
+	const STATUS_CANCELED = 9; // Closed - Not solved
265 265
 
266 266
 
267 267
 	/**
@@ -1586,9 +1586,9 @@  discard block
 block discarded – undo
1586 1586
 		}
1587 1587
 		// show categories for this record only in ajax to not overload lists
1588 1588
 		if (isModEnabled('category') && !$nofetch) {
1589
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
1589
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
1590 1590
 			$form = new Form($this->db);
1591
-			$datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_TICKET, 1);
1591
+			$datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_TICKET, 1);
1592 1592
 		}
1593 1593
 
1594 1594
 		return $datas;
@@ -1833,7 +1833,7 @@  discard block
 block discarded – undo
1833 1833
 		// Insert entry into agenda with code 'TICKET_MSG'
1834 1834
 		include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
1835 1835
 		$actioncomm = new ActionComm($this->db);
1836
-		$actioncomm->type_code = 'AC_OTH_AUTO';	// This is not an entry that must appears into manual calendar but only into CRM calendar
1836
+		$actioncomm->type_code = 'AC_OTH_AUTO'; // This is not an entry that must appears into manual calendar but only into CRM calendar
1837 1837
 		$actioncomm->code = 'TICKET_MSG';
1838 1838
 		if ($this->private) {
1839 1839
 			$actioncomm->code = 'TICKET_MSG_PRIVATE';
@@ -1847,7 +1847,7 @@  discard block
 block discarded – undo
1847 1847
 		$actioncomm->socid = $this->socid;
1848 1848
 		$actioncomm->label = $this->subject;
1849 1849
 		$actioncomm->note_private = $this->message;
1850
-		$actioncomm->userassigned = array($user->id => array('id' => $user->id,'transparency' => 0));
1850
+		$actioncomm->userassigned = array($user->id => array('id' => $user->id, 'transparency' => 0));
1851 1851
 		$actioncomm->userownerid = $user->id;
1852 1852
 		$actioncomm->datep = $now;
1853 1853
 		$actioncomm->percentage = -1; // percentage is not relevant for punctual events
@@ -2431,7 +2431,7 @@  discard block
 block discarded – undo
2431 2431
 						'email' => $obj->email,
2432 2432
 						'rowid' => (int) $obj->rowid,
2433 2433
 						'code' => $obj->code,
2434
-						'libelle' => $labelType,		// deprecated, replaced with labeltype
2434
+						'libelle' => $labelType, // deprecated, replaced with labeltype
2435 2435
 						'labeltype' => $labelType,
2436 2436
 						'status' => $obj->statuslink,
2437 2437
 						'statuscontact' => (int) $obj->statuscontact,
@@ -2518,7 +2518,7 @@  discard block
 block discarded – undo
2518 2518
 			if (is_resource($handle)) {
2519 2519
 				while (($file = readdir($handle)) !== false) {
2520 2520
 					if (!utf8_check($file)) {
2521
-						$file = mb_convert_encoding($file, 'UTF-8', 'ISO-8859-1');	// To be sure data is stored in UTF8 in memory
2521
+						$file = mb_convert_encoding($file, 'UTF-8', 'ISO-8859-1'); // To be sure data is stored in UTF8 in memory
2522 2522
 					}
2523 2523
 					if (dol_is_file($dir.$file)) {
2524 2524
 						return true;
@@ -2556,7 +2556,7 @@  discard block
 block discarded – undo
2556 2556
 		$formmail->trackid = (is_null($forcetrackid) ? 'tic'.$this->id : '');
2557 2557
 		$attachedfiles = $formmail->get_attached_files();
2558 2558
 
2559
-		$filepath = $attachedfiles['paths'];	// path is for example user->dir_temp.'/'.$user->id.'/'...
2559
+		$filepath = $attachedfiles['paths']; // path is for example user->dir_temp.'/'.$user->id.'/'...
2560 2560
 		$filename = $attachedfiles['names'];
2561 2561
 		$mimetype = $attachedfiles['mimes'];
2562 2562
 
@@ -2977,10 +2977,10 @@  discard block
 block discarded – undo
2977 2977
 
2978 2978
 								// If public interface is not enable, use link to internal page into mail
2979 2979
 								$url_public_ticket = (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE') ?
2980
-										(getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') !== '' ? getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') . '/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.urlencode($object->track_id);
2980
+										(getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') !== '' ? getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE').'/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.urlencode($object->track_id);
2981 2981
 
2982 2982
 								if (getDolGlobalInt('TICKET_INCLUDE_LINK_TO_PUBLIC_INTERFACE_IN_MESSAGE')) {
2983
-									$message .= '<br>' . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : <a href="' . $url_public_ticket . '">' . $object->track_id . '</a><br>';
2983
+									$message .= '<br>'.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : <a href="'.$url_public_ticket.'">'.$object->track_id.'</a><br>';
2984 2984
 								}
2985 2985
 
2986 2986
 								// Build final message
@@ -3025,7 +3025,7 @@  discard block
 block discarded – undo
3025 3025
 									if ($result) {
3026 3026
 										// update last_msg_sent date of ticket (for last message sent to external users)
3027 3027
 										$this->date_last_msg_sent = dol_now();
3028
-										$this->update($user, 1);	// disable trigger when updating date_last_msg_sent. sendTicketMessageByEmail already create an event in actioncomm table.
3028
+										$this->update($user, 1); // disable trigger when updating date_last_msg_sent. sendTicketMessageByEmail already create an event in actioncomm table.
3029 3029
 
3030 3030
 										// update event actioncomm $id
3031 3031
 										//print 'update actioncomm id='.$id.' with sendto='.json_encode($sendto)." sendtocc=".json_encode($sendtocc)." email_msgid=".json_encode($this->email_msgid);
Please login to merge, or discard this patch.