View | Details | Raw Unified | Return to bug 11315
Collapse All | Expand All

(-)a/C4/AuthoritiesMarc.pm (-10 / +14 lines)
Lines 1399-1405 sub AddAuthorityTrees{ Link Here
1399
1399
1400
=head2 merge
1400
=head2 merge
1401
1401
1402
  $ref= &merge(mergefrom,$MARCfrom,$mergeto,$MARCto)
1402
  $ref= &merge(mergefrom,$MARCfrom,$mergeto,$MARCto,$overwrite)
1403
1403
1404
Could add some feature : Migrating from a typecode to an other for instance.
1404
Could add some feature : Migrating from a typecode to an other for instance.
1405
Then we should add some new parameter : bibliotargettag, authtargettag
1405
Then we should add some new parameter : bibliotargettag, authtargettag
Lines 1407-1413 Then we should add some new parameter : bibliotargettag, authtargettag Link Here
1407
=cut
1407
=cut
1408
1408
1409
sub merge {
1409
sub merge {
1410
    my ($mergefrom,$MARCfrom,$mergeto,$MARCto) = @_;
1410
    my ($mergefrom,$MARCfrom,$mergeto,$MARCto,$overwrite) = @_;
1411
    $overwrite = C4::Context->preference('overwriteSubfieldsOnMerge') unless defined $overwrite;
1411
    my ($counteditedbiblio,$countunmodifiedbiblio,$counterrors)=(0,0,0);        
1412
    my ($counteditedbiblio,$countunmodifiedbiblio,$counterrors)=(0,0,0);        
1412
    my $dbh=C4::Context->dbh;
1413
    my $dbh=C4::Context->dbh;
1413
    my $authfrom = Koha::Authorities->find($mergefrom);
1414
    my $authfrom = Koha::Authorities->find($mergefrom);
Lines 1483-1499 sub merge { Link Here
1483
                my $tag=$field->tag();          
1484
                my $tag=$field->tag();          
1484
                if ($auth_number==$mergefrom) {
1485
                if ($auth_number==$mergefrom) {
1485
                my $field_to=MARC::Field->new(($tag_to?$tag_to:$tag),$field->indicator(1),$field->indicator(2),"9"=>$mergeto);
1486
                my $field_to=MARC::Field->new(($tag_to?$tag_to:$tag),$field->indicator(1),$field->indicator(2),"9"=>$mergeto);
1486
		my $exclude='9';
1487
                my $exclude='9';
1487
                foreach my $subfield (grep {$_->[0] ne '9'} @record_to) {
1488
                foreach my $subfield (grep {$_->[0] ne '9'} @record_to) {
1488
                    $field_to->add_subfields($subfield->[0] =>$subfield->[1]);
1489
                    $field_to->add_subfields($subfield->[0] =>$subfield->[1]);
1489
		    $exclude.= $subfield->[0];
1490
                    $exclude.= $subfield->[0];
1490
                }
1491
                }
1491
		$exclude='['.$exclude.']';
1492
                $exclude='['.$exclude.']';
1492
#		add subfields in $field not included in @record_to
1493
                unless($overwrite) {
1493
		my @restore= grep {$_->[0]!~/$exclude/} $field->subfields();
1494
                    # add subfields in $field not included in @record_to
1494
                foreach my $subfield (@restore) {
1495
                    my @restore= grep {$_->[0]!~/$exclude/} $field->subfields();
1495
                   $field_to->add_subfields($subfield->[0] =>$subfield->[1]);
1496
                    foreach my $subfield (@restore) {
1496
		}
1497
                        $field_to->add_subfields($subfield->[0] =>$subfield->[1]);
1498
                    }
1499
                }
1500
1497
                $marcrecord->delete_field($field);
1501
                $marcrecord->delete_field($field);
1498
                $marcrecord->insert_grouped_field($field_to);            
1502
                $marcrecord->insert_grouped_field($field_to);            
1499
                $update=1;
1503
                $update=1;
(-)a/installer/data/mysql/atomicupdate/BZ11315_ADD_SUPPORT_FOR_SUBFIELD_DELETION_WHEN_DOING_AUTHORITY_MERGES.perl (+6 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('overwriteSubfieldsOnMerge','0',NULL,'Overwrite the biblio\\'s subfields when merging an authority record with a biblio record.','YesNo')");
4
    SetVersion( $DBversion );
5
    print "Upgrade to $DBversion done (Bug 11315 - Add the overwriteSubfieldsOnMerge preference)\n";
6
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 389-394 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
389
('OverdueNoticeCalendar',0,NULL,'Take the calendar into consideration when generating overdue notices','YesNo'),
389
('OverdueNoticeCalendar',0,NULL,'Take the calendar into consideration when generating overdue notices','YesNo'),
390
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
390
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
391
('OverduesBlockRenewing','allow','allow|blockitem|block','If any of patron checked out documents is late, should renewal be allowed, blocked only on overdue items or blocked on whatever checked out document','Choice'),
391
('OverduesBlockRenewing','allow','allow|blockitem|block','If any of patron checked out documents is late, should renewal be allowed, blocked only on overdue items or blocked on whatever checked out document','Choice'),
392
('overwriteSubfieldsOnMerge','0',NULL,'Overwrite the biblio\'s subfields when merging an authority record with a biblio record.','YesNo'),
392
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
393
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
393
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'),
394
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'),
394
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
395
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref (-1 / +7 lines)
Lines 44-49 Authorities: Link Here
44
                  no: "Don't use"
44
                  no: "Don't use"
45
            - authority record numbers instead of text strings for searches from subject tracings.
45
            - authority record numbers instead of text strings for searches from subject tracings.
46
        -
46
        -
47
            - pref: overwriteSubfieldsOnMerge
48
              default: no
49
              choices:
50
                  yes: Overwrite
51
                  no: "Don't overwrite"
52
            - "the biblio's subfields when merging an authority record with a biblio record."
53
        -
47
            - Use the following text for the contents of UNIMARC authority field 100 position 08-35 (fixed length data elements). Do NOT include the date (position 00-07).
54
            - Use the following text for the contents of UNIMARC authority field 100 position 08-35 (fixed length data elements). Do NOT include the date (position 00-07).
48
            - pref: UNIMARCAuthorityField100
55
            - pref: UNIMARCAuthorityField100
49
              defautl: "afrey50      ba0"
56
              defautl: "afrey50      ba0"
50
- 

Return to bug 11315