View Issue Details

IDProjectCategoryView StatusLast Update
0005555phplist applicationInterface - Backendpublic18-02-08 14:06
Reporteruser1177 
PrioritylowSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product Version2.10.2 
Target Version2.10.7Fixed in Version2.10.4 
Summary0005555: automatically set order when adding multiple control values for attributes of type 'select' and 'checkboxgroup'
Descriptionin /lists/admin/?page=editattributes&id=1 you can add multiple attributes, but the script doesn't respect the order that you paste them into the the textarea, so you have to go and order them AGAIN with the 'change order' function on the same page. It works, but is annoying if you have a lot of values.
TagsNo tags attached.

Relationships

related to 0003721 closed phplist 2.10.x 

Activities

user1308

07-05-07 18:49

  ~0026643

Fix in file editattributes.php.

Find this starting at line 67:
if (isset($_POST["addnew"])) {
  $items = explode("\n", $_POST["itemlist"]);
  while (list($key,$val) = each($items)) {
    $val = clean($val);
    if ($val != "") {
      $query = sprintf('INSERT into %s (name) values("%s")',$table,$val);
      $result = Sql_query($query);
    }
  }
}


And replace it with:
if (isset($_POST["addnew"])) {
  $items = explode("\n", $_POST["itemlist"]);
  $query = sprintf('SELECT MAX(listorder) AS listorder FROM %s',$table);
  $maxitem = Sql_Fetch_Row_Query($query);
  if (!Sql_Affected_Rows() || !is_numeric($maxitem[0])) {
  $listorder = 1; # insert the listorder as it's in the textarea / start with 1
  }
  else {
  $listorder = $maxitem[0]+1; # One more than the maximun
  }
  while (list($key,$val) = each($items)) {
    $val = clean($val);
    if ($val != "") {
      $query = sprintf('INSERT into %s (name,listorder) values("%s","%s")',$table,$val,$listorder);
      $result = Sql_query($query);
    }
    $listorder++;
  }
}