Provincia de Castilla y León detalle
465 Emaitza
Errorea gertatu da txantiloia prozesatzerakoan.
Java method "com.sun.proxy.$Proxy893.getFriendlyURLEntryLocalization(long, String)" threw an exception when invoked on com.sun.proxy.$Proxy893 object "com.liferay.friendly.url.service.impl.FriendlyURLEntryLocalServiceImpl@25a198e2"; see cause exception in the Java stack trace.
----
FTL stack trace ("~" means nesting-related):
- Failed at: #assign friendlyURLEntryLocalization ... [in template "13333257#13333299#13752006" at line 42, column 49]
----
1<#assign classNameLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.ClassNameLocalService")/>
2<#assign dlFileEntryLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService")/>
3<#assign dlFileEntryTypeLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryTypeLocalService")/>
4<#assign dlFileEntryMetadataLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryMetadataLocalService")/>
5<#assign friendlyURLLocalService = serviceLocator.findService("com.liferay.friendly.url.service.FriendlyURLEntryLocalService")/>
6<#assign storageEngineManagerUtil = objectUtil("com.liferay.dynamic.data.mapping.kernel.StorageEngineManagerUtil")/>
7<#assign assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService") />
8<#assign assetLinkLocalService = serviceLocator.findService("com.liferay.asset.link.service.AssetLinkLocalService") />
9<#assign groupLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.GroupLocalService")/>
10<#assign documentUrlPrincipal = ""/>
11
12<#if searchContainer.getTotal() == 0>
13 <div class="sheet">
14 <div class="taglib-empty-result-message c-empty-state-animation">
15 <div class="c-empty-state-image taglib-empty-state"></div>
16 <p class="taglib-empty-result-message-title mb-0"><@liferay.language key="no-results-were-found" /></p>
17 <p class="taglib-empty-result-message-description">
18 <#assign msg>
19 <@liferay.language_format
20 key="no-results-were-found-that-matched-the-keywords-x"
21 arguments=[""]
22 />
23 </#assign>
24 ${msg?remove_ending(".")} <strong>${request.getParameter("q")!''}</strong>.
25 </p>
26 </div>
27 </div>
28<#else>
29 <#if entries?has_content>
30 <ul class="mj-results-list">
31 <#list entries as curEntry>
32 <li class="mj-box__information w-100">
33 <#assign classNameId = classNameLocalService.getClassNameId("com.liferay.portal.kernel.repository.model.FileEntry") />
34 <#assign dlFileEntry = dlFileEntryLocalService.getDLFileEntry(curEntry.classPK) />
35 <#assign assetEntryFE = assetEntryLocalService.getEntry("com.liferay.document.library.kernel.model.DLFileEntry", curEntry.classPK) />
36 <#assign relatedAssetsFE = assetLinkLocalService.getLinks(assetEntryFE.getEntryId())/>
37 <#assign fiscalRepositoryGroup = groupLocalService.getGroup(dlFileEntry.getGroupId())/>
38 <#assign repositoryFriendlyUrl = fiscalRepositoryGroup.getFriendlyURL()/>
39 <#assign imgUrlBase = "/documents/d"+repositoryFriendlyUrl+"/"/>
40 <#assign friendlyURLEntry = friendlyURLLocalService.fetchMainFriendlyURLEntry(classNameId, curEntry.classPK)!"" />
41 <#if friendlyURLEntry?? && friendlyURLEntry!="" >
42 <#assign friendlyURLEntryLocalization = friendlyURLLocalService.getFriendlyURLEntryLocalization(friendlyURLEntry.getFriendlyURLEntryId(), themeDisplay.getLanguageId()) />
43 </#if>
44 <#if dlFileEntry.getSize() gt 0 && friendlyURLEntryLocalization?? >
45 <#assign documentUrlPrincipal = getDocumentUrl(repositoryFriendlyUrl, friendlyURLEntryLocalization.getUrlTitle(), false)/>
46 <#else>
47 <#assign documentUrlPrincipal = ""/>
48 </#if>
49
50 <#assign descripcion = dlFileEntry.getDescription() />
51 <#assign fileEntryType = dlFileEntryTypeLocalService.getFileEntryType(dlFileEntry.getFileEntryTypeId()) />
52 <#assign fileEntryMetadata = dlFileEntryMetadataLocalService.getFileEntryMetadata(fileEntryType.getDataDefinitionId(), dlFileEntry.getLatestFileVersion(true).getFileVersionId()) />
53 <#assign ddmFormValues = storageEngineManagerUtil.getDDMFormValues(fileEntryMetadata.getDDMStorageId()) />
54 <#assign ddmFormFieldValues = ddmFormValues.getDDMFormFieldValues()/>
55
56 <#-- start -->
57 <#list ddmFormFieldValues as field>
58 <#assign reference = field.getFieldReference() />
59 <#if reference=="titulo" >
60 <#assign documentTitulo = (field.getValue().getString(locale)?has_content)?then(field.getValue().getString(locale),dlFileEntry.fileName) />
61 <#elseif reference=="tituloUrl" >
62 <#assign documentTituloUrl = field.getValue().getString(locale)/>
63 <#elseif reference=="url" >
64 <#assign documentUrl = field.getValue().getString(locale)/>
65 <#elseif reference=="fecha">
66 <#assign documentFecha = field.getValue().getString(locale)/>
67 <#elseif reference=="ca_document" >
68 <#assign documentJsonRaw = field.getValue().getString(locale)!"{}" />
69 <#if documentJsonRaw?? && documentJsonRaw!="{}">
70 <#assign documentJson = documentJsonRaw?eval/>
71 <#assign documentUrlCA = getDocumentUrl(repositoryFriendlyUrl, getUrlTitle(documentJson,themeDisplay.getLanguageId()), false)/>
72 <#else>
73 <#assign documentUrlCA = "">
74 </#if>
75 <#elseif reference=="gl_document" >
76 <#assign documentJsonRaw = field.getValue().getString(locale) />
77 <#if documentJsonRaw?? && documentJsonRaw!="{}">
78 <#assign documentJson = documentJsonRaw?eval/>
79 <#assign documentUrlGL = getDocumentUrl(repositoryFriendlyUrl, getUrlTitle(documentJson,themeDisplay.getLanguageId()), false)/>
80 <#else>
81 <#assign documentUrlGL = "">
82 </#if>
83 <#elseif reference=="va_document" >
84 <#assign documentJsonRaw = field.getValue().getString(locale) />
85 <#if documentJsonRaw?? && documentJsonRaw!="{}">
86 <#assign documentJson = documentJsonRaw?eval/>
87 <#assign documentUrlVA = getDocumentUrl(repositoryFriendlyUrl, getUrlTitle(documentJson,themeDisplay.getLanguageId()), false)/>
88 <#else>
89 <#assign documentUrlVA = "">
90 </#if>
91 <#elseif reference=="eu_document" >
92 <#assign documentJsonRaw = field.getValue().getString(locale) />
93 <#if documentJsonRaw?? && documentJsonRaw!="{}">
94 <#assign documentJson = documentJsonRaw?eval/>
95 <#assign documentUrlEU = getDocumentUrl(repositoryFriendlyUrl, getUrlTitle(documentJson,themeDisplay.getLanguageId()), false)/>
96 <#else>
97 <#assign documentUrlEU = "">
98 </#if>
99 <#elseif reference=="en_document" >
100 <#assign documentJsonRaw = field.getValue().getString(locale) />
101 <#if documentJsonRaw?? && documentJsonRaw!="{}">
102 <#assign documentJson = documentJsonRaw?eval/>
103 <#assign documentUrlEN = getDocumentUrl(repositoryFriendlyUrl, getUrlTitle(documentJson,themeDisplay.getLanguageId()), false)/>
104 <#else>
105 <#assign documentUrlEN = "">
106 </#if>
107 </#if>
108
109 </#list>
110
111 <#-- html -->
112 <div class="mj-box__information--top-wrapper">
113 <#if documentTitulo?? && documentTitulo!="">
114 <p class="mj-box__information--title bold">
115 <#if documentUrlPrincipal?? && documentUrlPrincipal!="">
116 <a href="${documentUrlPrincipal}?download=false" target="_blank" title="<@liferay.language key='opens-new-window'/>">${htmlUtil.escape(documentTitulo)}
117 </a>
118 <#else>
119 ${htmlUtil.escape(documentTitulo)}
120 </#if>
121 </p>
122 </#if>
123 <#if documentTituloUrl?? && documentTituloUrl!="">
124 <a class="mj-link mb-10 d-inline-block" href="${htmlUtil.escape(documentUrl)}" target="_blank" aria-label="${languageUtil.format(locale, 'x-opens-new-window', htmlUtil.escape(documentTituloUrl), false)}">
125 ${htmlUtil.escape(documentTituloUrl)}
126 </a>
127 </#if>
128 <#if descripcion?? && descripcion!="">
129 <p class="mj-box__information--text">
130 ${htmlUtil.escape(descripcion)}
131 </p>
132 </#if>
133 </div>
134 <div class="mj-box__information--bottom-wrapper">
135 <div>
136 <#if documentUrlPrincipal?? && documentUrlPrincipal!="">
137 <a href="${documentUrlPrincipal}" class="mj-link-download mr-2" download aria-label="${languageUtil.format(locale, 'download-x', htmlUtil.escape(documentTitulo), false)}" title="<@liferay.language key='download' /> ${htmlUtil.escape(documentTitulo)}"><@liferay.language key="download" /></a>
138 </#if>
139 <#if documentUrlCA?? && documentUrlCA!="">
140 <@printDownloadFlag documentUrlCA "ca_es" />
141 </#if>
142 <#if documentUrlGL?? && documentUrlGL!="">
143 <@printDownloadFlag documentUrlGL "gl_es" />
144 </#if>
145 <#if documentUrlVA?? && documentUrlVA!="">
146 <@printDownloadFlag documentUrlVA "va_es" />
147 </#if>
148 <#if documentUrlEU?? && documentUrlEU!="">
149 <@printDownloadFlag documentUrlEU "eu_es" />
150 </#if>
151 <#if documentUrlEN?? && documentUrlEN!="">
152 <@printDownloadFlag documentUrlEN "en_gb" />
153 </#if>
154 </div>
155
156 <#if documentFecha?? && documentFecha!="">
157 <#assign documentFecha_DateObj = dateUtil.parseDate("yyyy-MM-dd", documentFecha, locale)>
158 <#assign documentFechaFormat = dateUtil.getDate(documentFecha_DateObj, "dd/MM/yyyy", locale)/>
159 <time class="mj-datetime" datetime="${documentFecha_DateObj?date?iso_utc}">${documentFechaFormat}</time>
160 </#if>
161
162 </div>
163 <#-- DOCUMENTOS RELACIONADOS -->
164 <#if relatedAssetsFE?? && relatedAssetsFE?has_content>
165 <div class="mj-box__information--related-assets">
166 <p>
167 <span ><@liferay.language key='fiscal.document.related.assets' /></span>
168 <#if relatedAssetsFE?size gt 1 >
169
170 <@clay.button
171 id="zip_"+assetEntryFE.getEntryId()
172 name="button-zip"
173 title="Download zip"
174 icon="document-compressed"
175 cssClass="btn btn-secondary btn-sm"
176 label="Descargar todo"
177 > </@clay.button>
178 </#if>
179 </p>
180
181 <@getRelatedAssets assetEntryFE relatedAssetsFE fileEntryType.getFileEntryTypeId()/>
182 </div>
183 </#if>
184 </li>
185 </#list>
186 </ul>
187 </#if>
188</#if>
189<#function getUrlTitle documentJson languageId>
190 <#assign urlTitle = "" />
191 <#assign classPK = documentJson.classPK!""/>
192 <#if classPK?string=="">
193 <#assign classPK = documentJson.fileEntryId!""/>
194 </#if>
195 <#if classPK?? && classPK?string!="">
196 <#assign dlFileEntry = dlFileEntryLocalService.getDLFileEntry(classPK?number) />
197 <#assign classNameId = classNameLocalService.getClassNameId("com.liferay.portal.kernel.repository.model.FileEntry") />
198 <#assign friendlyURLEntry = friendlyURLLocalService.fetchMainFriendlyURLEntry(classNameId, classPK?number)!"" />
199 <#if friendlyURLEntry?? && friendlyURLEntry!="" >
200 <#assign friendlyURLEntryLocalization = friendlyURLLocalService.getFriendlyURLEntryLocalization(friendlyURLEntry.getFriendlyURLEntryId(), languageId) />
201 <#if dlFileEntry.getSize() gt 0 && friendlyURLEntryLocalization?? >
202 <#assign urlTitle = friendlyURLEntryLocalization.getUrlTitle() />
203 </#if>
204 </#if>
205 </#if>
206 <#return urlTitle>
207</#function>
208
209
210<#function getDocumentUrl repositoryUrl urlTitle isDownload>
211 <#if repositoryUrl?? && repositoryUrl!="" && urlTitle?? && urlTitle!="" >
212 <#if isDownload?? && isDownload==true >
213 <#return "/documents/d"+repositoryUrl+"/"+urlTitle+"?download=true">
214 <#else>
215 <#return "/documents/d"+repositoryUrl+"/"+urlTitle >
216 </#if>
217 <#else>
218 <#return "">
219 </#if>
220</#function>
221
222
223
224<#macro printDownloadFlag documentUrl localeFlag>
225 <#if localeFlag == 'ca_es'>
226 <#assign language = 'catalán' />
227 <#elseif localeFlag == 'gl_es'>
228 <#assign language = 'gallego' />
229 <#elseif localeFlag == 'va_es'>
230 <#assign language = 'valenciano' />
231 <#elseif localeFlag == 'eu_es'>
232 <#assign language = 'euskera' />
233 <#elseif localeFlag == 'en_gb'>
234 <#assign language = 'inglés' />
235 </#if>
236
237 <a href="${documentUrl}" class="mr-1" download target="_blank" title="<@liferay.language key='download' /> ${htmlUtil.escape(documentTitulo)} > ${language}">
238 <img src="${imgUrlBase}${localeFlag}" />
239 </a>
240</#macro>
241
242 <#-- DOCUMENTOS RELACIONADOS -->
243<#macro getRelatedAssets assetEntry relatedAssetsLink fileEntryTypeId>
244 <#if relatedAssetsLink?has_content>
245 <ul class="list-group sidebar-list-group">
246 <#list relatedAssetsLink as entryLink>
247 <#if entryLink.getEntryId1() == assetEntry.getEntryId()>
248 <#assign entry2 = assetEntryLocalService.getEntry(entryLink.getEntryId2()) />
249 <#if entry2?has_content && entry2.getClassPK()?has_content>
250 <#assign relatedContentSize = 0/>
251 <#attempt>
252 <#assign relatedContent = dlFileEntryLocalService.getDLFileEntry(entry2.getClassPK()) />
253 <#assign relatedContentSize = relatedContent.getSize()/>
254 <#recover>
255 <#assign relatedContent = ""/>
256 </#attempt>
257 <#if relatedContent?has_content && relatedContentSize gt 0 && fileEntryTypeId == relatedContent.getFileEntryTypeId()>
258 <#assign entryName = "zip_"+assetEntry.getEntryId() />
259 <#assign entryExtension = relatedContent.getExtension() />
260 <#assign entryMimeType = relatedContent.getMimeType() />
261 <#assign relatedContentURL = entry2.getAssetRenderer().getURLDownload(themeDisplay) />
262 <li class="list-group-item list-group-item-flex">
263 <a href="${relatedContentURL}" name="${entryName}" data-ext="${entryExtension}" data-mimetype="${entryMimeType}" class="mj-link-download mr-2" download target="_blank" title="<@liferay.language key='download' /> ${htmlUtil.escape(relatedContent.getFileName())} > ">
264 ${htmlUtil.escape(relatedContent.getTitle())}
265 </a>
266 </li>
267 </#if>
268 </#if>
269 </#if>
270
271 </#list>
272 </ul>
273 </#if>
274</#macro>
275
276<script>
277 document.addEventListener('DOMContentLoaded', function () {
278 const btnZip= document.getElementsByName("button-zip");
279
280 function downloadZipFile(event){
281 const relatedFiles= document.getElementsByName(event.currentTarget.id);
282 const filesArray=[];
283 relatedFiles.forEach(function(element) {
284 let fileName= element.textContent;
285 fileName=fileName.trim().replace("/", "-");
286 let temp = element.href.split("?")[0];
287 let fileUrl = temp.substring(0, temp.lastIndexOf("/"));
288 let ext=element.getAttribute("data-ext");
289 let mimeTp=element.getAttribute("data-mimetype");
290 //console.log("fileName "+fileName);
291 const fileObj=new Object({
292 name: fileName,
293 url: fileUrl,
294 extension: ext,
295 mimetype: mimeTp
296 });
297 filesArray.push(fileObj);
298
299 });
300 if(filesArray.length>0){
301 saveToZip("Documentos_Relacionados", filesArray);
302
303 }
304
305 }
306
307 async function saveToZip(filename, arrayFiles) {
308 const zip = new JSZip();
309
310 // 1. Procesar todos los archivos
311 for (let idx = 0; idx < arrayFiles.length; idx++) {
312 const fileObj = arrayFiles[idx];
313 const name = fileObj.name + "." + fileObj.extension;
314 const url = fileObj.url;
315
316 try {
317 const response = await fetch(url);
318 if (response.status !== 200) throw new Error(response.statusText);
319 const data = await response.arrayBuffer();
320 // console.log("Añadiendo: " + name, "Tamaño:", data.byteLength);
321 zip.file(name, data, { binary: true });
322
323 } catch (err) {
324 console.error("Error al descargar " + name, err);
325 }
326 }
327 const zipData = zip.generate({
328 type: "blob",
329 compression: "DEFLATE"
330 });
331
332 // 3. Lanzar la descarga
333 const link = document.createElement('a');
334 link.href = window.URL.createObjectURL(zipData);
335 link.download = filename;
336
337 // Añadir al documento temporalmente para asegurar compatibilidad en algunos navegadores
338 document.body.appendChild(link);
339 link.click();
340 document.body.removeChild(link);
341 // Limpiar memoria
342 window.URL.revokeObjectURL(link.href);
343}
344
345 btnZip.forEach(function(element) {
346 element.addEventListener("click", function(event){
347 downloadZipFile(event);
348 });
349 });
350
351
352 });
353</script>
We use cookies to deliver personalized content, analyze trends, administer the site, track user movements on the site, and collect demographic information about our user base as a whole. Accept all cookies for the best possible experience on our website or manage your preferences. Visit our Privacy Policy
