diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 81ca57f03ac..a67844e31bc 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -80,6 +80,15 @@ $statuslist = array( include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +if (GETPOSTISSET('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')) { // only for no js case + $param_disable_email = GETPOST('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION', $param_disable_email, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + } +} + if ($action == 'updateMask') { $maskconstticket = GETPOST('maskconstticket', 'aZ09'); $maskticket = GETPOST('maskticket', 'alpha'); @@ -112,17 +121,9 @@ if ($action == 'updateMask') { } elseif (preg_match('/set_(.*)/', $action, $reg)) { $code = $reg[1]; $value = GETPOSTISSET($code) ? GETPOSTINT($code) : 1; - if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - } else { - $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } + $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; } } elseif (preg_match('/del_(.*)/', $action, $reg)) { $code = $reg[1]; @@ -240,15 +241,6 @@ if ($action == 'updateMask') { if (!($res > 0)) { $error++; } - - // For compatibility when javascript is not enabled - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 && empty($conf->use_javascript_ajax)) { - $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - } } @@ -605,21 +597,6 @@ print $formcategory->textwithpicto('', $langs->trans("TicketAutoChangeStatusOnAn print ''; print ''; -// Check "Notify thirdparty" on ticket creation -print ''.$langs->trans("TicketAutoCheckNotifyThirdParty").''; -print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $formcategory->selectarray("TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION", $arrval, getDolGlobalString('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')); -} -print ''; -print ''; -print $formcategory->textwithpicto('', $langs->trans("TicketAutoCheckNotifyThirdPartyHelp"), 1, 'help'); -print ''; -print ''; - print ''; print ''.$langs->trans("TicketsDelayBeforeFirstAnswer").""; print ' @@ -646,13 +623,14 @@ print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition'); print ''; +print '
'; /* - * Notification + * Emails */ // Admin var of module -print load_fiche_titre($langs->trans("Notification"), '', ''); +print load_fiche_titre($langs->trans("Emails"), '', ''); print ''; @@ -662,7 +640,8 @@ print ''; print ''; print ''; -print ''; +print ''; +print ''; print ''; print "\n"; @@ -687,28 +666,26 @@ print ''; // Email for notification of TICKET_CREATE print ''; print ''; +print ''; print ''; print ''; -// Also send to TICKET_NOTIFICATION_EMAIL_TO for responses (not only creation) -if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - print ''; - print ''; - print ''; - print ''; +// Check "Notify thirdparty" on ticket creation +print ''; +print ''; +print ''; +print ''; // Message header $mail_intro = getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO', ''); diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 52a61d81c57..2c09caf0618 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -84,15 +84,6 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') { } } - if (GETPOSTISSET('TICKET_DISABLE_CUSTOMER_MAILS')) { // only for no js case - $param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - $errors[] = $db->lasterror(); - } - } - if (GETPOSTISSET('TICKET_SHOW_COMPANY_LOGO')) { // only for no js case $param_show_module_logo = GETPOST('TICKET_SHOW_COMPANY_LOGO', 'alpha'); $res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity); @@ -408,23 +399,6 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print ''; print ''; - // Also send to main email address - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - print ''; - print ''; - print ''; - print ''; - } - if (empty($conf->use_javascript_ajax)) { print ''; print ''; @@ -516,20 +490,6 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print ''; print ''; - // Activate email creation to user - print ''; - print ''; - print ''; - // Text of email after creatio of a ticket $mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody')); print ''; print ''; + // Also send to main email address + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { + print ''; + print ''; + print ''; + } + print '
'.$langs->trans("Email").''.$langs->trans("Parameter").''.$langs->trans("ShortInfo").'
'.$langs->trans("TicketEmailNotificationTo").''; -print ''; print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help'); print '
'.$langs->trans("TicketsEmailAlsoSendToMainAddress").''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $formcategory->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS); - } - print ''; - print $formcategory->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help'); - print '
'.$langs->trans("TicketAutoCheckNotifyThirdParty").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $formcategory->selectarray("TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION", $arrval, getDolGlobalString('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')); } +print ''; +print $formcategory->textwithpicto('', $langs->trans("TicketAutoCheckNotifyThirdPartyHelp"), 1, 'help'); +print '
'.$langs->trans("TicketsEmailAlsoSendToMainAddress").''; - if (!empty($conf->use_javascript_ajax)) { - print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')); - } - print ''; - print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help'); - print '
'; - print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help'); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, getDolGlobalInt('TICKET_DISABLE_CUSTOMER_MAILS')); - } - print '
'; @@ -564,6 +524,22 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print '
'.$langs->trans("TicketsEmailAlsoSendToMainAddress"); + print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help'); + print ''; + if (!empty($conf->use_javascript_ajax)) { + print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')); + } + print '
'; print ''; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index eb867663795..20ebd6464df 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -677,9 +677,11 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof // Set constant $("#set_" + code).click(function() { +console.log("ee"); if (warning) { alert(warning); } + if (input.alert && input.alert.set) { if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton; if (input.alert.set.noButton) noButton = input.alert.set.noButton; diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 41b98dcf06d..27b544205b1 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -160,8 +160,10 @@ class InterfaceTicketEmail extends DolibarrTriggers $see_ticket_assignee = 'SeeThisTicketIntomanagementInterface'; // Send email to notification email + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation because email sending is already managed by page + // $object->context['createdfrompublicinterface'] may also be defined when creation done from public interface if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) { - $sendto = !getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); if ($sendto) { $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); } @@ -196,7 +198,9 @@ class InterfaceTicketEmail extends DolibarrTriggers } // Send email to customer - if (!getDolGlobalInt('TICKET_DISABLE_CUSTOMER_MAILS') && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation because email sending is already managed by page + // $object->context['createdfrompublicinterface'] may also be defined when creation done from public interface + if (empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { $sendto = ''; // if contact selected send to email's contact else send to email's thirdparty @@ -244,15 +248,17 @@ class InterfaceTicketEmail extends DolibarrTriggers $see_ticket_customer = 'TicketCloseEmailBodyInfosTrackUrlCustomer'; // Send email to notification email + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation but not at closing if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) { - $sendto = !getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); if ($sendto) { $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); } } // Send email to customer. - if (!getDolGlobalString('TICKET_DISABLE_CUSTOMER_MAILS') && empty($object->context['disableticketemail'])) { + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation but not at closing + if (empty($object->context['disableticketemail'])) { $linked_contacts = $object->listeContact(-1, 'thirdparty'); $linked_contacts = array_merge($linked_contacts, $object->listeContact(-1, 'internal')); if (empty($linked_contacts) && getDolGlobalString('TICKET_NOTIFY_AT_CLOSING') && !empty($object->fk_soc)) { @@ -353,7 +359,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_admin .= '

'.$langs->trans('Message').' :

'.$message.'


'; $message_admin .= '

'.$langs->trans('SeeThisTicketIntomanagementInterface').'

'; - $from = getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . '<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; + $from = (getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ' : '') . '<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; $trackid = 'tic'.$object->id; @@ -442,7 +448,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_customer .= '

'.$langs->trans($see_ticket).' : '.$url_public_ticket.'

'; $message_customer .= '

'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

'; - $from = (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? '' : getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ').'<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; + $from = (getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ' : '').'<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; $trackid = 'tic'.$object->id; diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index b2397e2069c..ec3053a6a40 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -349,7 +349,8 @@ ALTER TABLE llx_societe_commerciaux ADD COLUMN fk_c_type_contact_code varchar(32 -- VPGSQL8.2 DROP INDEX uk_societe_commerciaux; ALTER TABLE llx_societe_commerciaux ADD UNIQUE INDEX uk_societe_commerciaux_c_type_contact (fk_soc, fk_user, fk_c_type_contact_code); ALTER TABLE llx_c_type_contact ADD INDEX idx_c_type_contact_code (code); -ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); +--Removed, not unique. ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); +ALTER TABLE llx_societe_commerciaux DROP FOREIGN KEY fk_societe_commerciaux_fk_c_type_contact_code; ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user(rowid); diff --git a/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql b/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql index 1672ff659c1..f4bc719c4ba 100644 --- a/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql +++ b/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql @@ -17,6 +17,6 @@ -- =================================================================== ALTER TABLE llx_societe_commerciaux ADD UNIQUE INDEX uk_societe_commerciaux_c_type_contact (fk_soc, fk_user, fk_c_type_contact_code); -ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); +--Removed, not unique. ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user(rowid); diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index ee2449ce74c..39b8ff61ce6 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -72,10 +72,10 @@ TicketPublicAccess=A public interface requiring no identification is available a TicketSetupDictionaries=The type of ticket, severity and analytic codes are configurable from dictionaries TicketParamModule=Module variable setup TicketParamMail=Email setup -TicketEmailNotificationFrom=Sender e-mail for notification on answers -TicketEmailNotificationFromHelp=Sender e-mail to use to send the notification email when an answer is provided inside the back office. For example noreply@example.com +TicketEmailNotificationFrom=Sender e-mail for notification on tickets +TicketEmailNotificationFromHelp=Sender e-mail to use to send the notification emails for tickets creation or messages. For example noreply@example.com TicketEmailNotificationTo=Notify ticket creation to this e-mail address -TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation +TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation (in addition to any other default recipients) TicketNewEmailBodyLabel=Text message sent after creating a ticket TicketNewEmailBodyHelp=The text specified here will be inserted into the email confirming the creation of a new ticket from the public interface. Information on the consultation of the ticket are automatically added. TicketParamPublicInterface=Public interface setup @@ -96,7 +96,9 @@ TicketPublicInterfaceTextHelpMessageHelpAdmin=This text will appear above the me ExtraFieldsTicket=Extra attributes TicketCkEditorEmailNotActivated=HTML editor is not activated. Please put FCKEDITOR_ENABLE_MAIL content to 1 to get it. TicketsDisableEmail=Do not send emails for ticket creation or message recording -TicketsDisableEmailHelp=By default, emails are sent when new tickets or messages created. Enable this option to disable *all* email notifications +TicketsDisableEmailHelp=By default, notification emails to third parties are sent when new tickets or messages are created for both backoffice and public interface. Enable this option to disable email notifications to thirdparties when creation is done from backoffice. +TicketsNotifyThirdPartyFromBackOfficeByDefault=Notify third party by default on ticket creation from backoffice +TicketsNotifyThirdPartyFromBackOfficeByDefaultHelp=When creating a ticket from the backoffice, the option "Notify third party" will be checked by default TicketsLogEnableEmail=Enable log by email TicketsLogEnableEmailHelp=At each change, an email will be sent **to each contact** associated with the ticket. TicketParams=Params @@ -119,7 +121,7 @@ TicketAutoChangeStatusOnAnswerHelp=When a user answers to a ticket, the status w TicketNumberingModules=Tickets numbering module TicketsModelModule=Document templates for tickets TicketNotifyTiersAtCreation=Notify third party at creation -TicketsDisableCustomerEmail=Always disable emails when a ticket is created from public interface +TicketsDisableCustomerEmail=Always disable emails to third parties when a ticket is created from the backoffice TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is added to a ticket TicketsPublicNotificationNewMessageHelp=Send email(s) when a new message is added from public interface (to assigned user or the notifications email to (update) and/or the notifications email to) TicketPublicNotificationNewMessageDefaultEmail=Notifications email to (update) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index c7be444a425..40217eded88 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -883,7 +883,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- print ''; } elseif ($id > 0 || !empty($ref)) { - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields // Projet card in view mode diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 691385ef878..848abcb4151 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -227,7 +227,7 @@ class Ticket extends CommonObject public $cache_msgs_ticket; /** - * @var int Notify thirdparty at create + * @var int Save if a thirdparty was notified at creation at ticket or not */ public $notify_tiers_at_create; @@ -2778,10 +2778,10 @@ class Ticket extends CommonObject } // Add global email address recipient - if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') && - getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto) - ) { - $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); + if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto)) { + if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')) { + $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); + } } if (!empty($sendto)) {