From ca4085109c3c5eb3ff7c30e6c87a1c0446c88794 Mon Sep 17 00:00:00 2001 From: Jonathan Rosenbaum Date: Thu, 20 Dec 2018 22:04:55 +0000 Subject: [PATCH] This closes #83 adding probation status to shop_log for contact_id. --- Connections/database_functions.php | 12 +++++++++++- js/shop.js | 18 +++++++++++++++++- json/contact.php | 11 ++++++++++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/Connections/database_functions.php b/Connections/database_functions.php index 2f658ca..9dff555 100644 --- a/Connections/database_functions.php +++ b/Connections/database_functions.php @@ -119,6 +119,16 @@ // Ban those pesky individuals who continually refuse to follow policies and safer space agreements by contact_id $banned_individuals = array(); + +/************ +PROBATION IDS +************/ + +// Put individuals under probation by contact_id. Probation could be used for a variety of scenarios, +// an individual who may potentially become banned, or who has been deemed as worthy of coming out of a ban, +// or someone who IOU's volunteer time for a bike they earned (generally, people should not be allowed to do +// this in the first place), etc. +$probation_individuals = array(); /******* CONTACTS @@ -369,7 +379,7 @@ function generate_list($querySQL,$list_value,$list_text, $form_name, $default_va $default_delimiter = 'selected="selected"'; } else { $default_delimiter = '';} echo '\n'; + $row_recordset[$list_text] . ''; } while ($row_recordset = mysql_fetch_assoc($recordset)); $rows = mysql_num_rows($recordset); if($rows > 0) { diff --git a/js/shop.js b/js/shop.js index 8c51a8f..fda0fdb 100644 --- a/js/shop.js +++ b/js/shop.js @@ -32,6 +32,23 @@ $(function(){ }); $(banned_list).css({backgroundColor: "red"}).prop("title", "BANNED"); + + // return probation list + var probation_list, pl; + $.post("json/contact.php", {probation: 1}, function (data) { + if (data) { + pl = $.parseJSON(data); + $(pl).each(function(i,v) { + if (i === 0) { + probation_list = "#" + v; + } else { + probation_list = probation_list + ",#" + v; + } + }); + } + }); + + $(probation_list).css({backgroundColor: "#eed202"}).prop("title", "PROBATION"); // error handler for shops with a popup dialog (TODO) function error_handler(input,error_span,error,error_text,event) { @@ -87,7 +104,6 @@ $(function(){ } ); - // could have done this in php, but this separates out the view logic var membership_ids, volunteer_ids; var last_index = $("#shop_log tr[id]").length; diff --git a/json/contact.php b/json/contact.php index 5eca1f9..81522d7 100644 --- a/json/contact.php +++ b/json/contact.php @@ -57,6 +57,15 @@ } + // pass probation contact_id values if they exist + if (isset($_POST['probation'])) { + + if ($probation_individuals) { + echo json_encode($probation_individuals); + } + + } + // update email_list if( isset($_POST['email_list']) ) { @@ -94,7 +103,7 @@ CURLOPT_SSL_VERIFYPEER => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode($json), - ); + ); if ($ssl_certificate) { $curlConfig[CURLOPT_CAINFO] = $ssl_certificate;