Bug 11299 - Add a button to automatically link authority records in cataloguing (AJAX)
Summary: Add a button to automatically link authority records in cataloguing (AJAX)
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement with 1 vote (vote)
Assignee: Bouzid Fergani
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks: 11300
  Show dependency treegraph
 
Reported: 2013-11-25 17:38 UTC by Frédérick Capovilla
Modified: 2019-03-25 13:24 UTC (History)
20 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Medium patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 11299: Add a button to the biblio edition page to automatically add authority links. (28.39 KB, patch)
2013-11-25 17:38 UTC, Frédérick Capovilla
Details | Diff | Splinter Review
Bug 11299: Adding bug number for signing off (29.09 KB, patch)
2014-04-01 04:13 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (28.01 KB, patch)
2014-10-31 14:44 UTC, simith.doliveira
Details | Diff | Splinter Review
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (29.27 KB, patch)
2015-04-15 19:03 UTC, Blou
Details | Diff | Splinter Review
Bug 11299 - add the lost button (1.17 KB, patch)
2015-04-15 19:05 UTC, Blou
Details | Diff | Splinter Review
Bug 11299 - cleaning up warnings/errors appearing in automatic_linker.pl (1.65 KB, patch)
2015-04-16 15:57 UTC, Blou
Details | Diff | Splinter Review
Bug 11299 - add the lost button (1.11 KB, patch)
2015-05-01 13:02 UTC, Blou
Details | Diff | Splinter Review
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (29.32 KB, patch)
2015-05-25 10:11 UTC, tadeas.moravec
Details | Diff | Splinter Review
Bug 11299 - cleaning up warnings/errors appearing in automatic_linker.pl (1.70 KB, patch)
2015-05-25 10:11 UTC, tadeas.moravec
Details | Diff | Splinter Review
Bug 11299 - add the lost button (1.16 KB, patch)
2015-05-25 10:11 UTC, tadeas.moravec
Details | Diff | Splinter Review
Bug 11299 - Follow-up to QA failure (8.62 KB, patch)
2015-07-08 12:28 UTC, Maxime Beaulieu
Details | Diff | Splinter Review
Bug 11299 - Adds test in t/Biblio.t to test the new sub in Biblio.pm (1.35 KB, patch)
2015-07-29 20:06 UTC, Rémi Mayrand-Provencher
Details | Diff | Splinter Review
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (32.62 KB, patch)
2015-11-27 21:41 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (30.06 KB, patch)
2016-10-13 20:32 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 small fix because TransformHtmlToMarc parameters it's changed (842 bytes, patch)
2016-10-14 12:11 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 small fix because TransformHtmlToMarc parameters it's changed (842 bytes, patch)
2016-10-14 12:14 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299: fix problem show undefined when submit blank data and other small fix (3.53 KB, patch)
2016-12-20 16:41 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (32.71 KB, patch)
2017-03-10 16:20 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Fix problems when authority is not found and i want add it (4.09 KB, patch)
2017-05-09 19:44 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - QA fix (2.13 KB, patch)
2017-05-09 19:45 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Fix problems when authority is not found and i want add it (4.09 KB, patch)
2017-05-09 19:46 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio (6.03 KB, patch)
2017-06-07 11:26 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Change icon for create authority (2.54 KB, patch)
2017-09-15 19:55 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (32.71 KB, patch)
2017-10-06 13:47 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - QA fix (2.13 KB, patch)
2017-10-06 13:47 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Fix problems when authority is not found and i want add it (4.09 KB, patch)
2017-10-06 13:47 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio (6.03 KB, patch)
2017-10-06 13:48 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Change icon for create authority (2.43 KB, patch)
2017-10-06 13:48 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Populated field for record when import authority in z3950 (8.60 KB, patch)
2017-10-06 13:48 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (32.82 KB, patch)
2017-10-09 06:28 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 11299 - QA fix (2.20 KB, patch)
2017-10-09 06:28 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug11299 - Fix problems when authority is not found and i want add it (4.16 KB, patch)
2017-10-09 06:29 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio (6.10 KB, patch)
2017-10-09 06:29 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 11299 - Change icon for create authority (2.49 KB, patch)
2017-10-09 06:29 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug11299 - Populated field for record when import authority in z3950 (8.68 KB, patch)
2017-10-09 06:29 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (33.11 KB, patch)
2018-09-25 19:32 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - QA fix (2.19 KB, patch)
2018-09-25 19:33 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Fix problems when authority is not found and i want add it (4.15 KB, patch)
2018-09-25 19:33 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio (6.08 KB, patch)
2018-09-25 19:33 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Change icon for create authority (2.48 KB, patch)
2018-09-25 19:33 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Populated field for record when import authority in z3950 (7.48 KB, patch)
2018-09-25 19:34 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (33.11 KB, patch)
2018-09-25 19:35 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - QA fix (2.19 KB, patch)
2018-09-25 19:35 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Fix problems when authority is not found and i want add it (4.15 KB, patch)
2018-09-25 19:35 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio (6.08 KB, patch)
2018-09-25 19:36 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Change icon for create authority (2.48 KB, patch)
2018-09-25 19:36 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Populated field for record when import authority in z3950 (7.48 KB, patch)
2018-09-25 19:36 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Populated field for record when import authority in z3950 (7.48 KB, patch)
2018-09-25 19:38 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (33.11 KB, patch)
2018-09-25 19:39 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Populated field for record when import authority in z3950 (7.48 KB, patch)
2018-09-25 19:45 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (33.11 KB, patch)
2018-09-26 19:31 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - QA fix (2.19 KB, patch)
2018-09-26 19:31 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Fix problems when authority is not found and i want add it (4.15 KB, patch)
2018-09-26 19:31 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio (6.08 KB, patch)
2018-09-26 19:31 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Change icon for create authority (2.48 KB, patch)
2018-09-26 19:31 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug11299 - Populated field for record when import authority in z3950 (7.48 KB, patch)
2018-09-26 19:32 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. (41.15 KB, patch)
2018-09-27 18:48 UTC, Bouzid Fergani
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Frédérick Capovilla 2013-11-25 17:38:31 UTC Comment hidden (obsolete)
Comment 1 Frédérick Capovilla 2013-11-25 18:24:35 UTC
Testing scenario (Creating an authority record for a failed automatic link) :

