{"action":"created","comment":{"url":"https://api.github.com/repos/OTRS/otrs/pulls/comments/31302368","id":31302368,"diff_hunk":"@@ -0,0 +1,140 @@\n+# --\n+# Copyright (C) 2001-2015 OTRS AG, http://otrs.com/\n+# --\n+# This software comes with ABSOLUTELY NO WARRANTY. For details, see\n+# the enclosed file COPYING for license information (AGPL). If you\n+# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.\n+# --\n+\n+use strict;\n+use warnings;\n+use utf8;\n+\n+use vars (qw($Self));\n+\n+use Kernel::System::PostMaster;\n+use Kernel::System::VariableCheck qw(IsHashRefWithData);\n+\n+# get needed objects\n+my $ConfigObject        = $Kernel::OM->Get('Kernel::Config');\n+my $MainObject          = $Kernel::OM->Get('Kernel::System::Main');\n+my $DynamicFieldObject  = $Kernel::OM->Get('Kernel::System::DynamicField');\n+my $TicketObject        = $Kernel::OM->Get('Kernel::System::Ticket');\n+\n+my $FieldName = 'FollowUpDetection';\n+my $Header    = \"X-OTRS-DynamicField-$FieldName\";\n+my $Config = $ConfigObject->Get('PostMaster::CheckFollowUpModule')->{'0800-DynamicField'};\n+$Config->{DynamicField} = $FieldName;\n+$Config->{Header}       = \"X-OTRS-DynamicField-$FieldName\";\n+$Config->{StateTypes}   = [ 'new', 'open' ];\n+\n+$ConfigObject->Set(\n+    Key         => 'PostmasterX-Header',\n+    Value       => [$Header],\n+);\n+\n+$ConfigObject->Set(\n+    Key   => 'PostmasterDefaultState',\n+    Value => 'new'\n+);\n+\n+\n+my $DynamicField = $DynamicFieldObject->DynamicFieldGet(\n+    Name => $FieldName,\n+);\n+\n+if ( !IsHashRefWithData( $DynamicField ) ) {\n+    $DynamicFieldObject->DynamicFieldAdd(\n+        Name    => $FieldName,\n+        Label   => $FieldName . '_test',\n+        FieldOrder      => 9992,\n+        FieldType       => 'Text',\n+        ObjectType      => 'Ticket',\n+        ValidID         => 1,\n+        UserID          => 1,\n+        Config          => { dummy => 1},\n+    );\n+    $DynamicField = $DynamicFieldObject->DynamicFieldGet(\n+        Name => $FieldName,\n+    );\n+}\n+\n+\n+my %TicketsToDelete;\n+sub ProcessMailFile {","path":"scripts/test/PostMaster/CheckFollowUpDynamicField.t","position":64,"original_position":64,"commit_id":"e896d64d6a782a2a7f93d32e214c7f74b511c3be","original_commit_id":"e896d64d6a782a2a7f93d32e214c7f74b511c3be","user":{"login":"mgruner","id":211281,"avatar_url":"https://avatars.githubusercontent.com/u/211281?v=3","gravatar_id":"","url":"https://api.github.com/users/mgruner","html_url":"https://github.com/mgruner","followers_url":"https://api.github.com/users/mgruner/followers","following_url":"https://api.github.com/users/mgruner/following{/other_user}","gists_url":"https://api.github.com/users/mgruner/gists{/gist_id}","starred_url":"https://api.github.com/users/mgruner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgruner/subscriptions","organizations_url":"https://api.github.com/users/mgruner/orgs","repos_url":"https://api.github.com/users/mgruner/repos","events_url":"https://api.github.com/users/mgruner/events{/privacy}","received_events_url":"https://api.github.com/users/mgruner/received_events","type":"User","site_admin":false},"body":"Another minor comment here: we discourage the use of package subs in tests as they will survive past eval {}. If you update your OTRSCodePolicy module it will also complain about this. Please use ```my $ProcessMailFile = sub { ... }``` instead.","created_at":"2015-05-29T06:44:52Z","updated_at":"2015-05-29T06:44:52Z","html_url":"https://github.com/OTRS/otrs/pull/583#discussion_r31302368","pull_request_url":"https://api.github.com/repos/OTRS/otrs/pulls/583","_links":{"self":{"href":"https://api.github.com/repos/OTRS/otrs/pulls/comments/31302368"},"html":{"href":"https://github.com/OTRS/otrs/pull/583#discussion_r31302368"},"pull_request":{"href":"https://api.github.com/repos/OTRS/otrs/pulls/583"}}},"pull_request":{"url":"https://api.github.com/repos/OTRS/otrs/pulls/583","id":36010700,"html_url":"https://github.com/OTRS/otrs/pull/583","diff_url":"https://github.com/OTRS/otrs/pull/583.diff","patch_url":"https://github.com/OTRS/otrs/pull/583.patch","issue_url":"https://api.github.com/repos/OTRS/otrs/issues/583","number":583,"state":"open","locked":false,"title":"Postmaster: Followup-check by dynamic field header","user":{"login":"moritz","id":23773,"avatar_url":"https://avatars.githubusercontent.com/u/23773?v=3","gravatar_id":"","url":"https://api.github.com/users/moritz","html_url":"https://github.com/moritz","followers_url":"https://api.github.com/users/moritz/followers","following_url":"https://api.github.com/users/moritz/following{/other_user}","gists_url":"https://api.github.com/users/moritz/gists{/gist_id}","starred_url":"https://api.github.com/users/moritz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moritz/subscriptions","organizations_url":"https://api.github.com/users/moritz/orgs","repos_url":"https://api.github.com/users/moritz/repos","events_url":"https://api.github.com/users/moritz/events{/privacy}","received_events_url":"https://api.github.com/users/moritz/received_events","type":"User","site_admin":false},"body":"This new module lets you define a header that is connected to a dyanmic field. If an existing ticket (in configurable states) has this dynamic field set to the same value as the header in an incoming mail, the mail is considered a follow-up to this ticket.\r\n\r\nUse cases include for example cron jobs that only send mails on errors; with this feature, you can make sure that all mails form a certain cron job end up in the same ticket, until somebody resolves the problem and the ticket.","created_at":"2015-05-22T08:42:05Z","updated_at":"2015-05-29T06:44:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f04d0fbf215c8809d0cde190660af69827f0484f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OTRS/otrs/pulls/583/commits","review_comments_url":"https://api.github.com/repos/OTRS/otrs/pulls/583/comments","review_comment_url":"https://api.github.com/repos/OTRS/otrs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OTRS/otrs/issues/583/comments","statuses_url":"https://api.github.com/repos/OTRS/otrs/statuses/e896d64d6a782a2a7f93d32e214c7f74b511c3be","head":{"label":"moritz:feature/checkfollowup-dynamic-field","ref":"feature/checkfollowup-dynamic-field","sha":"e896d64d6a782a2a7f93d32e214c7f74b511c3be","user":{"login":"moritz","id":23773,"avatar_url":"https://avatars.githubusercontent.com/u/23773?v=3","gravatar_id":"","url":"https://api.github.com/users/moritz","html_url":"https://github.com/moritz","followers_url":"https://api.github.com/users/moritz/followers","following_url":"https://api.github.com/users/moritz/following{/other_user}","gists_url":"https://api.github.com/users/moritz/gists{/gist_id}","starred_url":"https://api.github.com/users/moritz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moritz/subscriptions","organizations_url":"https://api.github.com/users/moritz/orgs","repos_url":"https://api.github.com/users/moritz/repos","events_url":"https://api.github.com/users/moritz/events{/privacy}","received_events_url":"https://api.github.com/users/moritz/received_events","type":"User","site_admin":false},"repo":{"id":16276677,"name":"otrs","full_name":"moritz/otrs","owner":{"login":"moritz","id":23773,"avatar_url":"https://avatars.githubusercontent.com/u/23773?v=3","gravatar_id":"","url":"https://api.github.com/users/moritz","html_url":"https://github.com/moritz","followers_url":"https://api.github.com/users/moritz/followers","following_url":"https://api.github.com/users/moritz/following{/other_user}","gists_url":"https://api.github.com/users/moritz/gists{/gist_id}","starred_url":"https://api.github.com/users/moritz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moritz/subscriptions","organizations_url":"https://api.github.com/users/moritz/orgs","repos_url":"https://api.github.com/users/moritz/repos","events_url":"https://api.github.com/users/moritz/events{/privacy}","received_events_url":"https://api.github.com/users/moritz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/moritz/otrs","description":"The OTRS framework.","fork":true,"url":"https://api.github.com/repos/moritz/otrs","forks_url":"https://api.github.com/repos/moritz/otrs/forks","keys_url":"https://api.github.com/repos/moritz/otrs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moritz/otrs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moritz/otrs/teams","hooks_url":"https://api.github.com/repos/moritz/otrs/hooks","issue_events_url":"https://api.github.com/repos/moritz/otrs/issues/events{/number}","events_url":"https://api.github.com/repos/moritz/otrs/events","assignees_url":"https://api.github.com/repos/moritz/otrs/assignees{/user}","branches_url":"https://api.github.com/repos/moritz/otrs/branches{/branch}","tags_url":"https://api.github.com/repos/moritz/otrs/tags","blobs_url":"https://api.github.com/repos/moritz/otrs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moritz/otrs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moritz/otrs/git/refs{/sha}","trees_url":"https://api.github.com/repos/moritz/otrs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moritz/otrs/statuses/{sha}","languages_url":"https://api.github.com/repos/moritz/otrs/languages","stargazers_url":"https://api.github.com/repos/moritz/otrs/stargazers","contributors_url":"https://api.github.com/repos/moritz/otrs/contributors","subscribers_url":"https://api.github.com/repos/moritz/otrs/subscribers","subscription_url":"https://api.github.com/repos/moritz/otrs/subscription","commits_url":"https://api.github.com/repos/moritz/otrs/commits{/sha}","git_commits_url":"https://api.github.com/repos/moritz/otrs/git/commits{/sha}","comments_url":"https://api.github.com/repos/moritz/otrs/comments{/number}","issue_comment_url":"https://api.github.com/repos/moritz/otrs/issues/comments{/number}","contents_url":"https://api.github.com/repos/moritz/otrs/contents/{+path}","compare_url":"https://api.github.com/repos/moritz/otrs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moritz/otrs/merges","archive_url":"https://api.github.com/repos/moritz/otrs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moritz/otrs/downloads","issues_url":"https://api.github.com/repos/moritz/otrs/issues{/number}","pulls_url":"https://api.github.com/repos/moritz/otrs/pulls{/number}","milestones_url":"https://api.github.com/repos/moritz/otrs/milestones{/number}","notifications_url":"https://api.github.com/repos/moritz/otrs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moritz/otrs/labels{/name}","releases_url":"https://api.github.com/repos/moritz/otrs/releases{/id}","created_at":"2014-01-27T11:06:44Z","updated_at":"2015-04-21T09:17:40Z","pushed_at":"2015-05-28T13:25:47Z","git_url":"git://github.com/moritz/otrs.git","ssh_url":"git@github.com:moritz/otrs.git","clone_url":"https://github.com/moritz/otrs.git","svn_url":"https://github.com/moritz/otrs","homepage":null,"size":195668,"stargazers_count":0,"watchers_count":0,"language":"Perl","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OTRS:master","ref":"master","sha":"253dc1a9a5ba77de4ed58d4306d2b4e92a47506a","user":{"login":"OTRS","id":3065906,"avatar_url":"https://avatars.githubusercontent.com/u/3065906?v=3","gravatar_id":"","url":"https://api.github.com/users/OTRS","html_url":"https://github.com/OTRS","followers_url":"https://api.github.com/users/OTRS/followers","following_url":"https://api.github.com/users/OTRS/following{/other_user}","gists_url":"https://api.github.com/users/OTRS/gists{/gist_id}","starred_url":"https://api.github.com/users/OTRS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OTRS/subscriptions","organizations_url":"https://api.github.com/users/OTRS/orgs","repos_url":"https://api.github.com/users/OTRS/repos","events_url":"https://api.github.com/users/OTRS/events{/privacy}","received_events_url":"https://api.github.com/users/OTRS/received_events","type":"Organization","site_admin":false},"repo":{"id":16276216,"name":"otrs","full_name":"OTRS/otrs","owner":{"login":"OTRS","id":3065906,"avatar_url":"https://avatars.githubusercontent.com/u/3065906?v=3","gravatar_id":"","url":"https://api.github.com/users/OTRS","html_url":"https://github.com/OTRS","followers_url":"https://api.github.com/users/OTRS/followers","following_url":"https://api.github.com/users/OTRS/following{/other_user}","gists_url":"https://api.github.com/users/OTRS/gists{/gist_id}","starred_url":"https://api.github.com/users/OTRS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OTRS/subscriptions","organizations_url":"https://api.github.com/users/OTRS/orgs","repos_url":"https://api.github.com/users/OTRS/repos","events_url":"https://api.github.com/users/OTRS/events{/privacy}","received_events_url":"https://api.github.com/users/OTRS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OTRS/otrs","description":"The OTRS framework.","fork":false,"url":"https://api.github.com/repos/OTRS/otrs","forks_url":"https://api.github.com/repos/OTRS/otrs/forks","keys_url":"https://api.github.com/repos/OTRS/otrs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OTRS/otrs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OTRS/otrs/teams","hooks_url":"https://api.github.com/repos/OTRS/otrs/hooks","issue_events_url":"https://api.github.com/repos/OTRS/otrs/issues/events{/number}","events_url":"https://api.github.com/repos/OTRS/otrs/events","assignees_url":"https://api.github.com/repos/OTRS/otrs/assignees{/user}","branches_url":"https://api.github.com/repos/OTRS/otrs/branches{/branch}","tags_url":"https://api.github.com/repos/OTRS/otrs/tags","blobs_url":"https://api.github.com/repos/OTRS/otrs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OTRS/otrs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OTRS/otrs/git/refs{/sha}","trees_url":"https://api.github.com/repos/OTRS/otrs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OTRS/otrs/statuses/{sha}","languages_url":"https://api.github.com/repos/OTRS/otrs/languages","stargazers_url":"https://api.github.com/repos/OTRS/otrs/stargazers","contributors_url":"https://api.github.com/repos/OTRS/otrs/contributors","subscribers_url":"https://api.github.com/repos/OTRS/otrs/subscribers","subscription_url":"https://api.github.com/repos/OTRS/otrs/subscription","commits_url":"https://api.github.com/repos/OTRS/otrs/commits{/sha}","git_commits_url":"https://api.github.com/repos/OTRS/otrs/git/commits{/sha}","comments_url":"https://api.github.com/repos/OTRS/otrs/comments{/number}","issue_comment_url":"https://api.github.com/repos/OTRS/otrs/issues/comments{/number}","contents_url":"https://api.github.com/repos/OTRS/otrs/contents/{+path}","compare_url":"https://api.github.com/repos/OTRS/otrs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OTRS/otrs/merges","archive_url":"https://api.github.com/repos/OTRS/otrs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OTRS/otrs/downloads","issues_url":"https://api.github.com/repos/OTRS/otrs/issues{/number}","pulls_url":"https://api.github.com/repos/OTRS/otrs/pulls{/number}","milestones_url":"https://api.github.com/repos/OTRS/otrs/milestones{/number}","notifications_url":"https://api.github.com/repos/OTRS/otrs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OTRS/otrs/labels{/name}","releases_url":"https://api.github.com/repos/OTRS/otrs/releases{/id}","created_at":"2014-01-27T10:44:13Z","updated_at":"2015-05-29T03:42:22Z","pushed_at":"2015-05-28T19:24:49Z","git_url":"git://github.com/OTRS/otrs.git","ssh_url":"git@github.com:OTRS/otrs.git","clone_url":"https://github.com/OTRS/otrs.git","svn_url":"https://github.com/OTRS/otrs","homepage":null,"size":287824,"stargazers_count":134,"watchers_count":134,"language":"Perl","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":143,"mirror_url":null,"open_issues_count":26,"forks":143,"open_issues":26,"watchers":134,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OTRS/otrs/pulls/583"},"html":{"href":"https://github.com/OTRS/otrs/pull/583"},"issue":{"href":"https://api.github.com/repos/OTRS/otrs/issues/583"},"comments":{"href":"https://api.github.com/repos/OTRS/otrs/issues/583/comments"},"review_comments":{"href":"https://api.github.com/repos/OTRS/otrs/pulls/583/comments"},"review_comment":{"href":"https://api.github.com/repos/OTRS/otrs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OTRS/otrs/pulls/583/commits"},"statuses":{"href":"https://api.github.com/repos/OTRS/otrs/statuses/e896d64d6a782a2a7f93d32e214c7f74b511c3be"}}}}