From: Steve Sutton Date: Tue, 12 Mar 2019 17:30:09 +0000 (-0400) Subject: Add expire notices to jobs X-Git-Tag: v1.0.0~1^2~1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=313a3de83f58b7bb71e430052af1823a8d88d5d5;p=WP-Plugins%2Fglm-member-db-jobs.git Add expire notices to jobs New Fields: expire notice message expire notice enable flag Send email to Contact Email on the job when job posting expires. --- diff --git a/classes/data/dataEmailJobsNotifications.php b/classes/data/dataEmailJobsNotifications.php index ce7a661..9340d4f 100644 --- a/classes/data/dataEmailJobsNotifications.php +++ b/classes/data/dataEmailJobsNotifications.php @@ -116,46 +116,58 @@ class GlmDataEmailJobsNotifications extends GlmDataAbstract $this->fields = array ( 'id' => array ( - 'field' => 'id', - 'type' => 'integer', + 'field' => 'id', + 'type' => 'integer', 'view_only' => true, - 'use' => 'a' + 'use' => 'a' ), // Email Notification Message 'job_email_notification' => array( - 'field' => 'job_email_notification', - 'type' => 'text', + 'field' => 'job_email_notification', + 'type' => 'text', 'required' => false, - 'use' => 'a' + 'use' => 'a' ), // Event Declined Message 'job_declined_message' => array( - 'field' => 'job_declined_message', - 'type' => 'text', + 'field' => 'job_declined_message', + 'type' => 'text', 'required' => false, - 'use' => 'a' + 'use' => 'a' ), // Event Declined Message 'job_approved_message' => array( - 'field' => 'job_approved_message', - 'type' => 'text', + 'field' => 'job_approved_message', + 'type' => 'text', 'required' => false, - 'use' => 'a' + 'use' => 'a' ), // To Email address 'job_to_email' => array( - 'field' => 'job_to_email', - 'type' => 'text', + 'field' => 'job_to_email', + 'type' => 'text', 'required' => false, - 'use' => 'a' + 'use' => 'a' ), // From Email Address 'job_from_email' => array( - 'field' => 'job_from_email', - 'type' => 'text', + 'field' => 'job_from_email', + 'type' => 'text', 'required' => false, - 'use' => 'a' + 'use' => 'a' + ), + 'job_expire_notices' => array ( + 'field' => 'job_expire_notices', + 'type' => 'checkbox', + 'use' => 'a' + ), + // Email Expired Message + 'job_expired_message' => array( + 'field' => 'job_expired_message', + 'type' => 'text', + 'required' => false, + 'use' => 'a' ), ); @@ -181,5 +193,3 @@ class GlmDataEmailJobsNotifications extends GlmDataAbstract return $r; } } - -?> diff --git a/classes/helper/notifications.php b/classes/helper/notifications.php index 486ccca..001bda7 100644 --- a/classes/helper/notifications.php +++ b/classes/helper/notifications.php @@ -75,6 +75,12 @@ class GlmMembersAdmin_jobs_notification extends GlmDataMembers } + public function isExpireNoticesEnabled() + { + $settings = $this->config['settings']; + return $settings['job_expire_notices']; + } + /** * Send the member a notice. * @@ -82,16 +88,16 @@ class GlmMembersAdmin_jobs_notification extends GlmDataMembers * If not found use the member info record email. * If nothing in either one then return. */ - public function sendMemberNotice( $memberId, $data ) + public function sendExpireNotice( $email, $contact ) { - $member = $this->getEntry( $memberId ); - // find notify_to - // See if there's a primary member contact for this member - $notify_to = $settings['job_to_email']; + $notify_to = $email; if ( !$notify_to ) { return false; } - $validEmail = filter_var( $notify_to, FILTER_VALIDATE_EMAIL ); + $settings = $this->config['settings']; + $notify_from = $settings['job_from_email']; + $notify_message = $settings['job_expired_message']; + $validEmail = filter_var( $email, FILTER_VALIDATE_EMAIL ); if ( !$validEmail ) { return false; } @@ -104,17 +110,17 @@ class GlmMembersAdmin_jobs_notification extends GlmDataMembers // Setup the Smarty Engine $smarty = new smartyTemplateSupport(); - $viewPath = GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/views'; + $viewPath = GLM_MEMBERS_JOBS_PLUGIN_PATH . '/views'; $smarty->template->setTemplateDir( $viewPath ); // Add standard parameters - require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php'; - $viewFile = 'admin/events/memberEmail.html'; + require GLM_MEMBERS_PLUGIN_SETUP_PATH . '/standardTemplateParams.php'; + $viewFile = 'admin/jobs/expireNoticeEmail.html'; - $dataList = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL ."?page=glm-members-admin-menu-events-list&glm_action=list"; - $smarty->templateAssign( 'location', 'Member Events' ); - $smarty->templateAssign( 'name', $data['fieldData']['name'] ); - $smarty->templateAssign( 'pendingEvents', $dataList ); + $dataList = GLM_MEMBERS_JOBS_PLUGIN_ADMIN_URL . "?page=glm-members-admin-menu-jobs-index"; + $smarty->templateAssign( 'notify_message', $notify_message ); + $smarty->templateAssign( 'name', $contact ); + $smarty->templateAssign( 'job_list', $dataList ); // Generate output from model data and view $htmlMessage = $smarty->template->fetch( $viewFile ); @@ -131,7 +137,7 @@ class GlmMembersAdmin_jobs_notification extends GlmDataMembers // Send confirmation email, set the content type to allow html by using this filter add_filter( 'wp_mail_content_type', array( $this, 'set_content_type' ) ); - $subject = 'Event Approved'; + $subject = 'Your Job Posting Expired'; $message = $htmlMessage; $header[] = 'From:' . $notify_from; $header[] = 'Reply-To:' . $notify_from; @@ -178,7 +184,7 @@ class GlmMembersAdmin_jobs_notification extends GlmDataMembers $smarty->templateAssign( 'notify_message', $notify_message); $smarty->templateAssign( 'member', $member ); $smarty->templateAssign( 'name', $data['fieldData']['title']['name'] ); - + // Generate output from model data and view $htmlMessage = $smarty->template->fetch( $viewFile ); diff --git a/index.php b/index.php index dc2f4ff..ccfa628 100644 --- a/index.php +++ b/index.php @@ -38,7 +38,7 @@ * version from this plugin. */ define('GLM_MEMBERS_JOBS_PLUGIN_VERSION', '0.0.1'); -define('GLM_MEMBERS_JOBS_PLUGIN_DB_VERSION', '0.0.4'); +define('GLM_MEMBERS_JOBS_PLUGIN_DB_VERSION', '0.0.5'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_JOBS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0'); diff --git a/models/admin/ajax/jobsSendExpireNotice.php b/models/admin/ajax/jobsSendExpireNotice.php new file mode 100644 index 0000000..7e88dba --- /dev/null +++ b/models/admin/ajax/jobsSendExpireNotice.php @@ -0,0 +1,81 @@ +wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + } + + public function modelAction( $actionData = false ) { + // Grab list of emails for the notifications. + // Getting only the emails (if set) as contact email for the jobs that + // expire today. + + $notification = new GlmMembersAdmin_jobs_notification( $this->wpdb, $this->config ); + + $expireNoticesEnabled = $notification->isExpireNoticesEnabled(); + + if ( $expireNoticesEnabled ) { + + $expire_list = $this->wpdb->get_results( + "SELECT email_location,contact_name + FROM " . GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . "jobs + WHERE CURDATE() = DATE_ADD( updated, INTERVAL job_expiration DAY ) AND active = true", + ARRAY_A + ); + + if ( isset( $expire_list ) && is_array( $expire_list ) && !empty( $expire_list ) ) { + foreach ( $expire_list as $expire_item ) { + $notification->sendExpireNotice( $expire_item['email_location'], $expire_item['contact_name'] ); + } + } + // echo '
$expire_list: ' . print_r( $expire_list, true ) . '
'; + } + + } +} diff --git a/models/admin/jobs/index.php b/models/admin/jobs/index.php index 0d0fbfc..e23ce45 100644 --- a/models/admin/jobs/index.php +++ b/models/admin/jobs/index.php @@ -95,21 +95,21 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs $job_titles = new GlmDataJobTitles($this->wpdb,$this->config); - $success_message = ""; - $haveJob = false; - $option = false; - $job = false; - $job_data = false; - $jobUpdated = false; - $jobUpdateError = false; - $jobAdded = false; - $jobAddError = false; - $view_file = 'index'; - $lockedToMember = false; - $isModerated = false; - $memberID = false; - $haveMember = false; - $where = ' TRUE '; + $success_message = ""; + $haveJob = false; + $option = false; + $job = false; + $job_data = false; + $jobUpdated = false; + $jobUpdateError = false; + $jobAdded = false; + $jobAddError = false; + $view_file = 'index'; + $lockedToMember = false; + $isModerated = false; + $memberID = false; + $haveMember = false; + $where = ' TRUE '; $isPending = ( !empty( $_REQUEST['pending-job'] ) ) ? true : false; @@ -126,7 +126,7 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs if ($lockedToMember) { $isModerated = true;//apply_filters('glm_user_is_moderated', $lockedToMember); - $memberID = $lockedToMember; + $memberID = $lockedToMember; $this->fields['admin_name']['required'] = true; $this->fields['admin_email']['required'] = true; @@ -213,13 +213,13 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs case 'insert': - $job = $this->insertEntry(); + $job = $this->insertEntry(); $this->job_id = $job['fieldData']['id']; $this->checkNewJobTitles(); $updated = $this->getUpdatedTime($this->job_id); if ($job['status']) { - $haveJob = true; + $haveJob = true; $jobAdded = true; // Update created timestamp and name slug for URLs @@ -231,13 +231,13 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs $this->updateTimestamp('updated', $this->job_id,$job,$updated); // $job = $this->addNewTitle($job); - $option = 'edit'; + $option = 'edit'; $jobAdded = true; } else { - $option = 'add'; + $option = 'add'; $jobAddError = true; } @@ -260,7 +260,7 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs // If we're locked to a member as a contact user and the event member doesn't equal the contact member if ($lockedToMember && $job['fieldData']['member']['value'] != $lockedToMember) { $haveJob = false; - $job = false; + $job = false; } // If we have a good Job if ($job['status']) { @@ -268,7 +268,7 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs } $job_titles = $job_titles->getList(); // echo '
', print_r($job), '
'; - $job_data = $this->getList($where); + $job_data = $this->getList($where); $view_file = 'edit'; break; @@ -286,11 +286,11 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs } else { $jobUpdateError = true; } - $job_titles = $job_titles->getList(); + $job_titles = $job_titles->getList(); $job_data = $this->getList($where); $this->updateTimestamp('updated', $this->job_id,$job,$updated); - $haveJob = true; - $view_file = 'edit'; + $haveJob = true; + $view_file = 'edit'; break; @@ -302,10 +302,10 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs $jobDeleteError = true; } $view_file = "index"; - $job_data = $this->getList($where, "post_date DESC"); + $job_data = $this->getList($where, "post_date DESC"); break; default: - $job_data = $this->getList($where, "post_date DESC"); + $job_data = $this->getList($where, "post_date DESC"); $view_file = 'index'; break; diff --git a/models/front/jobs/list.php b/models/front/jobs/list.php index 0a92d0c..68ed8fd 100644 --- a/models/front/jobs/list.php +++ b/models/front/jobs/list.php @@ -104,44 +104,44 @@ class GlmMembersFront_jobs_list extends GlmDatajobs public function modelAction($actionData = false) { - $jobs_where = ' TRUE '; - $job_titles_where = ' TRUE '; - $exclude_jobs = ( !empty( $actionData['request']['exclude-jobs'] ) ) ? $actionData['request']['exclude-jobs'] : false; - $members_only = ( !empty( $actionData['request']['members-only'] ) ) ? $actionData['request']['members-only'] : false; - $members_only_page = get_option(GLM_MEMBERS_PLUGIN_OPTION_MEMBERS_ONLY_ID); - $is_members_only = is_in_tree($members_only_page); - $job_titles = new GlmDataJobTitles($this->wpdb,$this->config); - $listUrl = GLM_MEMBERS_JOBS_SITE_BASE_URL ."/job-postings"; - - $sql = "SELECT list_page_id FROM " . GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . "management"; + $jobs_where = ' TRUE '; + $job_titles_where = ' TRUE '; + $exclude_jobs = ( !empty( $actionData['request']['exclude-jobs'] ) ) ? $actionData['request']['exclude-jobs'] : false; + $members_only = ( !empty( $actionData['request']['members-only'] ) ) ? $actionData['request']['members-only'] : false; + $members_only_page = get_option(GLM_MEMBERS_PLUGIN_OPTION_MEMBERS_ONLY_ID); + $is_members_only = is_in_tree($members_only_page); + $job_titles = new GlmDataJobTitles($this->wpdb,$this->config); + $listUrl = GLM_MEMBERS_JOBS_SITE_BASE_URL ."/job-postings"; + + $sql = "SELECT list_page_id FROM " . GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . "management"; $list_page_id = $this->wpdb->get_results($sql, 'ARRAY_A'); if(!empty($list_page_id)){ - $listUrl = get_permalink($list_page_id[0]['list_page_id']); + $listUrl = get_permalink($list_page_id[0]['list_page_id']); } - + if( $exclude_jobs && ( !$is_members_only && $members_only ) ){ $job_titles_where .= "AND id NOT IN ( $exclude_jobs ) "; - $jobs_where .= "AND title NOT IN ( $exclude_jobs ) "; + $jobs_where .= "AND title NOT IN ( $exclude_jobs ) "; }else if($exclude_jobs){ $job_titles_where .= "AND id NOT IN ( $exclude_jobs ) "; - $jobs_where .= "AND title NOT IN ( $exclude_jobs ) "; + $jobs_where .= "AND title NOT IN ( $exclude_jobs ) "; } - - $job_titles = $job_titles->getList($job_titles_where); + + $job_titles = $job_titles->getList($job_titles_where); $success_message = ""; - $option = false; + $option = false; if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') { $option = $_REQUEST['option']; } $jobs_where .= "AND CURDATE() <= DATE_ADD(updated, INTERVAL job_expiration DAY) AND active = true "; - + if (isset($_REQUEST['job_titles']) && $_REQUEST['job_titles'] !== '') { // Make sure it's numeric $job_title_id = ($_REQUEST['job_titles'] - 0); - $jobs_where .= "AND title = $job_title_id"; - $job_data = $this->getList($jobs_where); + $jobs_where .= "AND title = $job_title_id"; + $job_data = $this->getList($jobs_where); } else { $job_data = $this->getList($jobs_where); } @@ -151,17 +151,17 @@ class GlmMembersFront_jobs_list extends GlmDatajobs $templateData = array( 'jobData' => $job_data, 'jobTitles' => $job_titles, - 'siteBaseUrl' => GLM_MEMBERS_JOBS_SITE_BASE_URL, + 'siteBaseUrl' => GLM_MEMBERS_JOBS_SITE_BASE_URL, 'currentUrl' => GLM_MEMBERS_JOBS_PLUGIN_CURRENT_URL, 'listUrl' => $listUrl ); // Return status, any suggested view, and any data to controller return array( - 'status' => true, + 'status' => true, 'modelRedirect' => false, - 'view' => 'front/jobs/'.$view_file.'.html', - 'data' => $templateData + 'view' => 'front/jobs/'.$view_file.'.html', + 'data' => $templateData ); } diff --git a/setup/adminHooks.php b/setup/adminHooks.php index 53de97e..29efc8a 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -48,3 +48,20 @@ add_filter( return true; },10,1 ); + +// Setup cron task for sending emails. +add_filter( + 'glm_associate_cron_request', + function( $cron_task ){ + $new_cron = array( + array( + 'menu' => 'ajax', + 'action' => 'jobsSendExpireNotice', + 'daysOfWeek' => false, + 'times' => array( 5 ), + 'params' => array() + ) + ); + return array_merge( $cron_task, $new_cron ); + } +); diff --git a/setup/databaseScripts/create_database_V0.0.4.sql b/setup/databaseScripts/create_database_V0.0.4.sql deleted file mode 100644 index 312dc05..0000000 --- a/setup/databaseScripts/create_database_V0.0.4.sql +++ /dev/null @@ -1,99 +0,0 @@ --- Gaslight Media Members Database - Job Postings --- File Created: 11/20/17 15:27:15 --- Database Version: 0.0.3 --- Database Creation Script --- --- This file is called to create a new set of tables for this --- add-on for the most receint database version for this add-on. --- --- There should only be one such file in this directory --- --- To permit each query below to be executed separately, --- all queries must be separated by a line with four dashes - --- Conditions Table -CREATE TABLE {prefix}jobs ( - id INT NOT NULL AUTO_INCREMENT, - old_id int NULL , - title int NULL , - descr TEXT NULL , - salary TINYTEXT NULL , - email_location TINYTEXT NULL , - resume_location TINYTEXT NULL , - contact_name TINYTEXT NULL , - contact_phone TINYTEXT NULL , - post_date DATETIME NULL, - updated DATETIME NULL, - active BOOL NULL, - facility_operation TEXT NULL, - requirements TEXT NULL, - benefits TEXT NULL , - job_location TINYTEXT NULL , - job_expiration INT NULL, - duration TINYTEXT NULL , - deadline TINYTEXT NULL , - company TINYTEXT NULL , - repost TINYTEXT NULL , - position_available TINYTEXT NULL , - member INT NULL, - PRIMARY KEY (id) -); - ----- - --- Job Titles -CREATE TABLE {prefix}job_titles ( - id INT NOT NULL AUTO_INCREMENT, - old_id INT NULL, - job_title TINYTEXT NULL , - PRIMARY KEY (id) -); - ----- - --- Event Email Notifications -CREATE TABLE {prefix}email_notifications ( - id INT NOT NULL AUTO_INCREMENT, - job_declined_message TEXT NULL, -- Event declined message - job_approved_message TEXT NULL, -- Event approved message - job_to_email TINYTEXT NULL, -- To Email Address - job_from_email TINYTEXT NULL, -- From Email Address - job_email_notification TEXT NULL, -- Email notification message - PRIMARY KEY (id) -); - ----- - --- Event Email Notifications -CREATE TABLE {prefix}management ( - id INT NOT NULL AUTO_INCREMENT, - list_page_id INT NULL, - PRIMARY KEY (id) -); - ----- - --- Set default event email settings -INSERT INTO {prefix}email_notifications - ( id, job_declined_message, job_approved_message ) - VALUES - ( 1, 'The Job parameters do not comply with our event guidelines.', 'Your Job has been approved.' ) -; - ----- - --- Job Titles default entries in table --- INSERT INTO {prefix}job_titles ( id,old_id,job_title) VALUES --- (1,1, 'Supervisor'),(2,1,'Groundskeeper'),(3,1,'Janitor'); - ----- - --- Job Titles default entries in table --- INSERT INTO {prefix}jobs ( --- id,old_id,title,descr,salary, email_location,resume_location,contact_name,contact_phone,post_date,updated,visible, --- facility_operation,requirements,job_location,job_expiration,duration,deadline,position_available, --- company,member,benefits --- ) VALUES ( 1,1, 1,"DESCRIPTION",'SALARY', 'EMAIL LOCATION', 'RESUME LOCATION','CONTACT NAME', '453-3443', NOW(),NOW(), true, --- 'facility operations', 'REQUIREMENTS', 'JOB LOCATION', 30, 'JOB DURATION', 'DEADLINE', 'POSITION AVAILABLE', --- 'COMPANY', 1, 'JOB BENEFITS' --- ); \ No newline at end of file diff --git a/setup/databaseScripts/create_database_V0.0.5.sql b/setup/databaseScripts/create_database_V0.0.5.sql new file mode 100644 index 0000000..15bd90a --- /dev/null +++ b/setup/databaseScripts/create_database_V0.0.5.sql @@ -0,0 +1,101 @@ +-- Gaslight Media Members Database - Job Postings +-- File Created: 11/20/17 15:27:15 +-- Database Version: 0.0.5 +-- Database Creation Script +-- +-- This file is called to create a new set of tables for this +-- add-on for the most receint database version for this add-on. +-- +-- There should only be one such file in this directory +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +-- Conditions Table +CREATE TABLE {prefix}jobs ( + id INT NOT NULL AUTO_INCREMENT, + old_id int NULL , + title int NULL , + descr TEXT NULL , + salary TINYTEXT NULL , + email_location TINYTEXT NULL , + resume_location TINYTEXT NULL , + contact_name TINYTEXT NULL , + contact_phone TINYTEXT NULL , + post_date DATETIME NULL, + updated DATETIME NULL, + active BOOL NULL, + facility_operation TEXT NULL, + requirements TEXT NULL, + benefits TEXT NULL , + job_location TINYTEXT NULL , + job_expiration INT NULL, + duration TINYTEXT NULL , + deadline TINYTEXT NULL , + company TINYTEXT NULL , + repost TINYTEXT NULL , + position_available TINYTEXT NULL , + member INT NULL, + PRIMARY KEY (id) +); + +---- + +-- Job Titles +CREATE TABLE {prefix}job_titles ( + id INT NOT NULL AUTO_INCREMENT, + old_id INT NULL, + job_title TINYTEXT NULL , + PRIMARY KEY (id) +); + +---- + +-- Event Email Notifications +CREATE TABLE {prefix}email_notifications ( + id INT NOT NULL AUTO_INCREMENT, + job_declined_message TEXT NULL, -- Event declined message + job_approved_message TEXT NULL, -- Event approved message + job_to_email TINYTEXT NULL, -- To Email Address + job_from_email TINYTEXT NULL, -- From Email Address + job_email_notification TEXT NULL, -- Email notification message + job_expire_notices BOOLEAN DEFAULT '0', -- Turn on expire notices + job_expired_message TEXT NULL, -- Event Expired message + PRIMARY KEY (id) +); + +---- + +-- Event Email Notifications +CREATE TABLE {prefix}management ( + id INT NOT NULL AUTO_INCREMENT, + list_page_id INT NULL, + PRIMARY KEY (id) +); + +---- + +-- Set default event email settings +INSERT INTO {prefix}email_notifications + ( id, job_declined_message, job_approved_message, job_expired_message, job_expire_notices ) + VALUES + ( 1, 'The Job parameters do not comply with our event guidelines.', 'Your Job has been approved.', 'Your Job posting has expired.', false ) +; + +---- + +-- Job Titles default entries in table +-- INSERT INTO {prefix}job_titles ( id,old_id,job_title) VALUES +-- (1,1, 'Supervisor'),(2,1,'Groundskeeper'),(3,1,'Janitor'); + +---- + +-- Job Titles default entries in table +-- INSERT INTO {prefix}jobs ( +-- id,old_id,title,descr,salary, email_location,resume_location,contact_name,contact_phone,post_date,updated,visible, +-- facility_operation,requirements,job_location,job_expiration,duration,deadline,position_available, +-- company,member,benefits +-- ) VALUES ( 1,1, 1,"DESCRIPTION",'SALARY', 'EMAIL LOCATION', 'RESUME LOCATION','CONTACT NAME', '453-3443', NOW(),NOW(), true, +-- 'facility operations', 'REQUIREMENTS', 'JOB LOCATION', 30, 'JOB DURATION', 'DEADLINE', 'POSITION AVAILABLE', +-- 'COMPANY', 1, 'JOB BENEFITS' +-- ); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 35200ae..23ff089 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -38,4 +38,5 @@ $glmMembersjobsDbVersions = array( '0.0.2' => array('version' => '0.0.2', 'tables' => 2, 'date' => '11/21/2017'), '0.0.3' => array('version' => '0.0.3', 'tables' => 3, 'date' => '12/21/2017'), '0.0.4' => array('version' => '0.0.4', 'tables' => 4, 'date' => '07/31/2018'), + '0.0.5' => array('version' => '0.0.5', 'tables' => 4, 'date' => '03/11/2019'), ); diff --git a/setup/databaseScripts/update_database_V0.0.5.sql b/setup/databaseScripts/update_database_V0.0.5.sql new file mode 100644 index 0000000..b18a58e --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.5.sql @@ -0,0 +1,18 @@ +-- Gaslight Media Members Database - Events Add-On +-- File Created: 2019-03-11 +-- Database Version: 0.0.5 +-- Database Update From Previous Version Script +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +-- Event Email Notifications +ALTER TABLE {prefix}email_notifications ADD COLUMN job_expire_notices BOOLEAN DEFAULT '0'; + +---- + +ALTER TABLE {prefix}email_notifications ADD COLUMN job_expired_message TEXT NULL; + +---- + +UPDATE {prefix}email_notifications SET job_expired_message = 'Your Job posting has expired.', job_expire_notices = false WHERE id = 1; diff --git a/setup/validActions.php b/setup/validActions.php index 464e8d9..0566b75 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -59,7 +59,10 @@ $glmMembersjobsAddOnValidActions = array( 'adminActions' => array( - 'jobs' => array( + 'ajax' => array( + 'jobsSendExpireNotice' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, + ), + 'jobs' => array( 'index' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, ), 'settings' => array( @@ -71,11 +74,11 @@ $glmMembersjobsAddOnValidActions = array( ) ), 'frontActions' => array( - 'jobs' => array( + 'jobs' => array( 'list' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, 'detail' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, ), ) ); -?> \ No newline at end of file +?> diff --git a/views/admin/jobs/edit.html b/views/admin/jobs/edit.html index 8548701..50a5e39 100644 --- a/views/admin/jobs/edit.html +++ b/views/admin/jobs/edit.html @@ -42,7 +42,7 @@ Visible
- +
diff --git a/views/admin/jobs/expireNoticeEmail.html b/views/admin/jobs/expireNoticeEmail.html new file mode 100644 index 0000000..cc2c419 --- /dev/null +++ b/views/admin/jobs/expireNoticeEmail.html @@ -0,0 +1,25 @@ + + + + + + +

Job Posting Expired Notification

+ +
+

{$notify_message}

+
+ + + + + + +
Contact Name:{$name}
+ +
+

A Job Posting has expired.

+

To view it, please go to the Jobs page in your admin.

+
+ + diff --git a/views/admin/settings/emailJobsNotifications.html b/views/admin/settings/emailJobsNotifications.html index 34c3773..79eb3a2 100644 --- a/views/admin/settings/emailJobsNotifications.html +++ b/views/admin/settings/emailJobsNotifications.html @@ -65,6 +65,31 @@ )} +
+ + +
+
+ + +
+