OpenNetAdmin

Track. Automate. Configure.

Home About Features Community Develop
Download this project as a tar.gz file

location.inc.php patch to match docs

yshollander

15-07-2009 10:57:04

Patch to make the usage info match reality.

It's zip_code, not zip, and the code requires all fields be filled in. I autopopulate the optional ones with "unknown" if they're not set.

--- location.inc.php.orig 2009-07-15 12:45:19.000000000 -0400
+++ location.inc.php 2009-07-15 12:52:41.000000000 -0400
@@ -54,7 +54,7 @@
address=STRING
city=STRING
state=STRING
- zip=NUMBER
+ zip_code=NUMBER
latitude=STRING
longitude=STRING
misc=STRING
@@ -96,6 +96,34 @@
}
printmsg("DEBUG => ID for new location: $id", 3);

+ if ($options['address'] == "") {
+ $options['address'] = "unknown";
+ }
+
+ if ($options['city'] == "") {
+ $options['city'] = "unknown";
+ }
+
+ if ($options['state'] == "") {
+ $options['state'] = "unknown";
+ }
+
+ if ($options['zip_code'] == "") {
+ $options['zip_code'] = "unknown";
+ }
+
+ if ($options['latitude'] == "") {
+ $options['latitude'] = "unknown";
+ }
+
+ if ($options['longitude'] == "") {
+ $options['longitude'] = "unknown";
+ }
+
+ if ($options['misc'] == "") {
+ $options['misc'] = "unknown";
+ }
+
// Add the record
list($status, $rows) =
db_insert_record(

Matt

15-07-2009 13:02:19

Thanks much for the patch. I found a few more references of zip/zip_code that I fixed as well.

I did not do the "unknown" default value thing. only reference and name should be required but I had indicated in the GUI edit form that the rest were required. I've updated that so only the two fields are indicated as required.