Added order notes field.
authorIain Patterson <me@iain.cx>
Mon, 13 May 2013 09:32:37 +0000 (05:32 -0400)
committerIain Patterson <me@iain.cx>
Mon, 13 May 2013 12:48:07 +0000 (08:48 -0400)
Allow freeform notes for an order, for instance for noting specific
dietary requirements such as no tomatoes.

lib/delivery.php
lib/order.php
propel/schema.xml

index 4c7c4f0..43800ca 100644 (file)
       echo "\n<br>" . htmlspecialchars($address->getPostcode());
       echo "</p>\n";
 
+      $notes = $order->getNotes();
+      if ($notes) {
+        echo "<p><strong>Notes:</strong>\n";
+        echo htmlspecialchars($notes);
+        echo "</p>\n";
+      }
+
       echo "<hr>\n\n";
     }
   }
index 95d96bb..7872f94 100644 (file)
     echo "</td>\n";
     echo "</tr>\n";
 
+    /* Notes. */
+    echo "<tr>\n";
+    echo "  <td>Notes</td>\n";
+    echo "  <td>"; textarea("notes", $order->getNotes()); echo "</td>\n";
+    echo "</tr>\n";
+
     /* Driver. */
     echo "<tr>\n";
     echo "  <td>Driver</td>\n";
     for ($i = count($parcel_sizes); $i < count($parcel_contents); $i++) {
       if ($_POST['parcel_' . $i] == "on") $parcel |= (1 << $i);
     }
+    $notes = $_POST['notes'];
 
     if ($date) {
       list($y, $m, $d) = explode('-', $date);
       $order->setBeneficiaryId($beneficiary_id);
       $order->setHubId($hub_id);
       $order->setParcel($parcel);
+      $order->setNotes($notes);
 
       /* XXX: begin/commit */
       try {
index 7d7e6c0..3ab248b 100644 (file)
     <column name="beneficiary_id" type="integer" required="true"/>
     <column name="hub_id" type="integer" required="false"/>
     <column name="parcel" type="integer" required="true"/>
+    <column name="notes" type="longvarchar" lazyLoad="true"/>
     <foreign-key foreignTable="Contact" phpName="Requester" refPhpName="Requester">
       <reference local="requester_id" foreign="id"/>
     </foreign-key>