Bugzilla – Attachment 126588 Details for
Bug 25387
Merging different authority types creates no warning
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25387: Merging different authority types create no warning
Bug-25387-Merging-different-authority-types-create.patch (text/plain), 5.99 KB, created by
Marion Durand
on 2021-10-20 13:54:16 UTC
(
hide
)
Description:
Bug 25387: Merging different authority types create no warning
Filename:
MIME Type:
Creator:
Marion Durand
Created:
2021-10-20 13:54:16 UTC
Size:
5.99 KB
patch
obsolete
>From c2d3c147d4aa965391801abfd110340d4489ed58 Mon Sep 17 00:00:00 2001 >From: Marion Durand <marion.durand@biblibre.com> >Date: Wed, 6 Oct 2021 14:49:58 +0200 >Subject: [PATCH] Bug 25387: Merging different authority types create no > warning > >Merging two different authorities types can result in the loss of some >field. This patch adds a warning when merging different type of >authorities and add more display of authorities types during merge. > >To test: >1- Find two authorities you what to merge. Be sure that these >authorities have different type >2- Search for these authorities (be sure to have both results on the >results page) >3- For the first authority click on "Actions" then on "Merge", same for >the second one >4- Check that koha is asking you to choose a framework and that >authority types are not displayed >5- Choose a framework, then click on next >6- Check that the authority type is not displayed in the tabs and that >no warning appear >7- Apply the patch >8- Repeat step 1 to 3 again >9- Check that authority type is now displayed next to their ID >10- Repeate setp 5 again >11- Check that the authority types is now displayed in the tabs next to >their ID and that a warning appear >--- > authorities/merge.pl | 12 ++++++++++++ > .../intranet-tmpl/prog/en/includes/merge-record.inc | 3 ++- > .../prog/en/modules/authorities/merge.tt | 12 +++++++++++- > 3 files changed, 25 insertions(+), 2 deletions(-) > >diff --git a/authorities/merge.pl b/authorities/merge.pl >index 0799c26b04..a5787f8fd5 100755 >--- a/authorities/merge.pl >+++ b/authorities/merge.pl >@@ -156,6 +156,11 @@ else { > ($recordObj1, $recordObj2) = ($recordObj2, $recordObj1); > } > >+ # Getting frameworktext >+ my $frameworktext1 = Koha::Authority::Types->find( $recordObj1->authtypecode ); >+ my $frameworktext2 = Koha::Authority::Types->find( $recordObj2->authtypecode ); >+ my $frameworktextdestination = Koha::Authority::Types->find( $framework ); >+ > # Creating a loop for display > > my @records = ( >@@ -163,6 +168,7 @@ else { > recordid => $mergereference, > record => $recordObj1->record, > frameworkcode => $recordObj1->authtypecode, >+ frameworktext => $frameworktext1->authtypetext, > display => $recordObj1->createMergeHash($tagslib), > reference => 1, > }, >@@ -170,6 +176,7 @@ else { > recordid => $notreference, > record => $recordObj2->record, > frameworkcode => $recordObj2->authtypecode, >+ frameworktext => $frameworktext2->authtypetext, > display => $recordObj2->createMergeHash($tagslib), > }, > ); >@@ -180,6 +187,7 @@ else { > recordid2 => $notreference, > records => \@records, > framework => $framework, >+ frameworktext => $frameworktextdestination->authtypetext, > ); > } > else { >@@ -194,10 +202,14 @@ else { > ); > if ( $recordObj1->authtypecode ne $recordObj2->authtypecode ) { > my $authority_types = Koha::Authority::Types->search( { authtypecode => { '!=' => '' } }, { order_by => ['authtypetext'] } ); >+ my $frameworktext1 = Koha::Authority::Types->find( $recordObj1->authtypecode ); >+ my $frameworktext2 = Koha::Authority::Types->find( $recordObj2->authtypecode ); > $template->param( > frameworkselect => $authority_types->unblessed, > frameworkcode1 => $recordObj1->authtypecode, > frameworkcode2 => $recordObj2->authtypecode, >+ frameworklabel1 => $frameworktext1->authtypetext, >+ frameworklabel2 => $frameworktext2->authtypetext, > ); > } > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc >index 6d14015916..70846a43a4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc >@@ -53,6 +53,7 @@ > <a href="#tabrecord[% record.recordid | uri %]"> > [% record.recordid | html %] > [% IF record.reference %](ref)[% END %] >+ ([% record.frameworktext | html %]) > </a> > </li> > [% END %] >@@ -67,7 +68,7 @@ > > [% BLOCK mergetarget %] > <div id="result"> >- <h2>Destination record</h2> >+ <h2>Destination record ([% authtypetext %])</h2> > <div style="border:1px solid #E8E8E8;padding:1em;margin-top:2em;"> > <ul id="resultul"></ul> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >index d472c924f8..1057ae5148 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >@@ -104,7 +104,7 @@ div#result { margin-top: 1em; } > [% PROCESS mergesource sourcerecords=records %] > </div> > <div class="col-sm-6"> >-[% PROCESS mergetarget %] >+[% PROCESS mergetarget authtypetext=frameworktext %] > </div> > </div> > >@@ -113,6 +113,16 @@ div#result { margin-top: 1em; } > <input type="hidden" name="mergereference" value="[% mergereference | html %]" /> > <input type="hidden" name="frameworkcode" value="[% framework | html %]" /> > >+[% warning = 'FALSE' %] >+[% FOREACH record IN records %] >+ [% IF (record.frameworkcode != framework) %] >+ [% IF (warning != 'TRUE') %] >+ [% warning = 'TRUE' %] >+ <div class="dialog alert">Multiple authority types are used. There may be a data loss while merging.</div> >+ [% END %] >+ [% END %] >+[% END %] >+ > <fieldset class="action"><input type="submit" name="merge" value="Merge" /></fieldset> > </form> > >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25387
:
126415
|
126588
|
167226
|
167227
|
167258
|
168099
|
168100