WebsiteBaker Community Forum

WebsiteBaker Support (2.12.x) => Modules => Topic started by: CodeALot on November 13, 2019, 02:53:36 PM

Title: OneForAll duplicate item bug
Post by: CodeALot on November 13, 2019, 02:53:36 PM
OneForAll version 2.0.2.23
WB version 2.12.2 r379
PHP 7.3.6

Let's say you have a record with 10 images.
6 images are marked "Active", 4 are "Inactive"

Duplicate the record

All 10 images are copied to the new /media/oneforall/images/itemID and /media/oneforall/thumbs/itemID folders.
>> The database, however, only has the 6 active images for the new record.

So when you try to correct this, and re-upload the missing 4, you will get the "already exists" error, because the files are there but the database doesn't know it...
Title: Re: OneForAll duplicate item bug
Post by: dbs on November 13, 2019, 04:09:23 PM
Hi, in short: we had a similar problem with image set to inactive. Do you remember?
Reason was a enum field in the database which expected a string instead of a number.

Solution.
One change at field active: \''.$image['active'].'\' in save_item.php line 681

original:
Code: [Select]
.'VALUES ('.(int)$item_id.', \''.$image['filename'].'\', '.$image['active'].', '.$image['position'].', \''.$image['alt'].'\', \''.$image['title'].'\', \''.$image['caption'].'\')');
replace with
Code: [Select]
.'VALUES ('.(int)$item_id.', \''.$image['filename'].'\', \''.$image['active'].'\', '.$image['position'].', \''.$image['alt'].'\', \''.$image['title'].'\', \''.$image['caption'].'\')');