Added attachment check.

This commit is contained in:
Martin Edenhofer 2012-12-01 14:13:00 +01:00
parent acfd321d5a
commit 4e1d519575
4 changed files with 72 additions and 50 deletions

View file

@ -319,7 +319,7 @@ class Index extends App.Controller
# show to
to = customer.accounts['twitter'].username || customer.accounts['twitter'].uid
@el.find('[name="to"]').val(to)
else if article_type.name is 'email'
@el.find('[name="to"]').val(article.from)
# @log 'reply ', article, @el.find('[name="to"]')
@ -356,12 +356,13 @@ class Index extends App.Controller
e.preventDefault()
params = @formParam(e.target)
@log 'TicketZoom', 'notice', 'update', params, @ticket
article_type = App.TicketArticleType.find( params['ticket_article_type_id'] )
# update ticket
ticket_update = {}
for item in @configure_attributes_ticket
ticket_update[item.name] = params[item.name]
# check owner assignment
if !@isRole('Customer')
if !ticket_update['owner_id']
@ -372,6 +373,26 @@ class Index extends App.Controller
alert( App.i18n.translateContent('Title needed') )
return
if article_type.name is 'email'
# check if recipient exists
if !params['to'] && !params['cc']
alert( App.i18n.translateContent('Need recipient in "To" or "Cc".') )
return
# check if message exists
if !params['body']
alert( App.i18n.translateContent('Text needed') )
return
# check attachment
if params['body']
attachmentTranslated = App.i18n.translateContent('Attachment')
attachmentTranslatedRegExp = new RegExp( attachmentTranslated, 'i' )
if params['body'].match(/attachment/i) || params['body'].match( attachmentTranslatedRegExp )
return if !confirm( App.i18n.translateContent('You use attachment in text but no attachment is attached. Do you want to continue?') )
@ticket.load( ticket_update )
@log 'TicketZoom', 'notice', 'update ticket', ticket_update, @ticket

View file

@ -43,7 +43,7 @@ class Index extends App.ControllerLevel2
@menu = [
{ name: 'Base', 'target': 'base', controller: App.SettingsArea, params: { area: 'Ticket::Base' } },
{ name: 'Number', 'target': 'number', controller: App.SettingsArea, params: { area: 'Ticket::Number' } },
{ name: 'Sender Format', 'target': 'sender-format', controller: App.SettingsArea, params: { area: 'Ticket::SenderFormat' } },
# { name: 'Sender Format', 'target': 'sender-format', controller: App.SettingsArea, params: { area: 'Ticket::SenderFormat' } },
]
@page = {
title: 'Ticket',

View file

@ -32,7 +32,7 @@ class _Singleton extends Spine.Module
constructor: ->
@map = {}
@timestampFormat = 'yyyy-mm-dd HH:MM'
@set('de')
# observe if text has been translated
$('body')
.delegate '.translation', 'focus', (e) =>

View file

@ -785,52 +785,6 @@ Setting.create(
:frontend => false
)
Setting.create(
:title => 'Sender Format',
:name => 'ticket_define_email_from',
:area => 'Ticket::SenderFormat',
:description => 'Defines how the From field from the emails (sent from answers and email tickets) should look like.',
:options => {
:form => [
{
:display => '',
:null => true,
:name => 'ticket_define_email_from',
:tag => 'select',
:options => {
:SystemAddressName => 'System Address Display Name',
:AgentNameSystemAddressName => 'Agent Name + FromSeparator + System Address Display Name',
},
},
],
},
:state => {
:value => 'SystemAddressName',
},
:frontend => false
)
Setting.create(
:title => 'Sender Format Seperator',
:name => 'ticket_define_email_from_seperator',
:area => 'Ticket::SenderFormat',
:description => 'Defines the separator between the agents real name and the given queue email address.',
:options => {
:form => [
{
:display => '',
:null => false,
:name => 'ticket_define_email_from_seperator',
:tag => 'input',
},
],
},
:state => {
:value => 'via',
},
:frontend => false
)
Setting.create(
:title => 'Enable Ticket creation',
:name => 'customer_ticket_create',
@ -881,6 +835,52 @@ Setting.create(
:frontend => true
)
Setting.create(
:title => 'Sender Format',
:name => 'ticket_define_email_from',
:area => 'Email::Base',
:description => 'Defines how the From field from the emails (sent from answers and email tickets) should look like.',
:options => {
:form => [
{
:display => '',
:null => true,
:name => 'ticket_define_email_from',
:tag => 'select',
:options => {
:SystemAddressName => 'System Address Display Name',
:AgentNameSystemAddressName => 'Agent Name + FromSeparator + System Address Display Name',
},
},
],
},
:state => {
:value => 'SystemAddressName',
},
:frontend => false
)
Setting.create(
:title => 'Sender Format Seperator',
:name => 'ticket_define_email_from_seperator',
:area => 'Email::Base',
:description => 'Defines the separator between the agents real name and the given group email address.',
:options => {
:form => [
{
:display => '',
:null => false,
:name => 'ticket_define_email_from_seperator',
:tag => 'input',
},
],
},
:state => {
:value => 'via',
},
:frontend => false
)
Setting.create(
:title => 'Max. Email Size',
:name => 'postmaster_max_size',
@ -1812,6 +1812,7 @@ Translation.create( :locale => 'de', :source => "The way to communicate with us
Translation.create( :locale => 'de', :source => "or", :target => "oder", :updated_by_id => 1, :created_by_id => 1 )
Translation.create( :locale => 'de', :source => "yes", :target => "ja", :updated_by_id => 1, :created_by_id => 1 )
Translation.create( :locale => 'de', :source => "no", :target => "nein", :updated_by_id => 1, :created_by_id => 1 )
Translation.create( :locale => 'de', :source => "Attachment", :target => "Anhang", :updated_by_id => 1, :created_by_id => 1 )
#Translation.create( :locale => 'de', :source => "", :target => "", :updated_by_id => 1, :created_by_id => 1 )