diff --git a/core/tpl/digiquali_mass_control_list.tpl.php b/core/tpl/digiquali_mass_control_list.tpl.php index db49a829..442e1b2e 100644 --- a/core/tpl/digiquali_mass_control_list.tpl.php +++ b/core/tpl/digiquali_mass_control_list.tpl.php @@ -7,7 +7,7 @@ */ // Fetch the list of mass controls linked to the object -$massControlList = $object->fetchAll('', '', 0, 0, ['fk_control' => $object->id]); +$subControlList = $object->fetchAll('', '', 0, 0, ['fk_control' => $object->id]); // Start the responsive table container print '
Commentaire non enregistré
'),$(this).addClass("show-comment-unsaved-message")),window.digiquali.object.updateButtonsStatus()},window.digiquali.object.updateButtonsStatus=function(t){t=stringIsInteger(t)?t:$(this).attr("data-control-id"),$("#saveButton"+t).removeClass("butActionRefused"),$("#saveButton"+t).addClass("butAction"),$(".fa-circle").css("display","inline"),$("#saveButton"+t).attr("onclick",'$("#saveObject'+t+'").submit()'),$(".validateButton"+t).removeClass("butAction"),$("#dialog-confirm-actionButtonValidate"+t).removeAttr("id"),$(".validateButton"+t).addClass("butActionRefused")},window.digiquali.object.saveAnswer=function(t,o,e,i=""){var n=window.saturne.toolbox.getToken(),a=window.saturne.toolbox.getQuerySeparator(document.URL),a=i||document.URL+a+"action=save&token="+n;i.length<1&&window.saturne.loader.display($(".table-id-"+t)),$.ajax({url:a,type:"POST",data:JSON.stringify({autoSave:!0,questionId:t,answer:o,comment:e}),processData:!1,contentType:!1,success:function(t){i.length<1&&$(".fiche").replaceWith($(t).find(".fiche"))},error:function(){}})},window.digiquali.question={},window.digiquali.question.init=function(){window.digiquali.question.event()},window.digiquali.question.event=function(){$(document).on("click",".clicked-photo-preview",window.digiquali.question.previewPhoto),$(document).on("click",".ui-dialog-titlebar-close",window.digiquali.question.closePreviewPhoto),$(document).on("click","#show_photo",window.digiquali.question.showPhoto),$(document).on("click",".answer-picto .item, .wpeo-table .item",window.digiquali.question.selectAnswerPicto)},window.digiquali.question.previewPhoto=function(t){$(this).hasClass("photo-ok")?$("#dialogforpopup").attr("style","border: 10px solid #47e58e"):$(this).hasClass("photo-ko")&&$("#dialogforpopup").attr("style","border: 10px solid #e05353")},window.digiquali.question.closePreviewPhoto=function(t){$("#dialogforpopup").attr("style","border:")},window.digiquali.question.showPhoto=function(){var t=$(this).closest(".question-table").find(".linked-medias");t.hasClass("hidden")?(t.attr("style",""),t.removeClass("hidden")):(t.attr("style","display:none"),t.addClass("hidden"))},window.digiquali.question.selectAnswerPicto=function(t){var o=$(this).closest(".wpeo-dropdown");$(this).closest(".content").removeClass("active"),o.find(".dropdown-toggle span").hide(),o.find(".dropdown-toggle.button-picto").html($(this).closest(".wpeo-tooltip-event").html()),o.find(".input-hidden-picto").val($(this).data("label"))},window.digiquali.sheet={},window.digiquali.sheet.init=function(){window.digiquali.sheet.event()},window.digiquali.sheet.event=function(){}; \ No newline at end of file +window.digiquali||(window.digiquali={},window.digiquali.scriptsLoaded=!1),window.digiquali.scriptsLoaded||(window.digiquali.init=function(){window.digiquali.load_list_script()},window.digiquali.load_list_script=function(){if(!window.digiquali.scriptsLoaded){var t=void 0,o=void 0;for(t in window.digiquali)for(o in window.digiquali[t].init&&window.digiquali[t].init(),window.digiquali[t])window.digiquali[t]&&window.digiquali[t][o]&&window.digiquali[t][o].init&&window.digiquali[t][o].init();window.digiquali.scriptsLoaded=!0}},window.digiquali.refresh=function(){var t=void 0,o=void 0;for(t in window.digiquali)for(o in window.digiquali[t].refresh&&window.digiquali[t].refresh(),window.digiquali[t])window.digiquali[t]&&window.digiquali[t][o]&&window.digiquali[t][o].refresh&&window.digiquali[t][o].refresh()},$(document).ready(window.digiquali.init)),window.digiquali.control={},window.digiquali.control.init=function(){window.digiquali.control.event()},window.digiquali.control.event=function(){$(document).on("click",".validateButton",window.digiquali.control.getAnswerCounter),$(document).on("change","#fk_sheet",window.digiquali.control.showSelectObjectLinked),$(document).on("click",".clipboard-copy",window.digiquali.control.copyToClipboard),$(document).on("change","#productId",window.digiquali.control.refreshLotSelector),$(document).on("change",'[name="mass_control"]',window.digiquali.control.showSubControlsModel),$(document).on("click",".switch-public-control-view",window.digiquali.control.switchPublicControlView),$(document).on("click",".show-only-questions-with-no-answer",window.digiquali.control.showOnlyQuestionsWithNoAnswer),$(document).on("click",".photo-sheet-category",window.digiquali.control.getSheetCategoryID),$(document).on("click",".photo-sheet-sub-category",window.digiquali.control.getSheetSubCategoryID),$(document).on("click",".photo-sheet",window.digiquali.control.getSheetID),$(document).on("click",".saveSubControl:not(.butActionRefused)",window.digiquali.control.saveSubControl),$(document).on("click",".validateSubControl:not(.butActionRefused)",window.digiquali.control.validateSubControl),$(document).on("click",".reopenSubControl:not(.butActionRefused)",window.digiquali.control.reopenSubControl),$(document).on("click",".lockSubControl:not(.butActionRefused)",window.digiquali.control.lockSubControl),$(document).on("click",".saveSubControlAnswers",window.digiquali.control.saveSubControlAnswers),$(document).ready(function(){$(".verdict-box").on("click",function(t){$(this).hasClass("disabled")&&(t.stopPropagation(),t.preventDefault())})})},window.digiquali.control.getAnswerCounter=function(t){let o=0;jQuery("#tablelines").children().each(function(){0<$(this).find(".answer.active").length&&(o+=1)}),document.cookie="answerCounter="+o},window.digiquali.control.showSelectObjectLinked=function(){var t=$(this).val(),o=window.saturne.toolbox.getToken(),e=window.saturne.toolbox.getQuerySeparator(document.URL),e=document.URL+e+"fk_sheet="+t+"&token="+o;window.saturne.loader.display($(".linked-objects")),$.ajax({url:e,type:"POST",processData:!1,contentType:!1,success:function(t){$(".linked-objects").replaceWith($(t).find(".linked-objects"))},error:function(){}})},window.digiquali.control.copyToClipboard=function(t){var o=$(".copy-to-clipboard").attr("value");navigator.clipboard.writeText(o).then(()=>{$(".clipboard-copy").animate({backgroundColor:"#59ed9c"},200,()=>{$(".clipboard-copy").attr("class","fas fa-check clipboard-copy"),$(this).tooltip({items:".clipboard-copy",content:$("#copyToClipboardTooltip").val()}),$(this).tooltip("open"),$(".clipboard-copy").attr("style","")})})},window.digiquali.control.refreshLotSelector=function(t){var o=document.getElementById("add_control_equipment"),o=new FormData(o),e=window.saturne.toolbox.getToken(),o=o.get("productId"),e=document.URL+"&token="+e;e+="&fk_product="+o,window.saturne.loader.display($(".product-lot")),$.ajax({url:e,type:"POST",processData:!1,contentType:!1,success:function(t){$(".product-lot").replaceWith($(t).find(".product-lot"))},error:function(){}})},window.digiquali.control.switchPublicControlView=function(t){var o=$(this).find(".public-control-view").val(),e=window.saturne.toolbox.getToken();let i=document.URL+"&token="+e;i+=0==o?"&show_control_list=1":"&show_last_control=1",window.saturne.loader.display($(".signature-container")),$.ajax({url:i,type:"POST",processData:!1,contentType:!1,success:function(t){$("#publicControlHistory").replaceWith($(t).find("#publicControlHistory"))},error:function(){}})},window.digiquali.control.showOnlyQuestionsWithNoAnswer=function(){var t=window.saturne.toolbox.getQuerySeparator(document.URL),o=window.saturne.toolbox.getToken();let e;e=$(this).hasClass("fa-toggle-off")?1:0,window.saturne.loader.display($(this)),$.ajax({url:document.URL+t+"action=show_only_questions_with_no_answer&token="+o,type:"POST",processData:!1,data:JSON.stringify({showOnlyQuestionsWithNoAnswer:e}),contentType:!1,success:function(t){$(".progress-info").replaceWith($(t).find(".progress-info")),$(".question-answer-container").replaceWith($(t).find(".question-answer-container"))},error:function(){}})},window.digiquali.control.getSheetCategoryID=function(){let o=$(this).attr("value");var t=window.saturne.toolbox.getToken(),e=window.saturne.toolbox.getQuerySeparator(document.URL);window.saturne.loader.display($(".sheet-images-container")),$.ajax({url:document.URL+e+"sheetCategoryID="+o+"&token="+t,type:"POST",processData:!1,contentType:!1,success:function(t){$(".sheet-images-container").replaceWith($(t).find(".sheet-images-container")),$(".photo-sheet-category[value="+o+"]").css("border","3px solid #0d8aff"),$(".photo-sheet-category[value="+o+"]").addClass("photo-sheet-category-active"),$(".linked-objects").replaceWith($(t).find(".linked-objects"))},error:function(){}})},window.digiquali.control.getSheetSubCategoryID=function(){let o=$(".photo-sheet-category-active").attr("value"),e=$(this).attr("value");var t=window.saturne.toolbox.getToken(),i=window.saturne.toolbox.getQuerySeparator(document.URL);window.saturne.loader.display($(".sheet-images-container")),$.ajax({url:document.URL+i+"sheetCategoryID="+o+"&sheetSubCategoryID="+e+"&token="+t,type:"POST",processData:!1,contentType:!1,success:function(t){$(".sheet-images-container").replaceWith($(t).find(".sheet-images-container")),$(".photo-sheet-category[value="+o+"]").css("border","3px solid #0d8aff"),$(".photo-sheet-category[value="+o+"]").addClass("photo-sheet-category-active"),$(".photo-sheet-sub-category[value="+e+"]").css("border","3px solid #0d8aff"),$(".photo-sheet-sub-category[value="+e+"]").addClass("photo-sheet-sub-category-active"),$(".linked-objects").replaceWith($(t).find(".linked-objects"))},error:function(){}})},window.digiquali.control.getSheetID=function(){let o=$(this).attr("data-object-id");var t=$(".photo-sheet-category-active").attr("value"),e=$(".photo-sheet-sub-category-active").attr("value"),i=window.saturne.toolbox.getToken(),n=window.saturne.toolbox.getQuerySeparator(document.URL);window.saturne.loader.display($(".sheet-elements")),window.saturne.loader.display($(".linked-objects")),$.ajax({url:document.URL+n+"fk_sheet="+o+"&sheetCategoryID="+t+"&sheetSubCategoryID="+e+"&token="+i,type:"POST",processData:!1,contentType:!1,success:function(t){$(".sheet-elements").replaceWith($(t).find(".sheet-elements")),$(".photo-sheet[data-object-id="+o+"]").css("border","3px solid #0d8aff"),$(".linked-objects").replaceWith($(t).find(".linked-objects"))},error:function(){}})},window.digiquali.control.saveSubControl=function(){let a=$(this).attr("data-control-id"),s=$(this).attr("data-main-control-id");var t=$(this).closest(".table-row").find(".note-public").val();let d=[];$(this).closest(".table-row").find(".select-answer").each(function(){var t=$(this).attr("data-questionid"),o=$(this).find(".question-answer").val(),e=$(this).closest(".wpeo-table").find(".question-comment").val();d[t]={answer:o,comment:e}});var o=$(this).closest(".table-row").find('.verdict-option input[type="radio"]:checked').val();let c=window.saturne.toolbox.getToken();window.saturne.loader.display($(this).closest(".table-row"));var e=document.URL.replace(/id=\d+/,"id="+a);$.ajax({url:e+"&token="+c+"&action=confirm_setVerdict&verdict="+o+"¬eControl="+t,type:"POST",processData:!1,contentType:!1,data:[],success:async function(t){for(var[o,e]of Object.entries(d)){var i=document.URL.replace(/id=\d+/,"id="+a);await window.digiquali.object.saveAnswer(o,e.answer,e.comment,i+"&action=save&token="+c)}var n=document.URL.replace(/id=\d+/,"id="+s);$.ajax({url:n,type:"GET",processData:!1,contentType:!1,data:[],success:function(t){$(".wpeo-loader").removeClass("wpeo-loader"),$(".sub-control-"+a).replaceWith($(t).find(".sub-control-"+a))}})},error:function(){}})},window.digiquali.control.lockSubControl=function(){let e=$(this).attr("data-control-id"),i=$(this).attr("data-main-control-id");var t=window.saturne.toolbox.getToken(),o=(window.saturne.loader.display($(this).closest(".table-row")),document.URL.replace(/id=\d+/,"id="+e));$.ajax({url:o+"&token="+t+"&action=confirm_lock",type:"POST",processData:!1,contentType:!1,data:[],success:function(t){var o=document.URL.replace(/id=\d+/,"id="+i);$.ajax({url:o,type:"GET",processData:!1,contentType:!1,data:[],success:function(t){$(".sub-control-"+e).replaceWith($(t).find(".sub-control-"+e))}})},error:function(){}})},window.digiquali.control.validateSubControl=function(){let e=$(this).attr("data-control-id"),i=$(this).attr("data-main-control-id");var t=window.saturne.toolbox.getToken(),o=(window.saturne.loader.display($(this).closest(".table-row")),document.URL.replace(/id=\d+/,"id="+e));$.ajax({url:o+"&token="+t+"&action=confirm_validate&confirm=yes",type:"POST",processData:!1,contentType:!1,data:[],success:function(t){var o=document.URL.replace(/id=\d+/,"id="+i);$.ajax({url:o,type:"GET",processData:!1,contentType:!1,data:[],success:function(t){$(".sub-control-"+e).replaceWith($(t).find(".sub-control-"+e))}})},error:function(){}})},window.digiquali.control.reopenSubControl=function(){let e=$(this).attr("data-control-id"),i=$(this).attr("data-main-control-id");var t=window.saturne.toolbox.getToken(),o=(window.saturne.loader.display($(this).closest(".table-row")),document.URL.replace(/id=\d+/,"id="+e));$.ajax({url:o+"&token="+t+"&action=confirm_set_reopen&confirm=yes",type:"POST",processData:!1,contentType:!1,data:[],success:function(t){var o=document.URL.replace(/id=\d+/,"id="+i);$.ajax({url:o,type:"GET",processData:!1,contentType:!1,data:[],success:function(t){$(".sub-control-"+e).replaceWith($(t).find(".sub-control-"+e))}})},error:function(){}})},window.digiquali.control.saveSubControlAnswers=async function(){let o=$(this).attr("data-control-id");var t=$(this).attr("data-main-control-id");window.saturne.loader.display($(this));let i=[];$(this).closest(".table-row").find(".select-answer").each(function(){var t=$(this).attr("data-questionid"),o=$(this).find(".question-answer").val(),e=$(this).closest(".wpeo-table").find(".question-comment").val();i[t]={answer:o,comment:e}});var e,n,a=window.saturne.toolbox.getToken();let s=document.URL.replace(/id=\d+/,"id="+o);for([e,n]of Object.entries(i))await window.digiquali.object.saveAnswer(e,n.answer,n.comment,s+"&action=save&token="+a);s=document.URL.replace(/id=\d+/,"id="+t),$.ajax({url:s,type:"GET",processData:!1,contentType:!1,data:[],success:function(t){$(".sub-control-"+o).replaceWith($(t).find(".sub-control-"+o)),$(".wpeo-loader").removeClass("wpeo-loader")}})},window.digiquali.control.showSubControlsModel=function(){$(".sub-controls-model").attr("style",""),$(".sub-controls-model").find(".select2-container").css("width","500px")},window.digiquali.object={},window.digiquali.object.init=function(){window.digiquali.object.event()},window.digiquali.object.event=function(){$(document).on("change",".object-table.linked-objects select",window.digiquali.object.disableOtherSelectors),$(document).on("click",".answer:not(.disable)",window.digiquali.object.selectAnswer),$(document).on("input",".input-answer:not(.disable)",window.digiquali.object.selectAnswer),$(document).on("keyup",".question-comment",window.digiquali.object.showCommentUnsaved),$(document).on("click",".verdict-box",window.digiquali.object.updateButtonsStatus)},window.digiquali.object.disableOtherSelectors=function(){var t=document.getElementById("createObjectForm"),t=new FormData(t),o=$(this).attr("id");0<=t.get(o)?$(".object-table.linked-objects").find("select").not("#"+o).attr("disabled",1):$(".object-table.linked-objects").find("select").not("#"+o).removeAttr("disabled")},window.digiquali.object.selectAnswer=function(){var o=$(this).closest(".select-answer.answer-cell"),t=o.attr("data-questionId"),e=$(this).closest(".table-id-"+t).attr("data-publicInterface"),i=$(this).closest(".table-id-"+t).attr("data-autoSave");let n="";var a=$(this).hasClass("answer")?$(this).attr("value"):$(this).val(),s=$(this).closest(".table-id-"+t).find("#comment"+t).val(),d=$(this).closest(".table-id-"+t).attr("data-control-id");if($(this).closest(".table-cell").hasClass("select-answer")){if($(this).hasClass("multiple-answers")){$(this).closest("span").toggleClass("active");let t=[];o.find(".multiple-answers.active").each(function(){t.push($(this).attr("value"))}),n=t}else $(this).closest(".table-cell").find(".answer.active").css("background-color","#fff"),$(this).closest(".table-cell").find("span").removeClass("active"),$(this).closest("span").addClass("active"),n=a;$(this).hasClass("active")?(o=$(this).closest(".answer-cell").find(".answer-color-"+$(this).attr("value")).val(),$(this).attr("style",$(this).attr("style")+" background:"+o+";")):$(this).attr("style",$(this).attr("style")+" background:#fff;"),$(this).closest(".answer-cell").find(".question-answer").val(n)}e||1!=i||$(this).hasClass("multiple-answers")?window.digiquali.object.updateButtonsStatus(d):window.digiquali.object.saveAnswer(t,n,s)},window.digiquali.object.showCommentUnsaved=function(){$(this).hasClass("show-comment-unsaved-message")||($(this).after('Commentaire non enregistré
'),$(this).addClass("show-comment-unsaved-message")),window.digiquali.object.updateButtonsStatus()},window.digiquali.object.updateButtonsStatus=function(t){t=stringIsInteger(t)?t:$(this).attr("data-control-id"),$("#saveButton"+t).removeClass("butActionRefused"),$("#saveButton"+t).addClass("butAction"),$(".fa-circle").css("display","inline"),$("#saveButton"+t).attr("onclick",'$("#saveObject'+t+'").submit()'),$(".validateButton"+t).removeClass("butAction"),$("#dialog-confirm-actionButtonValidate"+t).removeAttr("id"),$(".validateButton"+t).addClass("butActionRefused")},window.digiquali.object.saveAnswer=function(t,o,e,i=""){var n=window.saturne.toolbox.getToken(),a=window.saturne.toolbox.getQuerySeparator(document.URL),a=i||document.URL+a+"action=save&token="+n;i.length<1&&window.saturne.loader.display($(".table-id-"+t)),$.ajax({url:a,type:"POST",data:JSON.stringify({autoSave:!0,questionId:t,answer:o,comment:e}),processData:!1,contentType:!1,success:function(t){i.length<1&&$(".fiche").replaceWith($(t).find(".fiche"))},error:function(){}})},window.digiquali.question={},window.digiquali.question.init=function(){window.digiquali.question.event()},window.digiquali.question.event=function(){$(document).on("click",".clicked-photo-preview",window.digiquali.question.previewPhoto),$(document).on("click",".ui-dialog-titlebar-close",window.digiquali.question.closePreviewPhoto),$(document).on("click","#show_photo",window.digiquali.question.showPhoto),$(document).on("click",".answer-picto .item, .wpeo-table .item",window.digiquali.question.selectAnswerPicto)},window.digiquali.question.previewPhoto=function(t){$(this).hasClass("photo-ok")?$("#dialogforpopup").attr("style","border: 10px solid #47e58e"):$(this).hasClass("photo-ko")&&$("#dialogforpopup").attr("style","border: 10px solid #e05353")},window.digiquali.question.closePreviewPhoto=function(t){$("#dialogforpopup").attr("style","border:")},window.digiquali.question.showPhoto=function(){var t=$(this).closest(".question-table").find(".linked-medias");t.hasClass("hidden")?(t.attr("style",""),t.removeClass("hidden")):(t.attr("style","display:none"),t.addClass("hidden"))},window.digiquali.question.selectAnswerPicto=function(t){var o=$(this).closest(".wpeo-dropdown");$(this).closest(".content").removeClass("active"),o.find(".dropdown-toggle span").hide(),o.find(".dropdown-toggle.button-picto").html($(this).closest(".wpeo-tooltip-event").html()),o.find(".input-hidden-picto").val($(this).data("label"))},window.digiquali.sheet={},window.digiquali.sheet.init=function(){window.digiquali.sheet.event()},window.digiquali.sheet.event=function(){}; \ No newline at end of file diff --git a/js/modules/control.js b/js/modules/control.js index 8c2f14dc..5e9e67e2 100644 --- a/js/modules/control.js +++ b/js/modules/control.js @@ -338,7 +338,7 @@ window.digiquali.control.getSheetID = function() { */ window.digiquali.control.saveSubControl = function() { let subControlID = $(this).attr('data-control-id'); - let massControlId = $(this).attr('data-mass-control-id'); + let mainControlId = $(this).attr('data-main-control-id'); let notePublic = $(this).closest('.table-row').find('.note-public').val(); // get input checked let questionIds = []; @@ -371,7 +371,7 @@ window.digiquali.control.saveSubControl = function() { await window.digiquali.object.saveAnswer(questionId, answer.answer, answer.comment, url + '&action=save&token=' + token); } - let url = document.URL.replace(/id=\d+/, 'id=' + massControlId); + let url = document.URL.replace(/id=\d+/, 'id=' + mainControlId); $.ajax({ url: url, type: 'GET', @@ -398,7 +398,7 @@ window.digiquali.control.saveSubControl = function() { */ window.digiquali.control.lockSubControl = function() { let subControlID = $(this).attr('data-control-id'); - let massControlId = $(this).attr('data-mass-control-id'); + let mainControlId = $(this).attr('data-main-control-id'); let token = window.saturne.toolbox.getToken(); window.saturne.loader.display($(this).closest('.table-row')); @@ -411,7 +411,7 @@ window.digiquali.control.lockSubControl = function() { contentType: false, data: [], success: function (resp) { - let url = document.URL.replace(/id=\d+/, 'id=' + massControlId); + let url = document.URL.replace(/id=\d+/, 'id=' + mainControlId); $.ajax({ url: url, type: 'GET', @@ -438,7 +438,7 @@ window.digiquali.control.lockSubControl = function() { */ window.digiquali.control.validateSubControl = function() { let subControlID = $(this).attr('data-control-id'); - let massControlId = $(this).attr('data-mass-control-id'); + let mainControlId = $(this).attr('data-main-control-id'); let token = window.saturne.toolbox.getToken(); window.saturne.loader.display($(this).closest('.table-row')); @@ -451,7 +451,7 @@ window.digiquali.control.validateSubControl = function() { contentType: false, data: [], success: function (resp) { - let url = document.URL.replace(/id=\d+/, 'id=' + massControlId); + let url = document.URL.replace(/id=\d+/, 'id=' + mainControlId); $.ajax({ url: url, type: 'GET', @@ -478,7 +478,7 @@ window.digiquali.control.validateSubControl = function() { */ window.digiquali.control.reopenSubControl = function() { let subControlID = $(this).attr('data-control-id'); - let massControlId = $(this).attr('data-mass-control-id'); + let mainControlId = $(this).attr('data-main-control-id'); let token = window.saturne.toolbox.getToken(); window.saturne.loader.display($(this).closest('.table-row')); @@ -491,7 +491,7 @@ window.digiquali.control.reopenSubControl = function() { contentType: false, data: [], success: function (resp) { - let url = document.URL.replace(/id=\d+/, 'id=' + massControlId); + let url = document.URL.replace(/id=\d+/, 'id=' + mainControlId); $.ajax({ url: url, type: 'GET', @@ -518,7 +518,7 @@ window.digiquali.control.reopenSubControl = function() { */ window.digiquali.control.saveSubControlAnswers = async function() { let subControlID = $(this).attr('data-control-id'); - let massControlId = $(this).attr('data-mass-control-id'); + let mainControlId = $(this).attr('data-main-control-id'); window.saturne.loader.display($(this)); let questionIds = []; @@ -542,7 +542,7 @@ window.digiquali.control.saveSubControlAnswers = async function() { await window.digiquali.object.saveAnswer(questionId, answer.answer, answer.comment, url + '&action=save&token=' + token); } - url = document.URL.replace(/id=\d+/, 'id=' + massControlId); + url = document.URL.replace(/id=\d+/, 'id=' + mainControlId); $.ajax({ url: url, type: 'GET', diff --git a/js/modules/object.js b/js/modules/object.js index 843fa36b..7069aebf 100644 --- a/js/modules/object.js +++ b/js/modules/object.js @@ -192,7 +192,7 @@ window.digiquali.object.saveAnswer = function(questionId, answer, comment, custo if (customUrl.length < 1) { window.saturne.loader.display($('.table-id-' + questionId)); } - + $.ajax({ url: url, type: 'POST', diff --git a/langs/fr_FR/digiquali.lang b/langs/fr_FR/digiquali.lang index 0db914d2..faaf5a93 100644 --- a/langs/fr_FR/digiquali.lang +++ b/langs/fr_FR/digiquali.lang @@ -358,7 +358,7 @@ AddAnObjectToControl = Ajouter un objet à contrôler SubControlsMustBeLockedToSetVerdict = Les sous-contrôles doivent être verrouillés pour définir le verdict MainControlMustBeDraftToEditSubControls = Le contrôle principal doit être brouillon pour éditer les sous-contrôles ParentControl = Contrôle parent - +NoSubControlFound = Aucun sous-contrôle trouvé #