Projet

Général

Profil

0001-mail-with-attachments-draft-8274.patch

Thomas Noël, 26 septembre 2017 17:28

Télécharger (2,51 ko)

Voir les différences:

Subject: [PATCH] mail with attachments, draft #8274

 wcs/workflows.py | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
wcs/workflows.py
2015 2015
    subject = None
2016 2016
    body = None
2017 2017
    custom_from = None
2018
    attachments = None
2018 2019

  
2019 2020
    comment = None
2020 2021

  
......
2053 2054
            return _('Send mail (not completed)')
2054 2055

  
2055 2056
    def get_parameters(self):
2056
        return ('to', 'subject', 'body', 'custom_from')
2057
        return ('to', 'subject', 'body', 'attachments', 'custom_from')
2057 2058

  
2058 2059
    def fill_admin_form(self, form):
2059 2060
        self.add_parameters_widgets(form, self.get_parameters())
......
2076 2077
                     value=self.body, cols=80, rows=10,
2077 2078
                     validation_function=ComputedExpressionWidget.validate_ezt,
2078 2079
                     hint=_('Available variables: url, url_status, details, name, number, comment, field_NAME'))
2080
        attachments_fields = [(None, '---', None)]
2081
        for field in self.parent.parent.get_backoffice_fields():
2082
            if field.key != 'file':
2083
                continue
2084
            if field.varname:
2085
                codename = 'form_var_%s' % field.varname
2086
                label = htmltext('%s (<code class="varname">%s</code>)') % (field.label, codename)
2087
            else:
2088
                codename = '__f%s' % field.id # __fbo<n>
2089
                label = field.label
2090
            attachments_fields.append((codename, label, codename))
2091
        if 'attachments' in parameters:
2092
            form.add(WidgetList, '%sattachments' % prefix, title=_('Attachments'),
2093
                     element_type=SingleSelectWidgetWithOther,
2094
                     value=self.attachments,
2095
                     add_element_label=_('Add attachment'),
2096
                     element_kwargs={'render_br': False, 'options': attachments_fields},
2097
                     hint=_('"Other" attachement choice should be a Python expression'))
2079 2098
        if 'custom_from' in parameters:
2080 2099
            form.add(ComputedExpressionWidget, '%scustom_from' % prefix,
2081 2100
                     title=_('Custom From Address'), value=self.custom_from,
2082
-