X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=lib%2Fcontact.php;h=d83e10116302281e4c960acaf29d39389a0533b8;hb=83ae8301b0ebdd1b334feb26888f33e80ddc9467;hp=ef8c335f7eaa2555fd5d245c07c8e75e3c73c3dc;hpb=6618cd51a335fa7413d58606cec3600f8f4a805d;p=readifood.git diff --git a/lib/contact.php b/lib/contact.php index ef8c335..d83e101 100644 --- a/lib/contact.php +++ b/lib/contact.php @@ -177,7 +177,7 @@ } function show_contact_form($contact = null, $new = false) { - global $contact_roles; + global $contact_roles, $parcel_sizes, $parcel_contents; if (! $contact) $contact = new Contact; @@ -262,6 +262,30 @@ echo " \n"; echo "\n"; + /* Parcel type. */ + echo "\n"; + echo " Family unit\n"; + echo " \n"; + echo "\n"; + + /* Parcel contents. */ + echo "\n"; + echo " Dietary requirements\n"; + echo " "; + for ($i = count($parcel_sizes); $i < count($parcel_contents); $i++) { + if (1 << $i == $GLOBALS['PARCEL_TOILETRY']) continue; + echo " getParcel() & (1 << $i)) echo " checked"; + echo ">$parcel_contents[$i]\n"; + } + echo "\n"; + echo "\n"; + /* Notes. */ echo "\n"; echo " Notes\n"; @@ -313,7 +337,7 @@ } function update_contact(&$contact, $area_id, $new = false) { - global $contact_roles; + global $contact_roles, $parcel_sizes, $parcel_contents; $role = 0; for ($i = 0; $i < count($contact_roles); $i++) { @@ -346,6 +370,7 @@ } /* Get address. */ + $area_id = $_POST['area_id']; $line = $_POST['address']; $postcode = $_POST['postcode']; $q = new AddressQuery; @@ -371,6 +396,10 @@ $telephone1 = $_POST['telephone1']; $telephone2 = $_POST['telephone2']; $email = $_POST['email']; + $parcel = $_POST['parcel_size']; + for ($i = count($parcel_sizes); $i < count($parcel_contents); $i++) { + if ($_POST['parcel_' . $i] == "on") $parcel |= (1 << $i); + } $notes = $_POST['notes']; $contact->setRole($role); @@ -381,6 +410,7 @@ $contact->setTelephone1($telephone1); $contact->setTelephone2($telephone2); $contact->setEmail($email); + $contact->setParcel($parcel); $contact->setNotes($notes); $contact->setAddressId($address->getId());