Update emailcollector.class.php

This commit is contained in:
UT from dolibit 2022-09-13 19:59:07 +02:00 committed by GitHub
parent 3869354a17
commit 0d20f332d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,37 +16,38 @@
*/ */
/** /**
* \file emailcollector/class/emailcollector.class.php * \file htdocs/emailcollector/class/emailcollector.class.php
* \ingroup emailcollector * \ingroup emailcollector
* \brief This file is a CRUD class file for EmailCollector (Create/Read/Update/Delete) * \brief This file is a CRUD class file for EmailCollector (Create/Read/Update/Delete)
*/ */
// Put here all includes required by your class file // Put here all includes required by your class file
include_once DOL_DOCUMENT_ROOT .'/emailcollector/lib/emailcollector.lib.php';
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; // customer proposal require_once DOL_DOCUMENT_ROOT .'/comm/propal/class/propal.class.php'; // Customer Proposal
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; // customer order require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php'; // Customer Order
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; // Shipment require_once DOL_DOCUMENT_ROOT .'/compta/facture/class/facture.class.php'; // Customer Invoice
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // supplier invoice require_once DOL_DOCUMENT_ROOT .'/contact/class/contact.class.php'; // Contact / Address
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // supplier order require_once DOL_DOCUMENT_ROOT .'/expedition/class/expedition.class.php'; // Shipping / Delivery
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // supplier proposal require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.commande.class.php'; // Supplier Order
require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; // reception require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.facture.class.php'; // Supplier Invoice
include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php'; require_once DOL_DOCUMENT_ROOT .'/projet/class/project.class.php'; // Project
require_once DOL_DOCUMENT_ROOT .'/reception/class/reception.class.php'; // Reception
require_once DOL_DOCUMENT_ROOT .'/recruitment/class/recruitmentcandidature.class.php'; // Recruiting
require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php'; // Third-Party
require_once DOL_DOCUMENT_ROOT .'/supplier_proposal/class/supplier_proposal.class.php'; // Supplier Proposal
require_once DOL_DOCUMENT_ROOT .'/ticket/class/ticket.class.php'; // Ticket
//require_once DOL_DOCUMENT_ROOT .'/expensereport/class/expensereport.class.php'; // Expense Report
//require_once DOL_DOCUMENT_ROOT .'/holiday/class/holiday.class.php'; // Holidays (leave request) //require_once DOL_DOCUMENT_ROOT .'/holiday/class/holiday.class.php'; // Holidays (leave request)
//require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; // expernse repor
// use Webklex\PHPIMAP; // use Webklex\PHPIMAP;
require DOL_DOCUMENT_ROOT .'/includes/webklex/php-imap/vendor/autoload.php'; require DOL_DOCUMENT_ROOT .'/includes/webklex/php-imap/vendor/autoload.php';
use Webklex\PHPIMAP\ClientManager;
use Webklex\PHPIMAP\ClientManager;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException; use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\InvalidWhereQueryCriteriaException; use Webklex\PHPIMAP\Exceptions\InvalidWhereQueryCriteriaException;
use Webklex\PHPIMAP\Exceptions\GetMessagesFailedException; use Webklex\PHPIMAP\Exceptions\GetMessagesFailedException;
@ -64,14 +65,17 @@ class EmailCollector extends CommonObject
* @var string ID to identify managed object * @var string ID to identify managed object
*/ */
public $element = 'emailcollector'; public $element = 'emailcollector';
/** /**
* @var string Name of table without prefix where object is stored * @var string Name of table without prefix where object is stored
*/ */
public $table_element = 'emailcollector_emailcollector'; public $table_element = 'emailcollector_emailcollector';
/** /**
* @var int Does emailcollector support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int Does emailcollector support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/ */
public $ismultientitymanaged = 1; public $ismultientitymanaged = 1;
/** /**
* @var int Does emailcollector support extrafields ? 0=No, 1=Yes * @var int Does emailcollector support extrafields ? 0=No, 1=Yes
*/ */
@ -91,6 +95,7 @@ class EmailCollector extends CommonObject
* @var array List of child tables. To test if we can delete object. * @var array List of child tables. To test if we can delete object.
*/ */
protected $childtables = array(); protected $childtables = array();
/** /**
* @var array List of child tables. To know object to delete on cascade. * @var array List of child tables. To know object to delete on cascade.
*/ */
@ -206,7 +211,6 @@ class EmailCollector extends CommonObject
*/ */
public $import_key; public $import_key;
public $host; public $host;
public $port; public $port;
public $hostcharset; public $hostcharset;
@ -1738,61 +1742,61 @@ class EmailCollector extends CommonObject
$objectid = $reg[2]; $objectid = $reg[2];
// See also list into interface_50_modAgenda_ActionsAuto // See also list into interface_50_modAgenda_ActionsAuto
if ($reg[1] == 'thi') { if ($reg[1] == 'thi') { // Third-party
$objectemail = new Societe($this->db); $objectemail = new Societe($this->db);
} }
if ($reg[1] == 'ctc') { if ($reg[1] == 'ctc') { // Contact
$objectemail = new Contact($this->db); $objectemail = new Contact($this->db);
} }
if ($reg[1] == 'inv') { // customer invoices if ($reg[1] == 'inv') { // Customer Invoice
$objectemail = new Facture($this->db); $objectemail = new Facture($this->db);
} }
if ($reg[1] == 'sinv') { // supplier invoices if ($reg[1] == 'sinv') { // Supplier Invoice
$objectemail = new FactureFournisseur($this->db); $objectemail = new FactureFournisseur($this->db);
} }
if ($reg[1] == 'pro') { // customer proposals if ($reg[1] == 'pro') { // Customer Proposal
$objectemail = new Propal($this->db); $objectemail = new Propal($this->db);
} }
if ($reg[1] == 'ord') { // customer orders if ($reg[1] == 'ord') { // Customer Order
$objectemail = new Commande($this->db); $objectemail = new Commande($this->db);
} }
if ($reg[1] == 'shi') { // shipments if ($reg[1] == 'shi') { // Shipment
$objectemail = new Expedition($this->db); $objectemail = new Expedition($this->db);
} }
if ($reg[1] == 'spro') { // supplier proposal if ($reg[1] == 'spro') { // Supplier Proposal
$objectemail = new SupplierProposal($this->db); $objectemail = new SupplierProposal($this->db);
} }
if ($reg[1] == 'sord') { // supplier order if ($reg[1] == 'sord') { // Supplier Order
$objectemail = new CommandeFournisseur($this->db); $objectemail = new CommandeFournisseur($this->db);
} }
if ($reg[1] == 'rec') { // Reception if ($reg[1] == 'rec') { // Reception
$objectemail = new Reception($this->db); $objectemail = new Reception($this->db);
} }
if ($reg[1] == 'proj') { if ($reg[1] == 'proj') { // Project
$objectemail = new Project($this->db); $objectemail = new Project($this->db);
} }
if ($reg[1] == 'tas') { if ($reg[1] == 'tas') { // Task
$objectemail = new Task($this->db); $objectemail = new Task($this->db);
} }
if ($reg[1] == 'con') { if ($reg[1] == 'con') { // Contact
$objectemail = new Contact($this->db); $objectemail = new Contact($this->db);
} }
if ($reg[1] == 'use') { if ($reg[1] == 'use') { // User
$objectemail = new User($this->db); $objectemail = new User($this->db);
} }
if ($reg[1] == 'tic') { if ($reg[1] == 'tic') { // Ticket
$objectemail = new Ticket($this->db); $objectemail = new Ticket($this->db);
} }
if ($reg[1] == 'recruitmentcandidature') { if ($reg[1] == 'recruitmentcandidature') { // Recruiting Candidate
$objectemail = new RecruitmentCandidature($this->db); $objectemail = new RecruitmentCandidature($this->db);
} }
if ($reg[1] == 'mem') { if ($reg[1] == 'mem') { // Member
$objectemail = new Adherent($this->db); $objectemail = new Adherent($this->db);
} }
/*if ($reg[1] == 'leav') { /*if ($reg[1] == 'leav') { // Leave / Holiday
$objectemail = new Holiday($db); $objectemail = new Holiday($db);
} }
if ($reg[1] == 'exp') { if ($reg[1] == 'exp') { // ExpenseReport
$objectemail = new ExpenseReport($db); $objectemail = new ExpenseReport($db);
}*/ }*/
} elseif (preg_match('/<(.*@.*)>/', $reference, $reg)) { } elseif (preg_match('/<(.*@.*)>/', $reference, $reg)) {
@ -2875,6 +2879,7 @@ class EmailCollector extends CommonObject
2.2.1 text/plain 2.2.1 text/plain
2.2.2 text/html 2.2.2 text/html
*/ */
/** /**
* Sub function for getpart(). Only called by createPartArray() and itself. * Sub function for getpart(). Only called by createPartArray() and itself.
* *