backoffice: let agent select channel during submission (#33670)
This commit is contained in:
parent
30559d6de8
commit
ab8e860bc3
|
@ -1184,6 +1184,38 @@ def test_backoffice_submission_manual_channel(pub):
|
|||
assert data_class.get(formdata_no).submission_channel == 'mail'
|
||||
|
||||
|
||||
def test_backoffice_submission_manual_channel_with_return_url(pub):
|
||||
user = create_user(pub)
|
||||
|
||||
FormDef.wipe()
|
||||
formdef = FormDef()
|
||||
formdef.name = 'form title'
|
||||
formdef.fields = [
|
||||
fields.StringField(
|
||||
id='1', label='1st field', type='string',
|
||||
display_locations=['validation', 'summary', 'listings']),
|
||||
]
|
||||
formdef.backoffice_submission_roles = user.roles[:]
|
||||
formdef.workflow_roles = {'_receiver': '23'} # role the user doesn't have
|
||||
formdef.store()
|
||||
|
||||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/submission/%s/?ReturnURL=http://example.net' % formdef.url_name)
|
||||
resp = resp.follow().follow()
|
||||
|
||||
assert resp.form['submission_channel'].attrs['type'] == 'hidden'
|
||||
resp.form['submission_channel'] = 'mail'
|
||||
resp.form['f1'] = 'test submission'
|
||||
resp = resp.form.submit('submit')
|
||||
assert 'Check values then click submit.' in resp.text
|
||||
|
||||
# final submit
|
||||
resp = resp.form.submit('submit')
|
||||
# as the user doesn't have a role to view the submitted form there's a
|
||||
# redirection to the preset URL.
|
||||
assert resp.location == 'http://example.net'
|
||||
|
||||
|
||||
def test_backoffice_submission_no_manual_channel_with_welco(pub, welco_url):
|
||||
user = create_user(pub)
|
||||
|
||||
|
|
|
@ -220,7 +220,8 @@ class FormFillPage(PublicFormFillPage):
|
|||
if formdata:
|
||||
r += FormBackOfficeStatusPage(self.formdef, formdata).get_extra_context_bar()
|
||||
else:
|
||||
if formdata and formdata.submission_context:
|
||||
if formdata and formdata.submission_context and \
|
||||
set(formdata.submission_context.keys()) != {'return_url'}:
|
||||
r += FormBackOfficeStatusPage(self.formdef, formdata).get_extra_submission_context_bar()
|
||||
elif self.has_channel_support:
|
||||
r += htmltext('<div class="submit-channel-selection" style="display: none;">')
|
||||
|
|
Loading…
Reference in New Issue