* In you system preferences, deactivate the "AutoCreateAuthorities" preference.
* Go to the biblio record creation form to create a new biblio record. (koha/cataloguing/addbiblio.pl)
* Click the "Link authorities automatically" button. A message should appear, telling the user "No authority link was changed."
* Add random informations in field 600$a of the biblio record.
* Click the "Link authorities automatically" button. The message box should now show "600 - No matching authority found." if no matching authority was found. For this scenario, we want the authority match to have failed.
* The 600$9 field should now be red and icons should have appeared next to it. Click on the "create authority" icon.
* A popup should appear, containing a "Modify authority" form. The form should be pre-filled, a the informations in the 600$a field of the biblio should be in the 100$a field of this new authority record.
* Click the "Save" button
* The 600$9 field in the biblio record should now be back to normal and have the authid of the authority record that was just created.
* Click the "Link authorities automatically" button again. The message box should now show "No authority link was changed.".
Comment 2 nicolas 2014-01-10 10:23:38 UTC
This patch apply correctly.
I create an authorithy following all these steps without saving the record (with 600$a and 700$a).
Works great !
But...
When the authority already exists, the message box still indicates "No matching authority found." (when the record is not saved, and when it is)
 
Even if we can check with the regular "Tag Editor" button, it can be really confusing to have both "authority checking system"...
Comment 3 Frédérick Capovilla 2014-01-20 21:36:56 UTC
The bug you encountered seems to be an indexation problem.
If the zebra index wasn't rebuild between the authority creation and the linkage attempt, the new authority record won't be found by the linker.

On our instances we use a deamon which automatically rebuilds the Zebra index when a new record is added to the queue.

Could anyone test this feature again and rebuild the zebra index once the new authority is added?

Also, the automatic linking should work on existing authorities that were already indexed.
Comment 4 Frédérick Capovilla 2014-03-07 17:29:53 UTC
Changing status to "Needs Signoff" so another round of QA can be done with zebra reindexations.
Comment 5 Aleisha Amohia 2014-04-01 04:13:22 UTC Comment hidden (obsolete)
Comment 6 verolencinas 2014-10-11 01:53:30 UTC
Could not test this patch due to a problem with the sandbox setup:

The sandbox you've requested is not ready.
Some problems occurred applying patches from bug 11299:
<h1>Something went wrong !</h1>Applying: Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging C4/Biblio.pm
Auto-merging C4/Linker.pm
Auto-merging authorities/authorities.pl
Auto-merging koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
Failed to merge in the changes.
Patch failed at 0001 Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.
Comment 7 simith.doliveira 2014-10-31 14:44:25 UTC Comment hidden (obsolete)
Comment 8 simith.doliveira 2014-10-31 14:45:02 UTC Comment hidden (obsolete)
Comment 9 François Pichenot 2015-03-05 11:03:13 UTC
I don't see the "Link authorities automatically" button.

Does this patch still apply ?
Comment 10 Blou 2015-04-15 19:03:29 UTC Comment hidden (obsolete)
Comment 11 Blou 2015-04-15 19:05:00 UTC Comment hidden (obsolete)
Comment 12 Blou 2015-04-15 19:06:46 UTC
I "fixed" Frederik/Simith's patch by standardizing the title and adding the testing scenario to it.

Added a second patch with the lost button.
Comment 13 Blou 2015-04-16 15:57:30 UTC Comment hidden (obsolete)
Comment 14 Blou 2015-05-01 13:02:39 UTC Comment hidden (obsolete)
Comment 15 tadeas.moravec 2015-05-25 10:11:37 UTC Comment hidden (obsolete)
Comment 16 tadeas.moravec 2015-05-25 10:11:50 UTC Comment hidden (obsolete)
Comment 17 tadeas.moravec 2015-05-25 10:11:55 UTC Comment hidden (obsolete)
Comment 18 Jonathan Druart 2015-06-24 13:21:00 UTC
QA comments:

1/ run the qa script, there are some failures
2/ perltidy the new script (cataloguing/automatic_linker.pl)
3/ use Modern::Perl;
4/ Not sure about the permission {catalogue => 1}
Since authorities are created, I'd say editauthorities is required.
5/     * Click the "Link authorities automatically" button. A message should appear, telling the user "No authority link was changed."

No, I got
    Automatic authority link results:
    700 - No matching authority found.
    ...
6/ Tests are needed for changes done in subroutines.
Comment 19 Maxime Beaulieu 2015-07-08 12:28:51 UTC Comment hidden (obsolete)
Comment 20 Rémi Mayrand-Provencher 2015-07-29 20:06:54 UTC Comment hidden (obsolete)
Comment 21 M. Tompsett 2015-08-19 18:55:01 UTC
Comment on attachment 39477 [details] [review]
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.

Review of attachment 39477 [details] [review]:
-----------------------------------------------------------------

::: cataloguing/automatic_linker.pl
@@ +29,5 @@
> +my $input        = new CGI;
> +print $input->header('application/json');
> +
> +# Check the user's permissions
> +my %cookies = fetch CGI::Cookie;

