eworkers / K2ForJ4

GNU General Public License v2.0
11 stars 6 forks source link

New Attachments and Tags not added in database #62

Closed martyharty closed 5 months ago

martyharty commented 6 months ago

Uploading a pdf to an existing item is uploaded to the media folder, but not added to the database and not attached the item. Maybe this behaviour is just on my side, but the rest of item editing seems to work fine on front- and backend. I did change the item model getname() with basename() and there is a JavaScript error: cannot read properties of undefined (reading 'msie'). Not sure if this affects the addAttachment to database function.

Unfortunately the same behaviour on my other upgrade; file is uploaded, but not inserted into db.

martyharty commented 6 months ago

New tags are also not saved to the item or database. On both sites J4/PHP 8.1 and database schemes are up to date (different servers). Could it be someting with count() or store()?

Also the extra field radio buttons are stacked/ displayed inline.

cmirnow commented 6 months ago

I can't reproduce the problem. I tried adding a tag and an attachment to a K2 article on a test site, and I have no problem with it.

Perhaps this is a local problem? I think this issue has already been resolved.

martyharty commented 6 months ago

Thanks for your reaction. I have the same problem in two different environments without any errors... I will be pulling my hair a little longer.

Is it possible to install the package over the existing one and/ or use it on a fresh J4 install? I will test further

cmirnow commented 6 months ago

Is it possible to install the package over the existing one and/ or use it on a fresh J4 install? I will test further

I think it is enough to install the new revision of K2ForJ4 over of the old release.

Perhaps these two fixed bugs are similar to your problem? - https://github.com/eworkers/K2ForJ4/issues/38 https://github.com/eworkers/K2ForJ4/issues/43

Can you provide technical information about your database server? What database encoding is used? The two servers I use do not have the problem you describe.

martyharty commented 6 months ago

With latest revision installed, first tried the attachment: Call to undefined method Joomla\CMS\Filesystem\File::getName()

In com_k2/models/item.php //$existingFileName = File::getName($dest) ;deprecated $existingFileName = basename($dest);

Upload is working: files move to media/k2/attachments

Added tag via menu: "Field description doesn't have a value" Alter #__k2_tags description to a NULL value saves the tag and also the item saving works.

Then I finally found the conflicting ordering row in the attachments table from this old fix (on both sites): https://github.com/getk2/k2/pull/511 (maybe later)

Database Version 10.11.6-MariaDB-log Database Collation latin1_swedish_ci

Database Version 10.5.24-MariaDB Database Collation latin1_swedish_ci

For now it works. Thanks!

eworkers commented 5 months ago

Added tag via menu: "Field description doesn't have a value" Alter #__k2_tags description to a NULL value saves the tag and also the item saving works.

But k2_tags does not have a description column! do you have a customized K2 version that you tried to update from?

martyharty commented 5 months ago

Not that I am aware of. Please check the latest K2 install: https://github.com/getk2/k2/blob/7ec1dbdb1283fb6134a1ed83c0886e3fd8e253db/install.k2.php#L181C5-L187C6

eworkers commented 5 months ago

Apparently k2 official version added description feature for tags which this fork do not support for the moment, update is on the way

eworkers commented 5 months ago

please update and check if your issue remains. If latest update fixes your issue, please close this

cmirnow commented 5 months ago

added tag description, (k2 introduced new feature that might have cau…)

@eworkers, is this update safe for those users who upgraded from K2 to K2forJ4 before the official K2 had this field?

martyharty commented 5 months ago

Works for me. Also changed back tags db. I guess with new migrations better not use the latest K2. Thanks

eworkers commented 5 months ago

added tag description, (k2 introduced new feature that might have cau…)

@eworkers, is this update safe for those users who upgraded from K2 to K2forJ4 before the official K2 had this field?

Yes of course