Thanks to visit codestin.com
Credit goes to github.com

Skip to content

The first document title should be of type bf:Title #2581

@pronguen

Description

@pronguen

Describe the bug

If the parallel appear before the proper title in the array of field title, this generates a bug:

  • error message in the circulation interface when trying to check out/in an item linked to this document

This problem is due to the operation logs, that are not able to retrieve the field title._text

Example of document causing the problem:

"title": [
      {
        "mainTitle": [
          {
            "value": "Le voyage imaginaire"
          }
        ],
        "type": "bf:ParallelTitle"
      },
      {
        "_text": "Cirque du Soleil = Le voyage imaginaire",
        "mainTitle": [
          {
            "value": "Cirque du Soleil"
          }
        ],
        "type": "bf:Title"
      }
    ]

To Reproduce

See example above.

Expected behavior

The correction must be made on 2 levels

  1. JSON schema: It is not possible to save a document with a first title of a type other than bf:Title

  2. Operation logs: they should be able to retrieve title._text in any position of the array (see code below)

    @classmethod
    def _get_document_data(cls, document_pid):
        """Get document record data.
    
        :param str document_pid: Document PID
        :returns: Document formatted data
        :rtype: dict
        """
        document = Document.get_record_by_pid(document_pid)
        document = document.dumps()
        return {
            'pid': document['pid'],
            'title':
            document['title'][0]['_text'],
            'type':
            document['type'][0].get('subtype',
                                    document['type'][0]['main_type'])
        }

Context

Metadata

Metadata

Assignees

Labels

bugBreaks something but is not blockingenhancementImprovement of an existing featuref: activity-logsEverything around logging user or system activitiesf: editorConcerns editor based on JSON schema AND custom editor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions