The function nodequeue_arrange_subqueue_form_validate is supposed to check for duplicate positions in the submitted form.

It's looping through the wrong part of the $form_state array, so it doesn't check the positions properly.

The line

foreach ($form_state['values'] as $nid => $element) {

should be

foreach ($form_state['values']['nodes'] as $nid => $element) {

I'll attach a patch once I get an issue ID.

CommentFileSizeAuthor
#1 nodqueue_validation-2098039-1.patch621 bytestripper54

Comments

tripper54’s picture

StatusFileSize
new621 bytes

Patch attached.

tripper54’s picture

Status: Active » Needs review

and changed status ;)

jenlampton’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

I believe this issue has been resolved. This is the code as it is today:

/**
 * Validate handler for nodequeue_arrange_subqueue_form.
 */
function nodequeue_arrange_subqueue_form_validate($form, &$form_state) {
  $positions = array();
  if (isset($form_state['values']['nodes'])) {
    foreach ($form_state['values']['nodes'] as $key => $element) {
      $nid = $form['nodes'][$key]['#node']['nid'];
      if (is_numeric($nid) && is_numeric($element['position'])) {
        $positions[$key] = $element['position'];
      }
    }
  }
  if (count(array_unique($positions)) < count($positions)) {
    $seen = array();
    foreach ($positions as $key => $position) {
      if (isset($seen[$position])) {
        form_set_error('nodes][' . $key . '][position', t('Duplicate position value.'));
      }
      $seen[$position] = TRUE;
    }
  }
}