Conjunto 8deffe0 en sipes
- Fecha y hora:
- 11/09/2018 11:18:10 (hace 6 años)
- Branches:
- stable
- Children:
- c18243e
- Parents:
- 49ac6ee
- Fichero:
-
- 1 editado
Leyenda
- No modificado
- Añadido
- Eliminado
-
0.3-modules/proyectos_operativos/proyectos_operativos.install
r698ba51 r8deffe0 6414 6414 return $content; 6415 6415 } 6416 6417 /** 6418 * Update values field bolivar soberano. 6419 */ 6420 function proyectos_operativos_update_6001() { 6421 include_once('./'. drupal_get_path('module', 'content') .'/content.install'); 6422 drupal_load('module', 'content'); 6423 6424 $fields_update = array( 6425 'field_proyecto_monto_anual' => 'field_proyecto_monto_anual', 6426 'field_proyecto_total' => 'field_proyecto_total', 6427 'field_proyecto_monto_prox' => 'field_proyecto_monto_prox', 6428 'field_proyecto_monto_ant' => 'field_proyecto_monto_ant', 6429 'field_proyecto_esp_monto_finan' => 'field_proyecto_esp_monto_finan', 6430 'field_proyecto_esp_total_fuent' => 'field_proyecto_esp_total_fuent', 6431 ); 6432 $rate = 100000; 6433 $ret = array(); 6434 $types_field = array( 6435 'number_float' => 'number_float', 6436 'number_decimal' => 'number_decimal', 6437 'number_integer' => 'number_integer', 6438 'cck_plan_fields_field' => 'cck_plan_fields_field', 6439 'cck_plan_fields_simple_field' => 'cck_plan_fields_simple_field', 6440 'cck_plan_fields_combine_term' => 'cck_plan_fields_combine_term', 6441 ); 6442 6443 // Get the latest cache values and schema. 6444 content_clear_type_cache(TRUE, TRUE); 6445 $types = content_types_install(); 6446 if (empty($types)) { 6447 return $ret; 6448 } 6449 6450 foreach ($types as $type_name => $fields) { 6451 foreach ($fields as $field) { 6452 if (array_key_exists($field['field_name'], $fields_update) && array_key_exists($field['type'], $types_field)) { 6453 $values[] = $field; 6454 } 6455 } 6456 } 6457 $index = array(); 6458 for($i = 0; $i < 12; $i++) { 6459 $index[] = $i === 0? 'value' : 'value_' . $i; 6460 } 6461 6462 foreach ($values as $field) { 6463 $db_info = content_database_info($field); 6464 $table = $db_info['table']; 6465 $columns = array(); 6466 foreach($index as $id) { 6467 if (isset($db_info['columns'][$id])) { 6468 $attributes = $db_info['columns'][$id]; 6469 $column = $attributes['column']; 6470 $decimals = isset($field['scale']) && is_numeric($field['scale'])? $field['scale'] : 0; 6471 $columns[] = $column . ' = round(' . $column . '/' . $rate . ', ' . $decimals . ')'; 6472 } 6473 } 6474 //$sql = 'UPDATE {'. $db_info['table'] . '} AS tab SET '. $column . ' = round(' . $column . '/' . $rate . ', ' . $decimals . ') FROM {node} AS n WHERE n.nid = tab.nid AND n.vid = tab.vid'; 6475 $ret[] = update_sql('UPDATE {'. $db_info['table'] . '} AS tab SET '. implode(', ', $columns) . ' FROM {node} AS n WHERE n.nid = tab.nid AND n.vid = tab.vid'); 6476 6477 } 6478 6479 $ret['#finished'] = 1; 6480 6481 return $ret; 6482 }
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.