Bug 14589 is attempting to standardize to CGI::Cookie->fetch;
Please change your syntax.
Comment 22 Bouzid Fergani 2015-11-27 21:41:06 UTC
Created attachment 45218 [details] [review]
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.

add authority type in the form to create the missing  authority.
 when authority was found, the 600$9 field have the authid.

Testing scenario (Creating an authority record for a failed automatic link) :

 * In you system preferences, deactivate the "AutoCreateAuthorities" preference.
 * Go to the biblio record creation form to create a new biblio record. (koha/cataloguing/addbiblio.pl)
 * Click the "Link authorities automatically" button. A message should appear, telling the user "No authority link was changed."
 * Add random informations in field 600$a of the biblio record.
 * Click the "Link authorities automatically" button.
   * if matching authority was found,  The message box should now show "600 - A matching authority was found in the local database".
   * if no matching authority was found, the message box should now show  "600 - No matching authority found.".  For this scenario, we want the authority match to have failed.
     * The 600$9 field should now be red and icons should have appeared next to it. Click on the "create authority" icon.
     * A popup will appear, containing a form to create the missing  authority. The form should be pre-filled, a the informations in the 600$a field of the biblio should    be in the 100$a field of this new authority record.
 * Fill in the form and click the "Save" button
 * The 600$9 field in the biblio record should now be back to normal and have the authid of the authority record that was just created.
 * Click the "Link authorities automatically" button again. The message box should now show "No authority link was changed.".
Comment 23 Aleisha Amohia 2016-01-14 00:07:59 UTC
CONFLICT (content): Merge conflict in C4/Biblio.pm
Comment 24 Josef Moravec 2016-02-16 14:40:14 UTC
Could you rebase?
Comment 25 M. Tompsett 2016-08-17 15:24:39 UTC
The addbiblio.tt conflict is easy enough to resolve, though you need to look into fontawesome classes instead of icon-ok.

The C4/Biblio.pm conflict is harder to resolve, as the logic which is ripped out and replaced with a function has changed. This means the logic in the new function needed to be rechecked.

Please rebase.
Comment 26 Bouzid Fergani 2016-10-13 20:32:16 UTC
Created attachment 56440 [details] [review]
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.

 add authority type in the form to create the missing  authority.
 when authority was found, the 600$9 field have the authid.

Testing scenario (Creating an authority record for a failed automatic link) :

 * In you system preferences, deactivate the "AutoCreateAuthorities" preference.
 * Go to the biblio record creation form to create a new biblio record. (koha/cataloguing/addbiblio.pl)
 * Click the "Link authorities automatically" button. A message should appear, telling the user "No authority link was changed."
 * Add random informations in field 600$a of the biblio record.
 * Click the "Link authorities automatically" button.
   * if matching authority was found,  The message box should now show "600 - A matching authority was found in the local database".
   * if no matching authority was found, the message box should now show  "600 - No matching authority found.".  For this scenario, we want the authority match to have failed.
     * The 600$9 field should now be red and icons should have appeared next to it. Click on the "create authority" icon.
     * A popup will appear, containing a form to create the missing  authority. The form should be pre-filled, a the informations in the 600$a field of the biblio should    be in the 100$a field of this new authority record.
 * Fill in the form and click the "Save" button
 * The 600$9 field in the biblio record should now be back to normal and have the authid of the authority record that was just created.
 * Click the "Link authorities automatically" button again. The message box should now show "No authority link was changed.".
Comment 27 Bouzid Fergani 2016-10-14 12:11:40 UTC Comment hidden (obsolete)
Comment 28 Bouzid Fergani 2016-10-14 12:14:02 UTC
Created attachment 56509 [details] [review]
Bug 11299 small fix because TransformHtmlToMarc parameters it's changed

small fix and rebase all patches
Comment 29 Josef Moravec 2016-11-02 14:17:49 UTC
I tested these patches and found some issues:

When editing biblio (cataloguing/addbiblio.pl), the button "Z39.50/SRU Search" is here twice - probably due to rebase

Button "Link authorities automatically" doesn't have icon - please use font awesome icons instead of obsoleted icon-* classes

When trying to link on blank record i got "undefined - undefined" response instead of "No authority link was changed."

Icons next to authority fields  (approve.gif / deny.gif) are not showing.

The matching itself looks OK
Comment 30 Bouzid Fergani 2016-12-20 16:41:00 UTC
Created attachment 58307 [details] [review]
Bug 11299: fix problem show undefined when submit blank data and other small fix

   - Show icon of button automaticlinker and search
   - Add icons deny and approve
   - Fix problem button 'Z39.50/SRU Search' it's show twice
Comment 31 Bouzid Fergani 2017-03-10 16:20:13 UTC
Created attachment 60998 [details] [review]
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.

add authority type in the form to create the missing  authority.
 when authority was found, the 600$9 field have the authid.

Testing scenario (Creating an authority record for a failed automatic link) :

 * In you system preferences, deactivate the "AutoCreateAuthorities" preference.
 * Go to the biblio record creation form to create a new biblio record. (koha/cataloguing/addbiblio.pl)
 * Click the "Link authorities automatically" button. A message should appear, telling the user "No authority link was changed."
 * Add random informations in field 600$a of the biblio record.
 * Click the "Link authorities automatically" button.
   * if matching authority was found,  The message box should now show "600 - A matching authority was found in the local database".
   * if no matching authority was found, the message box should now show  "600 - No matching authority found.".  For this scenario, we want the authority match to have failed.
     * The 600$9 field should now be red and icons should have appeared next to it. Click on the "create authority" icon.
     * A popup will appear, containing a form to create the missing  authority. The form should be pre-filled, a the informations in the 600$a field of the biblio should    be in the 100$a field of this new authority record.
 * Fill in the form and click the "Save" button
 * The 600$9 field in the biblio record should now be back to normal and have the authid of the authority record that was just created.
 * Click the "Link authorities automatically" button again. The message box should now show "No authority link was changed.".
