Fix foreign key constraints.
[readifood.git] / lib / order.php
index 74306d9..5c7e0d8 100644 (file)
     $hub_id = $_POST['hub_id'];
     $quantity = $_POST['quantity'];
     $driver_id = $_POST['driver_id'];
+    if (! $driver_id) $driver_id = null;
     $state = $_POST['state'];
     if (! $state) $state = $GLOBALS['STATE_PLACED'];
 
         return false;
       }
     }
+    else $hub_id = null;
 
     if (! is_numeric($quantity)) {
       echo "<p>Invalid quantity!</p>\n";