Skip to content
This repository has been archived by the owner on Jun 15, 2020. It is now read-only.

Commit

Permalink
Changed ajax, createTables, and forms to accommodate for secondary co…
Browse files Browse the repository at this point in the history
…ntact info
  • Loading branch information
SgtRaccoon committed Mar 12, 2012
1 parent 3694d50 commit b1badad
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
16 changes: 14 additions & 2 deletions ajax.php
Expand Up @@ -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
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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 ="";
Expand All @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions createTables.sql
Expand Up @@ -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,
Expand Down
22 changes: 15 additions & 7 deletions include/forms.php
Expand Up @@ -407,18 +407,26 @@ function options($id, $name, $data, $disabled=false) {
<td colspan="3"><input id="distribution2" name="name" type="text" size="45"/></td>
</tr>
<tr>
<td colspan="3"><label for="distribution6" >Agency Contact</label></td>
<td colspan="2"><label for="distribution6" >Agency Contact</label></td>
<td><label for="distribution7">Phone</label></td>
</tr>
<tr>
<td colspan="3"><input id="distribution6" name="contact" type="text" size="45"/></td>
</tr>
<td colspan="2"><input id="distribution6" name="contact" type="text" size="20"/></td>
<td><input type="tel" name="phone" id="distribution7" size="21" /></td>
</tr>
<tr>
<td><label for="distribution7">Phone</label></td>
<td colspan="2"><label for="distribution9">Email</label></td>
<td colspan="2"><label for="distribution11" >Secondary Contact</label></td>
<td><label for="distribution12">Secondary Phone</label></td>
</tr>
<tr>
<td><input type="tel" name="phone" id="distribution7" size="21" /></td>
<td colspan="2"><input type="text" name="email" id="distribution9" size="20" /></td>
<td colspan="2"><input id="distribution11" name="contact2" type="text" size="20"/></td>
<td><input type="tel" name="phone2" id="distribution12" size="21" /></td>
</tr>
<tr>
<td colspan="3"><label for="distribution9">Email</label></td>
</tr>
<tr>
<td colspan="3"><input type="text" name="email" id="distribution9" size="45" /></td>
</tr>
<tr>
<td colspan="3"><label for="distribution3">Street</label></td>
Expand Down

0 comments on commit b1badad

Please sign in to comment.