Comment 32 Bouzid Fergani 2017-03-10 16:21:57 UTC
Hi all,
I rebase all patches and squash all in one good patch.
Thanks.
Comment 33 Katrin Fischer 2017-05-01 23:50:32 UTC
Hi Bouzid,

I've tested the linking from the normal cataloguing editor and I really love it.

So, some first feedback:

There are 2 complaints from the QA script:

 FAIL	koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
   FAIL	  forbidden patterns
		forbidden pattern: Contains old bootstrap style for buttons (see bug 16239) (line 710)

 FAIL	authorities/authorities.pl
   FAIL	  spelling
		 autority  ==> authority

Testing:

When a match was found, it works nicely. Problems appear, when a new authority is to be added.

- When I click on the plugin, instead of the normal search form, the add authority form opens, but the window is too small for the big form with the normal header on top, the navigation on top is 'messy' in the small screen.
- It opened the wrong framework. I had 655 - so it should open Genre/Form, but instead it was Personal name.

Maybe it would be worth to split this big patch. For now, have the automatic linking from cataloguing and leave the authority plugin untouched and deal with that later on? But maybe it's an easy fix.
Comment 34 Bouzid Fergani 2017-05-09 19:44:45 UTC Comment hidden (obsolete)
Comment 35 Bouzid Fergani 2017-05-09 19:45:53 UTC
Created attachment 63312 [details] [review]
Bug 11299 - QA fix
Comment 36 Bouzid Fergani 2017-05-09 19:46:02 UTC
Created attachment 63313 [details] [review]
Bug11299 - Fix problems when authority is not found and i want add it
Comment 37 Bouzid Fergani 2017-05-09 19:56:07 UTC
Hi Katrin,

Thanks for the feedback.

I fix all problems from the QA script and all problems when you open window for add authority.

Now, if the authority is not found, when you click add authority, it's open the  window with the correct authority type.

Thanks.
Comment 38 Katrin Fischer 2017-05-10 22:37:33 UTC
Hi Bouzid, one step further!

- QA test tools pass now
- Adding a new authority entry after checking works nicely.
- Adding a new authority that was checked negative works much better too, but fields are not prepopulated as noted in the test plan, could you check? If this is not intended for now, we could also change the test plan and solve this later on, as long as we don't leave broken code.
Comment 39 Bouzid Fergani 2017-06-07 11:26:49 UTC
Created attachment 64075 [details] [review]
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio
Comment 40 Katrin Fischer 2017-07-09 18:03:03 UTC
I am sorry, but the workflow for adding a new record is still not quite right:

- Download a record from LOC
- Link authorities
- Check fields listed
- First problem: The same icon appears next to $9 and $a, but with different meaning. $a has the normal search, $9 the Create authority. We should use different icons at least.
- Second problem: Using Create authority the fields are prefilled now (good!), but after saving the window doesn't close and the $9 in the record is not populated.

I will try to keep an eye on this one and come back to it sooner next time!
Comment 41 Katrin Fischer 2017-08-08 19:22:37 UTC
Argh, sorry, I think I forgot to switch the status last time I worked on this.
Comment 42 Bouzid Fergani 2017-09-15 19:55:28 UTC
Created attachment 67162 [details] [review]
Bug 11299 - Change icon for create authority
Comment 43 Bouzid Fergani 2017-09-15 20:34:58 UTC
Hi katrin,
 - For the first problem, I changed icon for $9 when create authority
 - For the second problem, the workflow is the same in cataloguing authority plugin  
          - Add MARC record
          - Write any information in for example 700$a and click Tag editor
          - You have cataloguing authority plugin window
          - If you click Create new authority, you have the same page when you  click create authority added in this patch
          - Import authority form LOC and save
          - After saving, the window doesn't close and the information is not reported in the cataloguing authority plugin.
          - If you need found this authority, you should reindex zebra and click search 

   - The workflow in this patch is the same, when create authority, you should reindex and reclick Link authorities automatickly and you have the authid in $9.

I think this is the workflow of koha.

