Buscador

Se ha producido un error al procesar la plantilla.
The following has evaluated to null or missing:
==> AssetCategoryLocalService.fetchAssetCategory(num)  [in template "20100#20136#95210822" at line 38, column 20]

----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign cat = AssetCategoryLocalServi...  [in template "20100#20136#95210822" at line 38, column 5]
----
1<#assign AssetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")> 
2<#assign currentURL = themeDisplay.getURLCurrent()> 
3<#assign scheme = request.scheme> 
4<#assign serverName = request.serverName> 
5<#assign url = scheme + "://" + serverName + currentURL> 
6<#assign categoryValues = []> 
7<#assign categoryValuesNames = []> 
8 
9<#if currentURL != "/buscador?" && currentURL != "/buscador" > 
10  <#assign queryString = url?split("?")[1]> 
11  <#assign parameters = []> 
12 
13 
14  <#assign typeValues = []> 
15  <#assign qValues = []> 
16 
17  <#list queryString?split("&") as param> 
18    <#assign keyValue = param?split("=")> 
19    <#if keyValue?size == 2> 
20      <#assign paramValue = keyValue[1]> 
21      <#if keyValue[0] == "category"> 
22        <#assign categoryValues = categoryValues + [paramValue]> 
23      <#elseif keyValue[0] == "type"> 
24        <#assign typeValues = typeValues + [paramValue]> 
25      <#elseif keyValue[0] == "q"> 
26        <#assign qValues = qValues + [paramValue]> 
27      </#if> 
28      <#assign parameter = { 
29          "name": keyValue[0], 
30          "value": keyValue[1] 
31        }> 
32      <#assign parameters = parameters + [parameter]> 
33    </#if> 
34  </#list> 
35 
36  <#list categoryValues as param> 
37    <#assign num = param?number> 
38    <#assign cat = AssetCategoryLocalService.fetchAssetCategory(num) />     
39    <#assign categoryValuesNames = categoryValuesNames + [cat.getTitle(locale)]> 
40  </#list> 
41</#if> 
42 
43<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet" /> 
44<div id="selectedFilters"></div> 
45<script> 
46  var current = "${currentURL}"; 
47  if(current != "/buscador?" && current != "/buscador" ) { 
48    var catNames = [ 
49        <#list categoryValuesNames as value> 
50          "${value?js_string}", 
51        </#list> 
52      ]; 
53 
54    var catIds = [ 
55        <#list categoryValues as value> 
56          "${value?js_string}", 
57        </#list> 
58      ]; 
59 
60      if (catNames) { 
61        addCatParams(catNames); 
62
63 
64 
65      var url = new URL(window.location.href); 
66 
67      var params = new URLSearchParams(url.search); 
68      var qParam; 
69      var filterPrint = document.getElementById('selectedFilters'); 
70 
71      var parametros = []; 
72      for (var [nombre, valor] of params) { 
73        if(nombre != "sort" && nombre != "modifiedFrom" && nombre != "modifiedTo" && nombre != "category"){ 
74          if (nombre == "q") { 
75            qParam = valor; 
76          } else if (nombre in parametros) { 
77            parametros.push(valor); 
78          } else { 
79            parametros.push(valor); 
80
81
82
83 
84      var newUrl; 
85      //var params = url.href.split("&"); 
86      //var firstParam = params[0].split("?"); 
87      var params = url.href.split("?"); 
88      params = params[1].split("&") 
89      if(qParam) { 
90        addSearchedParameter(qParam); 
91
92      if (parametros) { 
93        addFilterParams(parametros); 
94
95 
96    } else { 
97      window.history.replaceState(null, null, window.location.href.split('?')[0]); 
98
99 
100    function addSearchedParameter(qParam) { 
101      var div = document.createElement("div"); 
102        div.setAttribute("name", "selectedFilterDiv"); 
103        div.setAttribute("id", qParam); 
104        div.setAttribute("class", "float-left m-2 pl-3 p-3"); 
105 
106        var filterName = document.createElement("span"); 
107        filterName.setAttribute("class", "filter-name"); 
108        filterName.innerText = qParam; 
109 
110        var icon = document.createElement("button"); 
111        icon.setAttribute("class", "fas fa-times ml-2"); 
112        icon.setAttribute("aria-label", "Quitar filtro"); 
113        icon.setAttribute("alt", "Quitar filtro"); 
114        icon.setAttribute("role", "button"); 
115        icon.setAttribute("onclick", "deleteFilter('"+div.id+"')"); 
116         
117        div.appendChild(filterName); 
118        div.appendChild(icon); 
119 
120        filterPrint.appendChild(div); 
121
122 
123 
124    function addFilterParams(parametros) { 
125      for (var i = 0; i < parametros.length; i++) { 
126        try { 
127 
128          var input = document.querySelector('input[data-term-id="'+parametros[i]+'"]'); 
129          input = input.nextElementSibling.textContent.trim(); 
130          input = input.replace(/\s*\([^)]*\)\s*/g, ''); 
131 
132          var div = document.createElement("div"); 
133          div.setAttribute("name", "selectedFilterDiv"); 
134          div.setAttribute("id", parametros[i]); 
135          div.setAttribute("class", "float-left m-2 pl-3 p-3"); 
136 
137          var filterName = document.createElement("span"); 
138          filterName.setAttribute("class", "filter-name"); 
139          filterName.innerText = input; 
140 
141          var icon = document.createElement("button"); 
142          icon.setAttribute("class", "fas fa-times ml-2"); 
143          icon.setAttribute("aria-label", "Quitar filtro"); 
144          icon.setAttribute("alt", "Quitar filtro"); 
145          icon.setAttribute("role", "button"); 
146          icon.setAttribute("onclick", "deleteFilter('"+div.id+"')"); 
147 
148          div.appendChild(filterName); 
149          div.appendChild(icon); 
150 
151          filterPrint.appendChild(div); 
152 
153        } catch(error) { 
154          for (var x = 0; x < params.length; x++) { 
155            var param = params[x].split("="); 
156            if (param[1] === parametros[i]) { 
157              params.splice(x, 1); 
158              x--; 
159
160
161          newUrl = "/buscador?"+params.join("&"); 
162
163
164      if (newUrl) { 
165        window.history.replaceState(null, null, newUrl); 
166
167
168 
169 
170    function addCatParams(catParam) { 
171      var filterPrint = document.getElementById('selectedFilters'); 
172      for (var i = 0; i < catParam.length; i++) { 
173        var input; 
174        var filterName = document.createElement("span"); 
175        var div = document.createElement("div"); 
176        var icon = document.createElement("button"); 
177        filterName.innerText = catParam[i]; 
178 
179        div.setAttribute("name", "selectedFilterDiv"); 
180        div.setAttribute("id", catIds[i]); 
181        div.setAttribute("class", "float-left m-2 pl-3 p-3"); 
182 
183 
184        icon.setAttribute("class", "fas fa-times ml-2"); 
185        icon.setAttribute("aria-label", "Quitar filtro"); 
186        icon.setAttribute("alt", "Quitar filtro"); 
187        icon.setAttribute("role", "button"); 
188        icon.setAttribute("onclick", "deleteFilter('"+div.id+"')"); 
189 
190        div.appendChild(filterName); 
191        div.appendChild(icon); 
192 
193        filterPrint.appendChild(div); 
194
195
196 
197    function deleteFilter(filterId) { 
198      var url = window.location.href; 
199      if (url.includes('q=' + filterId)) { 
200        url = url.replace(new RegExp('&?q=' + filterId), ''); 
201      } else if (url.includes('category-pl=' + filterId)) { 
202        url = url.replace(new RegExp('&?category-pl=' + filterId), ''); 
203      } else if (url.includes('type=' + filterId)) { 
204        url = url.replace(new RegExp('&?type=' + filterId), ''); 
205      } else if (url.includes('category-td=' + filterId)) { 
206        url = url.replace(new RegExp('&?category-td=' + filterId), ''); 
207      } else if (url.includes('category-m=' + filterId)) { 
208        url = url.replace(new RegExp('&?category-m=' + filterId), ''); 
209      } else if (url.includes('category=' + filterId)) { 
210        url = url.replace(new RegExp('&?category=' + filterId), ''); 
211
212      var finalURL = url.replace(/\?\&/g, "?"); 
213      window.location.href = finalURL; 
214
215 
216</script> 

Mostrando 391 resultados

¿Te ha resultado útil esta página?

Me ha sido útil

Ayúdanos a mejorar la página del Gobierno de Aragón

¿Por qué no te ha resultado útil? Puedes dejar aquí tu comentario anónimo.

Enviar Enviar mensaje Enviar sin comentario Enviar valoración sin mensaje

Tu respuesta nos ayudará a mejorar la web