[VUFIND-631] Creation date not populated when creating new lists Created: 20/Jul/12  Updated: 06/Aug/13  Resolved: 15/Jan/13

Status: Resolved
Project: VuFind®
Components: MyResearch
Affects versions: 1.3, 2.0alpha
Fix versions: 1.4, 2.0RC1

Type: Bug Priority: Minor
Reporter: Demian Katz Assignee: Demian Katz
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Attachments: JPEG File MySQLAdministrator-1.jpg     JPEG File MySQLAdministrator-2.jpg     File list-create-date.patch    

 Description   
When creating a new list, the created field of the user_list table is not populated correctly.

 Comments   
Comment by Filipe MS Bento [ 20/Jul/12 ]
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
Comment by Demian Katz [ 15/Jan/13 ]
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 .
Comment by Demian Katz [ 15/Jan/13 ]
Fixed in 1.x r6233 and 2.x here:

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

1.x fix attached as a patch.
Generated at Wed Apr 24 03:44:36 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100251-rev:1799943389865e673b0a2c8607653e705b66f09c.