Thanks.
Bouzid.
Comment 44 Katrin Fischer 2017-09-15 21:57:16 UTC
(In reply to Bouzid from comment #43)
> Hi katrin,
>  - For the first problem, I changed icon for $9 when create authority
>  - For the second problem, the workflow is the same in cataloguing authority
> plugin  
>           - Add MARC record
>           - Write any information in for example 700$a and click Tag editor
>           - You have cataloguing authority plugin window
>           - If you click Create new authority, you have the same page when
> you  click create authority added in this patch
>           - Import authority form LOC and save
>           - After saving, the window doesn't close and the information is
> not reported in the cataloguing authority plugin.
>           - If you need found this authority, you should reindex zebra and
> click search 
> 
>    - The workflow in this patch is the same, when create authority, you
> should reindex and reclick Link authorities automatickly and you have the
> authid in $9.

I think if this is the case (could not verify on master yet) - it's a regression/bug. I just tested on 16.11.10 as this was available to me:

- Open default framework
- Click on plugin on 100$a
- Use create authority from plugin window
- Enter 100$a with a name
- Save authority
- Window closes and data is filled in

If there is a bug, we will need to fix that first.
Comment 45 Bouzid Fergani 2017-10-06 13:47:27 UTC
Created attachment 67708 [details] [review]
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.

add authority type in the form to create the missing  authority.
 when authority was found, the 600$9 field have the authid.

Testing scenario (Creating an authority record for a failed automatic link) :

 * In you system preferences, deactivate the "AutoCreateAuthorities" preference.
 * Go to the biblio record creation form to create a new biblio record. (koha/cataloguing/addbiblio.pl)
 * Click the "Link authorities automatically" button. A message should appear, telling the user "No authority link was changed."
 * Add random informations in field 600$a of the biblio record.
 * Click the "Link authorities automatically" button.
   * if matching authority was found,  The message box should now show "600 - A matching authority was found in the local database".
   * if no matching authority was found, the message box should now show  "600 - No matching authority found.".  For this scenario, we want the authority match to have failed.
     * The 600$9 field should now be red and icons should have appeared next to it. Click on the "create authority" icon.
     * A popup will appear, containing a form to create the missing  authority. The form should be pre-filled, a the informations in the 600$a field of the biblio should    be in the 100$a field of this new authority record.
 * Fill in the form and click the "Save" button
 * The 600$9 field in the biblio record should now be back to normal and have the authid of the authority record that was just created.
 * Click the "Link authorities automatically" button again. The message box should now show "No authority link was changed.".
Comment 46 Bouzid Fergani 2017-10-06 13:47:39 UTC
Created attachment 67709 [details] [review]
Bug 11299 - QA fix
Comment 47 Bouzid Fergani 2017-10-06 13:47:53 UTC
Created attachment 67710 [details] [review]
Bug11299 - Fix problems when authority is not found and i want add it
Comment 48 Bouzid Fergani 2017-10-06 13:48:05 UTC
Created attachment 67712 [details] [review]
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio
Comment 49 Bouzid Fergani 2017-10-06 13:48:17 UTC
Created attachment 67713 [details] [review]
Bug 11299 - Change icon for create authority
Comment 50 Bouzid Fergani 2017-10-06 13:48:34 UTC
Created attachment 67714 [details] [review]
Bug11299 - Populated field for record when import authority in z3950
Comment 51 Bouzid Fergani 2017-10-06 14:03:38 UTC
Hi Katrin,
I fixed problem populated field of record when import from z3950 server.
The last patch, fix also problem when click tag editor in cataloguig module
    - Choose create authority
    - z39.50 search
    - In result of search, choose any authority and click import.
    - When save authority, the fileds of record is populate with value of import authority

without the patch, when save authority, the field is not populate.

Thanks.
Bouzid.
Comment 52 Katrin Fischer 2017-10-09 06:28:53 UTC
Created attachment 67824 [details] [review]
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.

 add authority type in the form to create the missing  authority.
 when authority was found, the 600$9 field have the authid.

Testing scenario (Creating an authority record for a failed automatic link) :

 * In you system preferences, deactivate the "AutoCreateAuthorities" preference.
 * Go to the biblio record creation form to create a new biblio record. (koha/cataloguing/addbiblio.pl)
 * Click the "Link authorities automatically" button. A message should appear, telling the user "No authority link was changed."
 * Add random informations in field 600$a of the biblio record.
 * Click the "Link authorities automatically" button.
   * if matching authority was found,  The message box should now show "600 - A matching authority was found in the local database".
   * if no matching authority was found, the message box should now show  "600 - No matching authority found.".  For this scenario, we want the authority match to have failed.
     * The 600$9 field should now be red and icons should have appeared next to it. Click on the "create authority" icon.
     * A popup will appear, containing a form to create the missing  authority. The form should be pre-filled, a the informations in the 600$a field of the biblio should    be in the 100$a field of this new authority record.
 * Fill in the form and click the "Save" button
 * The 600$9 field in the biblio record should now be back to normal and have the authid of the authority record that was just created.
 * Click the "Link authorities automatically" button again. The message box should now show "No authority link was changed.".

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 53 Katrin Fischer 2017-10-09 06:28:59 UTC
Created attachment 67825 [details] [review]
Bug 11299 - QA fix

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 54 Katrin Fischer 2017-10-09 06:29:05 UTC
Created attachment 67826 [details] [review]
Bug11299 - Fix problems when authority is not found and i want add it

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 55 Katrin Fischer 2017-10-09 06:29:10 UTC
Created attachment 67827 [details] [review]
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 56 Katrin Fischer 2017-10-09 06:29:15 UTC
Created attachment 67828 [details] [review]
Bug 11299 - Change icon for create authority

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 57 Katrin Fischer 2017-10-09 06:29:21 UTC
Created attachment 67829 [details] [review]
Bug11299 - Populated field for record when import authority in z3950

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 58 Katrin Fischer 2017-10-09 06:35:15 UTC
Thank you for your perseverance!
Comment 59 Marcel de Rooy 2018-01-05 08:41:33 UTC
+eval { eval "require $linker_module"; };

Does not look good.
Comment 60 Marcel de Rooy 2018-01-05 08:50:09 UTC
Bouzid: I will still continue on this one. But how do you make sure that you do not save a personal name into say field 610 that should only include corporate names ?
Comment 61 Marcel de Rooy 2018-01-12 07:25:12 UTC
(In reply to Marcel de Rooy from comment #60)
> Bouzid: I will still continue on this one. But how do you make sure that you
> do not save a personal name into say field 610 that should only include
> corporate names ?

QA: Looking here again little bit.
Bouzid: A response would have been helpful to expedite QA now..
Comment 62 Marcel de Rooy 2018-01-12 08:21:34 UTC
Thx for submitting your work. But I am still having serious doubts about this development.

In the editor we normally work with the authority popup. You completely go around that here, but I still need to undo the plugin assignments before I can really get your function working.
If I disconnect 600, you still assume that it is a personal name. But I may not want to work with your approach? If I enter an incorrect authid into $9, it accepts the name in $a and does not create an authority.
But in another field (650), I see one is not accepted with an invalid authid, and another one with invalid authid is accepted. This is not stable.

To get short, I would recommend to remove the link button, move your function to a plugin and minimize the changes to existing code to get it working. In that way we can choose which plugin we want to use. It might provide evidence for being stable and making a transition.

tests for LinkBibHeadingsToAuthorities ?
new sub AddAuthorityFromHeading
Please note that the RM does no longer want to add C4 routines.
What about UNIMARC btw?
And adding an authority should not be in C4::Biblio!

+    # Get the first heading found in the biblio informations
+    foreach my $field ( $record->fields() ) {
+        my $heading = C4::Heading->new_from_bib_field($field);
+        next unless defined $heading;
Isn't there a smarter way than just passing each field to Heading ?

+is(C4::Biblio::AddAuthorityFromHeading(), 0, 'AddAuthorityFromHeading returns zero if not passed heading, field or bib');
This is not enough to test a new sub.

Double eval (comment 59)

There are enough reasons listed to postpone further QA for now. I am sorry for the amount of work here, but imo it needs larger adjustments.
Comment 63 Marcel de Rooy 2018-01-12 08:27:09 UTC
Please squash the patches and correct the bug titles. See guidelines. We need them to be of the form Bug 12345: What does this patch do?
Comment 64 Katrin Fischer 2018-01-12 08:51:34 UTC
Hi Marcel,

> In the editor we normally work with the authority popup. You completely go
> around that here, but I still need to undo the plugin assignments before I
> can really get your function working.

I didn't do that in my testing. I still could use the normal plugin with the link on $a IIRC. I know I didn't change the frameworks.

> If I disconnect 600, you still assume that it is a personal name. But I may
> not want to work with your approach? If I enter an incorrect authid into $9,
> it accepts the name in $a and does not create an authority.
> But in another field (650), I see one is not accepted with an invalid
> authid, and another one with invalid authid is accepted. This is not stable.
> 
> To get short, I would recommend to remove the link button, move your
> function to a plugin and minimize the changes to existing code to get it
> working. In that way we can choose which plugin we want to use. It might
> provide evidence for being stable and making a transition.

I think you can't achieve the same functionality with a plugin, a button to check all fields at the same time and give you a summary report of the ones linked/unlinked. 

And you shouldn't have to choose - both should always be possible, manual (with search) and automatic linking.
Comment 65 Katrin Fischer 2018-01-12 08:53:52 UTC
I think it should work like this: Check the framework for the authority type linked to a field and check for authorities of that type to link it with automatically. Fields not linked to an authority type, should not be auto-linked.
Comment 66 Marcel de Rooy 2018-01-12 09:04:50 UTC
(In reply to Katrin Fischer from comment #65)
> I think it should work like this: Check the framework for the authority type
> linked to a field and check for authorities of that type to link it with
> automatically. Fields not linked to an authority type, should not be
> auto-linked.

Currently this is hardcoded in Heading somewhere.
Comment 67 Katrin Fischer 2018-01-12 09:29:07 UTC
(In reply to Marcel de Rooy from comment #66)
> (In reply to Katrin Fischer from comment #65)
> > I think it should work like this: Check the framework for the authority type
> > linked to a field and check for authorities of that type to link it with
> > automatically. Fields not linked to an authority type, should not be
> > auto-linked.
> 
> Currently this is hardcoded in Heading somewhere.

Hm, yeah, I seem to remember that this was used for importing authorities in order to assign the correct framework. Maybe this could be seen as a separate bug?
Comment 68 Marjorie Barry-Vila 2018-05-03 18:19:35 UTC
(In reply to Marcel de Rooy from comment #60)
> Bouzid: I will still continue on this one. But how do you make sure that you
> do not save a personal name into say field 610 that should only include
> corporate names ?

Hi Marcel,
Bouzid worked for our community to implement this development.
We use it as it has been here for 7 years now.
When using  "Link authorities automatically" the authorities are linked according to the type of authority.
If you enter a person name in a 610, the automatic link will not be made to a PERSO_NAME authority in 610 because it must be a CORPO_NAME. 
Can you describe test plan that led you to this result?

Regards,
Marjorie
Comment 69 Marcel de Rooy 2018-05-04 05:31:39 UTC
(In reply to Marjorie Barry-Vila from comment #68)
> Hi Marcel,
> Bouzid worked for our community to implement this development.
> We use it as it has been here for 7 years now.
> When using  "Link authorities automatically" the authorities are linked
> according to the type of authority.
> If you enter a person name in a 610, the automatic link will not be made to
> a PERSO_NAME authority in 610 because it must be a CORPO_NAME. 
> Can you describe test plan that led you to this result?

Hi Marjorie,
I raised a question and hoped for a response from Bouzid, but he did not and I continued QA until I felt that it made no sense to continue further..
So I do not have a test plan for you.
The comments before gave a series of points that need attention and/or feedback.

Marcel
Comment 70 Blou 2018-05-09 19:59:34 UTC
Bouzid did not respond because I asked him not to, waiting for the user (Marjorie) to comment.  Fixing bugs or architecture issues is one thing.  Defending the usefulness of a feature is another, and a much bigger one in my opinion.

If the value of the feature can't pass your smell test, I can't recommend that the user throw good money after bad into the re-engineering of the feature, indefinitely, to follow the latest architectural whims.  They coded this in 2010ish, so you can bet it's always playing catch-up, code-wise.

And if it could be put into a plugin, I would have recommended that avenue long ago.  My rebase at each version would be much simpler, and the client would have saved money overall.  But this is a major cataloging feature  -- essential, as commented by a cataloging power-user -- and needs to be seamlessly integrated.

If the user wants, Bouzid will start with the rework you asked.  Not sure about Unimarc, honestly, and if it's a deal breaker, well...  

Let's put this under the vise of slow death, for now: I'll put it In Discussion.
Comment 71 Marcel de Rooy 2018-05-11 06:04:42 UTC
(In reply to Blou from comment #70)
> Bouzid did not respond because I asked him not to, waiting for the user
> (Marjorie) to comment.  
Which could lead to misunderstandings about why the author does not respond..

> If the value of the feature can't pass your smell test
'Your smell test' does not sound good to me. Smells like an offense ;) No native speaker btw. But I understand your feelings when code is not approved.

> If the user wants, Bouzid will start with the rework you asked.  Not sure
> about Unimarc, honestly, and if it's a deal breaker, well...  
> Let's put this under the vise of slow death, for now: I'll put it In
> Discussion.

I will send a mail to the QA team. We could see if other QAers support the feature in its current form.
Comment 72 Jonathan Druart 2018-05-11 13:14:05 UTC
(In reply to Blou from comment #70)
> If the value of the feature can't pass your smell test, I can't recommend
> that the user throw good money after bad into the re-engineering of the
> feature, indefinitely, to follow the latest architectural whims.  They coded
> this in 2010ish, so you can bet it's always playing catch-up, code-wise.

Coded in 2010 and submitted to the community in November 2013.

I do not need to read the test plan or the content of the patch when I see that:
 C4/Biblio.pm                                       | 138 +++++++++++++-
 C4/Linker.pm                                       |   5 +-
 C4/Linker/Default.pm                               |   2 +-
 t/Biblio.t                                         |   2 +

This definitely is code smell, tests for changes in C4 and Koha are required for years now.

Several questions have been asked by Marcel 4 months ago, it would be good to get  an answer first. That should not take much time to just... answer, right?
Comment 73 Blou 2018-05-11 15:09:18 UTC
1) Did you read my explanation on the matter of answering?  The user/owner has many other priorities, and the delay should not be a consideration.  Who's waiting on who here?

2) In all those exchanges, I do not see the issue of Tests being raised until you did.  Not that it's not valid, mind you, but the testers are working on the Functionalities/usage (Kathleen) or questioning the validity (Marcel).  I prefer that, personally.  No point in working and rebasing and working again on tests for a feature that might not get accepted as deemed useless.  Tests are easy, Bouzid/team has written plenty of those for all the other patches.

I have no personal attachment to the feature.  Didn't code it, do not maintain it.  And knowing what code it touches, it matters to me that it's done well.  The process is important and must be followed.  But the feature, per the actual cataloging users, is a must have for a serious tool. 

Must. Have.

Philippe
PS You get a piece of meat, you smell it, your experience/intuition tells you it's shit, you won't eat it.  No need to call a biolab to test the meat.  QAs have seen enough features and pieces of code to do that with patches.

I do that with all _new_ features or bugs we talk about submitting. Let me tell you I have a picky nose myself, and I'm good at math/finance.  The paying users appreciate.

A smell test is not an insult.
Comment 74 Katrin Fischer 2018-05-15 11:58:00 UTC
Hi all,

as I have commented before I see a very valid use case for the feature as is and I think we should work on including it into Koha properly.

I am sorry for having missed the missing tests - I _should_ have noticed and noted that early on.

I agree that we need to do 2 things here:
- Agree on the feature itself.
- Agree on a clear list of things TBD to get this into Koha.

This won't make it into 18.05 now which is unfortunate.

I'd like to offer to go through the comments and see if I can create a summary first of what has been asked/unanswered and then we could try moving from there?
I could do this within the next 2 weeks I think.
Comment 75 Blou 2018-05-15 13:26:37 UTC
That would be great, Kathleen.  Follwing that, I'll make sure we give it quick response.

Thanks
Comment 76 Bouzid Fergani 2018-09-25 19:32:59 UTC
Created attachment 79385 [details] [review]
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.

add authority type in the form to create the missing  authority.
 when authority was found, the 600$9 field have the authid.

Testing scenario (Creating an authority record for a failed automatic link) :

 * In you system preferences, deactivate the "AutoCreateAuthorities" preference.
 * Go to the biblio record creation form to create a new biblio record. (koha/cataloguing/addbiblio.pl)
 * Click the "Link authorities automatically" button. A message should appear, telling the user "No authority link was changed."
 * Add random informations in field 600$a of the biblio record.
 * Click the "Link authorities automatically" button.
   * if matching authority was found,  The message box should now show "600 - A matching authority was found in the local database".
   * if no matching authority was found, the message box should now show  "600 - No matching authority found.".  For this scenario, we want the authority match to have failed.
     * The 600$9 field should now be red and icons should have appeared next to it. Click on the "create authority" icon.
     * A popup will appear, containing a form to create the missing  authority. The form should be pre-filled, a the informations in the 600$a field of the biblio should    be in the 100$a field of this new authority record.
 * Fill in the form and click the "Save" button
 * The 600$9 field in the biblio record should now be back to normal and have the authid of the authority record that was just created.
 * Click the "Link authorities automatically" button again. The message box should now show "No authority link was changed.".

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 77 Bouzid Fergani 2018-09-25 19:33:23 UTC
Created attachment 79386 [details] [review]
Bug 11299 - QA fix

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 78 Bouzid Fergani 2018-09-25 19:33:33 UTC
Created attachment 79387 [details] [review]
Bug11299 - Fix problems when authority is not found and i want add it

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 79 Bouzid Fergani 2018-09-25 19:33:45 UTC
Created attachment 79388 [details] [review]
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 80 Bouzid Fergani 2018-09-25 19:33:53 UTC
Created attachment 79389 [details] [review]
Bug 11299 - Change icon for create authority

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 81 Bouzid Fergani 2018-09-25 19:34:01 UTC
Created attachment 79390 [details] [review]
Bug11299 - Populated field for record when import authority in z3950
Comment 82 Bouzid Fergani 2018-09-25 19:35:26 UTC Comment hidden (obsolete)
Comment 83 Bouzid Fergani 2018-09-25 19:35:43 UTC Comment hidden (obsolete)
Comment 84 Bouzid Fergani 2018-09-25 19:35:56 UTC Comment hidden (obsolete)
Comment 85 Bouzid Fergani 2018-09-25 19:36:04 UTC Comment hidden (obsolete)
Comment 86 Bouzid Fergani 2018-09-25 19:36:12 UTC Comment hidden (obsolete)
Comment 87 Bouzid Fergani 2018-09-25 19:36:20 UTC Comment hidden (obsolete)
Comment 88 Bouzid Fergani 2018-09-25 19:38:50 UTC Comment hidden (obsolete)
Comment 89 Bouzid Fergani 2018-09-25 19:39:48 UTC Comment hidden (obsolete)
Comment 90 Bouzid Fergani 2018-09-25 19:45:30 UTC
Created attachment 79399 [details] [review]
Bug11299 - Populated field for record when import authority in z3950
Comment 91 Bouzid Fergani 2018-09-26 19:31:04 UTC
Created attachment 79447 [details] [review]
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.

add authority type in the form to create the missing  authority.
 when authority was found, the 600$9 field have the authid.

Testing scenario (Creating an authority record for a failed automatic link) :

 * In you system preferences, deactivate the "AutoCreateAuthorities" preference.
 * Go to the biblio record creation form to create a new biblio record. (koha/cataloguing/addbiblio.pl)
 * Click the "Link authorities automatically" button. A message should appear, telling the user "No authority link was changed."
 * Add random informations in field 600$a of the biblio record.
 * Click the "Link authorities automatically" button.
   * if matching authority was found,  The message box should now show "600 - A matching authority was found in the local database".
   * if no matching authority was found, the message box should now show  "600 - No matching authority found.".  For this scenario, we want the authority match to have failed.
     * The 600$9 field should now be red and icons should have appeared next to it. Click on the "create authority" icon.
     * A popup will appear, containing a form to create the missing  authority. The form should be pre-filled, a the informations in the 600$a field of the biblio should    be in the 100$a field of this new authority record.
 * Fill in the form and click the "Save" button
 * The 600$9 field in the biblio record should now be back to normal and have the authid of the authority record that was just created.
 * Click the "Link authorities automatically" button again. The message box should now show "No authority link was changed.".

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 92 Bouzid Fergani 2018-09-26 19:31:19 UTC
Created attachment 79448 [details] [review]
Bug 11299 - QA fix

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 93 Bouzid Fergani 2018-09-26 19:31:33 UTC
Created attachment 79449 [details] [review]
Bug11299 - Fix problems when authority is not found and i want add it

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 94 Bouzid Fergani 2018-09-26 19:31:44 UTC
Created attachment 79450 [details] [review]
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 95 Bouzid Fergani 2018-09-26 19:31:57 UTC
Created attachment 79451 [details] [review]
Bug 11299 - Change icon for create authority

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 96 Bouzid Fergani 2018-09-26 19:32:08 UTC
Created attachment 79452 [details] [review]
Bug11299 - Populated field for record when import authority in z3950
Comment 97 Bouzid Fergani 2018-09-27 18:48:50 UTC
Created attachment 79545 [details] [review]
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.

add authority type in the form to create the missing  authority.
 when authority was found, the 600$9 field have the authid.

Testing scenario (Creating an authority record for a failed automatic link) :

 * In you system preferences, deactivate the "AutoCreateAuthorities" preference.
 * Go to the biblio record creation form to create a new biblio record. (koha/cataloguing/addbiblio.pl)
 * Click the "Link authorities automatically" button. A message should appear, telling the user "No authority link was changed."
 * Add random informations in field 600$a of the biblio record.
 * Click the "Link authorities automatically" button.
   * if matching authority was found,  The message box should now show "600 - A matching authority was found in the local database".
   * if no matching authority was found, the message box should now show  "600 - No matching authority found.".  For this scenario, we want the authority match to have failed.
     * The 600$9 field should now be red and icons should have appeared next to it. Click on the "create authority" icon.
     * A popup will appear, containing a form to create the missing  authority. The form should be pre-filled, a the informations in the 600$a field of the biblio should    be in the 100$a field of this new authority record.
 * Fill in the form and click the "Save" button
 * The 600$9 field in the biblio record should now be back to normal and have the authid of the authority record that was just created.
 * Click the "Link authorities automatically" button again. The message box should now show "No authority link was changed.".

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 98 M. Tompsett 2018-09-28 02:17:22 UTC
Comment on attachment 79545 [details] [review]
Bug 11299 - Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.

Review of attachment 79545 [details] [review]:
-----------------------------------------------------------------

::: C4/Biblio.pm
@@ +475,4 @@
>  
>  =head2 LinkBibHeadingsToAuthorities
>  
> +  my $num_headings_changed, %results = LinkBibHeadingsToAuthorities($linker, $marc, $frameworkcode, [$allowrelink, $verbose]);

This is getting too long, consider a parameter refactor.

Please look at: https://wiki.koha-community.org/wiki/Coding_Guidelines#PERL16:_Hashrefs_should_be_used_as_arguments
Comment 99 Michal Denar 2019-03-25 13:24:51 UTC
Hi,
any progress on this bug?