Conjunto c25d016 en sipes


Ignorar:
Fecha y hora:
07/07/2016 10:16:45 (hace 8 años)
Autor:
lhernandez <lhernandez@…>
Branches:
stable, version-3.0
Children:
15f3818
Parents:
8555750
Mensaje:

se agregaron los nuevos cambios

Fichero:
1 editado

Leyenda

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

    r7d9e4be rc25d016  
    242242    }
    243243  }
    244   if ($first_field && $sumaf != $sumap) {
    245     form_set_error($first_field, t('Las fuentes de financiamiento (@f_financiamiento) deben ser igual a la programación presupuestaria (@fuente)', array('@fuente' => number_format($sumap, $form['#format_number']['format_number']['decimals'], $form['#format_number']['format_number']['dec_point'], $form['#format_number']['format_number']['thousands_sep']), '@f_financiamiento' => number_format($sumaf, $form['#format_number']['format_number']['decimals'], $form['#format_number']['format_number']['dec_point'], $form['#format_number']['format_number']['thousands_sep']))));
     244  if ($first_field && $sumaf > $sumap) {
     245    form_set_error($first_field, t('Las fuentes de financiamiento (@f_financiamiento) deben ser menor o igual a la programación presupuestaria (@fuente)', array('@fuente' => number_format($sumap, $form['#format_number']['format_number']['decimals'], $form['#format_number']['format_number']['dec_point'], $form['#format_number']['format_number']['thousands_sep']), '@f_financiamiento' => number_format($sumaf, $form['#format_number']['format_number']['decimals'], $form['#format_number']['format_number']['dec_point'], $form['#format_number']['format_number']['thousands_sep']))));
    246246  }
    247247}
     
    276276    }
    277277    $output .= drupal_render($form['field_accion_esp_ponderacion']);
    278     $output .= drupal_render($form['field_accion_esp_metaf']);
     278
     279    $output .= '<span title="Este campo es obligatorio." class="form-required" style="margin-left: 180px; position: absolute;">*</span>' . drupal_render($form['field_accion_esp_metaf']);
    279280    $output .= '</fieldset>';
    280281    $output .= drupal_render($form['distribucion']);
     
    323324      $row[] = array('data' => drupal_render($form['total_financiamiento']), );
    324325      $rows[] = $row;
    325       $output .= '<fieldset><legend>' . t('Fuentes de Financiamiento') . '</legend>' . theme('table', array(), $rows) . '</fieldset>';
     326      $output .= '<fieldset><legend>' . t('Fuentes de Financiamiento (BS)') . '<span title="Este campo es obligatorio." class="form-required">*</span></legend>' . theme('table', array(), $rows) . '</fieldset>';
    326327    }
    327328    $localizacion = variable_get('proyectos_operativos_muestra_accion_esp', TRUE);
     
    394395  $node_type = content_types('accion_especifica');
    395396  if ($op != t('Cancelar')) {
     397/*
    396398    //validamos el financiamiento
    397399    $first_field = FALSE;
     
    409411      }
    410412    }
    411     $sumaT = $form['#montos'] + $sumaf;
    412 //drupal_set_message('la suma' . $sumaT . '. la suma' . ',' . $sumaf . ', montos' . $form['#montos']);
     413*/
     414    //obtener la fecha de inicio y fin
     415    $mes = explode('-', $form_state['values']['field_accion_esp_fechai'][0]['value']);
     416    $mes_inicio = 0;
     417    if (count($mes)) {
     418      $mes_inicio = $mes[1] - 1;
     419    }
     420    //obtener la fecha de inicio y fin
     421    $mes = explode('-', $form_state['values']['field_accion_esp_fechaf'][0]['value']);
     422    $mes_final = 0;
     423    if (count($mes)) {
     424      $mes_final = $mes[1] - 1;
     425    }
     426
     427    $suma = 0;
     428    if (isset($form_state['values']['field_accion_esp_programacion'])) {
     429      foreach($form_state['values']['field_accion_esp_programacion'] as $id => $programacion) {
     430        for ($i = 0; $i < 12; $i++) {
     431          $valor = $i ? 'value_' . $i : 'value';
     432          if ($mes_inicio <= $i && $mes_final >= $i) {
     433            $suma += $form_state['values']['field_accion_esp_programacion'][$id][$valor];
     434          }
     435          else {
     436            $form_state['values']['field_accion_esp_programacion'][$id][$valor] = 0;
     437          }
     438        }
     439      }
     440    }
     441
     442
     443    $sumaT = $form['#montos'] + $suma;
    413444    $form['#proyecto']->field_proyecto_monto_anual[0]['value'] = $sumaT;
    414445    if (!$form['#esplurianual']) {
Nota: Vea TracChangeset para ayuda en el uso del visor de conjuntos de cambios.