';
if ($this->withtoreadonly) {
if (!empty($this->toname) && !empty($this->tomail)) {
@@ -675,7 +691,9 @@ class FormMail extends Form
}
// The select combo
if (!empty($this->withto) && is_array($this->withto)) {
- if (!empty($this->withtofree)) $out .= " ".$langs->trans("and")."/".$langs->trans("or")." ";
+ if (!empty($this->withtofree)) {
+ $out .= " ".$langs->trans("and")."/".$langs->trans("or")." ";
+ }
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
$tmparray = $this->withto;
foreach ($tmparray as $key => $val) {
@@ -805,7 +823,8 @@ class FormMail extends Form
$out .= '
';
- if ($this->withmaindocfile) { // withmaindocfile is set to 1 or -1 to show the checkbox (-1 = checked or 1 = not checked)
+ if ($this->withmaindocfile) {
+ // withmaindocfile is set to 1 or -1 to show the checkbox (-1 = checked or 1 = not checked)
if (GETPOSTISSET('sendmail')) {
$this->withmaindocfile = (GETPOST('addmaindocfile', 'alpha') ? -1 : 1);
} elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
@@ -847,12 +866,17 @@ class FormMail extends Form
}
$out .= ' ';
}
- } elseif (empty($this->withmaindocfile)) { // Do not show message if we asked to show the checkbox
+ } elseif (empty($this->withmaindocfile)) {
+ // Do not show message if we asked to show the checkbox
$out .= $langs->trans("NoAttachedFiles").' ';
}
- if ($this->withfile == 2) { // Can add other files
- if (!empty($conf->global->FROM_MAIL_USE_INPUT_FILE_MULTIPLE)) $out .= '';
- else $out .= '';
+ if ($this->withfile == 2) {
+ // Can add other files
+ if (!empty($conf->global->FROM_MAIL_USE_INPUT_FILE_MULTIPLE)) {
+ $out .= '';
+ } else {
+ $out .= '';
+ }
$out .= ' ';
$out .= '';
}
@@ -972,8 +996,11 @@ class FormMail extends Form
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
if ($this->withfckeditor == -1) {
- if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $this->withfckeditor = 1;
- else $this->withfckeditor = 0;
+ if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
+ $this->withfckeditor = 1;
+ } else {
+ $this->withfckeditor = 0;
+ }
}
$doleditor = new DolEditor('message', $defaultmessage, '', 280, $this->ckeditortoolbar, 'In', true, true, $this->withfckeditor, 8, '95%');
@@ -1118,10 +1145,18 @@ class FormMail extends Form
$out .= yn($this->withdeliveryreceipt);
} else {
$defaultvaluefordeliveryreceipt = 0;
- if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_PROPAL) && !empty($this->param['models']) && $this->param['models'] == 'propal_send') $defaultvaluefordeliveryreceipt = 1;
- if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_SUPPLIER_PROPOSAL) && !empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') $defaultvaluefordeliveryreceipt = 1;
- if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_ORDER) && !empty($this->param['models']) && $this->param['models'] == 'order_send') $defaultvaluefordeliveryreceipt = 1;
- if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_INVOICE) && !empty($this->param['models']) && $this->param['models'] == 'facture_send') $defaultvaluefordeliveryreceipt = 1;
+ if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_PROPAL) && !empty($this->param['models']) && $this->param['models'] == 'propal_send') {
+ $defaultvaluefordeliveryreceipt = 1;
+ }
+ if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_SUPPLIER_PROPOSAL) && !empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') {
+ $defaultvaluefordeliveryreceipt = 1;
+ }
+ if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_ORDER) && !empty($this->param['models']) && $this->param['models'] == 'order_send') {
+ $defaultvaluefordeliveryreceipt = 1;
+ }
+ if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_INVOICE) && !empty($this->param['models']) && $this->param['models'] == 'facture_send') {
+ $defaultvaluefordeliveryreceipt = 1;
+ }
$out .= $form->selectyesno('deliveryreceipt', (GETPOSTISSET("deliveryreceipt") ? GETPOST("deliveryreceipt") : $defaultvaluefordeliveryreceipt), 1);
}
$out .= "
\n";
@@ -1200,11 +1235,21 @@ class FormMail extends Form
$sql .= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')";
$sql .= " AND entity IN (".getEntity('c_email_templates').")";
$sql .= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned
- if ($active >= 0) $sql .= " AND active = ".$active;
- if ($label) $sql .= " AND label ='".$db->escape($label)."'";
- if (!($id > 0) && $languagetosearch) $sql .= " AND (lang = '".$db->escape($languagetosearch)."'".($languagetosearchmain ? " OR lang = '".$db->escape($languagetosearchmain)."'" : "")." OR lang IS NULL OR lang = '')";
- if ($id > 0) $sql .= " AND rowid=".$id;
- if ($id == -1) $sql .= " AND position=0";
+ if ($active >= 0) {
+ $sql .= " AND active = ".$active;
+ }
+ if ($label) {
+ $sql .= " AND label ='".$db->escape($label)."'";
+ }
+ if (!($id > 0) && $languagetosearch) {
+ $sql .= " AND (lang = '".$db->escape($languagetosearch)."'".($languagetosearchmain ? " OR lang = '".$db->escape($languagetosearchmain)."'" : "")." OR lang IS NULL OR lang = '')";
+ }
+ if ($id > 0) {
+ $sql .= " AND rowid=".$id;
+ }
+ if ($id == -1) {
+ $sql .= " AND position=0";
+ }
if ($languagetosearch) {
$sql .= $db->order("position,lang,label", "ASC,DESC,ASC"); // We want line with lang set first, then with lang null or ''
} else {
@@ -1229,7 +1274,8 @@ class FormMail extends Form
} elseif ($id == -2) {
// Not found with the provided label
return -1;
- } else { // If there is no template at all
+ } else {
+ // If there is no template at all
$defaultmessage = '';
if ($type_template == 'body') {
@@ -1460,7 +1506,7 @@ class FormMail extends Form
$tmparray['__USER_SIGNATURE__'] = 'TagSignature';
$tmparray['__CHECK_READ__'] = 'TagCheckMail';
$tmparray['__UNSUBSCRIBE__'] = 'TagUnsubscribe';
- //,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet in mass emailing
+ //,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet in mass emailing
$onlinepaymentenabled = 0;
if (!empty($conf->paypal->enabled)) $onlinepaymentenabled++;
@@ -1469,10 +1515,18 @@ class FormMail extends Form
if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
$tmparray['__SECUREKEYPAYMENT__'] = $conf->global->PAYMENT_SECURITY_TOKEN;
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
- if ($conf->adherent->enabled) $tmparray['__SECUREKEYPAYMENT_MEMBER__'] = 'SecureKeyPAYMENTUniquePerMember';
- if ($conf->facture->enabled) $tmparray['__SECUREKEYPAYMENT_INVOICE__'] = 'SecureKeyPAYMENTUniquePerInvoice';
- if ($conf->commande->enabled) $tmparray['__SECUREKEYPAYMENT_ORDER__'] = 'SecureKeyPAYMENTUniquePerOrder';
- if ($conf->contrat->enabled) $tmparray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'SecureKeyPAYMENTUniquePerContractLine';
+ if ($conf->adherent->enabled) {
+ $tmparray['__SECUREKEYPAYMENT_MEMBER__'] = 'SecureKeyPAYMENTUniquePerMember';
+ }
+ if ($conf->facture->enabled) {
+ $tmparray['__SECUREKEYPAYMENT_INVOICE__'] = 'SecureKeyPAYMENTUniquePerInvoice';
+ }
+ if ($conf->commande->enabled) {
+ $tmparray['__SECUREKEYPAYMENT_ORDER__'] = 'SecureKeyPAYMENTUniquePerOrder';
+ }
+ if ($conf->contrat->enabled) {
+ $tmparray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'SecureKeyPAYMENTUniquePerContractLine';
+ }
}
} else {
/* No need to show into tooltip help, option is not enabled