Field validation failure on record "Duplicate" after 8.0.5 upgrade

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DashingUno
    Member
    • Apr 2022
    • 45

    Field validation failure on record "Duplicate" after 8.0.5 upgrade

    Greetings, Im seeing this issue after upgrading to 8.0.5 that shows itself only when trying to duplicate a record

    WebUI error - Error 400: Bad request, field: off, validation: validCurrency
    HTML Code:
    Log error: [2023-11-15 05:46:39] WARNING: (400) Field validation failure; entityType: Debited, field: off, type: validCurrency.; POST /Debited; line: 56, file: /var/www/html/application/Espo/Core/Exceptions/BadReques>
    This entity is called Debited, and is used for registering spending from bank accounts and from till (cash)
    I understand that this has to do with currency, our Espo currently uses 2, Russian ruble and Thai Baht

    The entity structure that is afftected (as far as I understand from the logs)
    There is a field called "off", that is used as kind of a marker for another entity to determine either "off" or "on" state
    Formula used in the Debited entity:
    Code:
    ifThen(till == 'till1', off=sum);
    ifThen(till == 'till2', on=sum);
    ifThen(till != 'till1', off=0);
    ifThen(till != 'till2', on=0);
    ​
    The "off" field has a condition "visible only if sum = 9 999 999 999 rub"
    That was my way to hide it, since I want it non visible

    Not sure what direction to go from here, any help appreciated

    Edit: Probably should also specify that the upgrade was from 7.2.4, and the setup is on docker using :latest image
    Last edited by DashingUno; 11-15-2023, 06:40 AM.
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    It requires sumCurrency to be a valid currency code. E.g. 'USD'.

    Somehow a not valid currency or null is passed.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • DashingUno
      Member
      • Apr 2022
      • 45

      #3
      yuri

      Checked the browser request, you are right, "offCurrency" is passed as 'null'

      HTML Code:
      "sumCurrency":"RUB","offCurrency":null,"neoffCurrency":"RUB","createdById":"62hiddenb6931","createdByName":"D.U.
      Is this the part of the formula that can be doing this?
      HTML Code:
      ifThen(till != 'till1', off=0);

      Comment


      • DashingUno
        DashingUno commented
        Editing a comment
        Setting default currency to RUB in fieldmanager didn't help
    • rabii
      Active Community Member
      • Jun 2016
      • 1250

      #4
      Try to reset the field to its default setting, clear cache and rebuild system that might resolve issue. otherwise check if you have any other formula that requires this field.
      Rabii
      Web Dev

      Comment


      • DashingUno
        DashingUno commented
        Editing a comment
        Clear cache and rebuild unfortunately didn't help
        I also tried inputting this into the formula

        ifThen(till != 'till1', offCurrency="RUB");

        That didnt work either
    • rabii
      Active Community Member
      • Jun 2016
      • 1250

      #5
      try this

      PHP Code:
      if (till != 'till1') {
          entity\setAttribute('offCurrency', 'RUB');
      }
      Can you also check fi you have any hooks - beforesave or aftersave that reset the offCurrency Field.

      Rabii
      Web Dev

      Comment

      • DashingUno
        Member
        • Apr 2022
        • 45

        #6
        Thank you rabii , you first advice on clearing cache and rebuilding actually did help
        Just not with old records, anything new I create after clearing cache now works fine.

        Comment

        Working...