{"action":"created","comment":{"url":"https://api.github.com/repos/ManatiCR/manatime/pulls/comments/82820505","pull_request_review_id":3699548,"id":82820505,"diff_hunk":"@@ -0,0 +1,50 @@\n+<?php\n+\n+/**\n+ * @file\n+ * Plugin to check whether the url has a validate dates.\n+ */\n+\n+$plugin = array(\n+  'title' => t('Dates access'),\n+  'description' => t('Returns FALSE if url has invalid dates.'),\n+  'callback' => 'dates_access_check',\n+  'summary' => 'dates_access_summary',\n+  'required context' => array(\n+    new ctools_context_required(t('String'), 'string'),\n+  ),\n+);\n+\n+/**\n+ * Check for access.\n+ */\n+function dates_access_check($conf, $context) {\n+  // Return FALSE if the url does not have dates.\n+  if (empty($context[0]->data)) {\n+    return FALSE;\n+  }\n+  $dates = explode(\"-\", $context[0]->data);\n+  if (validate_date_format($dates[0]) && validate_date_format($dates[1])) {\n+    $beginning = new DateTime($dates[0]);\n+    $end = new DateTime($dates[1]);\n+    $query = new EntityFieldQuery();\n+    $result = $query\n+      ->entityCondition('entity_type', 'node')\n+      ->entityCondition('bundle', 'timesheet')\n+      ->fieldCondition('field_date', 'value', $beginning->format('Y-m-d'), '=')\n+      ->fieldCondition('field_date', 'value2', $end->format('Y-m-d'), '=')\n+      ->execute();\n+    // Return FALSE if there are timesheets with dates given.\n+    if (isset($result['node'])) {\n+      return FALSE;\n+    }\n+  }\n+  return TRUE;\n+}\n+\n+/**\n+ * Provides a plugin summary.\n+ */\n+function dates_access_summary($conf, $context) {\n+  return t('Show only if the url has a validate dates');","path":"modules/features/manatime_feature_timesheets/plugins/access/dates_access.inc","position":49,"original_position":49,"commit_id":"07616ae7711192c91a3561d869ae84d38c2410fe","original_commit_id":"07616ae7711192c91a3561d869ae84d38c2410fe","user":{"login":"kporras07","id":2217820,"avatar_url":"https://avatars.githubusercontent.com/u/2217820?v=3","gravatar_id":"","url":"https://api.github.com/users/kporras07","html_url":"https://github.com/kporras07","followers_url":"https://api.github.com/users/kporras07/followers","following_url":"https://api.github.com/users/kporras07/following{/other_user}","gists_url":"https://api.github.com/users/kporras07/gists{/gist_id}","starred_url":"https://api.github.com/users/kporras07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kporras07/subscriptions","organizations_url":"https://api.github.com/users/kporras07/orgs","repos_url":"https://api.github.com/users/kporras07/repos","events_url":"https://api.github.com/users/kporras07/events{/privacy}","received_events_url":"https://api.github.com/users/kporras07/received_events","type":"User","site_admin":false},"body":"*has valid dates","created_at":"2016-10-11T15:31:46Z","updated_at":"2016-10-11T15:31:46Z","html_url":"https://github.com/ManatiCR/manatime/pull/70#discussion_r82820505","pull_request_url":"https://api.github.com/repos/ManatiCR/manatime/pulls/70","_links":{"self":{"href":"https://api.github.com/repos/ManatiCR/manatime/pulls/comments/82820505"},"html":{"href":"https://github.com/ManatiCR/manatime/pull/70#discussion_r82820505"},"pull_request":{"href":"https://api.github.com/repos/ManatiCR/manatime/pulls/70"}}},"pull_request":{"url":"https://api.github.com/repos/ManatiCR/manatime/pulls/70","id":87817794,"html_url":"https://github.com/ManatiCR/manatime/pull/70","diff_url":"https://github.com/ManatiCR/manatime/pull/70.diff","patch_url":"https://github.com/ManatiCR/manatime/pull/70.patch","issue_url":"https://api.github.com/repos/ManatiCR/manatime/issues/70","number":70,"state":"open","locked":false,"title":"17: Timesheet submit.","user":{"login":"rohernandez","id":9342274,"avatar_url":"https://avatars.githubusercontent.com/u/9342274?v=3","gravatar_id":"","url":"https://api.github.com/users/rohernandez","html_url":"https://github.com/rohernandez","followers_url":"https://api.github.com/users/rohernandez/followers","following_url":"https://api.github.com/users/rohernandez/following{/other_user}","gists_url":"https://api.github.com/users/rohernandez/gists{/gist_id}","starred_url":"https://api.github.com/users/rohernandez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rohernandez/subscriptions","organizations_url":"https://api.github.com/users/rohernandez/orgs","repos_url":"https://api.github.com/users/rohernandez/repos","events_url":"https://api.github.com/users/rohernandez/events{/privacy}","received_events_url":"https://api.github.com/users/rohernandez/received_events","type":"User","site_admin":false},"body":"**Steps to test**\r\n\r\n- Create some nodes: project, task, timesheet, timeentries, Client.\r\n- Check if the button 'Submit timesheet' run successfully.\r\n- Check if the navigation per dates run successfully.\r\n\r\n**DoD**\r\n\r\n- Submit button (form?)\r\n- Set timesheet status to published\r\n- Set time entries to Submitted.\r\n- If submit is done in the middle of a week (ex. wednesday 31 of a given month), create a new timesheet for the rest of the week.\r\n\r\n[issue link](https://github.com/ManatiCR/manatime/issues/17)","created_at":"2016-10-04T00:49:38Z","updated_at":"2016-10-11T15:35:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29424c925470ed1de889a60c8b631e1b8a9f7766","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ManatiCR/manatime/pulls/70/commits","review_comments_url":"https://api.github.com/repos/ManatiCR/manatime/pulls/70/comments","review_comment_url":"https://api.github.com/repos/ManatiCR/manatime/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManatiCR/manatime/issues/70/comments","statuses_url":"https://api.github.com/repos/ManatiCR/manatime/statuses/07616ae7711192c91a3561d869ae84d38c2410fe","head":{"label":"ManatiCR:feature/manatime-17-timesheet-submit","ref":"feature/manatime-17-timesheet-submit","sha":"07616ae7711192c91a3561d869ae84d38c2410fe","user":{"login":"ManatiCR","id":10856718,"avatar_url":"https://avatars.githubusercontent.com/u/10856718?v=3","gravatar_id":"","url":"https://api.github.com/users/ManatiCR","html_url":"https://github.com/ManatiCR","followers_url":"https://api.github.com/users/ManatiCR/followers","following_url":"https://api.github.com/users/ManatiCR/following{/other_user}","gists_url":"https://api.github.com/users/ManatiCR/gists{/gist_id}","starred_url":"https://api.github.com/users/ManatiCR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManatiCR/subscriptions","organizations_url":"https://api.github.com/users/ManatiCR/orgs","repos_url":"https://api.github.com/users/ManatiCR/repos","events_url":"https://api.github.com/users/ManatiCR/events{/privacy}","received_events_url":"https://api.github.com/users/ManatiCR/received_events","type":"Organization","site_admin":false},"repo":{"id":65582948,"name":"manatime","full_name":"ManatiCR/manatime","owner":{"login":"ManatiCR","id":10856718,"avatar_url":"https://avatars.githubusercontent.com/u/10856718?v=3","gravatar_id":"","url":"https://api.github.com/users/ManatiCR","html_url":"https://github.com/ManatiCR","followers_url":"https://api.github.com/users/ManatiCR/followers","following_url":"https://api.github.com/users/ManatiCR/following{/other_user}","gists_url":"https://api.github.com/users/ManatiCR/gists{/gist_id}","starred_url":"https://api.github.com/users/ManatiCR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManatiCR/subscriptions","organizations_url":"https://api.github.com/users/ManatiCR/orgs","repos_url":"https://api.github.com/users/ManatiCR/repos","events_url":"https://api.github.com/users/ManatiCR/events{/privacy}","received_events_url":"https://api.github.com/users/ManatiCR/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManatiCR/manatime","description":"Manati Time Tracker","fork":false,"url":"https://api.github.com/repos/ManatiCR/manatime","forks_url":"https://api.github.com/repos/ManatiCR/manatime/forks","keys_url":"https://api.github.com/repos/ManatiCR/manatime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManatiCR/manatime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManatiCR/manatime/teams","hooks_url":"https://api.github.com/repos/ManatiCR/manatime/hooks","issue_events_url":"https://api.github.com/repos/ManatiCR/manatime/issues/events{/number}","events_url":"https://api.github.com/repos/ManatiCR/manatime/events","assignees_url":"https://api.github.com/repos/ManatiCR/manatime/assignees{/user}","branches_url":"https://api.github.com/repos/ManatiCR/manatime/branches{/branch}","tags_url":"https://api.github.com/repos/ManatiCR/manatime/tags","blobs_url":"https://api.github.com/repos/ManatiCR/manatime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManatiCR/manatime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManatiCR/manatime/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManatiCR/manatime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManatiCR/manatime/statuses/{sha}","languages_url":"https://api.github.com/repos/ManatiCR/manatime/languages","stargazers_url":"https://api.github.com/repos/ManatiCR/manatime/stargazers","contributors_url":"https://api.github.com/repos/ManatiCR/manatime/contributors","subscribers_url":"https://api.github.com/repos/ManatiCR/manatime/subscribers","subscription_url":"https://api.github.com/repos/ManatiCR/manatime/subscription","commits_url":"https://api.github.com/repos/ManatiCR/manatime/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManatiCR/manatime/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManatiCR/manatime/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManatiCR/manatime/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManatiCR/manatime/contents/{+path}","compare_url":"https://api.github.com/repos/ManatiCR/manatime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManatiCR/manatime/merges","archive_url":"https://api.github.com/repos/ManatiCR/manatime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManatiCR/manatime/downloads","issues_url":"https://api.github.com/repos/ManatiCR/manatime/issues{/number}","pulls_url":"https://api.github.com/repos/ManatiCR/manatime/pulls{/number}","milestones_url":"https://api.github.com/repos/ManatiCR/manatime/milestones{/number}","notifications_url":"https://api.github.com/repos/ManatiCR/manatime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManatiCR/manatime/labels{/name}","releases_url":"https://api.github.com/repos/ManatiCR/manatime/releases{/id}","deployments_url":"https://api.github.com/repos/ManatiCR/manatime/deployments","created_at":"2016-08-12T20:52:46Z","updated_at":"2016-08-18T20:19:36Z","pushed_at":"2016-10-11T15:14:57Z","git_url":"git://github.com/ManatiCR/manatime.git","ssh_url":"git@github.com:ManatiCR/manatime.git","clone_url":"https://github.com/ManatiCR/manatime.git","svn_url":"https://github.com/ManatiCR/manatime","homepage":null,"size":263,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":17,"forks":0,"open_issues":17,"watchers":0,"default_branch":"develop"}},"base":{"label":"ManatiCR:develop","ref":"develop","sha":"d4d6b1746c769703d02ead9cc6d60316e880c9c5","user":{"login":"ManatiCR","id":10856718,"avatar_url":"https://avatars.githubusercontent.com/u/10856718?v=3","gravatar_id":"","url":"https://api.github.com/users/ManatiCR","html_url":"https://github.com/ManatiCR","followers_url":"https://api.github.com/users/ManatiCR/followers","following_url":"https://api.github.com/users/ManatiCR/following{/other_user}","gists_url":"https://api.github.com/users/ManatiCR/gists{/gist_id}","starred_url":"https://api.github.com/users/ManatiCR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManatiCR/subscriptions","organizations_url":"https://api.github.com/users/ManatiCR/orgs","repos_url":"https://api.github.com/users/ManatiCR/repos","events_url":"https://api.github.com/users/ManatiCR/events{/privacy}","received_events_url":"https://api.github.com/users/ManatiCR/received_events","type":"Organization","site_admin":false},"repo":{"id":65582948,"name":"manatime","full_name":"ManatiCR/manatime","owner":{"login":"ManatiCR","id":10856718,"avatar_url":"https://avatars.githubusercontent.com/u/10856718?v=3","gravatar_id":"","url":"https://api.github.com/users/ManatiCR","html_url":"https://github.com/ManatiCR","followers_url":"https://api.github.com/users/ManatiCR/followers","following_url":"https://api.github.com/users/ManatiCR/following{/other_user}","gists_url":"https://api.github.com/users/ManatiCR/gists{/gist_id}","starred_url":"https://api.github.com/users/ManatiCR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManatiCR/subscriptions","organizations_url":"https://api.github.com/users/ManatiCR/orgs","repos_url":"https://api.github.com/users/ManatiCR/repos","events_url":"https://api.github.com/users/ManatiCR/events{/privacy}","received_events_url":"https://api.github.com/users/ManatiCR/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManatiCR/manatime","description":"Manati Time Tracker","fork":false,"url":"https://api.github.com/repos/ManatiCR/manatime","forks_url":"https://api.github.com/repos/ManatiCR/manatime/forks","keys_url":"https://api.github.com/repos/ManatiCR/manatime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManatiCR/manatime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManatiCR/manatime/teams","hooks_url":"https://api.github.com/repos/ManatiCR/manatime/hooks","issue_events_url":"https://api.github.com/repos/ManatiCR/manatime/issues/events{/number}","events_url":"https://api.github.com/repos/ManatiCR/manatime/events","assignees_url":"https://api.github.com/repos/ManatiCR/manatime/assignees{/user}","branches_url":"https://api.github.com/repos/ManatiCR/manatime/branches{/branch}","tags_url":"https://api.github.com/repos/ManatiCR/manatime/tags","blobs_url":"https://api.github.com/repos/ManatiCR/manatime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManatiCR/manatime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManatiCR/manatime/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManatiCR/manatime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManatiCR/manatime/statuses/{sha}","languages_url":"https://api.github.com/repos/ManatiCR/manatime/languages","stargazers_url":"https://api.github.com/repos/ManatiCR/manatime/stargazers","contributors_url":"https://api.github.com/repos/ManatiCR/manatime/contributors","subscribers_url":"https://api.github.com/repos/ManatiCR/manatime/subscribers","subscription_url":"https://api.github.com/repos/ManatiCR/manatime/subscription","commits_url":"https://api.github.com/repos/ManatiCR/manatime/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManatiCR/manatime/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManatiCR/manatime/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManatiCR/manatime/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManatiCR/manatime/contents/{+path}","compare_url":"https://api.github.com/repos/ManatiCR/manatime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManatiCR/manatime/merges","archive_url":"https://api.github.com/repos/ManatiCR/manatime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManatiCR/manatime/downloads","issues_url":"https://api.github.com/repos/ManatiCR/manatime/issues{/number}","pulls_url":"https://api.github.com/repos/ManatiCR/manatime/pulls{/number}","milestones_url":"https://api.github.com/repos/ManatiCR/manatime/milestones{/number}","notifications_url":"https://api.github.com/repos/ManatiCR/manatime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManatiCR/manatime/labels{/name}","releases_url":"https://api.github.com/repos/ManatiCR/manatime/releases{/id}","deployments_url":"https://api.github.com/repos/ManatiCR/manatime/deployments","created_at":"2016-08-12T20:52:46Z","updated_at":"2016-08-18T20:19:36Z","pushed_at":"2016-10-11T15:14:57Z","git_url":"git://github.com/ManatiCR/manatime.git","ssh_url":"git@github.com:ManatiCR/manatime.git","clone_url":"https://github.com/ManatiCR/manatime.git","svn_url":"https://github.com/ManatiCR/manatime","homepage":null,"size":263,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":17,"forks":0,"open_issues":17,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ManatiCR/manatime/pulls/70"},"html":{"href":"https://github.com/ManatiCR/manatime/pull/70"},"issue":{"href":"https://api.github.com/repos/ManatiCR/manatime/issues/70"},"comments":{"href":"https://api.github.com/repos/ManatiCR/manatime/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/ManatiCR/manatime/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/ManatiCR/manatime/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManatiCR/manatime/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/ManatiCR/manatime/statuses/07616ae7711192c91a3561d869ae84d38c2410fe"}}}}
{"actor":{"display_login":"kporras07"}}