Skip to content

Commit

Permalink
This closes #83 adding probation status to shop_log for contact_id.
Browse files Browse the repository at this point in the history
  • Loading branch information
fspc committed Dec 20, 2018
1 parent 23ce8ff commit ca40851
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
12 changes: 11 additions & 1 deletion Connections/database_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -369,7 +379,7 @@ function generate_list($querySQL,$list_value,$list_text, $form_name, $default_va
$default_delimiter = 'selected="selected"';
} else { $default_delimiter = '';}
echo '<option style="color:' . $color . ';" value="' . $row_recordset[$list_value] . '" ' . $default_delimiter . '>' .
$row_recordset[$list_text] . '</option>\n';
$row_recordset[$list_text] . '</option>';
} while ($row_recordset = mysql_fetch_assoc($recordset));
$rows = mysql_num_rows($recordset);
if($rows > 0) {
Expand Down
18 changes: 17 additions & 1 deletion js/shop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 10 additions & 1 deletion json/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']) ) {

Expand Down Expand Up @@ -94,7 +103,7 @@
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => json_encode($json),
);
);

if ($ssl_certificate) {
$curlConfig[CURLOPT_CAINFO] = $ssl_certificate;
Expand Down

0 comments on commit ca40851

Please sign in to comment.