Part-DB-server icon indicating copy to clipboard operation
Part-DB-server copied to clipboard

Target ID is shifted by one while generating part lot labels with twig

Open sammaranth opened this issue 1 year ago • 0 comments

Describe the bug hello,

i think i found a bug where incorrect part is being referenced while using twig while referencing part from part lot. output parts are being shifted by one. example:

range 10-14 will be give parts for 9,10,11,12,13 10,15,17 will give parts for 9,14,16 10 will give part with ID 9

issue only exists only when referencing part from part lot with twig as {{ element.part.id }} if i switch label generator to part and try the same thing with {{ element.id }} correct values are being returned.

problem is not only with ID field but all fields. ID, Name, Comment etc. so i suspect that if using element.part wrong object is being referenced.

To Reproduce Steps to reproduce the behavior:

  1. go to Tools --> Label generator --> advanced tab--> check twig mode (to select that it's required to enable it in permissions options)
  2. go to "common tab"
  3. change Target type to Part Lot
  4. provide some target ID
  5. type {{ element.part.id }} in content field
  6. click update

Expected behavior expected behavior is to receive ID of a part that this part lot is part of.

Screenshots image

Server Side

  • Part-DB Version: 1.14.2
  • PHP Version: 8.2.24 (SAPI: fpm-fcgi)
  • Database Server SQLite 3.40.1

Desktop (please complete the following information):

  • OS: Microsoft Windows 11 Pro, 10.0.22631 N/A Build 22631
  • Browser Firefox
  • Version 131.0.3 (64-bit)

Smartphone (please complete the following information): N/A

Additional context N/A


Thank you. have nice day! 😄

sammaranth avatar Oct 20 '24 04:10 sammaranth