Conjunto ef72343 en sipes
- Fecha y hora:
- 26/09/2018 09:10:05 (hace 6 años)
- Branches:
- stable
- Children:
- f8d6cf8
- Parents:
- a585534
- Fichero:
-
- 1 editado
Leyenda
- No modificado
- Añadido
- Eliminado
-
0.3-modules/ente_planificador_importar/ente_planificador_importar.module
ra585534 ref72343 822 822 if ($form_state['values']['search_parent_' . $j] && $data[$form_state['values']['search_parent_' . $j] - 1]) { 823 823 $term['search_parent'] = check_plain($data[$form_state['values']['search_parent_' . $j] - 1]); 824 $term['term_parent'] = check_plain($data[$form_state['values']['search_parent_0']]); 824 825 } 825 826 if (!($form_state['values']['encabezado'] && $i == 1)) { … … 897 898 */ 898 899 function _batch_ente_planificador_importar_term($term, &$context) { 899 //not create if exist 900 $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.name FROM {term_data} t WHERE LOWER(t.name) = LOWER('%s') AND vid = %d", 't', 'tid'), $term['name'], $term['vid']); 901 $row = db_fetch_array($db_result); 902 if (!taxonomy_get_term($row['tid'])) { 903 $term['parent'] = array(); 904 $term['search_parent']; 905 if ($term['search_parent']) { 906 $db_result = db_query(db_rewrite_sql("SELECT MAX(t.tid) FROM {term_data} t WHERE LOWER(t.name) = LOWER('%s') AND vid = %d", 't', 'tid'), trim($term['search_parent']), $term['vid']); 907 $result = array(); 908 $row = db_fetch_array($db_result); 909 if (!empty($row)) { 910 $parent = taxonomy_get_term($row['tid']); 911 if ($parent) { 912 $term['parent'][] = $parent->tid; 913 } 914 } 915 } 916 taxonomy_save_term($term); 917 } 900 //not create if exist 901 if ($term['search_parent']) { 902 $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.name FROM {term_data} t WHERE LOWER(t.name) = LOWER('%s') AND vid = %d", 't', 'tid'), trim($term['search_parent']), $term['vid']); 903 $result = array(); 904 while ($row = db_fetch_array($db_result)) { 905 if (!empty($row)) { 906 $parents_all = taxonomy_get_parents_all($row['tid']); 907 foreach ($parents_all as $parent) { 908 if ($parent->name == trim($term['search_parent']) && $parents_all[count($parents_all) - 1]->name == trim($term['term_parent'])) { 909 $parents = array('name' => $parent->name, 'tid_parent' => $row['tid']); 910 911 $db_query2 = db_query(db_rewrite_sql("SELECT t.tid, t.name FROM {term_data} t inner join {term_hierarchy} as h on h.tid=t.tid WHERE LOWER(t.name) = LOWER('%s') AND t.vid = %d AND h.parent = %d", 't', 'tid'), trim($term['name']), $term['vid'], $row['tid']); 912 $rows_query = db_fetch_array($db_query2); 913 if (!$rows_query['tid']) { 914 $term['parent'][] = $parents['tid_parent']; 915 taxonomy_save_term($term); 916 } 917 } 918 } 919 } 920 } 921 } 922 else { 923 $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_hierarchy} as h ON h.tid=t.tid WHERE LOWER(t.name) = LOWER('%s') AND t.vid = %d AND h.parent = %d", 't', 'tid'), trim($term['name']), $term['vid'], 0); 924 $rows = db_fetch_array($db_result); 925 926 if (!taxonomy_get_term($rows['tid'])) { 927 taxonomy_save_term($term); 928 } 929 } 918 930 919 931 $context['message'] = t('Now processing ente: %submission', array('%submission' => $term->name)); 920 932 $context['results'][] = 'term importado: ' . $term->name . '</pre>'; 921 /*922 if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {923 $context['finished'] = 1;924 } else {925 $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];926 }927 */928 933 } 929 934
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.