Menu

#220 CustomListOptions Add/Delete Problem

v2.0.1
open
nobody
General (114)
5
2012-11-15
2005-12-19
Kay Zenner
No

When you delete an option from a customFieldList, the
order gets invalid.

Solution you need to address the listOptions by their
unique-ID.

See our patch

Discussion

  • Kay Zenner

    Kay Zenner - 2005-12-19

    Cool-patch

     
  • Kay Zenner

    Kay Zenner - 2005-12-20

    Logged In: YES
    user_id=193204

    Sorry,
    there is a bug in my patch. you need to change
    CustomFields.class.php:
    class CustomOptionList -> function store(). The corrected
    code is:

            foreach\($new\_Options as $list\_option\_id => $opt\)
            \{
                $q  = new DBQuery;
                $q->addTable\('custom\_fields\_lists'\);
                if \($list\_option\_id < 0\)
                \{
        $optid = $db->GenID\('custom\_fields\_option\_id', 1 \);
                    $q->addInsert\('field\_id', $this->field\_id\);
                    $q->addInsert\('list\_option\_id', $optid\);
                    $q->addInsert\('list\_value', $opt\);
                \}
                else
                \{
                                        if \($this->options\[$list\_option\_id\] \!= $opt \)
                    \{
                        $q->addUpdate\('list\_value', $opt\);
                        $q->addWhere\('list\_option\_id = '.$list\_option\_id\);
                                            \}
                \}
    
     

Log in to post a comment.