mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-22 17:03:22 -05:00
Saves state for waiver & email_list, and more
1). Adds configuration options to turn off waiver & email_list options 2). Puts waiver in Connections/waiver.txt 3). New MySQL waiver column added, receive_newsletter used for email_list.
This commit is contained in:
parent
4cd269fd06
commit
b1a11b9f3b
@ -1,12 +1,20 @@
|
||||
<?php
|
||||
require_once('YBDB.php');
|
||||
|
||||
// Allow waiver (recommended) in Add/Edit Contacts; 1 = yes, 0 = no
|
||||
// Waiver text may be modified in Connections/waiver.txt
|
||||
define("WAIVER", 1);
|
||||
|
||||
// Allow email_list option in Add/Edit Contacts; 1 = yes, 0 = no
|
||||
define("EMAIL_LIST", 1);
|
||||
|
||||
// User defined constants - read sql/populate.sql for an explanation
|
||||
define("STORAGE_PERIOD", 14);
|
||||
define("ACCOUNTING_GROUP", "Sales");
|
||||
define("DEFAULT_TRANSACTION_TYPE", "Sale - Used Parts");
|
||||
define("DEFAULT_SHOP_USER", "Volunteer");
|
||||
|
||||
|
||||
/* Change Fund - A specific amount of money for the purpose of making change.
|
||||
The amount on hand should remain the same at all times;
|
||||
therefore a change funds does not require replenishment.
|
||||
|
16
Connections/waiver.txt
Normal file
16
Connections/waiver.txt
Normal file
@ -0,0 +1,16 @@
|
||||
I, and my heirs, in consideration of my participation in the Positive Spin Community
|
||||
Bike Project's Open Workshop hereby release Positive Spin,
|
||||
its officers, employees and agents, and any other people officially connected with this
|
||||
organization, from any and all liability for damage to or loss of personal
|
||||
property, sickness, or injury from whatever source, legal entanglements, imprisonment,
|
||||
death, or loss of money, which might occur while participating in said event/activity/class.
|
||||
Specifically, I release Positive Spin from any liability or
|
||||
responsibility for my personal well-being, condition of tools and equipment provided
|
||||
and produced thereof, including, but not limited to, bicycles and modes of transportation
|
||||
produced by participants. The Positive Spin Community Bike Project is a working,
|
||||
mechanical environment and I am aware of the risks of participation. I hereby state
|
||||
that I am in sufficient physical condition to accept a rigorous level of physical
|
||||
activity and exertion, as is sometimes the case when working in a mechanical environment.
|
||||
I understand that participation in this program is strickly voluntary and I
|
||||
freely chose to participate. I understand Positive Spin does not provide medical coverage for me.
|
||||
I verify that I will be responsible for any medical costs I incur as a result of my participation.
|
@ -3,6 +3,10 @@
|
||||
require_once('Connections/YBDB.php');
|
||||
require_once('Connections/database_functions.php');
|
||||
|
||||
$waiver = WAIVER;
|
||||
$email_list = EMAIL_LIST;
|
||||
|
||||
|
||||
if($_GET['shop_id']>0){
|
||||
$shop_id = $_GET['shop_id'];
|
||||
} else {
|
||||
@ -81,14 +85,13 @@ $editFormAction = "?contact_id={$contact_id}&shop_id={$shop_id}";
|
||||
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
|
||||
|
||||
$updateSQL = sprintf("UPDATE contacts SET first_name=%s, middle_initial=%s, last_name=%s, email=%s,
|
||||
DOB=%s, receive_newsletter=%s, phone=%s, address1=%s, address2=%s, city=%s,
|
||||
DOB=%s, phone=%s, address1=%s, address2=%s, city=%s,
|
||||
`state`=%s, zip=%s, pass=ENCODE(%s,'yblcatx') WHERE contact_id=%s",
|
||||
GetSQLValueString($_POST['first_name'], "text"),
|
||||
GetSQLValueString($_POST['middle_initial'], "text"),
|
||||
GetSQLValueString($_POST['last_name'], "text"),
|
||||
GetSQLValueString($_POST['email'], "text"),
|
||||
GetSQLValueString($_POST['DOB'], "date"),
|
||||
GetSQLValueString($_POST['list_yes_no'], "int"),
|
||||
GetSQLValueString($_POST['phone'], "text"),
|
||||
GetSQLValueString($_POST['address1'], "text"),
|
||||
GetSQLValueString($_POST['address2'], "text"),
|
||||
@ -150,6 +153,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
|
||||
<td><input id="email" type="text" name="email" value="<?php echo $row_Recordset1['email']; ?>" size="32">
|
||||
<span id="email_error"></span></td>
|
||||
</tr>
|
||||
<?php if($email_list) { ?>
|
||||
<tr>
|
||||
<td><label>Email List:</label></td>
|
||||
<td>
|
||||
@ -159,6 +163,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr >
|
||||
<td ><label>Phone:</label></td>
|
||||
<td><input id="phone" type="text" name="phone" value="<?php echo $row_Recordset1['phone']; ?>" size="32">
|
||||
@ -190,40 +195,27 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
|
||||
<input name="password" type="password" id="password" value="<?php echo $row_Recordset1['passdecode']; ?>" size="32">
|
||||
</td>
|
||||
</tr>
|
||||
<?php if($waiver) { ?>
|
||||
<tr>
|
||||
<td><label>Waiver of Liability:</label></td>
|
||||
<td> <div id="waiver">
|
||||
<p>
|
||||
I, and my heirs, in consideration of my participation in the Positive Spin Community
|
||||
Bike Project's Open Workshop hereby release Positive Spin,
|
||||
its officers, employees and agents, and any other people officially connected with this
|
||||
organization, from any and all liability for damage to or loss of personal
|
||||
property, sickness, or injury from whatever source, legal entanglements, imprisonment,
|
||||
death, or loss of money, which might occur while participating in said event/activity/class.
|
||||
Specifically, I release Positive Spin from any liability or
|
||||
responsibility for my personal well-being, condition of tools and equipment provided
|
||||
and produced thereof, including, but not limited to, bicycles and modes of transportation
|
||||
produced by participants. The Positive Spin Community Bike Project is a working,
|
||||
mechanical environment and I am aware of the risks of participation. I hereby state
|
||||
that I am in sufficient physical condition to accept a rigorous level of physical
|
||||
activity and exertion, as is sometimes the case when working in a mechanical environment.
|
||||
I understand that participation in this program is strickly voluntary and I
|
||||
freely chose to participate. I understand Positive Spin does not provide medical coverage for me.
|
||||
I verify that I will be responsible for any medical costs I incur as a result of my participation.
|
||||
<?php include("Connections/waiver.txt"); ?>
|
||||
</p>
|
||||
</div><input id="waiver_checkbox" type="checkbox"> I agree <span id="waiver_error"></span>
|
||||
<input type="submit" id="waiver_button" value="Show Waiver" \>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><br /><input id="submit_contact" type="submit" value="Submit"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="list_yes_no" value="1"> <!--This overides the option not to be invited to the newsletter list.-->
|
||||
|
||||
<input type="hidden" name="MM_insert" value="form1">
|
||||
<input type="hidden" name="contact_id" value="<?php echo $row_Recordset1['contact_id']; ?>">
|
||||
<input type="hidden" id="contact_id" name="contact_id" value="<?php echo $row_Recordset1['contact_id']; ?>">
|
||||
<input type="hidden" name="contact_id_entry" value="<?php echo $contact_id_entry; ?>">
|
||||
</form>
|
||||
</tr>
|
||||
|
@ -2,6 +2,7 @@ $(function(){
|
||||
|
||||
"use strict";
|
||||
|
||||
var contact_id = $("#contact_id").val();
|
||||
var birth_date = $("#birth_date");
|
||||
var waiver_checkbox = $("#waiver_checkbox"), waiver_error = $("#waiver_error");
|
||||
var first_name = $("#first_name"), first_name_error = $("#first_name_error");
|
||||
@ -88,7 +89,7 @@ $(function(){
|
||||
if ((err0 + err1 + err2 + err3 + err4 + err5) > 0 ) {
|
||||
|
||||
} else {
|
||||
e.preventDefault();
|
||||
//e.preventDefault();
|
||||
dfd.resolve("Success");
|
||||
}
|
||||
|
||||
@ -99,12 +100,25 @@ $(function(){
|
||||
} // end save_contact
|
||||
|
||||
save_contact().done(function(success) {
|
||||
|
||||
|
||||
// Process contact selects here (other than $_POST), waiver is always 1 unless not configured.
|
||||
if (success === "Success") {
|
||||
var name = first_name.val() + " " + last_name.val() + " " + email.val() + " " + $("#email_list_toggle").val();
|
||||
console.log(name);
|
||||
|
||||
}
|
||||
|
||||
var email_list = $("#email_list_toggle").val();
|
||||
var waiver = waiver_checkbox.prop("checked");
|
||||
if (!email_list) {
|
||||
email_list = 0;
|
||||
}
|
||||
if (!waiver) {
|
||||
waiver = 0;
|
||||
} else if (waiver === true) {
|
||||
waiver = 1;
|
||||
} else if (waiver === false) {
|
||||
waiver = 0;
|
||||
}
|
||||
$.post("json/contact.php", {contact_id: contact_id, email_list: email_list , waiver: waiver });
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
@ -172,23 +186,41 @@ $(function(){
|
||||
} // end error_handling function
|
||||
|
||||
|
||||
// email_list_toggle
|
||||
// email_list_toggle //
|
||||
function toggle( value ){
|
||||
$(this).toggleClass('off', value === "0");
|
||||
$(this).toggleClass('on', value === "1");
|
||||
}
|
||||
|
||||
$("#email_list_toggle").noUiSlider({
|
||||
orientation: "horizontal",
|
||||
start: 1,
|
||||
range: {
|
||||
'min': [0, 1],
|
||||
'max': 1
|
||||
},
|
||||
format: wNumb({
|
||||
decimals: 0
|
||||
})
|
||||
})
|
||||
|
||||
// set waiver state
|
||||
$.post("json/contact.php", {contact_id: contact_id, waiver_value: 1 }, function(data) {
|
||||
if(data == 1) {
|
||||
$("#waiver_checkbox").prop("checked",true);
|
||||
} else {
|
||||
$("#waiver_checkbox").prop("checked",false);
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
|
||||
// beginning or stored state
|
||||
$.post("json/contact.php", {contact_id: contact_id, email_list_value: 1 }, function(data) {
|
||||
|
||||
$("#email_list_toggle").noUiSlider({
|
||||
orientation: "horizontal",
|
||||
start: data,
|
||||
range: {
|
||||
'min': [0, 1],
|
||||
'max': 1
|
||||
},
|
||||
format: wNumb({
|
||||
decimals: 0
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
$("#email_list_toggle").addClass('toggle');
|
||||
$("#email_list_toggle").addClass('noUi-extended');
|
||||
@ -202,6 +234,6 @@ $(function(){
|
||||
$(this).html("yes");
|
||||
}
|
||||
});
|
||||
// end email_list_toggle
|
||||
// end email_list_toggle //
|
||||
|
||||
});
|
49
json/contact.php
Normal file
49
json/contact.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once('../Connections/database_functions.php');
|
||||
require_once('../Connections/YBDB.php');
|
||||
mysql_select_db($database_YBDB, $YBDB);
|
||||
|
||||
// update waiver
|
||||
if( isset($_POST['waiver']) ) {
|
||||
|
||||
$waiver = $_POST['waiver'];
|
||||
|
||||
$query = "UPDATE contacts SET waiver=" . $waiver .
|
||||
" WHERE contact_id=" . $_POST['contact_id'] . ";";
|
||||
$result = mysql_query($query, $YBDB) or die(mysql_error());
|
||||
|
||||
}
|
||||
|
||||
// return waiver value
|
||||
if (isset($_POST['waiver_value'])) {
|
||||
|
||||
$query = 'SELECT waiver FROM contacts WHERE contact_id="' . $_POST['contact_id'] . '";';
|
||||
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||
$result = mysql_fetch_assoc($sql);
|
||||
echo $result['waiver'];
|
||||
|
||||
}
|
||||
|
||||
// update email_list
|
||||
if( isset($_POST['email_list']) ) {
|
||||
|
||||
$email_list = $_POST['email_list'];
|
||||
$query = "UPDATE contacts SET receive_newsletter=" . $email_list .
|
||||
" WHERE contact_id=" . $_POST['contact_id'] . ";";
|
||||
$result = mysql_query($query, $YBDB) or die(mysql_error());
|
||||
|
||||
}
|
||||
|
||||
// return email_list value
|
||||
if (isset($_POST['email_list_value'])) {
|
||||
|
||||
$query = 'SELECT receive_newsletter FROM contacts WHERE contact_id="' . $_POST['contact_id'] . '";';
|
||||
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||
$result = mysql_fetch_assoc($sql);
|
||||
echo $result['receive_newsletter'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -61,16 +61,20 @@ INSERT INTO projects (project_id, date_established, active, public) VALUES
|
||||
-- select GROUP_CONCAT(COLUMN_NAME) from information_schema.COLUMNS where TABLE_NAME='contacts'
|
||||
-- Then take that output and find the values ..
|
||||
-- SELECT CONCAT_WS('","', col1, col2, ..., coln) FROM my_table;
|
||||
--
|
||||
-- Added waiver
|
||||
|
||||
DELETE FROM shop_hours;
|
||||
DELETE FROM contacts;
|
||||
ALTER TABLE contacts AUTO_INCREMENT = 1;
|
||||
ALTER TABLE contacts ADD waiver tinyint(1) NOT NULL DEFAULT '0';
|
||||
INSERT INTO contacts (
|
||||
contact_id, first_name, middle_initial, last_name, email, phone, address1,
|
||||
address2, city, state, country, receive_newsletter, date_created,
|
||||
invited_newsletter, DOB, pass, zip, hidden, location_name, location_type
|
||||
invited_newsletter, DOB, pass, zip, hidden, location_name, location_type,
|
||||
waiver
|
||||
) VALUES
|
||||
(1,"Jonathan","","Rosenbaum","info@positivespin.org","","","","Morgantown","WV","","1","2014-12-12 18:19:35",0,"2005-11-09","test","26501","0","",NULL);
|
||||
(1,"Jonathan","","Rosenbaum","info@positivespin.org","","","","Morgantown","WV","","1","2014-12-12 18:19:35",0,"2005-11-09","test","26501","0","",NULL, 1);
|
||||
|
||||
-- Set-up transaction types
|
||||
-- This is object orienteed like :)
|
||||
|
Loading…
x
Reference in New Issue
Block a user