Last modified by Super Admin on 2026/03/22 00:39

From version Icon 37.1 Icon
edited by Super Admin
on 2026/03/18 20:43
Change comment: There is no comment for this version
To version Icon 35.1 Icon
edited by Super Admin
on 2026/03/18 20:38
Change comment: There is no comment for this version

Summary

Details

Icon Page properties
Content
... ... @@ -222,20 +222,16 @@
222 222   .catch(function() { return false; });
223 223  
224 224   // 関連校チェック(他校の関連校として登録されているか確認)
225 - var affiliatedCheck = fetch('$request.contextPath/bin/view/SeitokaiCode/CheckAffiliated?code=' + encodeURIComponent(school.code) + '&outputSyntax=plain')
226 - .then(function(r) { return r.ok ? r.text() : ''; })
227 - .then(function(t) {
228 - try {
229 - var jsonEnd = t.indexOf('}');
230 - if (jsonEnd >= 0) return JSON.parse(t.substring(0, jsonEnd + 1));
231 - } catch(e) {}
232 - return { found: false };
233 - })
234 - .catch(function() { return { found: false }; });
225 + var affCheckUrl = restBase + '/query?q=' +
226 + encodeURIComponent("select doc.fullName, school.affiliatedSchoolName from Document doc, doc.object(SeitokaiCode.SchoolClass) school where school.affiliatedSchoolCode = :code") +
227 + '&type=hql&queryFilters=unique&parameters=code:' + encodeURIComponent(school.code);
228 + var affiliatedCheck = fetch(affCheckUrl, { headers: { 'Accept': 'application/json' } })
229 + .then(function(r) { return r.ok ? r.json() : []; })
230 + .catch(function() { return []; });
235 235  
236 236   Promise.all([duplicateCheck, affiliatedCheck]).then(function(results) {
237 237   var isDuplicate = results[0];
238 - var affData = results[1];
234 + var affResults = results[1];
239 239   var affNotice = document.getElementById('affiliatedNotice');
240 240  
241 241   if (isDuplicate) {
... ... @@ -249,10 +249,15 @@
249 249   }
250 250  
251 251   // 関連校として登録されている場合
252 - if (affData && affData.found) {
253 - var linkHref = '$request.contextPath/bin/Schools/' + affData.mainCode + '/';
248 + if (affResults && affResults.length > 0) {
249 + var mainPageRef = affResults[0];
250 + var mainCode = '';
251 + if (typeof mainPageRef === 'string' && mainPageRef.indexOf('Schools.') === 0) {
252 + mainCode = mainPageRef.split('.')[1];
253 + }
254 + var linkHref = mainCode ? ('$request.contextPath/bin/Schools/' + mainCode + '/') : '#';
254 254   document.getElementById('affiliatedNoticeText').innerHTML =
255 - '<a href="' + escapeHtml(linkHref) + '">' + escapeHtml(affData.mainName) + '</a> に中高一貫校の関連校として統合されています。' +
256 + '別の学校ページに中高一貫校の関連校として統合されています。' +
256 256   '<a href="' + escapeHtml(linkHref) + '">統合先のページへ移動する →</a>';
257 257   affNotice.style.display = 'flex';
258 258   } else {