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

Allow catalogNumber format to be determined by CollectionObjectType #5431

Open
wants to merge 25 commits into
base: production
Choose a base branch
from

Conversation

melton-jason
Copy link
Contributor

@melton-jason melton-jason commented Dec 3, 2024

Fixes #5232, #5233
See #5234

⚠️ Note: This PR affects database migrations. See migration testing instructions.

Aside from implementing #5232 and #5233, there are some other improvements in this PR!

Schema Config

  • When selecting a Field Format in the Schema Configuration tool, Specify now groups field formatters for the field they selected (Field Formats that explicitly reference the field in fieldName=fieldname) above the rest
Screenshot 2024-12-03 at 3 08 19 PM

Migrations
There were some bugs in other migrations which used the functions defined in specifyweb/specify/update_schema_config.py. These bugs have been fixed in this PR, and a migration has been written to fix these bugs for databases already affected: specify/0017_schemaconfig_fixes.py

UIFormatter picklists for Collection -> catalogNumFormatName and CollectionObjectType -> catalogNumberFormatName

  • Everywhere in the application*, these fields will now appear as a picklist whose items are the names of CO -> catalogNumber Field Formatters
Screenshot 2024-12-03 at 3 21 02 PM

*on the DataEntry Form, they will only appear as a PickList if uitype="combobox" is used on the form definition

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

Testing instructions

  • Define a Field Format for Collection Object -> catalogNumber which is different than the current Collection -> Catalog Num Format Name
    • An example field format called Rocks is provided below:
<format system="false" name="Rocks" class="edu.ku.brc.specify.datamodel.CollectionObject" fieldname="catalogNumber" default="false">
	<autonumber>edu.ku.brc.af.core.db.AutoNumberGeneric</autonumber>
	<field type="constant" size="4" value="ROCK"/>
	<field type="separator" size="1" value="-"/>
	<field type="numeric" size="6" inc="true"/>
</format>
  • Go to the Data Entry form to create a new Collection Object Type
  • Ensure the Catalog Number Format Name picklist shows all Catalog Number Field Formats
  • Save the Collection Object Type with a Catalog Number Format Name that is different than the Collection -> catalogNumFormatName
  • Make sure collectionObjectType is on the Collection Object form
  • Go to the Data Entry form to create a new Collection Object
  • Change the Collection Object Type of the Collection Object to be that which you previously saved
  • Ensure the Catalog Number of the Collection Object is replaced with the pattern of the new
  • (If needed) Modify the Catalog Number so that it matches the format of formatter
  • Save the Collection Object with the new format

@melton-jason melton-jason changed the title Allow CollectionObjects to be autonumbered by CollectionObjectType Allow catalogNumber format to be determined by CollectionObjectType Dec 3, 2024
@melton-jason melton-jason requested review from a team December 4, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋Back Log
Development

Successfully merging this pull request may close these issues.

Implement Catalog Numbering Configurations Based on COT
1 participant