mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under the License.
|
||||
|
||||
import os.path
|
||||
from datetime import date, datetime, time
|
||||
from decimal import Decimal
|
||||
|
||||
@@ -68,6 +69,7 @@ from pretix.base.services.placeholders import FormPlaceholderMixin
|
||||
from pretix.base.services.pricing import get_price
|
||||
from pretix.control.forms import SplitDateTimeField
|
||||
from pretix.control.forms.widgets import Select2
|
||||
from pretix.helpers.hierarkey import clean_filename
|
||||
from pretix.helpers.money import change_decimal_field
|
||||
|
||||
|
||||
@@ -723,6 +725,9 @@ class OrderMailForm(forms.Form):
|
||||
help_text=_("Will be ignored if tickets exceed a given size limit to ensure email deliverability."),
|
||||
required=False
|
||||
)
|
||||
attach_new_order = forms.BooleanField(
|
||||
required=False
|
||||
)
|
||||
attach_invoices = forms.ModelMultipleChoiceField(
|
||||
label=_("Attach invoices"),
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
@@ -759,6 +764,12 @@ class OrderMailForm(forms.Form):
|
||||
self.fields['attach_invoices'].queryset = order.invoices.all()
|
||||
self._set_field_placeholders('message', ['event', 'order'])
|
||||
self._set_field_placeholders('subject', ['event', 'order'])
|
||||
if order.event.settings.mail_attachment_new_order:
|
||||
self.fields['attach_new_order'].label = _('Attach {file}').format(
|
||||
file=clean_filename(os.path.basename(order.event.settings.mail_attachment_new_order.name))
|
||||
)
|
||||
else:
|
||||
del self.fields['attach_new_order']
|
||||
|
||||
|
||||
class OrderPositionMailForm(OrderMailForm):
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
{% bootstrap_field form.subject layout='horizontal' %}
|
||||
{% bootstrap_field form.message layout='horizontal' %}
|
||||
{% bootstrap_field form.attach_tickets layout='horizontal' %}
|
||||
{% if form.attach_new_order %}
|
||||
{% bootstrap_field form.attach_new_order layout='horizontal' %}
|
||||
{% endif %}
|
||||
{% if form.attach_invoices %}
|
||||
{% bootstrap_field form.attach_invoices layout='horizontal' %}
|
||||
{% endif %}
|
||||
|
||||
@@ -2385,6 +2385,9 @@ class OrderSendMail(EventPermissionRequiredMixin, OrderViewMixin, FormView):
|
||||
self.request.user, auto_email=False,
|
||||
attach_tickets=form.cleaned_data.get('attach_tickets', False),
|
||||
invoices=form.cleaned_data.get('attach_invoices', []),
|
||||
attach_other_files=[a for a in [
|
||||
self.request.event.settings.get('mail_attachment_new_order', as_type=str, default='')[len('file://'):]
|
||||
] if a] if form.cleaned_data.get('attach_new_order', False) else [],
|
||||
)
|
||||
messages.success(self.request,
|
||||
_('Your message has been queued and will be sent to {}.'.format(order.email)))
|
||||
@@ -2453,6 +2456,9 @@ class OrderPositionSendMail(OrderSendMail):
|
||||
'pretix.event.order.position.email.custom_sent',
|
||||
self.request.user,
|
||||
attach_tickets=form.cleaned_data.get('attach_tickets', False),
|
||||
attach_other_files=[a for a in [
|
||||
self.request.event.settings.get('mail_attachment_new_order', as_type=str, default='')[len('file://'):]
|
||||
] if a] if form.cleaned_data.get('attach_new_order', False) else [],
|
||||
)
|
||||
messages.success(self.request,
|
||||
_('Your message has been queued and will be sent to {}.'.format(position.attendee_email)))
|
||||
|
||||
Reference in New Issue
Block a user