Problem/Motivation

We need to be able to delete the remaining uses for one code.
We need to be able to delete one of the codes, without deleting all others (/admin/config/people/regcode/manage).
Currently, we can only Delete all registration codes, Delete all expired codes, Delete all inactive codes.

steps-reproduce">Steps to reproduce

For example, create a code with 3 uses, it has been already used 2 times.

Proposed resolution

Provide a patch for adding those possibilities.

Issue fork regcode-3227667

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

v.dovhaliuk created an issue. See original summary.

v.dovhaliuk’s picture

Version: 8.x-1.0-rc1 » 8.x-1.1-rc1
tr’s picture

Version: 8.x-1.1-rc1 » 8.x-1.x-dev
Category: Task » Feature request
v.dovhaliuk’s picture

Version: 8.x-1.x-dev » 8.x-1.1-rc1
Category: Feature request » Task
StatusFileSize
new11.74 KB
v.dovhaliuk’s picture

Status: Active » Needs review
v.dovhaliuk’s picture

Version: 8.x-1.1-rc1 » 8.x-1.x-dev
Category: Task » Feature request
v.dovhaliuk’s picture

StatusFileSize
new12.84 KB

Updated patch

tr’s picture

Status: Needs review » Needs work
vacho’s picture

StatusFileSize
new12.53 KB

This patch is for branch 8.x-1.x

Please review.

vacho’s picture

StatusFileSize
new11.85 KB

Please forgot that patch #9 it is bad and for another issue.

Please review this patch. it is the right.

tr’s picture

Status: Needs work » Needs review
artemboiko’s picture

StatusFileSize
new12.15 KB
new879 bytes

Added checking of maximum usage to validation function in operation form.

artemboiko’s picture

StatusFileSize
new13.07 KB
new3.93 KB

Worked more with that, found mistake in logic and fixed it. Also, I have added operation for removing all remaining uses. It will be very usefull for users. And refactored a little bit. Pls review.

Status: Needs review » Needs work

The last submitted patch, 13: 3227667-delete_regcode_and_uses-13.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tr’s picture

Issue tags: +Needs tests
artemboiko’s picture

Hi @TR, do you agree that functional test is enough here?

Because firstly need make this than add unit tests, I guess...
https://www.drupal.org/project/regcode/issues/3156063

tr’s picture

Yes, Kernel or Functional tests would be the first step I think. Even a minimal test is better than no test, and that will let us do some refactoring (like adding #3156063: Convert regcode to a content entity) while ensuring that we don't break the tested functionality. Unit tests aren't really important for this module, IMO. When we add #3156063: Convert regcode to a content entity, we won't need tests for most of the entity functionality because that is covered by core tests.

tr’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
tr’s picture

Issue summary: View changes
Status: Needs work » Active

Converted #13 into a MR against the 2.0.x branch.
Still needs tests.

socialnicheguru’s picture

Status: Active » Needs review