fix (scrutinizer) remove comments and create function send an email TODO
This commit is contained in:
parent
6e3042cad9
commit
4c5bcd02b7
@ -2313,4 +2313,28 @@ class Project extends CommonObject
|
||||
|
||||
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function sending an email to the current member with the text supplied in parameter.
|
||||
*
|
||||
* @param string $text Content of message (not html entities encoded)
|
||||
* @param string $subject Subject of message
|
||||
* @param array $filename_list Array of attached files
|
||||
* @param array $mimetype_list Array of mime types of attached files
|
||||
* @param array $mimefilename_list Array of public names of attached files
|
||||
* @param string $addr_cc Email cc
|
||||
* @param string $addr_bcc Email bcc
|
||||
* @param int $deliveryreceipt Ask a delivery receipt
|
||||
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
|
||||
* @param string $errors_to erros to
|
||||
* @param string $moreinheader Add more html headers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
// TODO EMAIL
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,51 +334,50 @@ if (empty($reshook) && $action == 'add') {
|
||||
if ($result > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$object = $proj;
|
||||
|
||||
if ($object->email) {
|
||||
$subject = '';
|
||||
$msg = '';
|
||||
|
||||
// if ($object->email) {
|
||||
// $subject = '';
|
||||
// $msg = '';
|
||||
// Send subscription email
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
// Set output language
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "members", "projects"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->PROJECT_EMAIL_TEMPLATE_AUTOLEAD;
|
||||
|
||||
// // Send subscription email
|
||||
// include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
// $formmail = new FormMail($db);
|
||||
// // Set output language
|
||||
// $outputlangs = new Translate('', $conf);
|
||||
// $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
|
||||
// // Load traductions files required by page
|
||||
// $outputlangs->loadLangs(array("main", "members", "projects"));
|
||||
// // Get email content from template
|
||||
// $arraydefaultmessage = null;
|
||||
// $labeltouse = $conf->global->PROJECT_EMAIL_TEMPLATE_AUTOLEAD;
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'project', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
}
|
||||
|
||||
// if (!empty($labeltouse)) {
|
||||
// $arraydefaultmessage = $formmail->getEMailTemplate($db, 'project', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
// }
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
}
|
||||
if (empty($labeltosue)) {
|
||||
$labeltouse = '['.$mysoc->name.'] '.$langs->trans("YourMessage");
|
||||
$msg = $langs->trans("YourMessageHasBeenReceived");
|
||||
}
|
||||
|
||||
// if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
// $subject = $arraydefaultmessage->topic;
|
||||
// $msg = $arraydefaultmessage->content;
|
||||
// }
|
||||
// if (empty($labeltosue)) {
|
||||
// $labeltouse = '['.$mysoc->name.'] '.$langs->trans("YourMessage");
|
||||
// $msg = $langs->trans("YourMessageHasBeenReceived");
|
||||
// }
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
||||
$texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
|
||||
if ($subjecttosend && $texttosend) {
|
||||
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/lead/new.php'."\r\n";
|
||||
|
||||
// $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
// complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
// $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
||||
// $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
|
||||
|
||||
// if ($subjecttosend && $texttosend) {
|
||||
// $moreinheader = 'X-Dolibarr-Info: send_an_email by public/lead/new.php'."\r\n";
|
||||
|
||||
// $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
// }
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
}
|
||||
/*if ($result < 0) {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}*/
|
||||
// }
|
||||
}
|
||||
|
||||
if (!empty($backtopage)) {
|
||||
$urlback = $backtopage;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user