4 Replies Latest reply on Apr 17, 2018 3:19 PM by Lee Stoltz

    Leap Day Birthday Prevents Login with SIP Authentication

    Lee Stoltz Adventurer

      Has anyone else had problems with Patrons with Leap Day Birthdays not being able to log in with the SIRSI SIP script?  The script seems to try to take the month and day and append the current year, which doesn't seem to work for February 29th.

        • Re: Leap Day Birthday Prevents Login with SIP Authentication
          Steven English Guide

          Hi Lee Stoltz,

           

          I crossed this bridge with Pharos for another customer back in 2014 but it looks like it has not made its way into production yet.  The 9.0 R2 Rev 157 version of the script has lines 443-469 as follows down below, but it can be replaced with an updated query that should accommodate for leap day and is much shorter to boot (immediately below).  I will go ahead and create ticket in our system so we can reach out to you and get this taken care of for you.

           

          NEW LINES:

                            new sSQLGetAge = "declare @dob datetime, @age int, @today datetime;"
                                            + "set @today = getdate();"
                                            + "set @dob = @1;"
                                            + "set @age = datediff(YYYY, @dob, @today) - case when @today < dateadd(YYYY, datediff(YYYY, @dob, @today), @dob) then 1 else 0 end;"
                                            + "select @age as [age]";
                              DB.ParametrizedSQL(sSQLGetAge, sUserBirthYear + "-" + sUserBirthMonth + "-" + sUserBirthDay);
          

           

          OLD LINES TO REPLACE:

                              new sSQLGetAge =
                                  "declare @years_difference  int " +
                                  "declare @months_difference  int " +
                                  "declare @days_difference    int " +
                                  "declare @birthyear          int " +
                                  "declare @birthmonth        int " +
                                  "declare @birthday          int " +
                                  "set @birthyear  = @1 " +
                                  "set @birthmonth  = @2 " +
                                  "set @birthday    = @3 " +
                                  "select @years_difference = datediff(mm,  " +
                                  "    cast(@birthmonth as nvarchar(10)) + N'/' +  " +
                                  "    cast(@birthday as nvarchar(10)) + N'/' +  " +
                                  "    cast(@birthyear as nvarchar(10)), getdate()) / 12 " +
                                  "select @months_difference = datediff(mm,  " +
                                  "    cast(@birthmonth as nvarchar(10)) + N'/' +  " +
                                  "    cast(@birthday as nvarchar(10)) + '/' +  " +
                                  "    cast(year(getdate()) as nvarchar(10)), getdate()) " +
                                  "select @days_difference = datediff(dd,  " +
                                  "    cast(@birthmonth as nvarchar(10)) + N'/' +  " +
                                  "    cast(@birthday as nvarchar(10)) + N'/' +  " +
                                  "    cast(year(getdate()) as nvarchar(10)), getdate()) " +
                                  "select " +
                                  "    case  " +
                                  "        when @months_difference = 0 and @days_difference < 0 then @years_difference - 1 else @years_difference " +
                                  "    end [age]";
                              DB.ParametrizedSQL(sSQLGetAge, sUserBirthYear, sUserBirthMonth, sUserBirthDay);
          

           

          Regards,

          Steven

          • Re: Leap Day Birthday Prevents Login with SIP Authentication
            Jeff Herald Guide

            Lee and Steven,

             

            We have an updated logon script for SIRSI, that does properly calculate for Leap Year birthdates.  We recently updated it ahead of the upcoming UP 9.1 release.  It is also backward compatible with previous versions.  Of course if you have added customizations in your current script, you'll need to add those changes to this script to keep your current functionality.  A copy of this new script is attached.

             

            (Thank you, Steven, for helping this customer)

             

            -Jeff Herald - Pharos Systems