NEW Can send an email to a user from its card.

This commit is contained in:
Laurent Destailleur 2017-05-15 00:15:56 +02:00
parent caae7e4171
commit b29d0385e6
4 changed files with 592 additions and 456 deletions

View File

@ -116,6 +116,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe')
{
$result=$object->fetch_thirdparty();
if ($object->element == 'user' && $result == 0) $result=1; // Even if not found, we consider ok
$thirdparty=$object->thirdparty;
$sendtosocid=$thirdparty->id;
}
@ -187,7 +188,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
{
$tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>';
}
else // Id du contact
elseif ($val) // Id du contact
{
$tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
$sendtoid[] = $val;
@ -217,7 +218,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
{
$tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>';
}
else // Id du contact
elseif ($val) // Id du contact
{
$tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
//$sendtoid[] = $val; TODO Add also id of contact in CC ?

View File

@ -153,6 +153,11 @@ class CMailFile
$this->error='ErrorSubjectIsRequired';
return;
}
if (empty($msg))
{
dol_syslog("CMailFile::CMailfile: Try to send an email with empty body");
$msg='.'; // Avoid empty message (with empty message conten show a multipart structure)
}
// Detect if message is HTML (use fast method)
if ($msgishtml == -1)

View File

@ -634,11 +634,11 @@ class FormMail extends Form
if ($this->withtopicreadonly)
{
$out.= $defaulttopic;
$out.= '<input type="hidden" size="60" id="subject" name="subject" value="'.$defaulttopic.'" />';
$out.= '<input type="hidden" class="quatrevingtpercent" id="subject" name="subject" value="'.$defaulttopic.'" />';
}
else
{
$out.= '<input type="text" size="60" id="subject" name="subject" value="'. ((isset($_POST["subject"]) && ! $_POST['modelselected'])?$_POST["subject"]:($defaulttopic?$defaulttopic:'')) .'" />';
$out.= '<input type="text" class="quatrevingtpercent" id="subject" name="subject" value="'. ((isset($_POST["subject"]) && ! $_POST['modelselected'])?$_POST["subject"]:($defaulttopic?$defaulttopic:'')) .'" />';
}
$out.= "</td></tr>\n";
}

File diff suppressed because it is too large Load Diff