Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#138 Custom fields break bulk update function

open
nobody
None
5
2010-12-08
2010-12-08
Brian Candler
No

I added some custom fields in iptemplate.xml (see below).

Now I go to a subnet and select a group of IPs to update (modifyipformmul.php). I find that:

(1) It doesn't prompt me to update the custom fields. That would be good functionality to have, but isn't critical.
(2) When I submit the form, the update itself fails, even though I'm not updating any custom fields. The error I get back is:

Format YYYY-MM-DD
IP address details could not be modified

Now, you can see that I've added a new field for support contract expiry, with default value 0000-00-00 and a regexp which enforces YYYY-MM-DD, and this appears to be preventing the update.

Another option would be to be able to flag custom fields as being optional, so if they are missing during a bulk update they'll be ignored.

As a workaround, I changed the regex to
REGEX="^(\d\d\d\d-\d\d-\d\d)?$"

to make the value optional, and now the bulk update works.

IMO, the ideal solution would be to show custom fields in the bulk update function. Since custom fields are stored in PHP serialized form, they are otherwise very difficult to bulk-update using SQL.

-------------------------------------------------------
<?xml version="1.0" ?>
<TEMPLATE>
<FIELD>
<DEFINITION NAME="info" DESCRIP="Additional information" TYPE="T" MAXLENGTH="10000" SIZE="80" ROWS="10" DEFAULT="" REGEX="" ERRMSG="Invalid field: Additional information" />
</FIELD>
<FIELD>
<DEFINITION NAME="contract" TYPE="C" DESCRIP="Support contract ref" MAXLENGTH="40" SIZE="10" ROWS="1" DEFAULT="" REGEX="" ERRMSG="Invalid field: Support contract ref" />
</FIELD>
<FIELD>
<DEFINITION NAME="expire" TYPE="C" DESCRIP="Support contract expiry date" MAXLENGTH="40" SIZE="10" ROWS="1" DEFAULT="0000-00-00" REGEX="^\d\d\d\d-\d\d-\d\d$" ERRMSG="Format YYYY-MM-DD" />
</FIELD>
<FIELD>
<DEFINITION NAME="select" TYPE="S" DESCRIP="Support Level" DEFAULT="8x5">
<SELECT OPTION="No support" VAL="0" />
<SELECT OPTION="8x5" VAL="8x5" />
<SELECT OPTION="24x7" VAL="24x7" />
</DEFINITION>
</FIELD>
</TEMPLATE>

Discussion