From 4e1d5195755b1fbd21b3454b0741f95af5f3d9b0 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 1 Dec 2012 14:13:00 +0100 Subject: [PATCH] Added attachment check. --- .../controllers/agent_ticket_zoom.js.coffee | 25 ++++- .../app/controllers/settings.js.coffee | 2 +- .../app/lib/app_post/i18n.js.coffee | 2 +- db/seeds.rb | 93 ++++++++++--------- 4 files changed, 72 insertions(+), 50 deletions(-) diff --git a/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee index eda0d90c0..3df6397cf 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee @@ -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 diff --git a/app/assets/javascripts/app/controllers/settings.js.coffee b/app/assets/javascripts/app/controllers/settings.js.coffee index e0577b1a5..8bdb40518 100644 --- a/app/assets/javascripts/app/controllers/settings.js.coffee +++ b/app/assets/javascripts/app/controllers/settings.js.coffee @@ -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', diff --git a/app/assets/javascripts/app/lib/app_post/i18n.js.coffee b/app/assets/javascripts/app/lib/app_post/i18n.js.coffee index 6216c85cd..d5d5fef45 100644 --- a/app/assets/javascripts/app/lib/app_post/i18n.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/i18n.js.coffee @@ -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) => diff --git a/db/seeds.rb b/db/seeds.rb index 4e6662d97..50596aeaa 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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 )