Fix images into medias not reabable into send emails
This commit is contained in:
parent
5b7a8e9c90
commit
bebe7baa80
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Add file in email form
|
* Add file in email form
|
||||||
*/
|
*/
|
||||||
if (GETPOST('addfile'))
|
if (GETPOST('addfile'))
|
||||||
{
|
{
|
||||||
$trackid = GETPOST('trackid','aZ09');
|
$trackid = GETPOST('trackid','aZ09');
|
||||||
@ -229,6 +229,11 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
|
|
||||||
if (dol_strlen($sendto))
|
if (dol_strlen($sendto))
|
||||||
{
|
{
|
||||||
|
// Define $urlwithroot
|
||||||
|
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||||
|
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||||
|
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
|
|
||||||
$langs->load("commercial");
|
$langs->load("commercial");
|
||||||
@ -255,6 +260,12 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
|
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
|
||||||
$message = $_POST['message'];
|
$message = $_POST['message'];
|
||||||
|
|
||||||
|
// Make a change into HTML code to allow to include images from medias directory with an external reabable URL.
|
||||||
|
// <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&entity=1&file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
||||||
|
// become
|
||||||
|
// <img alt="" src="'.$urlwithroot.'viewimage.php?modulepart=medias&entity=1&file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
||||||
|
$message=preg_replace('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $message);
|
||||||
|
|
||||||
$sendtobcc= GETPOST('sendtoccc');
|
$sendtobcc= GETPOST('sendtoccc');
|
||||||
if ($mode == 'emailfromproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO));
|
if ($mode == 'emailfromproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO));
|
||||||
if ($mode == 'emailfromorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO));
|
if ($mode == 'emailfromorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO));
|
||||||
|
|||||||
@ -865,7 +865,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
|||||||
// Make a change into HTML code to allow to include images from medias directory.
|
// Make a change into HTML code to allow to include images from medias directory.
|
||||||
// <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&entity=1&file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
// <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&entity=1&file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
||||||
// become
|
// become
|
||||||
// <img src="'.DOL_DATA_ROOT.'/media/image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
// <img alt="" src="'.DOL_DATA_ROOT.'/media/image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
||||||
$newfreetext=preg_replace('/(<img.*src=")[^\"]*viewimage\.php[^\"]*modulepart=medias[^\"]*file=([^\"]*)("[^\/]*\/>)/', '\1'.DOL_DATA_ROOT.'/medias/\2\3', $newfreetext);
|
$newfreetext=preg_replace('/(<img.*src=")[^\"]*viewimage\.php[^\"]*modulepart=medias[^\"]*file=([^\"]*)("[^\/]*\/>)/', '\1'.DOL_DATA_ROOT.'/medias/\2\3', $newfreetext);
|
||||||
|
|
||||||
$line.=$outputlangs->convToOutputCharset($newfreetext);
|
$line.=$outputlangs->convToOutputCharset($newfreetext);
|
||||||
|
|||||||
@ -44,6 +44,7 @@ ErrorFailedToWriteInDir=Failed to write in directory %s
|
|||||||
ErrorFoundBadEmailInFile=Found incorrect email syntax for %s lines in file (example line %s with email=%s)
|
ErrorFoundBadEmailInFile=Found incorrect email syntax for %s lines in file (example line %s with email=%s)
|
||||||
ErrorUserCannotBeDelete=User cannot be deleted. May be it is associated to Dolibarr entities.
|
ErrorUserCannotBeDelete=User cannot be deleted. May be it is associated to Dolibarr entities.
|
||||||
ErrorFieldsRequired=Some required fields were not filled.
|
ErrorFieldsRequired=Some required fields were not filled.
|
||||||
|
ErrorSubjectIsRequired=The email topic is required
|
||||||
ErrorFailedToCreateDir=Failed to create a directory. Check that Web server user has permissions to write into Dolibarr documents directory. If parameter <b>safe_mode</b> is enabled on this PHP, check that Dolibarr php files owns to web server user (or group).
|
ErrorFailedToCreateDir=Failed to create a directory. Check that Web server user has permissions to write into Dolibarr documents directory. If parameter <b>safe_mode</b> is enabled on this PHP, check that Dolibarr php files owns to web server user (or group).
|
||||||
ErrorNoMailDefinedForThisUser=No mail defined for this user
|
ErrorNoMailDefinedForThisUser=No mail defined for this user
|
||||||
ErrorFeatureNeedJavascript=This feature need javascript to be activated to work. Change this in setup - display.
|
ErrorFeatureNeedJavascript=This feature need javascript to be activated to work. Change this in setup - display.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user