public static function getDocumentVersionLinks($document_id, $time) {
global $core;
- $r = $core->con->select('SELECT * FROM document_links_versions WHERE document_id=' . $document_id . ' AND `update`=' . $time);
+ $r = $core->con->select('SELECT * FROM document_links_versions WHERE document_id=' . $document_id.' AND `update`<='.$time .' ORDER BY `update` DESC LIMIT 1');
return self::_recordToLinks($r);
}
$links = array();
$rulers = array();
+ fb($time);
+
foreach ($documents as $d) {
if (is_null($time)) {
$lr = self::getDocumentLastLinks($d);