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

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

Closed
pronguen opened this issue Dec 2, 2021 · 0 comments · Fixed by #2788
Closed

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

pronguen opened this issue Dec 2, 2021 · 0 comments · Fixed by #2788
Assignees
Labels
bug Breaks something but is not blocking enhancement Improvement of an existing feature f: activity-logs Everything around logging user or system activities f: editor Concerns editor based on JSON schema AND custom editor p-Medium Medium priority (to be solved within 1-2 years)

Comments

@pronguen
Copy link
Contributor

pronguen commented Dec 2, 2021

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

@pronguen pronguen added enhancement Improvement of an existing feature f: editor Concerns editor based on JSON schema AND custom editor bug Breaks something but is not blocking f: activity-logs Everything around logging user or system activities p-Medium Medium priority (to be solved within 1-2 years) labels Dec 2, 2021
@lauren-d lauren-d self-assigned this Mar 29, 2022
lauren-d added a commit to lauren-d/rero-ils that referenced this issue Mar 29, 2022
* Uses filter to retrieve main title of the document.
* Closes rero#2581.

Co-Authored-by: Lauren-D <[email protected]>
lauren-d added a commit that referenced this issue Mar 30, 2022
* Uses filter to retrieve main title of the document.
* Closes #2581.

Co-Authored-by: Lauren-D <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Breaks something but is not blocking enhancement Improvement of an existing feature f: activity-logs Everything around logging user or system activities f: editor Concerns editor based on JSON schema AND custom editor p-Medium Medium priority (to be solved within 1-2 years)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants