diff --git a/printer.cpp b/printer.cpp
index 10942865a..fcafaa38e 100644
--- a/printer.cpp
+++ b/printer.cpp
@@ -92,8 +92,9 @@ void Printer::render(int Pages = 0)
// render all the dive profiles in the current page
while (elemNo < collection.count() && collection.at(elemNo).geometry().y() < viewPort.y() + viewPort.height()) {
// dive id field should be dive_{{dive_no}} se we remove the first 5 characters
- int diveNo = collection.at(elemNo).attribute("id").remove(0, 5).toInt(0, 10);
- putProfileImage(collection.at(elemNo).geometry(), viewPort, &painter, get_dive(diveNo - 1), profile);
+ QString diveIdString = collection.at(elemNo).attribute("id");
+ int diveId = diveIdString.remove(0, 5).toInt(0, 10);
+ putProfileImage(collection.at(elemNo).geometry(), viewPort, &painter, get_dive_by_uniq_id(diveId), profile);
elemNo++;
}
diff --git a/printing_templates/One Dive.html b/printing_templates/One Dive.html
index 9f4d30a61..40c02b395 100644
--- a/printing_templates/One Dive.html
+++ b/printing_templates/One Dive.html
@@ -103,7 +103,7 @@
-
+
diff --git a/printing_templates/Two Dives.html b/printing_templates/Two Dives.html
index 0c8eec14c..986f119dd 100644
--- a/printing_templates/Two Dives.html
+++ b/printing_templates/Two Dives.html
@@ -196,7 +196,7 @@
-
diff --git a/templatelayout.cpp b/templatelayout.cpp
index 30919891a..1da88249b 100644
--- a/templatelayout.cpp
+++ b/templatelayout.cpp
@@ -133,6 +133,11 @@ int Dive::number() const
return m_number;
}
+int Dive::id() const
+{
+ return m_id;
+}
+
QString Dive::date() const
{
return m_date;
diff --git a/templatelayout.h b/templatelayout.h
index 5f4678923..c545f5a05 100644
--- a/templatelayout.h
+++ b/templatelayout.h
@@ -31,6 +31,7 @@ signals:
class Dive {
private:
int m_number;
+ int m_id;
QString m_date;
QString m_time;
QString m_location;
@@ -56,6 +57,7 @@ public:
: dive(dive)
{
m_number = dive->number;
+ m_id = dive->id;
put_date_time();
put_location();
put_duration();
@@ -68,6 +70,7 @@ public:
Dive();
~Dive();
int number() const;
+ int id() const;
QString date() const;
QString time() const;
QString location() const;
@@ -87,6 +90,8 @@ Q_DECLARE_METATYPE(print_options)
GRANTLEE_BEGIN_LOOKUP(Dive)
if (property == "number")
return object.number();
+else if (property == "id")
+ return object.id();
else if (property == "date")
return object.date();
else if (property == "time")