use warnings;
use base 'PciIds::DBQAny';
-my $adminDumpSql = 'SELECT
+my $adminDumpSql = 'SELECT DISTINCT
locations.id, locations.name, locations.note, locations.mainhistory, musers.email, musers.login, main.discussion, main.time,
- history.id, history.discussion, history.nodename, history.nodenote, users.email, users.login, history.time
+ history.id, history.discussion, history.nodename, history.nodenote, users.email, users.login, history.time, history.seen
FROM
locations INNER JOIN history ON history.location = locations.id
LEFT OUTER JOIN users ON history.owner = users.id
LEFT OUTER JOIN history AS main ON locations.mainhistory = main.id
LEFT OUTER JOIN users AS musers ON main.owner = musers.id
- WHERE history.seen = "0" AND locations.id LIKE ?
+ LEFT OUTER JOIN history AS test ON test.location = locations.id
+ WHERE test.seen = "0" AND locations.id LIKE ?
ORDER BY locations.id, history.id
LIMIT ';
sub genHist( $$$$$$$$$$$ ) {
my( $class, $email, $login, $time, $name, $note, $disc, $selname, $selvalue, $delname, $delvalue ) = @_;
print "<tr class='$class'>";
- print "<td class='selects'><input type='radio' name='$selname' value='$selvalue'>\n";
+ if( defined $selname ) {
+ print "<td class='selects'><input type='radio' name='$selname' value='$selvalue'>\n";
+ } else {
+ print "<td class='empty'>\n";
+ }
if( defined $delname ) {
print "<td class='deletes'><input type='checkbox' name='$delname' value='$delvalue'>\n";
} else {
print "// --></script>";
foreach( @{$tables->adminDump( $prefix, $limit )} ) {
my( $locId, $actName, $actNote, $actHist, $actEmail, $actLogin, $actDisc, $actTime,
- $hist, $disc, $name, $note, $email, $login, $time ) = @{$_};
+ $hist, $disc, $name, $note, $email, $login, $time, $seen ) = @{$_};
if( !defined( $lastId ) || ( $lastId ne $locId ) ) {
last if( $hiscnt > ( defined $limit ? $limit : 80 ) );
$lastId = $locId;
print "<td class='path' colspan='2'>";
genPathBare( $req, $addr, 1, 0, $tables );
print "<input type='hidden' name='loc-$cnt' value='$locId'>";
- if( defined $actHist ) {
- genHist( 'main-history', $actEmail, $actLogin, $actTime, $actName, $actNote, $actDisc, "loc-$cnt-sel", 'seen', undef, undef );
- } else {
+ if( !defined $actHist ) {
print "<tr class='main-history'><td><input type='radio' name='loc-$cnt-sel' value='seen'>";
}
}
$hiscnt ++;
$subcnt ++;
- genHist( 'unseen-history', $email, $login, $time, $name, $note, $disc, "loc-$cnt-sel", $hist, "del-$hiscnt", "del-$hist" );
+ if( $hist eq $actHist ) {
+ genHist( 'main-history', $actEmail, $actLogin, $actTime, $actName, $actNote, $actDisc, "loc-$cnt-sel", 'seen', undef, undef );
+ } else {
+ genHist( $seen ? 'history' : 'unseen-history', $email, $login, $time, $name, $note, $disc, ( defined $name && $name ne '' ) ? "loc-$cnt-sel" : undef, $hist, "del-$hiscnt", "del-$hist" );
+ }
print "<input type='hidden' name='owner-$hist' value='$locId'>";
print "<input type='hidden' name='his-$cnt-$subcnt' value='$hist'>";
}