From b1badad8f04c268391eacbc01b686de85b9fe88e Mon Sep 17 00:00:00 2001 From: Lawrence Neill Date: Sun, 11 Mar 2012 22:24:51 -0700 Subject: [PATCH] Changed ajax, createTables, and forms to accommodate for secondary contact info --- ajax.php | 16 ++++++++++++++-- createTables.sql | 2 ++ include/forms.php | 22 +++++++++++++++------- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ajax.php b/ajax.php index 207cba6..528e81c 100644 --- a/ajax.php +++ b/ajax.php @@ -714,6 +714,8 @@ function dateToStr($dateStr) { notes as Notes, email as email_tag, state as state_tag, + contact2 as contact2_tag, + phone2 as phone2_tag, ( SELECT group_concat(d.name) FROM distribution_hours dh, days d WHERE dh.distribution_id = dis.id AND dh.day_id = d.id) day_tag @@ -741,13 +743,15 @@ function dateToStr($dateStr) { $name = $_REQUEST['name']; $contact = $_REQUEST['contact']; $phone = $_REQUEST['phone']; + $contact2 = $_REQUEST['contact2']; + $phone2 = $_REQUEST['phone2']; $email = $_REQUEST['email']; $street = $_REQUEST['street']; $city = $_REQUEST['city']; $state = $_REQUEST['state']; $zip = $_REQUEST['zip']; $notes = $_REQUEST['note']; - $sql = "Update distributions Set name='$name', contact='$contact', phone='$phone', email='$email', street='$street', city='$city', state='$state',zip='$zip', notes='$notes' where id=$id"; + $sql = "Update distributions Set name='$name', contact='$contact', phone='$phone', contact2='$contact2', phone2='$phone2', email='$email', street='$street', city='$city', state='$state',zip='$zip', notes='$notes' where id=$id"; $r = $db->q($sql); for ($i=1; $i<8 ; $i++) { @@ -795,6 +799,14 @@ function dateToStr($dateStr) { $phone = $_REQUEST['phone']; else $phone =""; + if (isset($_REQUEST['contact2'])) + $contact2 = $_REQUEST['contact2']; + else $contact2 =""; + + if (isset($_REQUEST['phone2'])) + $phone2 = $_REQUEST['phone2']; + else $phone2 =""; + if (isset($_REQUEST['email'])) $email = $_REQUEST['email']; else $email =""; @@ -819,7 +831,7 @@ function dateToStr($dateStr) { $notes = $_REQUEST['notes']; else $notes =""; - $sql = "Insert into distributions(name, contact, phone, email, street, city, state, zip, notes) Values ('$name', '$contact', '$phone', '$email','$street','$city', '$state','$zip','$notes')"; + $sql = "Insert into distributions(name, contact, phone, contact2, phone2, email, street, city, state, zip, notes) Values ('$name', '$contact', '$phone', '$contact2', '$phone2', '$email','$street','$city', '$state','$zip','$notes')"; $r = $db->q($sql); if (!$r->isValid()) $data = getError(); diff --git a/createTables.sql b/createTables.sql index 9e1e4bd..66a5166 100644 --- a/createTables.sql +++ b/createTables.sql @@ -379,6 +379,8 @@ CREATE TABLE distributions ( name nvarchar(255) NOT NULL, contact nvarchar(255), phone varchar(17) NOT NULL, + contact2 nvarchar(255), + phone2 varchar(17), email nvarchar(255), street nvarchar(255) NOT NULL, city nvarchar(255) NOT NULL, diff --git a/include/forms.php b/include/forms.php index 1027141..445adf1 100644 --- a/include/forms.php +++ b/include/forms.php @@ -407,18 +407,26 @@ function options($id, $name, $data, $disabled=false) { - + + - - + + + - - + + - - + + + + + + + +