VuFind
  1. VuFind
  2. VUFIND-631

Creation date not populated when creating new lists

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3, 2.0alpha
    • Fix Version/s: 1.4, 2.0RC1
    • Component/s: MyResearch
    • Labels:
      None

      Description

      When creating a new list, the created field of the user_list table is not populated correctly.
      1. list-create-date.patch
        0.7 kB
        Demian Katz
      1. MySQLAdministrator-1.jpg
        63 kB
      2. MySQLAdministrator-2.jpg
        64 kB

        Activity

        Hide
        Filipe M S Bento added a comment - - edited
        I must say, not that VuFind needs by no means to have its honor defended -- it's on it way to be a perfect solution -- like, mentioned with Demian, this “bug” was one of those not relevant at all as that date wasn’t used elsewhere (sorting) than now with Public List browse (VUFIND-443).

        Also, like mentioned with Demian, if that helps others that need the solution right away, when found that bug last night tried to solve it (and did... but not in the conventional way):

        > web/services/MyResearch/ListEdit.php

        tried inserting

         $this->created = date('Y-m-d H:i:s');

        before

          $list->insert();

        but it did not work!

        My solution: back to basics (DB): MySQL Administrator does not accept NOW() or any other default value than a constant, so:

            ~ MySQLAdministrator-1.jpg (attached file) ~

        TIMESTAMP instead of DATETIME and default value set to CURRENT_TIMESTAMP ! >> it works! See the last record (id=10):

            ~ MySQLAdministrator-2.jpg (attached file) ~

        Patch: mysql alter command should do it.

        Mysql command line it seems to accept “now()”

             “ALTER TABLE user_list MODIFY COLUMN created DATETIME NOT NULL DEFAULT now();”

        so it can be kept as DATETIME.

        - Filipe
        Show
        Filipe M S Bento added a comment - - edited I must say, not that VuFind needs by no means to have its honor defended -- it's on it way to be a perfect solution -- like, mentioned with Demian, this “bug” was one of those not relevant at all as that date wasn’t used elsewhere (sorting) than now with Public List browse ( VUFIND-443 ). Also, like mentioned with Demian, if that helps others that need the solution right away, when found that bug last night tried to solve it (and did... but not in the conventional way): > web/services/MyResearch/ListEdit.php tried inserting  $this->created = date('Y-m-d H:i:s'); before   $list->insert(); but it did not work! My solution: back to basics (DB): MySQL Administrator does not accept NOW() or any other default value than a constant, so:     ~ MySQLAdministrator-1.jpg (attached file) ~ TIMESTAMP instead of DATETIME and default value set to CURRENT_TIMESTAMP ! >> it works! See the last record (id=10):     ~ MySQLAdministrator-2.jpg (attached file) ~ Patch: mysql alter command should do it. Mysql command line it seems to accept “now()”      “ALTER TABLE user_list MODIFY COLUMN created DATETIME NOT NULL DEFAULT now();” so it can be kept as DATETIME. - Filipe
        Hide
        Demian Katz added a comment - - edited
        The DEFAULT now() option is only supported in MySQL 5.6+; since VuFind is supposed to work with earlier versions of MySQL, we will have to work around this in code. I will post a patch shortly.

        For more details, see http://bugs.mysql.com/bug.php?id=27645 .
        Show
        Demian Katz added a comment - - edited The DEFAULT now() option is only supported in MySQL 5.6+; since VuFind is supposed to work with earlier versions of MySQL, we will have to work around this in code. I will post a patch shortly. For more details, see http://bugs.mysql.com/bug.php?id=27645 .
        Hide
        Demian Katz added a comment - - edited
        Fixed in 1.x r6233 and 2.x here:

        https://github.com/vufind-org/vufind/commit/cdbe22c8f4083193e15c94046f0cd43cbc28706f

        1.x fix attached as a patch.
        Show
        Demian Katz added a comment - - edited Fixed in 1.x r6233 and 2.x here: https://github.com/vufind-org/vufind/commit/cdbe22c8f4083193e15c94046f0cd43cbc28706f 1.x fix attached as a patch.

          People

          • Assignee:
            Demian Katz
            Reporter:
            Demian Katz
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: