1?'+'.$frequency.' months':'+1 month'; $last_sent->modify($intervale); if($now >= $last_sent){ $employees = Db::getInstance()->ExecuteS(' SELECT `id_employee`, CONCAT(`firstname`, \' \', `lastname`) AS "name", email FROM `'._DB_PREFIX_.'employee` WHERE `active` = 1 ORDER BY `email` '); foreach ($employees as $key => $employee) { $data = array( '{limit}' => (int)$limit, '{employee}' => $employee['name'], ); Mail::Send(2, 'resetpassword', 'Sécurité Prestashop', $data, $employee['email']); } Configuration::updateValue('ANT_RESETBOPASSWORD_DATE', date('Y-m-d H:i:s')); } // Resending ! $reset_link = __PS_BASE_URI__.'adm/resetpasswd.php'; $updated_date_send = new Datetime(Configuration::get('ANT_RESETBOPASSWORD_DATE')); $sending_date = $updated_date_send; $day_limit = $limit>1?'+'.$limit.' days':'+1 day'; $updated_date_send->modify($day_limit); $employees = Db::getInstance()->ExecuteS(' SELECT `id_employee`, CONCAT(`firstname`, \' \', `lastname`) AS "name", `email`, `date_passwd_upd` FROM `'._DB_PREFIX_.'employee` WHERE `active` = 1 AND ORDER BY `email` '); foreach ($employees as $key => $employee) { $date_passwd_upd = new Datetime($employee['date_passwd_upd']); if($now > $updated_date_send && $date_passwd_upd < $sending_date){ $data = array( '{limit}' => (int)$limit, '{employee}' => $employee['name'], '{reset_link}' => $reset_link, ); Mail::Send(2, 'resetpassword_2', 'Sécurité Prestashop', $data, $employee['email']); } } exit;