summaryrefslogtreecommitdiffstats
path: root/tabellio/pcfdb
diff options
context:
space:
mode:
Diffstat (limited to 'tabellio/pcfdb')
-rw-r--r--tabellio/pcfdb/sync.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tabellio/pcfdb/sync.py b/tabellio/pcfdb/sync.py
index 4b4044c..403f946 100644
--- a/tabellio/pcfdb/sync.py
+++ b/tabellio/pcfdb/sync.py
@@ -825,8 +825,10 @@ class SyncFromPcfDbView(BrowserView):
where_ts = cursor.mogrify('AND t_document.ts > %s', (timestamp,))
cursor.execute('''SELECT t_document.id, type, sess, date, no, nodoc, anx,
intit, auteurs, matiereids, comppols, imageid,
- textdefts, textprovts
+ t_file.imagestoreid, textdefts, textprovts
FROM t_document
+ LEFT JOIN t_file
+ ON (t_document.text1id = t_file.fileid)
JOIN t_typedoc
ON (t_document.type = t_typedoc.id)
WHERE t_document.st = 'S_INDEXED' AND
@@ -844,7 +846,7 @@ class SyncFromPcfDbView(BrowserView):
break
count += 1
(doc_id, doctype, sess, date, no, nodoc, anx, intit, authors, topics,
- polgroups, image_id, textprovts, textdefts) = row
+ polgroups, image_id, text1id, textprovts, textdefts) = row
if intit is None:
intit = {'RAPP': u'Rapport',
@@ -884,6 +886,8 @@ class SyncFromPcfDbView(BrowserView):
elif textprovts:
object.final_version = False
object.publication_date = DateTime(textprovts.isoformat())
+ if not object.file_image_id and text1id:
+ object.file_image_id = text1id
if authors:
authors = [self.get_author_intid(x) for x in authors]
object.authors = [RelationValue(x) for x in authors if x]