OJS 3.3.0.3 Announcement unexpected error

Hello! I tried to save an announcement but OJS gives me an error:
image

Here is an example of error in my log file:

[Thu Feb 25 00:32:21.609329 2021] [php7:notice] [pid 187849] [client 19X.X.X.X:XXX] Slim Application Error:\nType: Illuminate\Database\QueryException\nCode: HY000\nMessage: SQLSTATE[HY000]: General error: 1364 Field ‘setting_type’ doesn’t have a default value (SQL: insert into announcement_settings (announcement_id, locale, setting_name, setting_value) values (1, ru_RU, description, text_of_my_annonecement) on duplicate key update announcement_id = values(announcement_id), locale = values(locale), setting_name = values(setting_name), setting_value = values(setting_value))\nFile: /var/www/ojs-3.3/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php\nLine: 671\nTrace: #0

I ended up editing the announcement in the database right away.

I would very obliged if you cold give me a digging direction.

Hi @vanushkin,

Please see the closed github issue here: [OJS 3.3] Cannot create Announcements: General error: 1364 Field 'setting_type' doesn't have a default value · Issue #6748 · pkp/pkp-lib · GitHub

In particular the part where he refers to a solution for this issue and states

"The issue is caused by upgraded installations not having the setting_type column of announcement_settings set to permit null entries. You can fix already-upgraded installations by running the following SQL query:

ALTER TABLE announcement_settings MODIFY setting_type VARCHAR(6);

However, I would recommend also installing the patch attached to this issue (https://github.com/pkp/pkp-lib/commit/20b2f238e8ed3cd317d216f596edecac2b115a82.diff) – it corrects some additional minor issues around announcement and announcement type creation."

Best regards,

Roger
PKP team

Thank you very much! After running the SQL query the problem disappeared! Hooray!
Applied the patch just in case.

Just a newbie’s remark: dunno whether it is correct, but I put the file and ran the patch from the …/ojs/lib/pkp folder using this command:

patch -b -p1 < 20b2f238e8ed3cd317d216f596edecac2b115a82.diff

It seemed to work. :upside_down_face:

1 Like