Author Topic: OneForAll duplicate item bug  (Read 1486 times)

Offline CodeALot

  • Posts: 512
  • Gender: Male
OneForAll duplicate item bug
« on: November 13, 2019, 02:53:36 PM »
OneForAll version
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...

Offline dbs

  • Betatester
  • **
  • Posts: 8737
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: OneForAll duplicate item bug
« Reply #1 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.

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

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'].'\')');