|
@@ -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
|
|
|
@@ -789,7 +789,7 @@ discard block |
|
|
block discarded – undo |
|
789
|
789
|
} elseif (empty($this->imap_encryption) || ($this->imap_encryption == 'ssl' && getDolGlobalString('IMAP_FORCE_NOSSL'))) { |
|
790
|
790
|
$flags .= ''; |
|
791
|
791
|
} else { |
|
792
|
|
- $flags .= '/' . $this->imap_encryption; |
|
|
792
|
+ $flags .= '/'.$this->imap_encryption; |
|
793
|
793
|
} |
|
794
|
794
|
|
|
795
|
795
|
$flags .= '/novalidate-cert'; |
|
@@ -819,8 +819,8 @@ discard block |
|
|
block discarded – undo |
|
819
|
819
|
{ |
|
820
|
820
|
if (function_exists('mb_convert_encoding')) { |
|
821
|
821
|
// change spaces by entropy because mb_convert fail with spaces |
|
822
|
|
- $str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used |
|
823
|
|
- $str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used |
|
|
822
|
+ $str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used |
|
|
823
|
+ $str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used |
|
824
|
824
|
// if mb_convert work |
|
825
|
825
|
if ($str = mb_convert_encoding($str, "UTF-7")) { |
|
826
|
826
|
// change characters |
|
@@ -1440,7 +1440,7 @@ discard block |
|
|
block discarded – undo |
|
1440
|
1440
|
} |
|
1441
|
1441
|
|
|
1442
|
1442
|
if ($rule['type'] == 'from') { |
|
1443
|
|
- $tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def' |
|
|
1443
|
+ $tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def' |
|
1444
|
1444
|
if (count($tmprulevaluearray) >= 2) { |
|
1445
|
1445
|
foreach ($tmprulevaluearray as $tmprulevalue) { |
|
1446
|
1446
|
$search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $tmprulevalue).'"'; |
|
@@ -1450,7 +1450,7 @@ discard block |
|
|
block discarded – undo |
|
1450
|
1450
|
} |
|
1451
|
1451
|
} |
|
1452
|
1452
|
if ($rule['type'] == 'to') { |
|
1453
|
|
- $tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def' |
|
|
1453
|
+ $tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def' |
|
1454
|
1454
|
if (count($tmprulevaluearray) >= 2) { |
|
1455
|
1455
|
foreach ($tmprulevaluearray as $tmprulevalue) { |
|
1456
|
1456
|
$search .= ($search ? ' ' : '').$not.'TO "'.str_replace('"', '', $tmprulevalue).'"'; |
|
@@ -1578,7 +1578,7 @@ discard block |
|
|
block discarded – undo |
|
1578
|
1578
|
$tmpsourcedir = $this->getEncodedUtf7($sourcedir); |
|
1579
|
1579
|
} |
|
1580
|
1580
|
|
|
1581
|
|
- $f = $client->getFolders(false, $tmpsourcedir); // Note the search of directory do a search on sourcedir* |
|
|
1581
|
+ $f = $client->getFolders(false, $tmpsourcedir); // Note the search of directory do a search on sourcedir* |
|
1582
|
1582
|
if ($f) { |
|
1583
|
1583
|
$folder = $f[0]; |
|
1584
|
1584
|
if ($folder instanceof Webklex\PHPIMAP\Folder) { |
|
@@ -1637,7 +1637,7 @@ discard block |
|
|
block discarded – undo |
|
1637
|
1637
|
} |
|
1638
|
1638
|
} |
|
1639
|
1639
|
|
|
1640
|
|
- $arrayofemailtodelete = array(); // Track email to delete to make the deletion at end. |
|
|
1640
|
+ $arrayofemailtodelete = array(); // Track email to delete to make the deletion at end. |
|
1641
|
1641
|
|
|
1642
|
1642
|
// Loop on each email found |
|
1643
|
1643
|
if (!$error && !empty($arrayofemail) && count($arrayofemail) > 0) { |
|
@@ -1809,7 +1809,7 @@ discard block |
|
|
block discarded – undo |
|
1809
|
1809
|
$isreplytook = 0; |
|
1810
|
1810
|
foreach ($rulesreplyto as $key => $rulereplyto) { |
|
1811
|
1811
|
if (preg_match('/'.preg_quote($rulereplyto, '/').'/', $headers['Reply-To'])) { |
|
1812
|
|
- $isreplytook ++; |
|
|
1812
|
+ $isreplytook++; |
|
1813
|
1813
|
} |
|
1814
|
1814
|
} |
|
1815
|
1815
|
|
|
@@ -1869,7 +1869,7 @@ discard block |
|
|
block discarded – undo |
|
1869
|
1869
|
$attachments = []; |
|
1870
|
1870
|
} |
|
1871
|
1871
|
} else { |
|
1872
|
|
- $this->getmsg($connection, $imapemail); // This set global var $charset, $htmlmsg, $plainmsg, $attachments |
|
|
1872
|
+ $this->getmsg($connection, $imapemail); // This set global var $charset, $htmlmsg, $plainmsg, $attachments |
|
1873
|
1873
|
} |
|
1874
|
1874
|
'@phan-var-force Webklex\PHPIMAP\Attachment[] $attachments'; |
|
1875
|
1875
|
|
|
@@ -1969,7 +1969,7 @@ discard block |
|
|
block discarded – undo |
|
1969
|
1969
|
$tmpdate = $overview['date']->toDate(); |
|
1970
|
1970
|
$tmptimezone = $tmpdate->getTimezone()->getName(); |
|
1971
|
1971
|
|
|
1972
|
|
- $dateemail = dol_stringtotime((string) $overview['date'], 'gmt'); // if $overview['timezone'] is "+00:00" |
|
|
1972
|
+ $dateemail = dol_stringtotime((string) $overview['date'], 'gmt'); // if $overview['timezone'] is "+00:00" |
|
1973
|
1973
|
if (preg_match('/^([+\-])(\d\d):(\d\d)/', $tmptimezone, $reg)) { |
|
1974
|
1974
|
if ($reg[1] == '+' && ($reg[2] != '00' || $reg[3] != '00')) { |
|
1975
|
1975
|
$dateemail -= (3600 * (int) $reg[2]); |
|
@@ -1983,7 +1983,7 @@ discard block |
|
|
block discarded – undo |
|
1983
|
1983
|
$subject = $overview['subject']; |
|
1984
|
1984
|
} else { |
|
1985
|
1985
|
$fromstring = $overview[0]->from; |
|
1986
|
|
- $replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : "")) ; |
|
|
1986
|
+ $replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : "")); |
|
1987
|
1987
|
|
|
1988
|
1988
|
$sender = !empty($overview[0]->sender) ? $overview[0]->sender : ''; |
|
1989
|
1989
|
$to = $overview[0]->to; |
|
@@ -2054,17 +2054,17 @@ discard block |
|
|
block discarded – undo |
|
2054
|
2054
|
foreach ($arrayofreferences as $reference) { |
|
2055
|
2055
|
//print "Process mail ".$iforemailloop." email_msgid ".$msgid.", date ".dol_print_date($dateemail, 'dayhour', 'gmt').", subject ".$subject.", reference ".dol_escape_htmltag($reference)."<br>\n"; |
|
2056
|
2056
|
if (!empty($trackidfoundintorecipienttype)) { |
|
2057
|
|
- $resultsearchtrackid = -1; // trackid found |
|
|
2057
|
+ $resultsearchtrackid = -1; // trackid found |
|
2058
|
2058
|
$reg[1] = $trackidfoundintorecipienttype; |
|
2059
|
2059
|
$reg[2] = $trackidfoundintorecipientid; |
|
2060
|
2060
|
} elseif (!empty($trackidfoundintomsgidtype)) { |
|
2061
|
|
- $resultsearchtrackid = -1; // trackid found |
|
|
2061
|
+ $resultsearchtrackid = -1; // trackid found |
|
2062
|
2062
|
$reg[1] = $trackidfoundintomsgidtype; |
|
2063
|
2063
|
$reg[2] = $trackidfoundintomsgidid; |
|
2064
|
2064
|
} else { |
|
2065
|
|
- $resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg); // trackid found or not |
|
|
2065
|
+ $resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg); // trackid found or not |
|
2066
|
2066
|
if (empty($resultsearchtrackid) && getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE')) { |
|
2067
|
|
- $resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg); // trackid found |
|
|
2067
|
+ $resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg); // trackid found |
|
2068
|
2068
|
} |
|
2069
|
2069
|
} |
|
2070
|
2070
|
|
|
@@ -2225,7 +2225,7 @@ discard block |
|
|
block discarded – undo |
|
2225
|
2225
|
} else { |
|
2226
|
2226
|
foreach ($arrayofreferences as $key => $referencetmp) { |
|
2227
|
2227
|
if (!str_contains($objectemail->origin_references, $referencetmp)) { |
|
2228
|
|
- $objectemail->origin_references.= " ".$referencetmp; |
|
|
2228
|
+ $objectemail->origin_references .= " ".$referencetmp; |
|
2229
|
2229
|
$changeonticket_references = true; |
|
2230
|
2230
|
} |
|
2231
|
2231
|
} |
|
@@ -2360,7 +2360,7 @@ discard block |
|
|
block discarded – undo |
|
2360
|
2360
|
|
|
2361
|
2361
|
// Make Operation |
|
2362
|
2362
|
dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id); |
|
2363
|
|
- 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 |
|
|
2363
|
+ 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 |
|
2364
|
2364
|
|
|
2365
|
2365
|
// Try to guess if this is an email in or out. |
|
2366
|
2366
|
$actioncode = 'EMAIL_IN'; |
|
@@ -2413,7 +2413,7 @@ discard block |
|
|
block discarded – undo |
|
2413
|
2413
|
$operationslog .= '<br>Ticket not found using trackid='.$trackid.' or msgid='.$msgid; |
|
2414
|
2414
|
$ticketalreadyexists = 0; |
|
2415
|
2415
|
} else { |
|
2416
|
|
- $operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid; // We change the operation type to do |
|
|
2416
|
+ $operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid; // We change the operation type to do |
|
2417
|
2417
|
$ticketalreadyexists = 1; |
|
2418
|
2418
|
$operation['type'] = 'recordevent'; |
|
2419
|
2419
|
} |
|
@@ -2650,11 +2650,11 @@ discard block |
|
|
block discarded – undo |
|
2650
|
2650
|
$result = $contactstatic->fetch(0, null, '', $from); |
|
2651
|
2651
|
if ($result < 0) { |
|
2652
|
2652
|
$errorforactions++; |
|
2653
|
|
- $this->error = 'Error when getting contact with email ' . $from; |
|
|
2653
|
+ $this->error = 'Error when getting contact with email '.$from; |
|
2654
|
2654
|
$this->errors[] = $this->error; |
|
2655
|
2655
|
break; |
|
2656
|
2656
|
} elseif ($result == 0) { |
|
2657
|
|
- dol_syslog("Contact with email " . $from . " was not found. We try to create it."); |
|
|
2657
|
+ dol_syslog("Contact with email ".$from." was not found. We try to create it."); |
|
2658
|
2658
|
$contactstatic = new Contact($this->db); |
|
2659
|
2659
|
|
|
2660
|
2660
|
// Create contact |
|
@@ -2669,28 +2669,28 @@ discard block |
|
|
block discarded – undo |
|
2669
|
2669
|
} else { |
|
2670
|
2670
|
// Search country by name or code |
|
2671
|
2671
|
if (!empty($contactstatic->country)) { |
|
2672
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
|
2672
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
|
2673
|
2673
|
$result = getCountry('', 3, $this->db, '', 1, $contactstatic->country); |
|
2674
|
2674
|
if ($result == 'NotDefined') { |
|
2675
|
2675
|
$errorforactions++; |
|
2676
|
|
- $this->error = "Error country not found by this name '" . $contactstatic->country . "'"; |
|
|
2676
|
+ $this->error = "Error country not found by this name '".$contactstatic->country."'"; |
|
2677
|
2677
|
} elseif (!($result > 0)) { |
|
2678
|
2678
|
$errorforactions++; |
|
2679
|
|
- $this->error = "Error when search country by this name '" . $contactstatic->country . "'"; |
|
|
2679
|
+ $this->error = "Error when search country by this name '".$contactstatic->country."'"; |
|
2680
|
2680
|
$this->errors[] = $this->db->lasterror(); |
|
2681
|
2681
|
} else { |
|
2682
|
2682
|
$contactstatic->country_id = $result; |
|
2683
|
2683
|
$operationslog .= '<br>We set property country_id='.dol_escape_htmltag($result); |
|
2684
|
2684
|
} |
|
2685
|
2685
|
} elseif (!empty($contactstatic->country_code)) { |
|
2686
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
|
2686
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
|
2687
|
2687
|
$result = getCountry($contactstatic->country_code, 3, $this->db); |
|
2688
|
2688
|
if ($result == 'NotDefined') { |
|
2689
|
2689
|
$errorforactions++; |
|
2690
|
|
- $this->error = "Error country not found by this code '" . $contactstatic->country_code . "'"; |
|
|
2690
|
+ $this->error = "Error country not found by this code '".$contactstatic->country_code."'"; |
|
2691
|
2691
|
} elseif (!($result > 0)) { |
|
2692
|
2692
|
$errorforactions++; |
|
2693
|
|
- $this->error = "Error when search country by this code '" . $contactstatic->country_code . "'"; |
|
|
2693
|
+ $this->error = "Error when search country by this code '".$contactstatic->country_code."'"; |
|
2694
|
2694
|
$this->errors[] = $this->db->lasterror(); |
|
2695
|
2695
|
} else { |
|
2696
|
2696
|
$contactstatic->country_id = $result; |
|
@@ -2701,28 +2701,28 @@ discard block |
|
|
block discarded – undo |
|
2701
|
2701
|
if (!$errorforactions) { |
|
2702
|
2702
|
// Search state by name or code (for country if defined) |
|
2703
|
2703
|
if (!empty($contactstatic->state)) { |
|
2704
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; |
|
|
2704
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; |
|
2705
|
2705
|
$result = dol_getIdFromCode($this->db, $contactstatic->state, 'c_departements', 'nom', 'rowid'); |
|
2706
|
2706
|
if (empty($result)) { |
|
2707
|
2707
|
$errorforactions++; |
|
2708
|
|
- $this->error = "Error state not found by this name '" . $contactstatic->state . "'"; |
|
|
2708
|
+ $this->error = "Error state not found by this name '".$contactstatic->state."'"; |
|
2709
|
2709
|
} elseif (!($result > 0)) { |
|
2710
|
2710
|
$errorforactions++; |
|
2711
|
|
- $this->error = "Error when search state by this name '" . $contactstatic->state . "'"; |
|
|
2711
|
+ $this->error = "Error when search state by this name '".$contactstatic->state."'"; |
|
2712
|
2712
|
$this->errors[] = $this->db->lasterror(); |
|
2713
|
2713
|
} else { |
|
2714
|
2714
|
$contactstatic->state_id = $result; |
|
2715
|
2715
|
$operationslog .= '<br>We set property state_id='.dol_escape_htmltag($result); |
|
2716
|
2716
|
} |
|
2717
|
2717
|
} elseif (!empty($contactstatic->state_code)) { |
|
2718
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; |
|
|
2718
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; |
|
2719
|
2719
|
$result = dol_getIdFromCode($this->db, $contactstatic->state_code, 'c_departements', 'code_departement', 'rowid'); |
|
2720
|
2720
|
if (empty($result)) { |
|
2721
|
2721
|
$errorforactions++; |
|
2722
|
|
- $this->error = "Error state not found by this code '" . $contactstatic->state_code . "'"; |
|
|
2722
|
+ $this->error = "Error state not found by this code '".$contactstatic->state_code."'"; |
|
2723
|
2723
|
} elseif (!($result > 0)) { |
|
2724
|
2724
|
$errorforactions++; |
|
2725
|
|
- $this->error = "Error when search state by this code '" . $contactstatic->state_code . "'"; |
|
|
2725
|
+ $this->error = "Error when search state by this code '".$contactstatic->state_code."'"; |
|
2726
|
2726
|
$this->errors[] = $this->db->lasterror(); |
|
2727
|
2727
|
} else { |
|
2728
|
2728
|
$contactstatic->state_id = $result; |
|
@@ -2787,8 +2787,8 @@ discard block |
|
|
block discarded – undo |
|
2787
|
2787
|
$actioncomm->label = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from; |
|
2788
|
2788
|
$actioncomm->note_private = $descriptionfull; |
|
2789
|
2789
|
$actioncomm->fk_project = $projectstatic->id; |
|
2790
|
|
- $actioncomm->datep = $dateemail; // date of email |
|
2791
|
|
- $actioncomm->datef = $dateemail; // date of email |
|
|
2790
|
+ $actioncomm->datep = $dateemail; // date of email |
|
|
2791
|
+ $actioncomm->datef = $dateemail; // date of email |
|
2792
|
2792
|
$actioncomm->percentage = -1; // Not applicable |
|
2793
|
2793
|
$actioncomm->socid = $thirdpartystatic->id; |
|
2794
|
2794
|
$actioncomm->contact_id = $contactstatic->id; |
|
@@ -2987,7 +2987,7 @@ discard block |
|
|
block discarded – undo |
|
2987
|
2987
|
} |
|
2988
|
2988
|
$hookmanager->initHooks(array('emailcolector')); |
|
2989
|
2989
|
$parameters = array('arrayobject' => $arrayobject); |
|
2990
|
|
- $reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks |
|
|
2990
|
+ $reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks |
|
2991
|
2991
|
if ($reshook > 0) { |
|
2992
|
2992
|
$arrayobject = $hookmanager->resArray; |
|
2993
|
2993
|
} |
|
@@ -2996,10 +2996,10 @@ discard block |
|
|
block discarded – undo |
|
2996
|
2996
|
|
|
2997
|
2997
|
foreach ($arrayobject as $key => $objectdesc) { |
|
2998
|
2998
|
$sql = 'SELECT DISTINCT t.rowid '; |
|
2999
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->db->sanitize($objectdesc['table']) . ' AS t'; |
|
|
2999
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.$this->db->sanitize($objectdesc['table']).' AS t'; |
|
3000
|
3000
|
$sql .= ' WHERE '; |
|
3001
|
3001
|
foreach ($objectdesc['fields'] as $field) { |
|
3002
|
|
- $sql .= "('" .$this->db->escape($subject) . "' LIKE CONCAT('%', t." . $this->db->sanitize($field) . ", '%') AND t." . $this->db->sanitize($field) . " <> '') OR "; |
|
|
3002
|
+ $sql .= "('".$this->db->escape($subject)."' LIKE CONCAT('%', t.".$this->db->sanitize($field).", '%') AND t.".$this->db->sanitize($field)." <> '') OR "; |
|
3003
|
3003
|
} |
|
3004
|
3004
|
$sql = substr($sql, 0, -4); |
|
3005
|
3005
|
|
|
@@ -3019,8 +3019,8 @@ discard block |
|
|
block discarded – undo |
|
3019
|
3019
|
foreach ($ids as $val) { |
|
3020
|
3020
|
$res = $objectmanaged->fetch($val); |
|
3021
|
3021
|
if ($res) { |
|
3022
|
|
- $path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : ''); |
|
3023
|
|
- $dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/'; |
|
|
3022
|
+ $path = ($objectmanaged->entity > 1 ? "/".$objectmanaged->entity : ''); |
|
|
3023
|
+ $dirs[] = DOL_DATA_ROOT.$path."/".$elementpath.'/'.dol_sanitizeFileName($objectmanaged->ref).'/'; |
|
3024
|
3024
|
} else { |
|
3025
|
3025
|
$this->errors[] = 'object not found'; |
|
3026
|
3026
|
} |
|
@@ -3029,7 +3029,7 @@ discard block |
|
|
block discarded – undo |
|
3029
|
3029
|
foreach ($dirs as $target) { |
|
3030
|
3030
|
$prefix = $this->actions[$this->id]['actionparam']; |
|
3031
|
3031
|
foreach ($data as $filename => $content) { |
|
3032
|
|
- $resr = saveAttachment($target, $prefix . '_' . $filename, $content); |
|
|
3032
|
+ $resr = saveAttachment($target, $prefix.'_'.$filename, $content); |
|
3033
|
3033
|
if ($resr == -1) { |
|
3034
|
3034
|
$this->errors[] = 'Doc not saved'; |
|
3035
|
3035
|
} |
|
@@ -3076,7 +3076,7 @@ discard block |
|
|
block discarded – undo |
|
3076
|
3076
|
$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent'); |
|
3077
|
3077
|
|
|
3078
|
3078
|
$projecttocreate->title = $subject; |
|
3079
|
|
- $projecttocreate->date_start = $date; // date of email |
|
|
3079
|
+ $projecttocreate->date_start = $date; // date of email |
|
3080
|
3080
|
$projecttocreate->date_end = 0; |
|
3081
|
3081
|
$projecttocreate->opp_status = $id_opp_status; |
|
3082
|
3082
|
$projecttocreate->opp_percent = $percent_opp_status; |
|
@@ -3338,7 +3338,7 @@ discard block |
|
|
block discarded – undo |
|
3338
|
3338
|
$candidaturetocreate->note_private = $descriptionfull; |
|
3339
|
3339
|
$candidaturetocreate->entity = $conf->entity; |
|
3340
|
3340
|
$candidaturetocreate->email_msgid = $msgid; |
|
3341
|
|
- $candidaturetocreate->email_date = $date; // date of email |
|
|
3341
|
+ $candidaturetocreate->email_date = $date; // date of email |
|
3342
|
3342
|
$candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT; |
|
3343
|
3343
|
//$candidaturetocreate->fk_contact = $contactstatic->id; |
|
3344
|
3344
|
|
|
@@ -3728,8 +3728,8 @@ discard block |
|
|
block discarded – undo |
|
3728
|
3728
|
* append increment number to the original filename |
|
3729
|
3729
|
*/ |
|
3730
|
3730
|
while (file_exists($destdir.$file_name.".".$extension)) { |
|
3731
|
|
- $file_name = $file_name_original . ' (' . $num . ')'; |
|
3732
|
|
- $file_name_complete = $file_name . "." . $extension; |
|
|
3731
|
+ $file_name = $file_name_original.' ('.$num.')'; |
|
|
3732
|
+ $file_name_complete = $file_name.".".$extension; |
|
3733
|
3733
|
$destination = $destdir.$file_name_complete; |
|
3734
|
3734
|
$num++; |
|
3735
|
3735
|
} |
|
@@ -3843,7 +3843,7 @@ discard block |
|
|
block discarded – undo |
|
3843
|
3843
|
*/ |
|
3844
|
3844
|
private function saveAttachment($destdir, $filename, $content) |
|
3845
|
3845
|
{ |
|
3846
|
|
- require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; |
|
|
3846
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; |
|
3847
|
3847
|
|
|
3848
|
3848
|
$tmparraysize = getDefaultImageSizes(); |
|
3849
|
3849
|
$maxwidthsmall = $tmparraysize['maxwidthsmall']; |