phplist

NOTE:: Before reporting an issue, make sure you are running the latest version, currently 3.3.1


View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005555phplist applicationInterface - Backendpublic23-02-06 16:4518-02-08 14:06
Reporteruser1177 
PrioritylowSeverityfeatureReproducibilityN/A
StatusresolvedResolutionfixed 
PlatformOSOS Version
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.
Attached Files

- Relationships
related to 0003721closed phplist 2.10.x 

-  Notes
(0026643)
user1308
07-05-07 18:49

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++;
  }
}


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker