Skip to content

Commit 40abaae

Browse files
committed
mail: add checkbox to add mail address to db
Change-Id: I6c33ae08d7e5d0a9b6177aca43dd5b245573a514
1 parent 4dc72f3 commit 40abaae

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

api/sendPic.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,16 @@
4848
exit();
4949
}
5050

51-
if ($config['mail']['send_all_later']) {
51+
if ($config['mail']['send_all_later'] || isset($_POST['addToDb'])) {
5252
$mailService = MailService::getInstance();
5353
// Save each recipient to the database
5454
foreach ($recipients as $recipient) {
5555
$mailService->addRecipientToDatabase($recipient);
5656
}
57-
echo json_encode(['success' => true, 'saved' => true]);
58-
exit();
57+
if ($config['mail']['send_all_later']) {
58+
echo json_encode(['success' => true, 'saved' => true]);
59+
exit();
60+
}
5961
}
6062

6163
if (empty($_POST['image'])) {

assets/js/core.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,26 @@ const photoBooth = (function () {
10721072
virtualKeyboard.initialize(config.mail.keyboardLayout, '#send-mail-recipient', '#send-mail-form');
10731073
}
10741074

1075+
// add to database on send
1076+
if (!config.mail.send_all_later) {
1077+
const dbCheckboxWrapper = document.createElement('div');
1078+
dbCheckboxWrapper.classList.add('form-db-checkbox-wrapper');
1079+
1080+
const dbCheckbox = document.createElement('input');
1081+
dbCheckbox.type = 'checkbox';
1082+
dbCheckbox.id = 'send-mail-db-checkbox';
1083+
dbCheckbox.name = 'addToDb';
1084+
dbCheckbox.classList.add('form-db-checkbox');
1085+
1086+
const dbCheckboxLabel = document.createElement('label');
1087+
dbCheckboxLabel.htmlFor = 'send-mail-db-checkbox';
1088+
dbCheckboxLabel.textContent = ' ' + photoboothTools.getTranslation('add_to_mail_database');
1089+
1090+
dbCheckboxWrapper.appendChild(dbCheckbox);
1091+
dbCheckboxWrapper.appendChild(dbCheckboxLabel);
1092+
form.appendChild(dbCheckboxWrapper);
1093+
}
1094+
10751095
// Submit
10761096
const submitLabel = config.mail.send_all_later
10771097
? photoboothTools.getTranslation('add')

resources/lang/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"abort": "Abort",
33
"add": "Add",
44
"add_image": "Add image",
5+
"add_to_mail_database": "save email address(es)",
56
"admin_panel": "Admin panel",
67
"adminpanel_back": "Back",
78
"adminpanel_toggletextOFF": "Off",

0 commit comments

Comments
 (0)