Conjunto 96e211e en sipes


Ignorar:
Fecha y hora:
10/07/2017 15:22:33 (hace 7 años)
Autor:
Sipes Apn <root@…>
Branches:
stable
Children:
f9bf786
Parents:
28143b8
Mensaje:

se corrigio el error presentado al guardar los entes

Fichero:
1 editado

Leyenda

No modificado
Añadido
Eliminado
  • 0.3-modules/ente_planificador_hierarchical/ente_planificador_hierarchical.module

    r28143b8 r96e211e  
    194194        $prev_father = intval($_POST['ente_planificador_hierarchical_father_' . $lower_level]) > 0 ? intval($_POST['ente_planificador_hierarchical_father_' . $lower_level]) : 0;
    195195        $childrens = _ente_planificador_hierarchical_get_children($prev_father, $lower_level);
    196         if (isset($form['#node']->nid) && isset($childrens[$form['#node']->nid])) {
    197           unset($childrens[$form['#node']->nid]);
    198         }
    199         $childrens[0] = t('Seleccionar este nivel');
     196        foreach ($childrens as $children) {
     197          if ($children['nid']) {
     198            $options[$children['nid']] = $children['title'];
     199          }
     200        }
     201        if (isset($form['#node']->nid) && isset($options[$form['#node']->nid])) {
     202          unset($options[$form['#node']->nid]);
     203        }
     204        $options[0] = t('Seleccionar este nivel');
    200205        $form['ente_planificador_hierarchical_father_' . $i] = array(
    201206          '#title' => $tipo_text,
    202207          '#type' => 'select',
    203208          '#default_value' => $default_value,
    204           '#options' => $childrens,
     209          '#options' => $options,
    205210        );
    206211      }
     
    509514    $prev_father = 0;
    510515    for($i = 1; $i < $hierarchical + 1; $i++) {
    511       $childrens = array();
     516      $options = array();
    512517      $default_value = isset($fathers[$i])? $fathers[$i]['nid'] : 0;
    513518      $lower_level = $i - 1;
     
    517522        $query = db_query("SELECT d.nid, n.title FROM {ente_planificador} AS d INNER JOIN {node} AS n ON n.nid = d.nid WHERE tipo = 1");
    518523        while ($father = db_fetch_object($query)) {
    519           $childrens[$father->nid] = $father->title;
     524          $options[$father->nid] = $father->title;
    520525        }
    521526      }
     
    523528        $tipo_text = t(variable_get('ente_planificador_hierarchical_text_' . $i, 'Actor operativo ' . $i));
    524529        $childrens = _ente_planificador_hierarchical_get_children($prev_father, $lower_level);
    525       }
    526       if (isset($form['#node']->nid) && isset($childrens[$form['#node']->nid])) {
    527         unset($childrens[$form['#node']->nid]);
     530        foreach ($childrens as $children) {
     531          if ($children['nid']) {
     532            $options[$children['nid']] = $children['title'];
     533          }
     534        }
     535      }
     536
     537      if (isset($form['#node']->nid) && isset($options[$form['#node']->nid])) {
     538        unset($options[$form['#node']->nid]);
    528539      }
    529540      $macros = array();
    530       $macros = $childrens;
     541      $macros = $options;
    531542      $macros[0] = t('Seleccionar este nivel');
    532543      $opens_div .= '</div>';
Nota: Vea TracChangeset para ayuda en el uso del visor de conjuntos de cambios.