From aa7848c34ba439b43a13e5a0869e84bea417f745 Mon Sep 17 00:00:00 2001 From: Richard Toth Date: Fri, 23 May 2025 14:12:15 +0200 Subject: [PATCH 1/3] remove some fields from kids and change exported data columns --- _class/class_user_kid.php | 36 +-- _css/button.css | 7 +- _include/include_export_users.php | 31 +-- _include/include_userlist.php | 31 +-- template/templates/user_data_create.tpl | 185 ++++++--------- template/templates/user_data_edit.tpl | 290 +++++++++--------------- template/templates/user_export_list.tpl | 36 +-- 7 files changed, 231 insertions(+), 385 deletions(-) diff --git a/_class/class_user_kid.php b/_class/class_user_kid.php index 9283fb0..441fb8c 100644 --- a/_class/class_user_kid.php +++ b/_class/class_user_kid.php @@ -418,25 +418,12 @@ class user_kid extends user_parent { $_user_value_array['uk_parent_1'] = self::add_new_parent( $_user_value_array['add_parent_1'], $_user_value_array['parent_1_email'], - $_user_value_array['parent_1_facebook'], $_user_value_array['parent_1_phone']); + '', $_user_value_array['parent_1_phone']); log::register('new_parent', $_user_value_array['uk_parent_1']); } if (isset($_user_value_array['add_parent_1'])) unset($_user_value_array['add_parent_1']); if (isset($_user_value_array['parent_1_email'])) unset($_user_value_array['parent_1_email']); - if (isset($_user_value_array['parent_1_facebook'])) unset($_user_value_array['parent_1_facebook']); if (isset($_user_value_array['parent_1_phone'])) unset($_user_value_array['parent_1_phone']); - //PARENT_2 HANDLER - if (isset($_user_value_array['add_parent_2']) && $_user_value_array['add_parent_2'] != "") { - $_user_value_array['uk_parent_2'] = self::add_new_parent( - $_user_value_array['add_parent_2'], - $_user_value_array['parent_2_email'], $_user_value_array['parent_2_facebook'], - $_user_value_array['parent_2_phone']); - log::register('new_parent', $_user_value_array['uk_parent_2']); - } - if (isset($_user_value_array['add_parent_2'])) unset($_user_value_array['add_parent_2']); - if (isset($_user_value_array['parent_2_email'])) unset($_user_value_array['parent_2_email']); - if (isset($_user_value_array['parent_2_facebook'])) unset($_user_value_array['parent_2_facebook']); - if (isset($_user_value_array['parent_2_phone'])) unset($_user_value_array['parent_2_phone']); //date handler if (!isset($_user_value_array['uk_first_training']) || $_user_value_array['uk_first_training'] == "") { @@ -482,38 +469,21 @@ class user_kid extends user_parent { $_user_value_array['uk_parent_1'] = self::add_new_parent( $_user_value_array['add_parent_1'], $_user_value_array['parent_1_email'], - $_user_value_array['parent_1_facebook'], $_user_value_array['parent_1_phone']); + '', $_user_value_array['parent_1_phone']); log::register('new_parent', $_user_value_array['uk_parent_1']); } else { //meglévő szülő updatelése user_parent::update_parent(array( 'up_email' => $_user_value_array['parent_1_email'], - 'up_facebook' => $_user_value_array['parent_1_facebook'], 'up_phone' => $_user_value_array['parent_1_phone']), $_user_value_array['uk_parent_1']); } if (isset($_user_value_array['add_parent_1'])) unset($_user_value_array['add_parent_1']); if (isset($_user_value_array['parent_1_email'])) unset($_user_value_array['parent_1_email']); - if (isset($_user_value_array['parent_1_facebook'])) unset($_user_value_array['parent_1_facebook']); if (isset($_user_value_array['parent_1_phone'])) unset($_user_value_array['parent_1_phone']); //PARENT_2 HANDLER - if (isset($_user_value_array['add_parent_2']) && $_user_value_array['add_parent_2'] != "") { - $_user_value_array['uk_parent_2'] = self::add_new_parent( - $_user_value_array['add_parent_2'], - $_user_value_array['parent_2_email'], $_user_value_array['parent_2_facebook'], - $_user_value_array['parent_2_phone']); - log::register('new_parent', $_user_value_array['uk_parent_2']); - } - else { - //meglévő szülő updatelése - //var_dump($_user_value_array['uk_parent_2']); - user_parent::update_parent(array( - 'up_email' => $_user_value_array['parent_2_email'], - 'up_facebook' => $_user_value_array['parent_2_facebook'], - 'up_phone' => $_user_value_array['parent_2_phone']), $_user_value_array['uk_parent_2']); - - } + if (isset($_user_value_array['add_parent_2'])) unset($_user_value_array['add_parent_2']); if (isset($_user_value_array['parent_2_email'])) unset($_user_value_array['parent_2_email']); if (isset($_user_value_array['parent_2_facebook'])) unset($_user_value_array['parent_2_facebook']); diff --git a/_css/button.css b/_css/button.css index 7f026b9..7784938 100644 --- a/_css/button.css +++ b/_css/button.css @@ -42,8 +42,13 @@ text-shadow: 0 1px 0 #2f2f2f; padding: 5px; } + +.button.black[disabled] { + color: #aa9e9e; + background: linear-gradient(#656565, #6a6262); +} -.button.black:hover { +.button.black:not([disabled]):hover { background: #4c4c4c; background: -webkit-gradient(linear, 0 0, 0 bottom, from(#4c4c4c), to(#565656)); background: -moz-linear-gradient(#4c4c4c, #565656); diff --git a/_include/include_export_users.php b/_include/include_export_users.php index efa39ab..01e9361 100644 --- a/_include/include_export_users.php +++ b/_include/include_export_users.php @@ -3,28 +3,33 @@ $userAssocArray = $sql->assoc_array(" SELECT uk_name AS 'Név', - GROUP_CONCAT(trt_name) as 'Szint', - sc_name as 'Iskola', - uk_email as 'Email', - uk_phone as 'Telefonszám', - p1.up_name as 'Szülő1', - p1.up_email as 'Sz1_Email', - p1.up_phone as 'Sz1_Telefonszám', - p2.up_name as 'Szülő2', - p2.up_email as 'Sz2_Email', - p2.up_phone as 'Sz2_Telefonszám' + CASE + WHEN uk_gender = 1 THEN 'fiú' + ELSE 'lány' + END AS 'Nem', + uk_birth_date AS 'Születési dátum', + scc_city AS 'Lakhely', + CASE + WHEN uk_hand = 1 THEN 'bal' + ELSE 'jobb' + END AS 'Kéz', + sc_name AS 'Iskola', + uk_email AS 'Email', + uk_phone AS 'Telefonszám', + p1.up_name AS 'Szülő', + p1.up_email AS 'Szülő Email', + p1.up_phone AS 'Szülő Telefonszám', + uk_other AS 'Egyéb' FROM user_kid LEFT JOIN user_parent p1 ON p1.up_id = uk_parent_1 LEFT JOIN - user_parent p2 ON p2.up_id = uk_parent_2 - LEFT JOIN school ON sc_id = uk_school_sc_id LEFT JOIN user_kid_training_type ON uktt_user_kid_uk_id = uk_id LEFT JOIN - training_type ON trt_id = uktt_training_type_tt_id + school_city ON uk_address_scc_id = scc_id WHERE uk_deleted = 0 AND uk_is_active = 1 GROUP BY uk_name diff --git a/_include/include_userlist.php b/_include/include_userlist.php index ab07cd7..a560916 100644 --- a/_include/include_userlist.php +++ b/_include/include_userlist.php @@ -3,28 +3,33 @@ $userAssocArray = $sql->assoc_array(" SELECT uk_name AS 'Név', - GROUP_CONCAT(trt_name) as 'Szint', - sc_name as 'Iskola', - uk_email as 'Email', - uk_phone as 'Telefonszám', - p1.up_name as 'Szülő1', - p1.up_email as 'Sz1_Email', - p1.up_phone as 'Sz1_Telefonszám', - p2.up_name as 'Szülő2', - p2.up_email as 'Sz2_Email', - p2.up_phone as 'Sz2_Telefonszám' + CASE + WHEN uk_gender = 1 THEN 'fiú' + ELSE 'lány' + END AS 'Nem', + uk_birth_date AS 'Születési dátum', + scc_city AS 'Lakhely', + CASE + WHEN uk_hand = 1 THEN 'bal' + ELSE 'jobb' + END AS 'Kéz', + sc_name AS 'Iskola', + uk_email AS 'Email', + uk_phone AS 'Telefonszám', + p1.up_name AS 'Szülő', + p1.up_email AS 'Szülő Email', + p1.up_phone AS 'Szülő Telefonszám', + uk_other AS 'Egyéb' FROM user_kid LEFT JOIN user_parent p1 ON p1.up_id = uk_parent_1 LEFT JOIN - user_parent p2 ON p2.up_id = uk_parent_2 - LEFT JOIN school ON sc_id = uk_school_sc_id LEFT JOIN user_kid_training_type ON uktt_user_kid_uk_id = uk_id LEFT JOIN - training_type ON trt_id = uktt_training_type_tt_id + school_city ON uk_address_scc_id = scc_id WHERE uk_deleted = 0 AND uk_is_active = 1 GROUP BY uk_name diff --git a/template/templates/user_data_create.tpl b/template/templates/user_data_create.tpl index 93b8d6d..68a8e77 100644 --- a/template/templates/user_data_create.tpl +++ b/template/templates/user_data_create.tpl @@ -61,18 +61,7 @@ - -
- -
-
- -
- -
-
- - +
Kéz:
@@ -85,16 +74,6 @@
- {*
- - {foreach $tt_assoc_array as $tt} -
- - {$tt['trt_name']} -
- {/foreach} -
*} -
@@ -105,30 +84,6 @@
-
- -
-
- -
- -
- -
-
- -
- -
-
-
@@ -162,33 +117,6 @@
- - - -
- -
- -
-
- -
- -
-
- -
- -
-
-
@@ -216,52 +144,6 @@
-
- -
-
- - -
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
- -
-

