From 4b6853fc0b7e3f2b3881dae873bfcc0ae251c989 Mon Sep 17 00:00:00 2001 From: joshvazquez Date: Wed, 1 Sep 2021 19:00:08 -0700 Subject: [PATCH] Fix due date capture Grocy puts the due date into "due_date" but the code currently looks for it in "duedate" and never finds it, so the due date is never printed. This changes duedate to due_date. https://github.com/grocy/grocy/blob/a0cf58b97481f2d2aa0fcda8b047677bf9131fc5/controllers/StockApiController.php#L671 --- brother_ql_web.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/brother_ql_web.py b/brother_ql_web.py index dcdeaafb..335093cc 100755 --- a/brother_ql_web.py +++ b/brother_ql_web.py @@ -72,7 +72,7 @@ def get_label_context(request): 'margin_right': float(d.get('margin_right', 35))/100., 'grocycode': d.get('grocycode', None), 'product': d.get('product', None), - 'duedate': d.get('duedate', None) + 'due_date': d.get('due_date', None) } context['margin_top'] = int(context['font_size']*context['margin_top']) context['margin_bottom'] = int(context['font_size']*context['margin_bottom']) @@ -150,7 +150,7 @@ def create_label_im(text, **kwargs): def create_label_grocy(text, **kwargs): product = kwargs['product'] - duedate = kwargs['duedate'] + due_date = kwargs['due_date'] grocycode = kwargs['grocycode'] @@ -161,7 +161,7 @@ def create_label_grocy(text, **kwargs): datamatrix.save('/tmp/dmtx.png') product_font = ImageFont.truetype(kwargs['font_path'], 100) - duedate_font = ImageFont.truetype(kwargs['font_path'], 60) + due_date_font = ImageFont.truetype(kwargs['font_path'], 60) width = kwargs['width'] height = 200 if kwargs['orientation'] == 'rotated': @@ -192,7 +192,7 @@ def create_label_grocy(text, **kwargs): draw.text(textoffset, product, kwargs['fill_color'], font=product_font) - if duedate is not None: + if due_date is not None: if kwargs['orientation'] == 'standard': vertical_offset += 110 horizontal_offset = kwargs['margin_left'] @@ -201,7 +201,7 @@ def create_label_grocy(text, **kwargs): horizontal_offset += 110 textoffset = horizontal_offset, vertical_offset - draw.text(textoffset, duedate, kwargs['fill_color'], font=duedate_font) + draw.text(textoffset, due_date, kwargs['fill_color'], font=due_date_font) return im