Changeset 16976 for main


Ignore:
Timestamp:
29 Jun 2022, 10:24:59 (2 years ago)
Author:
Henrik Bettermann
Message:

Send email after final submission of application form.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r16960 r16976  
    14061406                    mapping = {'a':  emails_sent})
    14071407        IWorkflowInfo(self.context).fireTransition('submit')
     1408        # Send confirmation email
     1409        getUtility(IKofaUtils).informApplicant(self.context)
    14081410        # application_date is used in export files for sorting.
    14091411        # We can thus store utc.
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py

    r16746 r16976  
    319319        )
    320320
     321    send_email= schema.Bool(
     322        title = _(u'Send email after submission'),
     323        required = False,
     324        default = False,
     325        )
     326
    321327    def addApplicant(applicant):
    322328        """Add an applicant.
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r16801 r16976  
    19701970        referee2.name = u'Otis Stone'
    19711971        referee2.email = 'otis@stones.de'
     1972        self.applicant.__parent__.send_email = True
    19721973        self.applicant.referees = [referee1, referee2]
    19731974        self.assertFalse(referee1.email_sent)
     
    20422043            '\nmsg: Sample University'
    20432044            '\nmsg: '
     2045            '\nSending email from no-reply@waeup.org to xx@yy.zz:'
     2046            '\nMessage:'
     2047            '\nmsg: MIME-Version: 1.0'
     2048            '\nmsg: Content-Type: text/plain; charset="us-ascii"'
     2049            '\nmsg: Content-Transfer-Encoding: 7bit'
     2050            '\nmsg: From: Administrator <no-reply@waeup.org>'
     2051            '\nmsg: To: John Anthony Tester <xx@yy.zz>'
     2052            '\nmsg: Reply-To: Administrator <contact@waeup.org>'
     2053            '\nmsg: Subject: Your application form was successfully submitted'
     2054            '\nmsg: '
     2055            '\nmsg: Dear John Anthony Tester,'
     2056            '\nmsg: '
     2057            '\nmsg: Your application app2020_<6-DIGITS> has been successfully submitted to Sample University.'
     2058            '\nmsg: '
     2059            '\nmsg: Regards'
     2060            '\nmsg: '
    20442061            % (session_1, session_1, session_2, mandate_id_0,
    20452062               session_1, session_1, session_2, mandate_id_1,),
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py

    r15918 r16976  
    7373            result,
    7474            'application_category,application_fee,application_slip_notice,code,'
    75             'description,enddate,hidden,mode,prefix,startdate,'
     75            'description,enddate,hidden,mode,prefix,send_email,startdate,'
    7676            'strict_deadline,title,with_picture,year\r\n'
    7777
    7878            'basic,0.0,,dp2017,'
    7979            '"Some Description\nwith linebreak\n<<de>>man spriht deutsh",'
    80             '2017-01-31 23:00:00+00:00#,0,,app,2017-01-01 12:00:00+00:00#,1,'
     80            '2017-01-31 23:00:00+00:00#,0,,app,0,2017-01-01 12:00:00+00:00#,1,'
    8181            'General Studies,1,2017\r\n'
    8282            )
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r16828 r16976  
    405405
    406406
     407    def informApplicant(self, applicant):
     408        """Inform applicant that the application form was successfully
     409        submitted.
     410        """
     411        if not getattr(applicant.__parent__, 'send_email', False):
     412            return
     413        subject = 'Your application form was successfully submitted'
     414        text = _(u"""Dear ${a},
     415
     416Your application ${b} has been successfully submitted to ${c}.
     417
     418Regards
     419""")
     420        config = grok.getSite()['configuration']
     421        from_name = config.name_admin
     422        from_addr = config.email_admin
     423        rcpt_name = applicant.display_fullname
     424        rcpt_addr = applicant.email
     425        session = '%s/%s' % (
     426            applicant.__parent__.year, applicant.__parent__.year+1)
     427        text = _(text, mapping={
     428            'a': rcpt_name,
     429            'b': applicant.applicant_id,
     430            'c': config.name,
     431            })
     432        body = translate(text, 'waeup.kofa',
     433            target_language=self.PORTAL_LANGUAGE)
     434        return send_mail(
     435            from_name, from_addr, rcpt_name, rcpt_addr,
     436            subject, body, config)
     437
    407438    def inviteReferee(self, referee, applicant, url_info=None):
    408439        """Send invitation email to referee.
Note: See TracChangeset for help on using the changeset viewer.