Проверка даты RSA Archer

Итак, в основном у меня есть требование создать проверку в подформе, чтобы пользователь не мог отправить дату в запросе на расширение. Я использовал проверку настраиваемого объекта, но возникла проблема с отображением исходного сохранения, сохранения и закрытия вместе с сохранением, сохранением и закрытием настраиваемого объекта.

Проверка настраиваемого объекта работает, но отображение оригинального сохранения, сохранения и закрытия является серьезной проблемой.

Пожалуйста, найдите код ниже.

<script type="text/javascript">
     //Define date field ids
     var dateOccurredFldId = 22418;

    // For todays date;
     Date.prototype.today = function () { 
          return (((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"/"+ ((this.getDate() < 10)?"0":"") + this.getDate() + "/" + this.getFullYear();
     }

     // For the time now
          Date.prototype.timeNow = function () {
          return ((this.getHours() < 10)?"0":"") + this.getHours() +":"+ ((this.getMinutes() < 10)?"0":"") + this.getMinutes() +":"+ ((this.getSeconds() < 10)?"0":"") + this.getSeconds();
     }

     Sys.Application.add_load(function() {
          // Hijack Save and Close Button
          $('#master_btnSave').clone().attr('id', 'master_customBtnSave').insertBefore('#master_btnApply');
          $('#master_btnSave').hide();
          $('#master_customBtnSave').unbind('click').prop("onclick", null).click(function(){ DateCheck('save');return false;});

          // Hijack Save Button
          $('#master_btnApply').clone().attr('id', 'master_customBtnApply').insertBefore('#master_btnApply');
          $('#master_btnApply').hide();
          $('#master_customBtnApply').unbind('click').prop("onclick", null).click(function(){ DateCheck('apply');return false;});
     });

     function DateCheck(type) {
          //Get Date Field Values
          var dateOccurred = new Date(String($CM.getFieldValue(dateOccurredFldId, false)));
          var currentDate = new Date();
          var dateTime = currentDate.today() + ' '+ currentDate.timeNow();
          var currentDateTime = new Date(dateTime);


          //Set Alert Box Title
          var title = 'Warning';

          if(dateOccurred) {
               if(dateOccurred <= currentDate) {
                    WarningAlert('The <b>Entension Date</b> cannot be lesser than the <b> Current Date Created</b>','',title);
                    return false;
               } else {
                    SaveApply(type)
               }
          } else {
               SaveApply(type)
          }
     }

     function SaveApply(type) {
          if (type == 'save') {
               $('#master_btnSave').click();
          } else if (type == 'apply') {
               $('#master_btnApply').click();
          }
     }
</script>


person Ahmad Mazhar    schedule 27.02.2021    source источник
comment
Ахмад, какую версию Арчера ты используешь?   -  person DjP    schedule 01.03.2021
comment
Моя текущая версия 6.7 P3   -  person Ahmad Mazhar    schedule 03.03.2021


Ответы (1)


Попробуйте обновленный код ниже.

<script type="text/javascript">
     //Define date field ids
     var dateOccurredFldId = 22418;

     // For todays date;
     Date.prototype.today = function () { 
          return (((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"/"+ ((this.getDate() < 10)?"0":"") + this.getDate() + "/" + this.getFullYear();
     }

     // For the time now
     Date.prototype.timeNow = function () {
          return ((this.getHours() < 10)?"0":"") + this.getHours() +":"+ ((this.getMinutes() < 10)?"0":"") + this.getMinutes() +":"+ ((this.getSeconds() < 10)?"0":"") + this.getSeconds();
     }

     // Hijack Save Button
     $('#master_btnApply1, #master_btnApplyIcon').unbind('click').prop("onclick", null).click(function(){ DateCheck('Apply');return false;})

     // Hijack Save And Close Button
     $('#master_btnSave1').unbind('click').prop("onclick", null).click(function(){ DateCheck('Save')});

     // Hide Right-Click Save and Save and Close Right-Click Menu Items
     $('.rmLink:Contains("Save")').parent().parent().hide();
     $('.rmLink:Contains("Save and Close")').parent().parent().hide();

     function DateCheck(action) {
          //Get Date Field Values
          var dateOccurred = new Date(String($CM.getFieldValue(dateOccurredFldId, false)));
          var currentDate = new Date();
          var dateTime = currentDate.today() + ' '+ currentDate.timeNow();
          var currentDateTime = new Date(dateTime);


          //Set Alert Box Title
          var title = 'Warning';

          if(dateOccurred) {
               if(dateOccurred <= currentDate) {
                    WarningAlert('The <b>Entension Date</b> cannot be lesser than the <b> Current Date Created</b>','',title);
                    return false;
               } else {
                    SaveApply(action)
               }
          } else {
               SaveApply(action)
          }
     }

     function SaveApply(action) {
          if (type == 'Save') {
               ShowAnimationAndPostback('master$btn' + action);
          } else if (type == 'Apply') {
               ShowAnimationAndPostback('master$btn' + action);
          }
     }
</script>

person DjP    schedule 03.03.2021
comment
Теперь он проверяет и показывает только 1 сохранение, Сохранить и закрыть. Проблема в том, что на самом деле он не сохраняется даже с будущими датами. Таким образом, он проверяется, как и ожидалось, но не сохраняет запись. - person Ahmad Mazhar; 06.03.2021