{"action":"created","comment":{"url":"https://api.github.com/repos/openemr/openemr/pulls/comments/72900049","id":72900049,"diff_hunk":"@@ -0,0 +1,197 @@\n+<?php\n+/**\n+ * interface/main/holidays/import_holidays.php holidays/clinic handle import/download holidays files\n+ *\n+ * Copyright (C) 2016 Sharon Cohen <sharonco@matrix.co.il>\n+ *\n+ * LICENSE: This program is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU General Public License\n+ * as published by the Free Software Foundation; either version 3\n+ * of the License, or (at your option) any later version.\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+ * GNU General Public License for more details.\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.\n+ *\n+ * @package OpenEMR\n+ * @author  sharonco <sharonco@matrix.co.il>\n+ * @link    http://www.open-emr.org\n+ */\n+\n+?>\n+<?php\n+/**\n+ *\n+ * @package OpenEMR\n+ * @author  sharon cohen <sharonco@matrix.co.il>\n+ * @link    http://www.open-emr.org\n+ */\n+\n+set_time_limit(0);\n+\n+// Disable magic quotes and fake register globals.\n+$sanitize_all_escapes = true;\n+$fake_register_globals = false;\n+require_once('../../globals.php');\n+require_once($GLOBALS['srcdir'] . '/acl.inc');\n+require_once(\"$srcdir/htmlspecialchars.inc.php\");\n+require_once(\"$srcdir/sql.inc\");\n+require_once(\"Holidays_Controller.php\");\n+\n+if (!acl_check('admin', 'super')) die(xlt('Not authorized'));\n+\n+$holidays_controller = new Holidays_Controller();\n+$csv_file_data = $holidays_controller->get_file_csv_data();\n+\n+//this part download the CSV file after the click on the href link\n+if($_GET['download_file']==1) {\n+    $target_file=$holidays_controller->get_target_file();\n+    if ( ! file_exists($target_file))\n+    {\n+        echo 'file missing';\n+    }\n+    else\n+    {\n+        header('HTTP/1.1 200 OK');\n+        header('Cache-Control: no-cache, must-revalidate');\n+        header(\"Pragma: no-cache\");\n+        header(\"Expires: 0\");\n+        header(\"Content-type: text/csv\");\n+        header(\"Content-Disposition: attachment; filename='holiday.csv'\");\n+        readfile($target_file);\n+        exit;\n+    }\n+    die();\n+}\n+// end download section\n+\n+// Handle uploads.\n+\n+if (!empty($_POST['bn_upload'])) {\n+    //Upload and save the csv\n+    $saved = $holidays_controller->upload_csv($_FILES);\n+    if($saved) {\n+        $csv_file_data = $holidays_controller->get_file_csv_data();\n+    }\n+\n+}\n+if (!empty($_POST['import_holidays'])) {\n+    //Import from the csv file to the calendar external table\n+    $saved = $holidays_controller->import_holidays_from_csv();\n+}\n+if (!empty($_POST['sync'])) {\n+    //Upload and save the csv\n+    $saved = $holidays_controller->create_holiday_event();\n+}\n+\n+\n+?>\n+\n+<html>\n+<head>\n+    <title><?php echo xlt('Holidays management'); ?></title>\n+    <link rel=\"stylesheet\" href='<?php echo $css_header ?>' type='text/css'>\n+\n+</head>\n+\n+<body class=\"body_top\">\n+<?php\n+if ($saved){\n+    echo \"<p style='color:green'>\" .\n+        xlt('Successfully Completed');\n+        \"</p>\\n\";\n+}elseif(!empty($_POST['bn_upload'])             &&\n+        !empty($_POST['import_holidays'])       &&\n+        !empty($_POST['sync'])\n+        ){\n+    echo \"<p style='color:red'>\" .\n+        xlt('Operation Failed' );\n+    \"</p>\\n\";\n+}\n+?>\n+<form method='post' action='import_holidays.php' enctype='multipart/form-data'\n+      onsubmit='return top.restoreSession()'>\n+\n+        <p class='text'>\n+        <table border='1' cellpadding='4'>\n+            <tr bgcolor='#dddddd' class='dehead'>\n+                <td align='center' colspan='2'>\n+                    <?php echo xlt('CSV'); ?>\n+                </td>\n+            </tr>\n+            <tr>\n+                <td class='detail' nowrap>\n+                    <?php echo htmlspecialchars(xl('CSV File')); ?>\n+                    <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"350000000\" />\n+                </td>\n+                <td class='detail' nowrap>\n+                    <input type=\"file\" name=\"form_file\" size=\"40\" />\n+                </td>\n+            </tr>\n+            <tr>\n+                <td class='detail' nowrap>\n+                    <?php echo xlt('File on server (modification date)'); ?>\n+                </td>\n+                <td class='detail' nowrap>\n+                    <?php\n+                    if(!empty($csv_file_data)){?>\n+\n+                        <?php $path=explode(\"/\",$holidays_controller->get_target_file());?>\n+                        <?php $filename=$path[count($path)-1];?>\n+                        <?php unset($path[count($path)-1]);?>\n+\n+                        <?php\n+                        // build the path to the for the download request\n+                        $phppagepath = \"http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]?filename=\";?>\n+                        <a href=\"#\" onclick='window.open(\"import_holidays.php?download_file=1\")'><?php echo text($csv_file_data['date']);?></a>\n+                    <?php }else{\n+                        echo htmlspecialchars(xl('File not found'));\n+                    }?>\n+                </td>\n+            </tr>\n+\n+        <tr bgcolor='#dddddd'>\n+                <td align='center' class='detail' colspan='2'>\n+                    <input type='submit' name='bn_upload' value='<?php echo xla('Upload / Save') ?>' />\n+                </td>\n+            </tr>\n+        </table>\n+        </p>\n+</form>\n+        <table border='1'>\n+\n+        <tr >\n+            <td >\n+                <form method='post' action='import_holidays.php' onsubmit='return top.restoreSession()'>\n+                    <input type='submit' name='import_holidays' value='<?php echo xla('Import holiday events') ?>'></br>\n+\n+                </form>\n+            </td>\n+\n+            <td>\n+                    <?php echo xla('CSV to calendar_external table'); ?></br>\n+                <?php echo xla('If  the csv has been uploaded please click on \"Import holiday events\" button\n+                    **NOTE: clicking on the button will remove all the existing rows in the calendar external table')?>\n+                </td>\n+        </tr>\n+            <tr >\n+                <td >\n+                    <form method='post' action='import_holidays.php' onsubmit='return top.restoreSession()'>\n+                        <input type='submit' name='sync' value='<?php echo xla('Syncronize') ?>' /></br>\n+                    </form>\n+                </td>\n+                <td >\n+                    <?php echo xla('calendar_External to events'); ?></br>\n+                    <?php echo xla('If you have already filled the calendar external table please click on \"Syncronize\" to have the holidays n the calendar view \n+                    **NOTE: clicking on the button will remove all the existing rows in the events table related to holidays')?>","path":"interface/main/holidays/import_holidays.php","position":188,"original_position":188,"commit_id":"2b789815b953cce939a806e56b85032263c5de7b","original_commit_id":"2b789815b953cce939a806e56b85032263c5de7b","user":{"login":"bradymiller","id":278968,"avatar_url":"https://avatars.githubusercontent.com/u/278968?v=3","gravatar_id":"","url":"https://api.github.com/users/bradymiller","html_url":"https://github.com/bradymiller","followers_url":"https://api.github.com/users/bradymiller/followers","following_url":"https://api.github.com/users/bradymiller/following{/other_user}","gists_url":"https://api.github.com/users/bradymiller/gists{/gist_id}","starred_url":"https://api.github.com/users/bradymiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradymiller/subscriptions","organizations_url":"https://api.github.com/users/bradymiller/orgs","repos_url":"https://api.github.com/users/bradymiller/repos","events_url":"https://api.github.com/users/bradymiller/events{/privacy}","received_events_url":"https://api.github.com/users/bradymiller/received_events","type":"User","site_admin":false},"body":"Need to be on one line. See above for example.","created_at":"2016-07-31T07:52:46Z","updated_at":"2016-07-31T07:52:46Z","html_url":"https://github.com/openemr/openemr/pull/163#discussion_r72900049","pull_request_url":"https://api.github.com/repos/openemr/openemr/pulls/163","_links":{"self":{"href":"https://api.github.com/repos/openemr/openemr/pulls/comments/72900049"},"html":{"href":"https://github.com/openemr/openemr/pull/163#discussion_r72900049"},"pull_request":{"href":"https://api.github.com/repos/openemr/openemr/pulls/163"}}},"pull_request":{"url":"https://api.github.com/repos/openemr/openemr/pulls/163","id":78688305,"html_url":"https://github.com/openemr/openemr/pull/163","diff_url":"https://github.com/openemr/openemr/pull/163.diff","patch_url":"https://github.com/openemr/openemr/pull/163.patch","issue_url":"https://api.github.com/repos/openemr/openemr/issues/163","number":163,"state":"open","locked":false,"title":"Holidays in calendar","user":{"login":"matrix-olegsv","id":17746516,"avatar_url":"https://avatars.githubusercontent.com/u/17746516?v=3","gravatar_id":"","url":"https://api.github.com/users/matrix-olegsv","html_url":"https://github.com/matrix-olegsv","followers_url":"https://api.github.com/users/matrix-olegsv/followers","following_url":"https://api.github.com/users/matrix-olegsv/following{/other_user}","gists_url":"https://api.github.com/users/matrix-olegsv/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-olegsv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-olegsv/subscriptions","organizations_url":"https://api.github.com/users/matrix-olegsv/orgs","repos_url":"https://api.github.com/users/matrix-olegsv/repos","events_url":"https://api.github.com/users/matrix-olegsv/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-olegsv/received_events","type":"User","site_admin":false},"body":"Hi, in this branch we implemented the holiday events for the whole clinic.\r\nHow it works:\r\n*Create csv file with date,title\r\n\r\n2016-07-04,Independence day\r\n2016-12,25,Christmas\r\n\r\n*Administration->Other->Import Holidays\r\n\r\n*Upload the csv you just created\r\n* If the file was uploaded successfully ->Click on \"Import Holiday events\"\r\n*On success -> Click on \"Synchronize\"\r\n\r\nVOILA!!\r\n\r\n*On the calendar you will see the holidays  (dates and titles from the csv)\r\n*When adding an appointment on that day it will \"alert\" that is a holiday (like when provider not available)\r\n\r\nLet us know if you have any questions!\r\n\r\n ","created_at":"2016-07-25T14:13:47Z","updated_at":"2016-07-31T07:52:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"65ef2cd94663e29ffa75661764126052b91cb732","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openemr/openemr/pulls/163/commits","review_comments_url":"https://api.github.com/repos/openemr/openemr/pulls/163/comments","review_comment_url":"https://api.github.com/repos/openemr/openemr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openemr/openemr/issues/163/comments","statuses_url":"https://api.github.com/repos/openemr/openemr/statuses/2b789815b953cce939a806e56b85032263c5de7b","head":{"label":"matrix-israel:SC/Holidays","ref":"SC/Holidays","sha":"2b789815b953cce939a806e56b85032263c5de7b","user":{"login":"matrix-israel","id":17746552,"avatar_url":"https://avatars.githubusercontent.com/u/17746552?v=3","gravatar_id":"","url":"https://api.github.com/users/matrix-israel","html_url":"https://github.com/matrix-israel","followers_url":"https://api.github.com/users/matrix-israel/followers","following_url":"https://api.github.com/users/matrix-israel/following{/other_user}","gists_url":"https://api.github.com/users/matrix-israel/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-israel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-israel/subscriptions","organizations_url":"https://api.github.com/users/matrix-israel/orgs","repos_url":"https://api.github.com/users/matrix-israel/repos","events_url":"https://api.github.com/users/matrix-israel/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-israel/received_events","type":"Organization","site_admin":false},"repo":{"id":54314139,"name":"openemr","full_name":"matrix-israel/openemr","owner":{"login":"matrix-israel","id":17746552,"avatar_url":"https://avatars.githubusercontent.com/u/17746552?v=3","gravatar_id":"","url":"https://api.github.com/users/matrix-israel","html_url":"https://github.com/matrix-israel","followers_url":"https://api.github.com/users/matrix-israel/followers","following_url":"https://api.github.com/users/matrix-israel/following{/other_user}","gists_url":"https://api.github.com/users/matrix-israel/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-israel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-israel/subscriptions","organizations_url":"https://api.github.com/users/matrix-israel/orgs","repos_url":"https://api.github.com/users/matrix-israel/repos","events_url":"https://api.github.com/users/matrix-israel/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-israel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/matrix-israel/openemr","description":"Mirror of official OpenEMR Sourceforge repository","fork":true,"url":"https://api.github.com/repos/matrix-israel/openemr","forks_url":"https://api.github.com/repos/matrix-israel/openemr/forks","keys_url":"https://api.github.com/repos/matrix-israel/openemr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/matrix-israel/openemr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/matrix-israel/openemr/teams","hooks_url":"https://api.github.com/repos/matrix-israel/openemr/hooks","issue_events_url":"https://api.github.com/repos/matrix-israel/openemr/issues/events{/number}","events_url":"https://api.github.com/repos/matrix-israel/openemr/events","assignees_url":"https://api.github.com/repos/matrix-israel/openemr/assignees{/user}","branches_url":"https://api.github.com/repos/matrix-israel/openemr/branches{/branch}","tags_url":"https://api.github.com/repos/matrix-israel/openemr/tags","blobs_url":"https://api.github.com/repos/matrix-israel/openemr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/matrix-israel/openemr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/matrix-israel/openemr/git/refs{/sha}","trees_url":"https://api.github.com/repos/matrix-israel/openemr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/matrix-israel/openemr/statuses/{sha}","languages_url":"https://api.github.com/repos/matrix-israel/openemr/languages","stargazers_url":"https://api.github.com/repos/matrix-israel/openemr/stargazers","contributors_url":"https://api.github.com/repos/matrix-israel/openemr/contributors","subscribers_url":"https://api.github.com/repos/matrix-israel/openemr/subscribers","subscription_url":"https://api.github.com/repos/matrix-israel/openemr/subscription","commits_url":"https://api.github.com/repos/matrix-israel/openemr/commits{/sha}","git_commits_url":"https://api.github.com/repos/matrix-israel/openemr/git/commits{/sha}","comments_url":"https://api.github.com/repos/matrix-israel/openemr/comments{/number}","issue_comment_url":"https://api.github.com/repos/matrix-israel/openemr/issues/comments{/number}","contents_url":"https://api.github.com/repos/matrix-israel/openemr/contents/{+path}","compare_url":"https://api.github.com/repos/matrix-israel/openemr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/matrix-israel/openemr/merges","archive_url":"https://api.github.com/repos/matrix-israel/openemr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/matrix-israel/openemr/downloads","issues_url":"https://api.github.com/repos/matrix-israel/openemr/issues{/number}","pulls_url":"https://api.github.com/repos/matrix-israel/openemr/pulls{/number}","milestones_url":"https://api.github.com/repos/matrix-israel/openemr/milestones{/number}","notifications_url":"https://api.github.com/repos/matrix-israel/openemr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/matrix-israel/openemr/labels{/name}","releases_url":"https://api.github.com/repos/matrix-israel/openemr/releases{/id}","deployments_url":"https://api.github.com/repos/matrix-israel/openemr/deployments","created_at":"2016-03-20T11:32:59Z","updated_at":"2016-03-22T10:56:31Z","pushed_at":"2016-07-31T06:51:22Z","git_url":"git://github.com/matrix-israel/openemr.git","ssh_url":"git@github.com:matrix-israel/openemr.git","clone_url":"https://github.com/matrix-israel/openemr.git","svn_url":"https://github.com/matrix-israel/openemr","homepage":"http://open-emr.org/","size":256709,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"openemr:master","ref":"master","sha":"f23541d26b9b60e0b18e7b2b391acfb88e24566d","user":{"login":"openemr","id":283089,"avatar_url":"https://avatars.githubusercontent.com/u/283089?v=3","gravatar_id":"","url":"https://api.github.com/users/openemr","html_url":"https://github.com/openemr","followers_url":"https://api.github.com/users/openemr/followers","following_url":"https://api.github.com/users/openemr/following{/other_user}","gists_url":"https://api.github.com/users/openemr/gists{/gist_id}","starred_url":"https://api.github.com/users/openemr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openemr/subscriptions","organizations_url":"https://api.github.com/users/openemr/orgs","repos_url":"https://api.github.com/users/openemr/repos","events_url":"https://api.github.com/users/openemr/events{/privacy}","received_events_url":"https://api.github.com/users/openemr/received_events","type":"User","site_admin":false},"repo":{"id":679584,"name":"openemr","full_name":"openemr/openemr","owner":{"login":"openemr","id":283089,"avatar_url":"https://avatars.githubusercontent.com/u/283089?v=3","gravatar_id":"","url":"https://api.github.com/users/openemr","html_url":"https://github.com/openemr","followers_url":"https://api.github.com/users/openemr/followers","following_url":"https://api.github.com/users/openemr/following{/other_user}","gists_url":"https://api.github.com/users/openemr/gists{/gist_id}","starred_url":"https://api.github.com/users/openemr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openemr/subscriptions","organizations_url":"https://api.github.com/users/openemr/orgs","repos_url":"https://api.github.com/users/openemr/repos","events_url":"https://api.github.com/users/openemr/events{/privacy}","received_events_url":"https://api.github.com/users/openemr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/openemr/openemr","description":"Mirror of official OpenEMR Sourceforge repository","fork":false,"url":"https://api.github.com/repos/openemr/openemr","forks_url":"https://api.github.com/repos/openemr/openemr/forks","keys_url":"https://api.github.com/repos/openemr/openemr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openemr/openemr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openemr/openemr/teams","hooks_url":"https://api.github.com/repos/openemr/openemr/hooks","issue_events_url":"https://api.github.com/repos/openemr/openemr/issues/events{/number}","events_url":"https://api.github.com/repos/openemr/openemr/events","assignees_url":"https://api.github.com/repos/openemr/openemr/assignees{/user}","branches_url":"https://api.github.com/repos/openemr/openemr/branches{/branch}","tags_url":"https://api.github.com/repos/openemr/openemr/tags","blobs_url":"https://api.github.com/repos/openemr/openemr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openemr/openemr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openemr/openemr/git/refs{/sha}","trees_url":"https://api.github.com/repos/openemr/openemr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openemr/openemr/statuses/{sha}","languages_url":"https://api.github.com/repos/openemr/openemr/languages","stargazers_url":"https://api.github.com/repos/openemr/openemr/stargazers","contributors_url":"https://api.github.com/repos/openemr/openemr/contributors","subscribers_url":"https://api.github.com/repos/openemr/openemr/subscribers","subscription_url":"https://api.github.com/repos/openemr/openemr/subscription","commits_url":"https://api.github.com/repos/openemr/openemr/commits{/sha}","git_commits_url":"https://api.github.com/repos/openemr/openemr/git/commits{/sha}","comments_url":"https://api.github.com/repos/openemr/openemr/comments{/number}","issue_comment_url":"https://api.github.com/repos/openemr/openemr/issues/comments{/number}","contents_url":"https://api.github.com/repos/openemr/openemr/contents/{+path}","compare_url":"https://api.github.com/repos/openemr/openemr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openemr/openemr/merges","archive_url":"https://api.github.com/repos/openemr/openemr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openemr/openemr/downloads","issues_url":"https://api.github.com/repos/openemr/openemr/issues{/number}","pulls_url":"https://api.github.com/repos/openemr/openemr/pulls{/number}","milestones_url":"https://api.github.com/repos/openemr/openemr/milestones{/number}","notifications_url":"https://api.github.com/repos/openemr/openemr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openemr/openemr/labels{/name}","releases_url":"https://api.github.com/repos/openemr/openemr/releases{/id}","deployments_url":"https://api.github.com/repos/openemr/openemr/deployments","created_at":"2010-05-21T19:54:08Z","updated_at":"2016-07-26T06:27:42Z","pushed_at":"2016-07-30T09:01:30Z","git_url":"git://github.com/openemr/openemr.git","ssh_url":"git@github.com:openemr/openemr.git","clone_url":"https://github.com/openemr/openemr.git","svn_url":"https://github.com/openemr/openemr","homepage":"http://open-emr.org/","size":277679,"stargazers_count":294,"watchers_count":294,"language":"PHP","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":443,"mirror_url":null,"open_issues_count":41,"forks":443,"open_issues":41,"watchers":294,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openemr/openemr/pulls/163"},"html":{"href":"https://github.com/openemr/openemr/pull/163"},"issue":{"href":"https://api.github.com/repos/openemr/openemr/issues/163"},"comments":{"href":"https://api.github.com/repos/openemr/openemr/issues/163/comments"},"review_comments":{"href":"https://api.github.com/repos/openemr/openemr/pulls/163/comments"},"review_comment":{"href":"https://api.github.com/repos/openemr/openemr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openemr/openemr/pulls/163/commits"},"statuses":{"href":"https://api.github.com/repos/openemr/openemr/statuses/2b789815b953cce939a806e56b85032263c5de7b"}}}}
{"actor":{"display_login":"bradymiller"}}