update code

This commit is contained in:
Philippe GRAND 2022-09-04 13:24:12 +02:00
parent 975d3ecf99
commit 34b4ba7f33
3 changed files with 12 additions and 12 deletions

View File

@ -180,7 +180,7 @@ abstract class ActionsContactCardCommon
if ($action == 'view' || $action == 'edit' || $action == 'delete') {
// Emailing
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$langs->load("mails");
$this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
}

View File

@ -249,7 +249,7 @@ if (empty($reshook)) {
$action = 'create';
}
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && $object->no_email == -1 && !empty($object->email)) {
if (isModEnabled('mailing') && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && $object->no_email == -1 && !empty($object->email)) {
$error++;
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
$action = 'create';
@ -290,7 +290,7 @@ if (empty($reshook)) {
}
}
if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email)) {
if (empty($error) && isModEnabled('mailing') && !empty($object->email)) {
// Add mass emailing flag into table mailing_unsubscribe
$result = $object->setNoEmail($object->no_email);
if ($result < 0) {
@ -342,7 +342,7 @@ if (empty($reshook)) {
$action = 'edit';
}
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST("no_email", "int") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
if (isModEnabled('mailing') && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST("no_email", "int") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
$error++;
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
$action = 'edit';
@ -830,7 +830,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</tr>';
// Unsubscribe
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) {
print "\n".'<script type="text/javascript">'."\n";
print '$(document).ready(function () {
@ -1101,7 +1101,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<td>';
print img_picto('', 'object_email');
print '<input type="text" name="email" id="email" class="maxwidth100onsmartphone quatrevingtpercent" value="'.(GETPOSTISSET('email') ?GETPOST('email', 'alpha') : $object->email).'"></td>';
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$langs->load("mails");
print '<td class="nowrap">'.$langs->trans("NbOfEMailingsSend").'</td>';
print '<td>'.$object->getNbOfEMailings().'</td>';
@ -1111,7 +1111,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</tr>';
// Unsubscribe
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
if ($conf->use_javascript_ajax && isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) {
print "\n".'<script type="text/javascript">'."\n";
@ -1376,14 +1376,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("PostOrFunction").'</td><td>'.$object->poste.'</td></tr>';
// Email
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$langs->load("mails");
print '<tr><td>'.$langs->trans("NbOfEMailingsSend").'</td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?filteremail='.urlencode($object->email).'">'.$object->getNbOfEMailings().'</a></td></tr>';
}
// Unsubscribe opt-out
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$result = $object->getNoEmail();
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -78,7 +78,7 @@ $search_phone_pro = GETPOST("search_phone_pro", 'alpha');
$search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
$search_fax = GETPOST("search_fax", 'alpha');
$search_email = GETPOST("search_email", 'alpha');
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$search_no_email = GETPOSTISSET("search_no_email") ? GETPOST("search_no_email", 'int') : -1;
} else {
$search_no_email = -1;
@ -218,7 +218,7 @@ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
$arrayfields['unsubscribed'] = array(
'label'=>'No_Email',
'checked'=>0,
'enabled'=>(!empty($conf->mailing->enabled)),
'enabled'=>(isModEnabled('mailing')),
'position'=>111);
if (isModEnabled('socialnetworks')) {
@ -385,7 +385,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed";
}
// Add fields from hooks