added email from
This commit is contained in:
@@ -168,8 +168,14 @@ function update_paypal_credentials_CIPF($request, $option_name, $option_data, $o
|
||||
function update_emails_settings_option_CIPF($request, $option_name, $option_data, $option_default) {
|
||||
Plgntls::debug_infos();
|
||||
|
||||
/*
|
||||
* loop through saved data option
|
||||
* update them
|
||||
* add them to the option that will be saved
|
||||
*
|
||||
*/
|
||||
foreach ($option_data as $email_type => $email_options) {
|
||||
$ret_update = update_email_by_type_CIPF($email_type, $email_options, $request);
|
||||
$ret_update = update_email_by_type_CIPF($email_type, $email_options, $option_default[$email_type], $request);
|
||||
if ($ret_update !== false) {
|
||||
$option_data[$email_type] = $ret_update;
|
||||
}
|
||||
@@ -178,7 +184,6 @@ function update_emails_settings_option_CIPF($request, $option_name, $option_data
|
||||
/*
|
||||
* to reorder and add new data with the default data
|
||||
* also take the name of the default
|
||||
* not really good :p
|
||||
*
|
||||
*/
|
||||
$new_option = array();
|
||||
@@ -208,7 +213,7 @@ function update_emails_settings_option_CIPF($request, $option_name, $option_data
|
||||
* utility function to update the emails
|
||||
*
|
||||
*/
|
||||
function update_email_by_type_CIPF($email_type, $email_options, $request) {
|
||||
function update_email_by_type_CIPF($email_type, $email_options, $email_default_options, $request) {
|
||||
Plgntls::debug_infos();
|
||||
$is_new = false;
|
||||
|
||||
@@ -224,20 +229,26 @@ function update_email_by_type_CIPF($email_type, $email_options, $request) {
|
||||
* loop through all options to update them
|
||||
*
|
||||
*/
|
||||
foreach ($email_options as $option => $value) {
|
||||
if (!isset($request[$email_type.'_'.$option])) {
|
||||
foreach ($email_default_options as $default_option => $default_value) {
|
||||
if (!isset($request[$email_type.'_'.$default_option])) {
|
||||
if (isset($email_options[$default_option])) {
|
||||
continue;
|
||||
}
|
||||
$is_new = true;
|
||||
$email_options[$default_option] = $default_value;
|
||||
continue;
|
||||
}
|
||||
$new_value = $request[$email_type.'_'.$option];
|
||||
$new_value = $request[$email_type.'_'.$default_option];
|
||||
$value = $email_options[$default_option];
|
||||
if ($new_value === $value) {
|
||||
continue;
|
||||
}
|
||||
$is_new = true;
|
||||
if ($option === 'notification_send' || $option === 'confirmation_send') {
|
||||
$email_options[$option] = true;
|
||||
if ($default_option === 'notification_send' || $default_option === 'confirmation_send') {
|
||||
$email_options[$default_option] = true;
|
||||
}
|
||||
else {
|
||||
$email_options[$option] = $new_value;
|
||||
$email_options[$default_option] = $new_value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user