From a0818a46a8ca4a4c4e598a1c1c5a258932f59a76 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Mon, 11 Jun 2018 15:40:11 +0200
Subject: [PATCH] printing voucher link is visible only when there are vouchers
 to be printed

---
 smash/web/templates/includes/subject_vouchers_box.html | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/smash/web/templates/includes/subject_vouchers_box.html b/smash/web/templates/includes/subject_vouchers_box.html
index 4cd7c2f4..2d720e5b 100644
--- a/smash/web/templates/includes/subject_vouchers_box.html
+++ b/smash/web/templates/includes/subject_vouchers_box.html
@@ -41,7 +41,8 @@
                     {% endfor %}
                     </tbody>
                 </table>
-                <a href="#" data-url="{% url "web.views.mail_template_generate_for_vouchers" %}" onclick='
+                {% if subject.vouchers.all.count > 0 %}
+                    <a href="#" data-url="{% url "web.views.mail_template_generate_for_vouchers" %}" onclick='
                 var checkboxes = $(".voucher_checkbox");
                 var url = $(this).data("url")+"?voucher_id=";
 
@@ -52,6 +53,7 @@
                 }
                 this.href = url;
                 '>Print vouchers</a>
+                {% endif %}
 
             </div>
         </div>
-- 
GitLab