Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2023-05-26 11:19:08 +02:00
commit bad2b42442
10 changed files with 43 additions and 23 deletions

View File

@ -715,7 +715,7 @@ while ($i < $imaxinloop) {
// Label
if (!empty($arrayfields['t.libelle']['checked'])) {
print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($obj->note).'">';
print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($obj->note_private).'">';
print dol_escape_htmltag(dolGetFirstLineOfText($obj->note_private));
print '</td>';
if (!$i) {

View File

@ -395,9 +395,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$connectstringtarget = '';
// Note: $object->host has been loaded by the fetch
$usessl = 1;
$connectstringserver = $object->getConnectStringIMAP($usessl);
$connectstringserver = $object->getConnectStringIMAP();
if ($action == 'scan') {
if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) {

View File

@ -547,7 +547,7 @@ class Notify
break;
case 'ORDER_SUPPLIER_VALIDATE':
$link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$dir_output = $conf->fournisseur->commande->dir_output;
$dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object);
$object_type = 'order_supplier';
$mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
$mesg .= $outputlangs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $link, $user->getFullName($outputlangs));
@ -555,7 +555,7 @@ class Notify
break;
case 'ORDER_SUPPLIER_APPROVE':
$link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$dir_output = $conf->fournisseur->commande->dir_output;
$dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object);
$object_type = 'order_supplier';
$mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
$mesg .= $outputlangs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($outputlangs));
@ -563,7 +563,7 @@ class Notify
break;
case 'ORDER_SUPPLIER_REFUSE':
$link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$dir_output = $conf->fournisseur->commande->dir_output;
$dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object);
$object_type = 'order_supplier';
$mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
$mesg .= $outputlangs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $link, $user->getFullName($outputlangs));
@ -815,7 +815,7 @@ class Notify
break;
case 'ORDER_SUPPLIER_VALIDATE':
$link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$dir_output = $conf->fournisseur->commande->dir_output;
$dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object);
$object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg .= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $link, $user->getFullName($langs));
@ -823,7 +823,7 @@ class Notify
break;
case 'ORDER_SUPPLIER_APPROVE':
$link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$dir_output = $conf->fournisseur->commande->dir_output;
$dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object);
$object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg .= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($langs));
@ -831,7 +831,7 @@ class Notify
break;
case 'ORDER_SUPPLIER_APPROVE2':
$link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$dir_output = $conf->fournisseur->commande->dir_output;
$dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object);
$object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg .= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($langs));

View File