@@ -275,7 +157,7 @@
- +
@@ -297,4 +179,67 @@ $('#uk_school_sc_id').change(function() { $(".add_school").toggle(this.value == 'null'); }); +document.addEventListener("DOMContentLoaded", function () { + const form = document.querySelector(".form_wrapper form"); + const submitButton = form.querySelector('input.button.black[type="submit"]'); + + const textInputs = Array.from(form.querySelectorAll('input[type="text"], input[type="email"], textarea')); + + // Select fields that control conditional validation + const parentSelect = form.querySelector('#uk_parent_1'); + const schoolSelect = form.querySelector('#uk_school_sc_id'); + const addressSelect = form.querySelector('#uk_address_scc_id'); + + const conditionalFields = [ + { + select: parentSelect, + valueToIgnore: 'null', + fields: [ + form.querySelector('#add_parent_1'), + form.querySelector('#parent_1_email'), + form.querySelector('#parent_1_phone') + ] + }, + { + select: schoolSelect, + valueToIgnore: 'null', + fields: [ + form.querySelector('#add_school') + ] + } + ]; + + function toggleSubmitButton() { + let fieldsToCheck = [...textInputs]; + + // Exclude fields based on select value + conditionalFields.forEach(group => { + if (group.select.value !== group.valueToIgnore) { + fieldsToCheck = fieldsToCheck.filter(field => !group.fields.includes(field)); + } + }); + + // Check if any required field is empty + const anyEmpty = fieldsToCheck.some(input => input.value.trim() === ""); + + // Check if uk_address_scc_id is still "null" + const addressMissing = addressSelect.value === "null"; + + submitButton.disabled = anyEmpty || addressMissing; + } + + // Listen to input changes + textInputs.forEach(input => { + input.addEventListener("input", toggleSubmitButton); + }); + + // Listen to select changes + [parentSelect, schoolSelect, addressSelect].forEach(select => { + select.addEventListener("change", toggleSubmitButton); + }); + + // Initial validation + toggleSubmitButton(); +}); + diff --git a/template/templates/user_data_edit.tpl b/template/templates/user_data_edit.tpl index 700bae7..c36b730 100644 --- a/template/templates/user_data_edit.tpl +++ b/template/templates/user_data_edit.tpl @@ -1,42 +1,36 @@
- -
- - - +
+ Törlés +
+ + + +
-
+
-
+
-
-
- -
- -
+
+
-
+
-{*
- -
-
*} -
{{$user_data.uk_balance|number_format:0:'':' '}} Ft
@@ -90,7 +84,8 @@
-
- -
- -
-
-
Kéz:
@@ -120,16 +105,6 @@
- {*
- - {foreach $tt_assoc_array as $tt} -
- - {$tt['trt_name']} -
- {/foreach} -
*} -
@@ -140,37 +115,14 @@
-
- -
-
- -
- -
- -
-
- -
- -
-
-
- - {foreach $region_assoc_array as $region_array} - - {/foreach} - -
-
- -
- -
-
- -
- -
-
-
-
- -
-
- - - - -
- -
- -
-
- -
- -
-
- -
- -
-
-
- -
-
- -
- -
-
- -
- -
- -
-

@@ -317,11 +197,11 @@
- + + document.addEventListener("DOMContentLoaded", function() { + const form = document.querySelector(".form_wrapper form"); + const submitButton = form.querySelector('input.button.black[type="submit"]'); + + const textInputs = Array.from(form.querySelectorAll( + 'input[type="text"], input[type="email"], textarea')); + + // Select fields that control conditional validation + const parentSelect = form.querySelector('#uk_parent_1'); + const schoolSelect = form.querySelector('#uk_school_sc_id'); + const addressSelect = form.querySelector('#uk_address_scc_id'); + + const conditionalFields = [{ + select: parentSelect, + valueToIgnore: 'null', + fields: [ + form.querySelector('#add_parent_1'), + form.querySelector('#parent_1_email'), + form.querySelector('#parent_1_phone') + ] + }, + { + select: schoolSelect, + valueToIgnore: 'null', + fields: [ + form.querySelector('#add_school') + ] + } + ]; + + function toggleSubmitButton() { + let fieldsToCheck = [...textInputs]; + + // Exclude fields based on select value + conditionalFields.forEach(group => { + if (group.select.value !== group.valueToIgnore) { + fieldsToCheck = fieldsToCheck.filter(field => !group.fields.includes(field)); + } + }); + + // Check if any required field is empty + const anyEmpty = fieldsToCheck.some(input => input.value.trim() === ""); + + // Check if uk_address_scc_id is still "null" + const addressMissing = addressSelect.value === "null"; + + submitButton.disabled = anyEmpty || addressMissing; + } + + // Listen to input changes + textInputs.forEach(input => { + input.addEventListener("input", toggleSubmitButton); + }); + + // Listen to select changes + [parentSelect, schoolSelect, addressSelect].forEach(select => { + select.addEventListener("change", toggleSubmitButton); + }); + + // Initial validation + toggleSubmitButton(); + }); + \ No newline at end of file diff --git a/template/templates/user_export_list.tpl b/template/templates/user_export_list.tpl index 5d005be..185b911 100644 --- a/template/templates/user_export_list.tpl +++ b/template/templates/user_export_list.tpl @@ -8,30 +8,32 @@ - + + + + + + - - - - - - - - + + + + {foreach $users as $user} - - + + + + - - - - - - + + + + + {/foreach}
NévSzintNemSzületési dátumLakhelyKézEmailTelefonszám IskolaEmailTelefonszámSzülő 1EmailTelefonszámSzülő 2EmailTelefonszámSzülőSzülő EmailSzülő TelefonszámEgyéb
{$user['Név']}{$user['Szint']}{$user['Iskola']}{$user['Nem']}{$user['Születési dátum']}{$user['Lakhely']}{$user['Kéz']} {$user['Email']} {$user['Telefonszám']}{$user['Szülő1']}{$user['Sz1_Email']}{$user['Sz1_Telefonszám']}{$user['Szülő2']}{$user['Sz2_Email']}{$user['Sz2_Telefonszám']}{$user['Iskola']}{$user['Szülő']}{$user['Szülő Email']}{$user['Szülő Telefonszám']}{$user['Egyéb']}
From 50936f84e3f115925c2978f87c56061b367ae22a Mon Sep 17 00:00:00 2001 From: Richard Toth Date: Sat, 24 May 2025 18:56:48 +0200 Subject: [PATCH 2/3] add notify emails --- _ajax/send_notify.php | 113 ++++++++++++ _class/class_camp_apply.php | 2 +- _class/class_email_log.php | 212 +++++++++++++++++++++++ _class/class_user_kid.php | 10 ++ _css/default.css | 4 + _include/include_email.php | 17 ++ _include/include_emails.php | 37 ++++ queries/20250525_email_logs.sql | 7 + template/templates/email.tpl | 37 ++++ template/templates/emails.tpl | 75 ++++++++ template/templates/user_balance_list.tpl | 57 +++++- 11 files changed, 568 insertions(+), 3 deletions(-) create mode 100644 _ajax/send_notify.php create mode 100644 _class/class_email_log.php create mode 100644 _include/include_email.php create mode 100644 _include/include_emails.php create mode 100644 queries/20250525_email_logs.sql create mode 100644 template/templates/email.tpl create mode 100644 template/templates/emails.tpl diff --git a/_ajax/send_notify.php b/_ajax/send_notify.php new file mode 100644 index 0000000..7af2f8b --- /dev/null +++ b/_ajax/send_notify.php @@ -0,0 +1,113 @@ + $value) { + trigger_error($_SERVER['HTTP_HOST'], E_USER_NOTICE); +} +*/ +include('../_include/include_db_conn.php'); + +if (empty($_POST['uk_id'])) { + echo json_encode(null); +} else { + $toNotify = new user_kid(); + $toNotify->set_user_data_by_id($_POST['uk_id']); + + if (null === $toNotify->get_uk_parent_1()->get_up_email() || null === $toNotify->get_uk_parent_1()->get_up_name()) { + echo json_encode('missing-data'); + } else { + $email_template_id = $sql->single_variable('select et_id from email_template where et_name = \'below_zero\''); + if (null !== $email_template_id) { + $emailTemplate = new email_template(); + $emailTemplate->set_et_data_by_id($email_template_id); + + $raw_subject = $emailTemplate->get_et_subject(); + $raw_message = $emailTemplate->get_et_message(); + //var_dump($toNotify_array); + //foreach ($toNotify_array as $toNotify) { + $personalizedSubject = $emailTemplate->personalize($raw_subject, array( + 'uk_name' => $toNotify->get_uk_name(), + )); + + $personalizedMessage = $emailTemplate->personalize($raw_message, array( + 'notify_name' => $toNotify->get_uk_parent_1()->get_up_name(), + 'uk_name' => $toNotify->get_uk_name(), + )); + + $mail = new PHPMailer(true); // Passing `true` enables exceptions + try { + //Server settings + $mail->SMTPDebug = 4; // Enable verbose debug output + $mail->isSMTP(); // Set mailer to use SMTP + $mail->CharSet = PHPMailer::CHARSET_UTF8; // UTF-8 + $mail->Host = 'mail.livingsport.hu'; // Specify main and backup SMTP servers + $mail->SMTPAuth = true; // Enable SMTP authentication + $mail->Username = 'notify@livingsport.hu'; // SMTP username + $mail->Password = 'dpDiKSqU0V'; // SMTP password + $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted + $mail->Port = 465; + + //Recipients + $mail->setFrom($emailTemplate->get_et_from_email(), $emailTemplate->get_et_from_name()); + // $mail->addAddress($toNotify->get_uk_parent_1()->get_up_email(), $toNotify->get_uk_parent_1()->get_up_name()); + $mail->addAddress('tricsusz@gmail.com', 'Tóth Richárd'); // TEST + + + //Content + $mail->isHTML(true); // Set email format to HTML + $mail->Subject = $personalizedSubject; + $mail->Body = $personalizedMessage; + $mail->AltBody = 'Az Ön levelezője nem támogatja a HTML tartalom megjelenítését!'; + + //send mail + $mail->send(); + //LOG SUCCESS + email_log::create_email_log( + $personalizedMessage, + $personalizedSubject, + $toNotify->get_uk_parent_1()->get_up_name(), + $toNotify->get_uk_parent_1()->get_up_email(), + $emailTemplate->get_et_id() + ); + + //Update kids last noti date + $sql->update_table('user_kid', array('uk_last_notification' => date('Y-m-d H:i:s')), array('uk_id' => $toNotify->get_uk_id())); + + echo json_encode('success'); + + } catch (Exception $e) { + //LOG ERROR + email_log::create_email_log( + $personalizedMessage, + $personalizedSubject, + $toNotify->get_uk_parent_1()->get_up_name(), + $toNotify->get_uk_parent_1()->get_up_email(), + $emailTemplate->get_et_id(), + mysql_escape_string($e) + ); + + echo json_encode(null); + } + + //} + } + } +} + +?> + diff --git a/_class/class_camp_apply.php b/_class/class_camp_apply.php index efaa739..165312d 100644 --- a/_class/class_camp_apply.php +++ b/_class/class_camp_apply.php @@ -221,7 +221,7 @@ class camp_apply $mail->SMTPDebug = 0; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->CharSet = PHPMailer::CHARSET_UTF8; // UTF-8 - $mail->Host = 'mail.livingsport.hu '; // Specify main and backup SMTP servers + $mail->Host = 'mail.livingsport.hu'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'notify@livingsport.hu'; // SMTP username $mail->Password = 'dpDiKSqU0V'; // SMTP password diff --git a/_class/class_email_log.php b/_class/class_email_log.php new file mode 100644 index 0000000..4c31a58 --- /dev/null +++ b/_class/class_email_log.php @@ -0,0 +1,212 @@ +assoc_array("select * from email_log where el_id = " . $_id); + $el_data_array = $el_data_assoc_array[0]; + foreach ($el_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + if ('el_email_template_et_id' == $field) { + $new_et = new email_template(); + $new_et->set_et_data_by_id($value); + $this->set_el_email_template_et_id($new_et); + } + } + } + + public static function create_email_log($_message, $_subject, $_name, $_email, $_et, $_exc = 'null', $_date = null) + { + global $sql; + + if (null === $_date) { + $_date = date('Y-m-d H:i:s'); + } + + return $sql->insert_into('email_log', array( + 'el_message' => $_message, + 'el_subject' => $_subject, + 'el_to_name' => $_name, + 'el_to_email' => $_email, + 'el_email_template_et_id' => $_et, + 'el_exception' => $_exc, + 'el_sent_date' => $_date + )); + } + + /** + * @return mixed + */ + public function get_el_id() + { + return $this->el_id; + } + + /** + * @param mixed $el_id + * + * @return self + */ + public function set_el_id($el_id) + { + $this->el_id = $el_id; + + return $this; + } + + /** + * @return mixed + */ + public function get_el_message() + { + return $this->el_message; + } + + /** + * @param mixed $el_message + * + * @return self + */ + public function set_el_message($el_message) + { + $this->el_message = $el_message; + + return $this; + } + + /** + * @return mixed + */ + public function get_el_subject() + { + return $this->el_subject; + } + + /** + * @param mixed $el_subject + * + * @return self + */ + public function set_el_subject($el_subject) + { + $this->el_subject = $el_subject; + + return $this; + } + + /** + * @return mixed + */ + public function get_el_to_name() + { + return $this->el_to_name; + } + + /** + * @param mixed $el_to_name + * + * @return self + */ + public function set_el_to_name($el_to_name) + { + $this->el_to_name = $el_to_name; + + return $this; + } + + /** + * @return mixed + */ + public function get_el_to_email() + { + return $this->el_to_email; + } + + /** + * @param mixed $el_to_email + * + * @return self + */ + public function set_el_to_email($el_to_email) + { + $this->el_to_email = $el_to_email; + + return $this; + } + + /** + * @return mixed + */ + public function get_el_sent_date() + { + return $this->el_sent_date; + } + + /** + * @param mixed $el_sent_date + * + * @return self + */ + public function set_el_sent_date($el_sent_date) + { + $this->el_sent_date = $el_sent_date; + + return $this; + } + + /** + * @return mixed + */ + public function get_el_exception() + { + return $this->el_exception; + } + + /** + * @param mixed $el_exception + * + * @return self + */ + public function set_el_exception($el_exception) + { + $this->el_exception = $el_exception; + + return $this; + } + + /** + * @return mixed + */ + public function get_el_email_template_et_id() + { + return $this->el_email_template_et_id; + } + + /** + * @param mixed $el_email_template_et_id + * + * @return self + */ + public function set_el_email_template_et_id($el_email_template_et_id) + { + $this->el_email_template_et_id = $el_email_template_et_id; + + return $this; + } +} + + +?> + diff --git a/_class/class_user_kid.php b/_class/class_user_kid.php index 441fb8c..ec9d723 100644 --- a/_class/class_user_kid.php +++ b/_class/class_user_kid.php @@ -128,6 +128,11 @@ class user_kid extends user_parent { public function get_uk_shirt_size() { return $this->user_shirt_size; } + + public function get_uk_is_active() { + return $this->user_is_active; + } + public function get_uk_shirt_size_name() { global $sql; if ($this->user_shirt_size) return $sql->single_variable("select shirt_name from shirt where shirt_id = " . $this->user_shirt_size); @@ -375,6 +380,11 @@ class user_kid extends user_parent { $city->set_school_city_data_by_id($value); $this->set_uk_address($city); } + if ($field == 'uk_parent_1' && !empty($value)) { + $parent = new user_parent(); + $parent->set_user_data_by_id($value); + $this->set_uk_parent_1($parent); + } //$this->set_ua_type(2); //kid típus beállítása } $this->set_login(true); diff --git a/_css/default.css b/_css/default.css index 42e6537..e26e1e4 100644 --- a/_css/default.css +++ b/_css/default.css @@ -759,6 +759,10 @@ form#auto_filters > div > label { background-color: cadetblue; } +.notification-text.disabled { + opacity: 0.5; +} + .notification-text.in-progress { background-color: #f5ea16; } diff --git a/_include/include_email.php b/_include/include_email.php new file mode 100644 index 0000000..387890f --- /dev/null +++ b/_include/include_email.php @@ -0,0 +1,17 @@ +is_id()) { + + # EMAIL LOG RÉSZLETEK + + $email_log = new email_log(); + $email_log->set_el_data_by_id($this->get_id()); + + $smarty->assign('email', $email_log); + $smarty->display('email.tpl'); +} else { + +} + +?> + diff --git a/_include/include_emails.php b/_include/include_emails.php new file mode 100644 index 0000000..f11a983 --- /dev/null +++ b/_include/include_emails.php @@ -0,0 +1,37 @@ +is_id()) { + + # EMAIL LISTA (50 / oldal) + + $all_emails_query = "SELECT count(DISTINCT el_id) FROM email_log"; + $emails_query = "SELECT * FROM email_log ORDER BY el_sent_date DESC LIMIT " . ($this->is_id() ? ($this->get_id() - 1) * 50 : "0") . ",50"; + $el_assoc_array = $sql->assoc_array($emails_query); + $el_count = $sql->single_variable($all_emails_query); + $next_link = true; + + $el_array = array(); + foreach ($el_assoc_array as $key => $el) { + $new_el = new email_log(); + $new_el->set_el_data_by_id($el['el_id']); + $el_array[] = $new_el; + } + + $fold = $el_count > 50; + + if ($el_count <= $this->get_id() * 50) { + $next_link = false; + } + + $smarty->assign('el_array', $el_array); + $smarty->assign('fold', $fold); + $smarty->assign('next_id', $next_link ? $this->get_id() + 1 : false); + $smarty->assign('previous_id', ($this->get_id() > 1 ? $this->get_id() - 1 : false)); + + $smarty->display('emails.tpl'); +} else { + header("Location: /admin/emails/1"); +} + +?> + diff --git a/queries/20250525_email_logs.sql b/queries/20250525_email_logs.sql new file mode 100644 index 0000000..0b5b3c9 --- /dev/null +++ b/queries/20250525_email_logs.sql @@ -0,0 +1,7 @@ +INSERT INTO `setting` (`set_id`, `set_name`, `set_setting_type_st_id`) VALUES (NULL, 'Email küldés log', '3'); + +INSERT INTO `setting_value` (`setv_id`, `setv_set_date`, `setv_setting_set_id`, `setv_int`, `setv_varchar`, `setv_text`, `setv_date`) VALUES (NULL, '2025-05-24 15:18:09.000000', '6', NULL, 'emails', NULL, NULL); + + CREATE TABLE `email_log` ( `el_id` int(11) NOT NULL, `el_email_template_et_id` int(11) NOT NULL, `el_to_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_to_email` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_message` text CHARACTER SET utf8 COLLATE utf8_hungarian_ci, `el_sent_date` datetime DEFAULT NULL, `el_exception` text CHARACTER SET utf8 COLLATE utf8_hungarian_ci ) ENGINE=InnoDB DEFAULT CHARSET=latin1 + + INSERT INTO `email_template` (`et_id`, `et_name`, `et_title`, `et_deleted`, `et_message`, `et_subject`, `et_from_name`, `et_from_email`) VALUES (NULL, 'below_zero', 'Értesítés negatív egyenlegről', '0', 'Kedves {$notify_name}!
\r\n
\r\nNyilvántartásunk szerint {$uk_name} tollaslabda edzésdíj egyenlege 0 Ft alá csökkent.
\r\n
\r\nLiving Sport
\r\n
\r\nui.: Ez egy automatikusan generált üzenet, amelyre nem várunk választ.', 'Értesítés negatív egyenlegről', 'Living Sport', 'notify@livingsport.hu'); \ No newline at end of file diff --git a/template/templates/email.tpl b/template/templates/email.tpl new file mode 100644 index 0000000..b27c137 --- /dev/null +++ b/template/templates/email.tpl @@ -0,0 +1,37 @@ +
+
+ +
{$email->get_el_to_name()}
<{$email->get_el_to_email()}>
+
+
+ +
{$email->get_el_subject()}
+
+
+ +
{$email->get_el_sent_date()}
+
+
+ +
{$email->get_el_message()}
+
+ + {if $email->get_el_exception()} +
+ +
{$email->get_el_exception()}
+
+ {/if} + + +
\ No newline at end of file diff --git a/template/templates/emails.tpl b/template/templates/emails.tpl new file mode 100644 index 0000000..f79f760 --- /dev/null +++ b/template/templates/emails.tpl @@ -0,0 +1,75 @@ +{if $fold} + + + +{/if} + +
+ + + + + + + + + + {foreach $el_array as $log} + + + + + + + + + {/foreach} + + +
+ + + + \ No newline at end of file diff --git a/template/templates/user_balance_list.tpl b/template/templates/user_balance_list.tpl index 8452cdd..665cfa1 100644 --- a/template/templates/user_balance_list.tpl +++ b/template/templates/user_balance_list.tpl @@ -7,14 +7,67 @@ + +
{foreach $user_kids as $user} - - + From 323be3f77e07a64a9a74cdcf97063f300449f67a Mon Sep 17 00:00:00 2001 From: Richard Toth Date: Fri, 30 May 2025 09:39:18 +0200 Subject: [PATCH 3/3] fix query --- queries/20250525_email_logs.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/queries/20250525_email_logs.sql b/queries/20250525_email_logs.sql index 0b5b3c9..9e024af 100644 --- a/queries/20250525_email_logs.sql +++ b/queries/20250525_email_logs.sql @@ -2,6 +2,6 @@ INSERT INTO `setting` (`set_id`, `set_name`, `set_setting_type_st_id`) VALUES (N INSERT INTO `setting_value` (`setv_id`, `setv_set_date`, `setv_setting_set_id`, `setv_int`, `setv_varchar`, `setv_text`, `setv_date`) VALUES (NULL, '2025-05-24 15:18:09.000000', '6', NULL, 'emails', NULL, NULL); - CREATE TABLE `email_log` ( `el_id` int(11) NOT NULL, `el_email_template_et_id` int(11) NOT NULL, `el_to_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_to_email` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_message` text CHARACTER SET utf8 COLLATE utf8_hungarian_ci, `el_sent_date` datetime DEFAULT NULL, `el_exception` text CHARACTER SET utf8 COLLATE utf8_hungarian_ci ) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CREATE TABLE `email_log` ( `el_id` int(11) NOT NULL, `el_email_template_et_id` int(11) NOT NULL, `el_to_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_to_email` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_message` text CHARACTER SET utf8 COLLATE utf8_hungarian_ci, `el_sent_date` datetime DEFAULT NULL, `el_exception` text CHARACTER SET utf8 COLLATE utf8_hungarian_ci ) ENGINE=InnoDB DEFAULT CHARSET=latin1 - INSERT INTO `email_template` (`et_id`, `et_name`, `et_title`, `et_deleted`, `et_message`, `et_subject`, `et_from_name`, `et_from_email`) VALUES (NULL, 'below_zero', 'Értesítés negatív egyenlegről', '0', 'Kedves {$notify_name}!
\r\n
\r\nNyilvántartásunk szerint {$uk_name} tollaslabda edzésdíj egyenlege 0 Ft alá csökkent.
\r\n
\r\nLiving Sport
\r\n
\r\nui.: Ez egy automatikusan generált üzenet, amelyre nem várunk választ.', 'Értesítés negatív egyenlegről', 'Living Sport', 'notify@livingsport.hu'); \ No newline at end of file +INSERT INTO `email_template` (`et_id`, `et_name`, `et_title`, `et_deleted`, `et_message`, `et_subject`, `et_from_name`, `et_from_email`) VALUES (NULL, 'below_zero', 'Tollaslabda edzésdíj tartozás', '0', 'Kedves {$notify_name}!

Egyesületünk tollaslabda edzésdíj tartozást állapított meg {$uk_name} esetében.
Kérlek légy oly kedves és fáradj be hozzánk, hogy tartozásotokat rendezzétek.

Tartozásotokat több módon is rendezni tudjátok: készpénz, bankkártya, szépkártya.

Tartozásotokat több módon is rendezni tudjátok: készpénz, bankkártya, szépkártya.

Üdvözlettel,
Életmód Sport Egyesület
+36204100735
info@lvingsport.hu', 'Tollaslabda edzésdíj tartozás', 'Living Sport', 'notify@livingsport.hu'); \ No newline at end of file