Manage the reply-to field into mail libs
This commit is contained in:
parent
805940f61c
commit
f640bf7c61
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
|
||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
|
||||
@ -66,6 +67,7 @@ $form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$companystatic=new Societe($db);
|
||||
if (! empty($conf->propal->enabled)) $propalstatic=new Propal($db);
|
||||
if (! empty($conf->supplier_proposal->enabled)) $supplierproposalstatic=new SupplierProposal($db);
|
||||
if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
|
||||
if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db);
|
||||
|
||||
@ -208,6 +210,86 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Draft supplier proposals
|
||||
*/
|
||||
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
|
||||
{
|
||||
$langs->load("supplier_proposal");
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.fk_statut = 0";
|
||||
$sql.= " AND p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.entity IN (".getEntity('propal', 1).")";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("SupplierProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">';
|
||||
$supplierproposalstatic->id=$obj->rowid;
|
||||
$supplierproposalstatic->ref=$obj->ref;
|
||||
$supplierproposalstatic->total_ht = $obj->total_ht;
|
||||
$supplierproposalstatic->total_tva = $obj->total_tva;
|
||||
$supplierproposalstatic->total_ttc = $obj->total_ttc;
|
||||
print $supplierproposalstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print $companystatic->getNomUrl(1,'customer',16);
|
||||
print '</td>';
|
||||
print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>';
|
||||
$i++;
|
||||
$total += $obj->total_ht;
|
||||
}
|
||||
if ($total>0)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoProposal").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Draft orders
|
||||
*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
@ -712,8 +712,7 @@ if ($resql)
|
||||
|
||||
$i = 0;
|
||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$massactionbutton,$num,$nbtotalofrecords,'title_accountancy.png');
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$massactionbutton,$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
|
||||
@ -37,10 +37,11 @@
|
||||
class CMailFile
|
||||
{
|
||||
var $subject; // Topic: Subject of email
|
||||
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>')
|
||||
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>'). Note that with gmail smtps, value here is forced by google to account (but not the reply-to).
|
||||
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
|
||||
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain.
|
||||
// Return-Path: Email where to send bounds.
|
||||
var $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined)
|
||||
var $errors_to; // Errors-To: Email where to send errors.
|
||||
var $addr_to;
|
||||
var $addr_cc;
|
||||
@ -190,6 +191,7 @@ class CMailFile
|
||||
// Define smtp_headers
|
||||
$this->subject = $subject;
|
||||
$this->addr_from = $from;
|
||||
$this->reply_to = $from; // Set this property after constructor if you want to use another value
|
||||
$this->errors_to = $errors_to;
|
||||
$this->addr_to = $to;
|
||||
$this->addr_cc = $addr_cc;
|
||||
@ -256,7 +258,8 @@ class CMailFile
|
||||
$smtps->setTO($this->getValidAddress($to,0,1));
|
||||
$smtps->setFrom($this->getValidAddress($from,0,1));
|
||||
$smtps->setTrackId($trackid);
|
||||
|
||||
$smtps->setReplyTo($this->getValidAddress($from,0,1)); // Set property with this->smtps->setReplyTo after constructor if you want to use another value than the From
|
||||
|
||||
if (! empty($this->html))
|
||||
{
|
||||
if (!empty($css))
|
||||
@ -308,6 +311,7 @@ class CMailFile
|
||||
$this->phpmailer->Subject($this->encodetorfc2822($subject));
|
||||
$this->phpmailer->setTO($this->getValidAddress($to,0,1));
|
||||
$this->phpmailer->SetFrom($this->getValidAddress($from,0,1));
|
||||
$this->phpmailer->SetReplyTo($this->getValidAddress($from,0,1)); // Set property with this->phpmailer->setReplyTo after constructor if you want to use another value than the From
|
||||
// TODO Add trackid into smtp header
|
||||
|
||||
if (! empty($this->html))
|
||||
@ -341,12 +345,10 @@ class CMailFile
|
||||
}
|
||||
}
|
||||
|
||||
$smtps->setCC($addr_cc);
|
||||
$smtps->setBCC($addr_bcc);
|
||||
$smtps->setErrorsTo($errors_to);
|
||||
$smtps->setDeliveryReceipt($deliveryreceipt);
|
||||
|
||||
$this->smtps=$smtps;
|
||||
$this->phpmailer->setCC($addr_cc);
|
||||
$this->phpmailer->setBCC($addr_bcc);
|
||||
$this->phpmailer->setErrorsTo($errors_to);
|
||||
$this->phpmailer->setDeliveryReceipt($deliveryreceipt);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -817,7 +817,36 @@ class SMTPs
|
||||
return $_retValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reply-To Address from which mail will be the reply-to
|
||||
*
|
||||
* @param string $_strReplyTo Address from which mail will be the reply-to
|
||||
* @return void
|
||||
*/
|
||||
function setReplyTo($_strReplyTo)
|
||||
{
|
||||
if ( $_strReplyTo )
|
||||
$this->_msgReplyTo = $this->_strip_email($_strReplyTo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the Address from which mail will be the reply-to
|
||||
*
|
||||
* @param boolean $_part To "strip" 'Real name' from address
|
||||
* @return string Address from which mail will be the reply-to
|
||||
*/
|
||||
function getReplyTo($_part = true)
|
||||
{
|
||||
$_retValue = '';
|
||||
|
||||
if ( $_part === true )
|
||||
$_retValue = $this->_msgReplyTo;
|
||||
else
|
||||
$_retValue = $this->_msgReplyTo[$_part];
|
||||
|
||||
return $_retValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts given addresses into structured format.
|
||||
* This method takes a list of given addresses, via an array
|
||||
@ -1159,7 +1188,8 @@ class SMTPs
|
||||
$_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n";
|
||||
if ( $this->getErrorsTo() )
|
||||
$_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n";
|
||||
$_header .= "Reply-To: ".$this->getFrom('addr') ."\r\n";
|
||||
if ( $this->getReplyTo() )
|
||||
$_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n";
|
||||
|
||||
$_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n"
|
||||
. 'Mime-Version: 1.0' . "\r\n";
|
||||
|
||||
@ -2968,7 +2968,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois
|
||||
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image
|
||||
* @param string $morehtml More html to show
|
||||
* @param string $morecss More css to the table
|
||||
* @param int $limit Limit ofnumber of lines on each page
|
||||
* @param int $limit Max number of lines
|
||||
* @return void
|
||||
*/
|
||||
function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=0)
|
||||
@ -3016,7 +3016,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
{
|
||||
if ($totalnboflines) // If we know total nb of lines
|
||||
{
|
||||
$maxnbofpage=(empty($conf->dol_optimize_smallscreen) ? 6 : 3); // nb before and after selected page + ... + first or last
|
||||
$maxnbofpage=(empty($conf->dol_optimize_smallscreen) ? 6 : 3); // page nb before and after selected page + ... + first or last
|
||||
|
||||
$nbpages=ceil($totalnboflines/$limit);
|
||||
$cpt=($page-$maxnbofpage);
|
||||
@ -3055,7 +3055,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
$pagelist.= '<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><span '.(empty($conf->dol_use_jmobile)?'class="active"':'data-role="button"').'>'.($page+1)."</li>";
|
||||
}
|
||||
}
|
||||
print_fleche_navigation($page,$file,$options,$nextpage,$pagelist,$morehtml); // output the div and ul for previous/last completed with page numbers into $pagelist
|
||||
print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtml, $limit, $totalnboflines); // output the div and ul for previous/last completed with page numbers into $pagelist
|
||||
print '</td>';
|
||||
|
||||
print '</tr></table>'."\n";
|
||||
@ -3071,13 +3071,42 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
* @param integer $nextpage Do we show a next page button
|
||||
* @param string $betweenarrows HTML content to show between arrows. MUST contains '<li> </li>' tags or '<li><span> </span></li>'.
|
||||
* @param string $afterarrows HTML content to show after arrows. Must NOT contains '<li> </li>' tags.
|
||||
* @param string $limit Max nb of record to show ('' = unknown = default, '0' = no limit, 'x' = limit)
|
||||
* @param int $totalnboflines Total number of records/lines for all pages (if known)
|
||||
* @return void
|
||||
*/
|
||||
function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='')
|
||||
function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='', $limit='', $totalnboflines=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
print '<div class="pagination"><ul>';
|
||||
if ($limit != '')
|
||||
{
|
||||
$pagesizechoices='10:10,20:20,30:30,50:50,100:100,250:250,500:500,1000:1000,0:'.$langs->trans("All");
|
||||
if (! empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices=$conf->global->MAIN_PAGESIZE_CHOICES;
|
||||
|
||||
print '<li class="pagination"><select class="flat selectlimit" name="limit">';
|
||||
$tmpchoice=explode(',',$pagesizechoices);
|
||||
$found=false;
|
||||
foreach($tmpchoice as $val)
|
||||
{
|
||||
$selected='';
|
||||
$tmp=explode(':',$val);
|
||||
$key=$tmp[0];
|
||||
$val=$tmp[1];
|
||||
if ($key != '' && $val != '')
|
||||
{
|
||||
if ($key == $limit)
|
||||
{
|
||||
$selected = ' selected="selected"';
|
||||
$found = true;
|
||||
}
|
||||
print '<option name="'.$key.'"'.$selected.'>'.dol_escape_htmltag($val).'</option>'."\n";
|
||||
}
|
||||
}
|
||||
print '</select>';
|
||||
print '</li>';
|
||||
}
|
||||
if ($page > 0)
|
||||
{
|
||||
if (empty($conf->dol_use_jmobile)) print '<li class="pagination"><a class="paginationprevious" href="'.$file.'?page='.($page-1).$options.'"><</a></li>';
|
||||
|
||||
@ -310,7 +310,7 @@ UnitPrice=Unit price
|
||||
UnitPriceHT=Unit price (net)
|
||||
UnitPriceTTC=Unit price
|
||||
PriceU=U.P.
|
||||
PriceUHT=U.P. (net in currency)
|
||||
PriceUHT=U.P. (net)
|
||||
PriceUHTCurrency=U.P (currency)
|
||||
SupplierProposalUHT=U.P. net Requested
|
||||
PriceUTTC=U.P. (inc. tax)
|
||||
|
||||
@ -7,6 +7,7 @@ CommRequest=Price request
|
||||
CommRequests=Price requests
|
||||
SearchRequest=Find a request
|
||||
DraftRequests=Draft requests
|
||||
SupplierProposalsDraft=Draft supplier proposals
|
||||
LastModifiedRequests=Last %s modified price requests
|
||||
RequestsOpened=Open price requests
|
||||
SupplierProposalArea=Supplier proposals area
|
||||
|
||||
@ -520,6 +520,9 @@ div.myavailability {
|
||||
margin-top: 6px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
.selectlimit {
|
||||
margin-right: 10px !important;
|
||||
}
|
||||
|
||||
/* ============================================================================== */
|
||||
/* Styles to hide objects */
|
||||
|
||||
@ -508,6 +508,9 @@ div.myavailability {
|
||||
margin-top: 6px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
.selectlimit {
|
||||
margin-right: 10px !important;
|
||||
}
|
||||
|
||||
/* ============================================================================== */
|
||||
/* Styles to hide objects */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user