Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions api/sendPic.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@
exit();
}

if ($config['mail']['send_all_later']) {
if ($config['mail']['send_all_later'] || isset($_POST['addToDb'])) {
$mailService = MailService::getInstance();
// Save each recipient to the database
foreach ($recipients as $recipient) {
$mailService->addRecipientToDatabase($recipient);
}
echo json_encode(['success' => true, 'saved' => true]);
exit();
if ($config['mail']['send_all_later']) {
echo json_encode(['success' => true, 'saved' => true]);
exit();
}
}

if (empty($_POST['image'])) {
Expand Down
20 changes: 20 additions & 0 deletions assets/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,26 @@ const photoBooth = (function () {
virtualKeyboard.initialize(config.mail.keyboardLayout, '#send-mail-recipient', '#send-mail-form');
}

// add to database on send
if (!config.mail.send_all_later) {
const dbCheckboxWrapper = document.createElement('div');
dbCheckboxWrapper.classList.add('form-db-checkbox-wrapper');

const dbCheckbox = document.createElement('input');
dbCheckbox.type = 'checkbox';
dbCheckbox.id = 'send-mail-db-checkbox';
dbCheckbox.name = 'addToDb';
dbCheckbox.classList.add('form-db-checkbox');

const dbCheckboxLabel = document.createElement('label');
dbCheckboxLabel.htmlFor = 'send-mail-db-checkbox';
dbCheckboxLabel.textContent = ' ' + photoboothTools.getTranslation('add_to_mail_database');

dbCheckboxWrapper.appendChild(dbCheckbox);
dbCheckboxWrapper.appendChild(dbCheckboxLabel);
form.appendChild(dbCheckboxWrapper);
}

// Submit
const submitLabel = config.mail.send_all_later
? photoboothTools.getTranslation('add')
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"add": "Add",
"add_entry": "Add entry",
"add_image": "Add image",
"add_to_mail_database": "save email address(es)",
"admin_panel": "Admin panel",
"adminpanel_back": "Back",
"adminpanel_toggletextOFF": "Off",
Expand Down
Loading