Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket linking of items allows items that do not exist #336

Closed
Tracked by #376
jasonpagetas opened this issue Sep 29, 2024 · 4 comments · Fixed by #381
Closed
Tracked by #376

Ticket linking of items allows items that do not exist #336

jasonpagetas opened this issue Sep 29, 2024 · 4 comments · Fixed by #381
Assignees
Labels
bug::missing feature Bug Reason type::bug Issue Type v1.2-beta Version Affected.

Comments

@jasonpagetas
Copy link
Collaborator

jasonpagetas commented Sep 29, 2024

When linking an item to a ticket I accidentally selected services instead of software, I entered the id of the software I wanted in this case 16.

Now in the linked items it shows $service-16

This should throw an error as the id does not exist

image

@jon-nfc
Copy link
Member

jon-nfc commented Sep 29, 2024

Now in the linked items it shows $service-16

where?

so did the item link or is this in a comment

@jon-nfc jon-nfc moved this to Awaiting Feedback in Centurion ERP Sep 29, 2024
@jasonpagetas jasonpagetas changed the title Linked items allows items that do not exist Ticket linking of items allows items that do not exist Sep 29, 2024
@jon-nfc jon-nfc added the v1.2-beta Version Affected. label Sep 29, 2024
@jon-nfc
Copy link
Member

jon-nfc commented Sep 29, 2024

agreed this should not occur.

@jon-nfc jon-nfc added the type::bug Issue Type label Sep 29, 2024
@jon-nfc jon-nfc moved this from Awaiting Feedback to Ready to Commence in Centurion ERP Sep 29, 2024
@jon-nfc jon-nfc added this to the v1.4 - UI / API Refactor milestone Nov 1, 2024
@jon-nfc jon-nfc moved this from Backlog to Planning in Centurion ERP Nov 1, 2024
@jon-nfc jon-nfc mentioned this issue Nov 2, 2024
5 tasks
@jon-nfc jon-nfc self-assigned this Nov 5, 2024
@jon-nfc jon-nfc moved this from Planning to In progress in Centurion ERP Nov 5, 2024
@jon-nfc
Copy link
Member

jon-nfc commented Nov 5, 2024

TBH I don't know how this bug is even possible Using a scenario of linking a non-existing item.

The logic was setup purposely to to try and fetch the item by the id provided in the command, if the item does not exist an exception is thrown which prevents linking the item to the ticket.

if model:
item = model.objects.get(
pk = model_id
)
TicketLinkedItem.objects.create(
organization = self.organization,
ticket = ticket,
item_type = item_type,
item = item.id
)
return None
except Exception as e:
return str(match.string[match.start():match.end()])

The above code has not changed since it was initially introduced.

The only way i see this occurring is the item was linked and later removed. This scenario will create what you have reported.

Within the current test env (v1.3.0) I can't link an item that does not exist.

Test cases have been added in e9d5b08 to ensure that there is no regression in the requirement, dont link non-existing item to ticket

I'm going to assume that what has occured is that the item was linked when it was created, then subsequently deleted. I will add some test cases to ensure that when an item is deleted, the linking to tickets is also cleaned up.

@jon-nfc jon-nfc added the bug::missing feature Bug Reason label Nov 5, 2024
jon-nfc added a commit that referenced this issue Nov 5, 2024
jon-nfc added a commit that referenced this issue Nov 5, 2024
@jon-nfc jon-nfc linked a pull request Nov 5, 2024 that will close this issue
7 tasks
@jon-nfc
Copy link
Member

jon-nfc commented Nov 5, 2024

Added fix in dc55883 to correct the issue where when an item that may be linked to a ticket is deleted, the ticket link is also removed.

Test Cases added in e170226 to ensure there is no regression in the requirement "when an item is deleted, remove the ticket link".

This issue will be resolved on release of #344.

@jon-nfc jon-nfc moved this from In progress to Done in Centurion ERP Nov 5, 2024
jon-nfc added a commit that referenced this issue Nov 7, 2024
jon-nfc added a commit that referenced this issue Nov 7, 2024
jon-nfc added a commit that referenced this issue Nov 7, 2024
jon-nfc added a commit that referenced this issue Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug::missing feature Bug Reason type::bug Issue Type v1.2-beta Version Affected.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants