Integer entity ids problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alasdaircr
    Active Community Member
    • Aug 2014
    • 525

    Integer entity ids problem

    Hello there,

    I have a bit of a situation which I've only just noticed after using this software for 2 years!

    When we migrated from HighRise to EspoCRM, my import script used the previous ids provided by the export from Highrise. I didn't generate the 24 character hash ids.

    Now I realise this was a terrible decision but it seemed like a good idea at the time. I've just noticed a few places where is_string( ) is used to check whether a variable contains an ID or not. With an integer ID, this check fails. This was causing a call to RDB::relate() to fail.

    I'm not sure what the best solution is. Either improve those checks so they don't expect alpha chars to confirm validity of an id, or process ALL of the references to the thousands of integer ids out of the database - prone to lots of potential mistakes.

    Any suggestion would be appreciated..
  • yuri
    Member
    • Mar 2014
    • 8627

    #2
    Hi,

    Please clarify. Do you have numeric ID values in database in varchar column? And it causes the problem when you want to relate those record with another record?
    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

    • alasdaircr
      Active Community Member
      • Aug 2014
      • 525

      #3
      Yes that's it. My solution was to replace the four is_string checks in RDB::relate() as changing the ID values throughout the database would be very error prone.

      Comment

      • alasdaircr
        Active Community Member
        • Aug 2014
        • 525

        #4
        Diff: http://sprunge.us/OPCg

        Comment

        • yuri
          Member
          • Mar 2014
          • 8627

          #5
          It's not a proper fix. It's rather a hack. Integer value shouldn't be passed there. Admin user has ID '1' value and we don't have problem with it. We need to figure out how integer value came up.
          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

          • alasdaircr
            Active Community Member
            • Aug 2014
            • 525

            #6
            I know it's not a proper fix, I just what I needed to get the program working for us! :-)

            I don't really know the internals of Espo that well to know where the issue is.

            Comment

            Working...