Batch add files question Batch add files question
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Batch add files question

Started by MarioKnight, October 04, 2013, 02:48:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MarioKnight

I'm not having any problems, this has been working wonderfully so far.  As I am in the process of importing ~600 albums with ~300 in queue to process once I'm caught up, I was just curious if there was any way to only show empty albums in the batch add files drop down menu instead of all of them.  I couldn't find any information in searching, so I hope this is something that can be done.  If not, it's no big deal, would just be a help.  I'm very happy with this software.  =)

Αndré

We'd need to adjust the database query which fetch the albums from the database.

Αndré

This should work. Open include/functions.inc.php, find
$result = cpg_db_query("SELECT aid, title, category FROM {$CONFIG['TABLE_ALBUMS']} ORDER BY pos");
and replace with
$result = cpg_db_query("SELECT a.aid, a.title, a.category FROM {$CONFIG['TABLE_ALBUMS']} AS a INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON a.aid = p.aid ORDER BY pos");

MarioKnight

Thank you for the quick response!  However it looks like this filters out the opposite as intended, as only albums with pictures show in the drop-down instead of albums without pictures.  Though I see what 's being attempted, My SQL is a bit rusty on how this can be tweaked to reverse the results.  This is certainly appreciated though!

Αndré

Of course, sorry. I'll update the query as soon as possible, probably not earlier than Monday.

MarioKnight

Works for me, I'll keep an eye out for it.  Thanks!

Αndré

This should work as expected:
$result = cpg_db_query("SELECT aid, title, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid NOT IN (SELECT aid FROM {$CONFIG['TABLE_PICTURES']}) ORDER BY pos");

MarioKnight

This works perfectly!  Thank you!  =D