BibIndex: bibauthorid performance improvements

* Re-implements get_author_canonical_ids_for_recid() to bypass
  complex BibAuthorID API usage and directly retrieve data
  from the DB for a gain of speed of ~800x.

* Fixes bug introduced in previous re-implementation of
  get_author_canonical_ids_for_recid() where the flag column
  was not considered.

Signed-off-by: Samuele Kaplun <samuele.kaplun@cern.ch>
Co-authored-by: Samuele Carli <samuele.carli@cern.ch>
Co-authored-by: Alessio Deiana <alessio.deiana@cern.ch>
Reported-by: Annette Holtkamp <annette.holtkamp@cern.ch>
BibEdit: holdingPen fix

*  When merging a record with a template, if the record is a hp record
   make all its subfields volatile.

Reviewed-by: Javier Martin Montull <javier.martin.montull@cern.ch>
BibEdit: logs all user actions to help debugging

* On the client side, keeps all actions in a list

* On the server side, when an exception occurs the action list is displayed
  on top of the exception

Co-authored-by: Javier Martin Montull <javier.martin.montull@cern.ch>
BibEdit: fix check for record in BibSched queue

* Only the first OAIID_TAG was being taken into account before. Now
  all of them.

 * Fixes problem when metadata contains regular expression special
   characters.
BibEdit: make submission preview window modal

* Also avoid double submission by disabling submit button on click.
BibEdit: catch InvalidCache exception on clone
BibEdit: fix int object is not iterable
WebInterface: avoid problem when req object has no headers
BibEdit: create new RT ticket through UI dialog

* Creates a UI dialog on new ticket click. It contains a minimal form for
  quick submission of a new RT ticket.

* For chosen queues can produce template subject and content for the ticket,
  through the use of ticket templates plugin.

* Retrieves all needed information through an Ajax request.

Reviewed-by: Javier Martin Montull <javier.martin.montull@cern.ch>
BibEdit: removes duplicate code

Signed-off-by: Javier Martin Montull <javier.martin.montull@cern.ch>
BibEdit: add author names to history revisions

* Retrieves the author name for every revision of the record and
  displays it inside the history revision entry.

Reviewed-by: Javier Martin Montull <javier.martin.montull@cern.ch>
BibEdit: autocompletion of fields from KBs

*  In CFG_BIBEDIT_AUTOCOMPLETE we declare for which fields
   data will be loaded from which Knowledge Base,
   in order to help user by autocompleting the value.
   Also we choose if the data will be loaded when page is
   loaded or when typing and how will be displayed.

*  addHandler_autocompleteAffiliations is replaced
   from a generic function that handles the behavior for
   any given tag.

*  Handles both static and dynamic KBs

Reviewed-by: Javier Martin Montull <javier.martin.montull@cern.ch>
BibEdit: remove old autocomplete code

Signed-off-by: Javier Martin Montull <javier.martin.montull@cern.ch>
BibEdit: fixes wrongly displayed HP changeset bug

* When switching from table to marc view
  cache was created again without adding
  information about the disabled_hp_entries.

* As a result when record was retrieved again
  all HP changesets were displayed as non applied.

* When changing from marc to table view
  gDisabledHpEntries are saved to the cache.

* Displays a message when user has applied a HP
  changeset, has not taken action for all changes
  and tries to switch to marc view.

Reviewed-by: Javier Martin Montull <javier.martin.montull@cern.ch>
BibAuthorID: Fixed bibref selection dropdown bug in claiming system.
BibAuthorID: fixed name resolution problem

* Clicking on a name on a paper now brings correctly to the author page
  instead of a person search page. Solves some minor ambiguity problems.
BibAuthorID: fix crash on /manage_profile without args

* Now /author/manage_profile/ correctly displays an error message
  when visited without the expected argument.

Signed-off-by: Samuele Carli <samuele.carli@cern.ch>
Reviewed-by: Samuele Kaplun <samuele.kaplun@cern.ch>
BibAuthorID: fix wrong string replacement in assertion

* The assertion message was generating an exception due to a bad
  string replacement.

Signed-off-by: Carli Samuele <samuele.carli@cern.ch>
BibAuthorID: fix in import_publication_from_orcid

* The system crashed in case something goes wrong and the
  orcid was not assignet to a profile yet when the import
  was called. Now this is handled gracefully.

Signed-off-by: Carli Samuele <samuele.carli@cern.ch>
crossrefutils: handle UnboundLocalError

* Fixes UnboundLocalError when number of server retries reach
  it's maximum and the code is trying to call a variable that
  is not defined.

* Fixes a few PEP8 issues.

Signed-off-by: Jan Aage Lavik <jan.age.lavik@cern.ch>