Skip to content

Only change CO -> catNum for new COs when COT changes#6300

Merged
melton-jason merged 3 commits into
productionfrom
issue-6299
Mar 5, 2025
Merged

Only change CO -> catNum for new COs when COT changes#6300
melton-jason merged 3 commits into
productionfrom
issue-6299

Conversation

@melton-jason

@melton-jason melton-jason commented Mar 5, 2025

Copy link
Copy Markdown
Contributor

Fixes #6299

Firstly -as far as I can tell- autonumbering has ever only worked when creating new records, and not when updating old records. This would mean that if you were to use the default CatalogNumberNumeric formatter and save an existing record with a ######### catalogNumber, then Specify wouldn't even try to autonumber the CollectionObject. I'm unsure if this was an intentional design decision (that existing records would not be autonumbered) or not. Of course, it is much simpler to only apply autonumbering to new records, so that might be the case (or part of it)?

Secondly, technically the default pattern of the incrementing formatter is a valid value for the formatter! With CatalogNumberNumeric for example, ######### is a valid value for the format, so Specify sees nothing wrong with validating and saving a CollectionObject with the format. I think this goes hand-in-hand with the aforementioned assumption that only new records will have catalogNumbers which match the incrementing default pattern (###...).

[This Issue is recreatable in v7.9.6.2].
Of course, with the changes relating to changing the catalogNumber when the CollectionObjectType changes, this is probably more apparent.

What would you suggest as a solution? Here are some potential solutions I came up with, any number of which can be implemented:

  • Allow autonumbering to apply to existing records
  • Once a record exists in the database, treat ##.. as an invalid value for the formatter
  • For existing CollectionObjects, don't change the CatalogNumber when the COT changes

From #6261 (comment)

This PR implements the third suggestion of the above; that is, the Catalog Number will not change for existing CollectionObjects whenever the CollectionObjectType changes.

Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add automated tests
  • Add relevant issue to release milestone
  • Add relevant documentation (Tester - Dev)

Testing instructions

For a Collection which has more than one CollectionObjectType with differing CatalogNumberFormatNames, and at least one CollectionObjectType with an auto-incrementing numeric Formatter:

  • Go to a new CollectionObject DataEntry Form

  • Ensure that when the CollectionObjectType changes, the catalogNumber changes accordingly to match the CollectionObjectType's format

  • Save the CollectionObject with a Type which has an auto-incrementing portion and ensure that it is auto-incremented properly (does not save with any # placeholders from the format)

  • Go to an existing CollectionObject's DataEntry form

  • Change the CollectionObjectType to the type which has an auto-incrementing numeric portion

    • If the current CollectionObjectType is the only one which has an auto-incrementing numeric portion, change the CollectionObjectType to another Type and change it back to the original Type
  • Ensure that changing the CollectionObjectType for the CollectionObject does not change the CollectionObject's CatalogNumber

@emenslin emenslin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Ensure that when the CollectionObjectType changes, the catalogNumber changes accordingly to match the CollectionObjectType's format
  • Save the CollectionObject with a Type which has an auto-incrementing portion and ensure that it is auto-incremented properly (does not save with any # placeholders from the format)
  • Ensure that changing the CollectionObjectType for the CollectionObject does not change the CollectionObject's CatalogNumber

Looks good, cat # is not changed when COT is changed after save

@Areyes42 Areyes42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Ensure that when the CollectionObjectType changes, the catalogNumber changes accordingly to match the CollectionObjectType's format
  • Save the CollectionObject with a Type which has an auto-incrementing portion and ensure that it is auto-incremented properly (does not save with any # placeholders from the format)
  • Ensure that changing the CollectionObjectType for the CollectionObject does not change the CollectionObject's CatalogNumber

Looks good!

@melton-jason
melton-jason merged commit eebbae4 into production Mar 5, 2025
@melton-jason
melton-jason deleted the issue-6299 branch March 5, 2025 20:45
@github-project-automation github-project-automation Bot moved this from 📋Back Log to ✅Done in General Tester Board Mar 5, 2025

@combs-a combs-a left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Ensure that when the CollectionObjectType changes, the catalogNumber changes accordingly to match the CollectionObjectType's format

  • Save the CollectionObject with a Type which has an auto-incrementing portion and ensure that it is auto-incremented properly (does not save with any # placeholders from the format)

  • Ensure that changing the CollectionObjectType for the CollectionObject does not change the CollectionObject's CatalogNumber


Everything looks pretty good to me!

Switching to a different type and back will trigger unload protect even if no other changes were made--I doubt that this will have any serious ramifications, but if there's any concerns I'm potentially missing those should be brought up. I doubt people will be switching to a different COT and back most of the time as well, so user experience most likely won't be too affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅Done

Development

Successfully merging this pull request may close these issues.

CatalogNumber changes on existing CollectionObject when Type changes

5 participants