Changeset 916


Ignore:
Timestamp:
Oct 25, 2005, 10:50:14 PM (19 years ago)
Author:
plg
Message:
  • bug 183 fixed: Warning when trying to associate an image with an already associated category. Just coded the TODO instructions I had let some time ago.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/element_set_global.php

    r875 r916  
    117117    $associated = array_from_query($query, 'image_id');
    118118
    119     // TODO : if $associable array is empty, no further actions
    120119    $associable = array_diff($collection, $associated);
    121    
    122     foreach ($associable as $item)
    123     {
    124       array_push($datas,
    125                  array('category_id'=>$_POST['associate'],
    126                        'image_id'=>$item));
    127     }
     120
     121    if (count($associable) != 0)
     122    {
     123      foreach ($associable as $item)
     124      {
     125        array_push(
     126          $datas,
     127          array(
     128            'category_id' => $_POST['associate'],
     129            'image_id' => $item
     130            )
     131          );
     132      }
    128133 
    129     mass_inserts(IMAGE_CATEGORY_TABLE,
    130                  array('image_id', 'category_id'),
    131                  $datas);
    132     update_category(array($_POST['associate']));
     134      mass_inserts(
     135        IMAGE_CATEGORY_TABLE,
     136        array('image_id', 'category_id'),
     137        $datas
     138        );
     139     
     140      update_category(array($_POST['associate']));
     141    }
    133142  }
    134143
  • trunk/doc/ChangeLog

    r915 r916  
     12005-10-25 Pierrick LE GALL
     2
     3        * bug 183 fixed: Warning when trying to associate an image with an
     4        already associated category. Just coded the TODO instructions I
     5        had let some time ago.
     6
    172005-10-23 chrisaga
    28
Note: See TracChangeset for help on using the changeset viewer.