Active
Project:
filedepot
Version:
6.x-1.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Dec 2013 at 20:26 UTC
Updated:
9 Dec 2013 at 20:26 UTC
When user deletes file that was attached on node, Filedepot reacts and throws PHP error message in Recent log entries:
Unknown column 'cckfd' in 'where clause' query: SELECT fid FROM filedepot_files WHERE cckfd=444 in /path/to/drupal/sites/all/modules/filedepot/filedepot.module on line 1175.
Looking at line 1175, it says:
$filedepot_fid = db_result(db_query("SELECT fid FROM {filedepot_files} WHERE cckfd=%d", $file->fid));
Then I did in MySQL
desc filedepot_files;
and get response:
+----------------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+---------------------+------+-----+---------+----------------+
| fid | mediumint(9) | NO | PRI | NULL | auto_increment |
| cid | mediumint(9) | NO | MUL | 0 | |
| fname | varchar(255) | NO | | | |
| title | varchar(128) | NO | | | |
| description | longtext | YES | | NULL | |
| version | tinyint(3) unsigned | NO | | 1 | |
| cckfid | int(11) | NO | | 0 | |
| size | int(11) | NO | | 0 | |
| mimetype | varchar(255) | NO | | | |
| extension | varchar(8) | NO | | | |
| submitter | mediumint(9) | NO | | 0 | |
| status | tinyint(4) | NO | | 0 | |
| date | int(11) | NO | | 0 | |
| version_ctl | tinyint(4) | NO | | 0 | |
| status_changedby_uid | mediumint(9) | NO | | 0 | |
+----------------------+---------------------+------+-----+---------+----------------+
Problem is that field is called CCKFID. In code, it is called cckfd instead cckfid.
How to fix:
- edit line 1175 in filedepot.module to look like:
$filedepot_fid = db_result(db_query("SELECT fid FROM {filedepot_files} WHERE cckfid=%d", $file->fid));