@ -13,7 +13,7 @@ if (isset($totalarray['pos'])) {
while ($i < $totalarray['nbfield']) {
$i++;
if (!empty($totalarray['pos'][$i])) {
switch ($totalarray['type'][$i]) {
switch ($totalarray['pos'][$i]) {
case 'duration';
print '<td class="right">';
print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin') : 0);

View File

@ -131,6 +131,8 @@ class EmailCollector extends CommonObject
'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com', 'csslist'=>'tdoverflowmax125'),
'port' => array('type'=>'varchar(10)', 'label'=>'EMailHostPort', 'visible'=>1, 'enabled'=>1, 'position'=>91, 'notnull'=>1, 'searchall'=>0, 'comment'=>"IMAP server port", 'help'=>'Example: 993', 'csslist'=>'tdoverflowmax50', 'default'=>'993'),
'hostcharset' => array('type'=>'varchar(16)', 'label'=>'HostCharset', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>0, 'searchall'=>0, 'comment'=>"IMAP server charset", 'help'=>'Example: "UTF-8" (May be "US-ASCII" with some Office365)', 'default'=>'UTF-8'),
'imap_encryption' => array('type'=>'varchar(16)', 'label'=>'ImapEncryption', 'visible'=>1, 'enabled'=>1, 'position'=>93, 'searchall'=>0, 'comment'=>"IMAP encryption", 'help'=>'ImapEncryptionHelp', 'arrayofkeyval'=> array('ssl'=>'SSL', 'tls' => 'TLS', 'notls' => 'NOTLS'), 'default'=>'ssl'),
'norsh' => array('type'=>'integer', 'label'=>'NoRSH', 'visible'=>1, 'enabled'=>"!getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position'=>94, 'searchall'=>0, 'help'=>'NoRSHHelp', 'arrayofkeyval'=> array(0 =>'No', 1 => 'Yes'), 'default'=> 0),
'acces_type' => array('type'=>'integer', 'label'=>'accessType', 'visible'=>-1, 'enabled'=>"getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position'=>101, 'notnull'=>1, 'index'=>1, 'comment'=>"IMAP login type", 'arrayofkeyval'=>array('0'=>'loginPassword', '1'=>'oauthToken'), 'default'=>'0', 'help'=>''),
'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'),
'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>"1", 'position'=>103, 'notnull'=>-1, 'comment'=>"IMAP password", 'help'=>'WithGMailYouCanCreateADedicatedPassword'),
@ -213,6 +215,8 @@ class EmailCollector extends CommonObject
public $password;
public $acces_type;
public $oauth_service;
public $imap_encryption;
public $norsh;
public $source_directory;
public $target_directory;
public $maxemailpercollect;
@ -775,11 +779,9 @@ class EmailCollector extends CommonObject
/**
* Return the connectstring to use with IMAP connection function
*
* @param int $ssl Add /ssl tag
* @param int $norsh Add /norsh to connectstring
* @return string
*/
public function getConnectStringIMAP($ssl = 1, $norsh = 0)
public function getConnectStringIMAP()
{
global $conf;
@ -787,15 +789,16 @@ class EmailCollector extends CommonObject
$flags = '/service=imap'; // IMAP
if (!empty($conf->global->IMAP_FORCE_TLS)) {
$flags .= '/tls';
} elseif (empty($conf->global->IMAP_FORCE_NOSSL)) {
if ($ssl) {
$flags .= '/ssl';
}
} elseif (empty($this->imap_encryption) || ($this->imap_encryption == 'ssl' && !empty($conf->global->IMAP_FORCE_NOSSL))) {
$flags .= '';
} else {
$flags .= '/' . $this->imap_encryption;
}
$flags .= '/novalidate-cert';
//$flags.='/readonly';
//$flags.='/debug';
if ($norsh || !empty($conf->global->IMAP_FORCE_NORSH)) {
if (!empty($this->norsh) || !empty($conf->global->IMAP_FORCE_NORSH)) {
$flags .= '/norsh';
}
//Used in shared mailbox from Office365
@ -1191,7 +1194,7 @@ class EmailCollector extends CommonObject
$client = $cm->make([
'host' => $this->host,
'port' => $this->port,
'encryption' => 'ssl',
'encryption' => !empty($this->imap_encryption) ? $this->imap_encryption : false,
'validate_cert' => true,
'protocol' => 'imap',
'username' => $this->login,
@ -1204,7 +1207,7 @@ class EmailCollector extends CommonObject
$client = $cm->make([
'host' => $this->host,
'port' => $this->port,
'encryption' => 'ssl',
'encryption' => !empty($this->imap_encryption) ? $this->imap_encryption : false,
'validate_cert' => true,
'protocol' => 'imap',
'username' => $this->login,

View File

@ -130,7 +130,10 @@ if (empty($conf->global->MAIN_REMOVE_INSTALL_WARNING)) {
//if (!empty($message)) $message.='<br>';
$message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
}
$reshook = $hookmanager->executeHooks('infoadmin', $action); // Note that $action and $object may have been modified by some hooks
if ($reshook == 0) {
$message .= $hookmanager->resPrint;
}
if ($message) {
print $message.'<br>';
//$message.='<br>';

View File

@ -428,3 +428,8 @@ ALTER TABLE llx_c_stcomm ADD COLUMN sortorder smallint DEFAULT 0;
ALTER TABLE llx_element_time ADD COLUMN ref_ext varchar(32);
ALTER TABLE llx_c_ziptown ADD COLUMN town_up varchar(180);
-- Email Collector
ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN imap_encryption varchar(16) DEFAULT "ssl" AFTER hostcharset;
ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN norsh integer DEFAULT 0 AFTER imap_encryption;

View File

@ -24,6 +24,8 @@ CREATE TABLE llx_emailcollector_emailcollector(
host varchar(255),
port varchar(10) DEFAULT '993',
hostcharset varchar(16) DEFAULT 'UTF-8',
imap_encryption varchar(16) DEFAULT 'ssl',
norsh integer DEFAULT 0,
login varchar(128),
acces_type integer DEFAULT 0,
oauth_service varchar(128),

View File

@ -2113,6 +2113,10 @@ oauthToken=Oauth2 token
accessType=Acces type
oauthService=Oauth service
TokenMustHaveBeenCreated=Module OAuth2 must be enabled and an oauth2 token must have been created with the correct permissions (for example scope "gmail_full" with OAuth for Gmail).
ImapEncryption = IMAP encryption method
ImapEncryptionHelp = Example: none, ssl, tls, notls
NoRSH = Use the NoRSH configuration
NoRSHHelp = Do not use RSH or SSH protocols to establish an IMAP pre-identification session
MailboxSourceDirectory=Mailbox source directory
MailboxTargetDirectory=Mailbox target directory
EmailcollectorOperations=Operations to do by collector

View File

@ -900,7 +900,9 @@ if (empty($reshook)) {
}
}
$sectionwithinvoicelink .= '</span><br>';
if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) {
$sectionwithinvoicelink .= ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">Invoice</a>';
} elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposConnector('.$placeid.')">'.$langs->trans('PrintTicket').'</button>';
} else {
@ -1688,6 +1690,9 @@ print '</table>';
if (($action == "valid" || $action == "history") && $invoice->type != Facture::TYPE_CREDIT_NOTE && empty($conf->global->TAKEPOS_NO_CREDITNOTE)) {
print '<button id="buttonprint" type="button" onclick="ModalBox(\'ModalCreditNote\')">'.$langs->trans('CreateCreditNote').'</button>';
if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) {
print ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">Invoice</a>';
}
}