From c5f348ec82b2c3b244c057aa438795758f8f85a7 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Fri, 9 Dec 2016 13:55:34 +0100 Subject: [PATCH 1/2] Follow up: Fixed issue #519 - Import of articles without a content type fails. --- .../import/otrs/article/no_content_type.json | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 spec/fixtures/import/otrs/article/no_content_type.json diff --git a/spec/fixtures/import/otrs/article/no_content_type.json b/spec/fixtures/import/otrs/article/no_content_type.json new file mode 100644 index 000000000..2c5413fec --- /dev/null +++ b/spec/fixtures/import/otrs/article/no_content_type.json @@ -0,0 +1,104 @@ +{ + "Age": 200536176, + "PriorityID": "3", + "ContentType": null, + "DynamicField_SugarCRMCompanySelection": [ + "Firma 1 - 117c26c0-11d4-7b8b-cb8f-4f7cb6823dd8", + "Firma 2 - 1111111-11d4-7b8b-cb8f-4f7cb6823dd8", + "Firma 3 - 22222222-11d4-7b8b-cb8f-4f7cb6823dd8" + ], + "ServiceID": null, + "TicketFreeText11": null, + "DynamicField_ITSMDueDate": null, + "DynamicField_Topic": null, + "StateID": "1", + "DynamicField_Hostname": null, + "Body": "Welcome!\n\nThank you for installing OTRS.\n\nYou will find updates and patches at http://www.otrs.com/open-source/.\nOnline documentation is available at http://doc.otrs.org/.\nYou can also use our mailing lists http://lists.otrs.org/\nor our forums at http://forums.otrs.org/\n\nRegards,\n\nThe OTRS Project\n", + "DynamicField_ZammadMigratorChanged": null, + "EscalationTime": "0", + "Changed": "2014-06-24 09:32:14", + "OwnerID": "1", + "DynamicField_ZarafaTN": null, + "DynamicField_ProcessManagementActivityID": null, + "DynamicField_TopicID": null, + "DynamicField_ScomHostname": null, + "Owner": "root@localhost", + "AgeTimeUnix": 82611378, + "TicketFreeKey11": null, + "ArticleID": "999", + "Created": "2010-08-02 14:00:00", + "DynamicField_ScomUUID": null, + "DynamicField_TicketFreeText11": null, + "DynamicField_TicketFreeKey11": null, + "DynamicField_ITSMReviewRequired": null, + "DynamicField_OpenExchangeTicketNumber": null, + "DynamicField_ITSMDecisionDate": null, + "ArticleTypeID": "1", + "QueueID": "2", + "ReplyTo": null, + "DynamicField_ITSMImpact": null, + "TicketID": "999", + "DynamicField_ITSMRecoveryStartTime": null, + "Cc": null, + "EscalationResponseTime": "0", + "DynamicField_ProcessManagementProcessID": null, + "IncomingTime": "1280750400", + "Charset": "", + "DynamicField_CheckboxExample": null, + "DynamicField_Location": null, + "CustomerUserID": "1000001", + "DynamicField_Vertriebsweg": null, + "Attachments": [], + "DynamicField_CustomerLocation": null, + "DynamicField_SugarCRMRemoteID": null, + "DynamicField_OpenExchangeTN": null, + "Service": "", + "Type": "Incident", + "ContentCharset": "", + "DynamicField_TETest": [ + "test", + "test1", + "test3" + ], + "Responsible": "root@localhost", + "SenderType": "customer", + "ResponsibleID": "1", + "SLA": "", + "MimeType": "", + "DynamicField_Combine": "22222222-11d4-7b8b-cb8f-4f7cb6823dd8", + "Subject": "Welcome to OTRS!", + "InReplyTo": null, + "RealTillTimeNotUsed": "0", + "DynamicField_ScomService": null, + "CustomerID": "1000001", + "TypeID": null, + "MessageID": "<007@localhost>", + "Priority": "3 normal", + "To": "Your OTRS System ", + "DynamicField_SugarCRMCompanySelectedID": "22222222-11d4-7b8b-cb8f-4f7cb6823dd8", + "UntilTime": 0, + "EscalationUpdateTime": "0", + "CreatedBy": "1", + "Queue": "Raw", + "DynamicField_ITSMRepairStartTime": null, + "ToRealname": "Your OTRS System", + "State": "new", + "SenderTypeID": "3", + "DynamicField_ZammadMigratorChangedOld": null, + "Title": "Welcome to OTRS!", + "DynamicField_ScomState": null, + "References": null, + "DynamicField_Department": null, + "ArticleType": "email-external", + "StateType": "new", + "FromRealname": "OTRS Feedback", + "EscalationSolutionTime": "0", + "LockID": "2", + "TicketNumber": "2010080210123456", + "DynamicField_ITSMDecisionResult": null, + "Lock": "lock", + "CreateTimeUnix": "1280750400", + "SLAID": null, + "DynamicField_ITSMCriticality": null, + "From": "OTRS Feedback " +} \ No newline at end of file From 477fefc4e5114fe4cd8ac8b9b6aedd2bfe99d635 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Fri, 9 Dec 2016 16:12:39 +0100 Subject: [PATCH 2/2] Made OTRS import statistic method public to access it for plausibility check. --- lib/import/otrs/import_stats.rb | 4 ++-- spec/import/otrs/import_stats_examples.rb | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/import/otrs/import_stats.rb b/lib/import/otrs/import_stats.rb index e1c437501..59c7644bd 100644 --- a/lib/import/otrs/import_stats.rb +++ b/lib/import/otrs/import_stats.rb @@ -21,8 +21,6 @@ module Import } end - private - def statistic # check cache @@ -37,6 +35,8 @@ module Import statistic end + private + def base_done ::Group.count + ::Ticket::State.count + ::Ticket::Priority.count end diff --git a/spec/import/otrs/import_stats_examples.rb b/spec/import/otrs/import_stats_examples.rb index e21cfb5c7..7cbb7ea59 100644 --- a/spec/import/otrs/import_stats_examples.rb +++ b/spec/import/otrs/import_stats_examples.rb @@ -2,4 +2,7 @@ RSpec.shared_examples 'Import::OTRS::ImportStats' do it 'responds to current_state' do expect(described_class).to respond_to('current_state') end + it 'responds to statistic' do + expect(described_class).to respond_to('statistic') + end end