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

(-)a/C4/AuthoritiesMarc.pm (-10 / +14 lines)
Lines 1407-1413 sub AddAuthorityTrees{ Link Here
1407
1407
1408
=head2 merge
1408
=head2 merge
1409
1409
1410
  $ref= &merge(mergefrom,$MARCfrom,$mergeto,$MARCto)
1410
  $ref= &merge(mergefrom,$MARCfrom,$mergeto,$MARCto,$overwrite)
1411
1411
1412
Could add some feature : Migrating from a typecode to an other for instance.
1412
Could add some feature : Migrating from a typecode to an other for instance.
1413
Then we should add some new parameter : bibliotargettag, authtargettag
1413
Then we should add some new parameter : bibliotargettag, authtargettag
Lines 1415-1421 Then we should add some new parameter : bibliotargettag, authtargettag Link Here
1415
=cut
1415
=cut
1416
1416
1417
sub merge {
1417
sub merge {
1418
    my ($mergefrom,$MARCfrom,$mergeto,$MARCto) = @_;
1418
    my ($mergefrom,$MARCfrom,$mergeto,$MARCto,$overwrite) = @_;
1419
    $overwrite = C4::Context->preference('overwriteSubfieldsOnMerge') unless defined $overwrite;
1419
    my ($counteditedbiblio,$countunmodifiedbiblio,$counterrors)=(0,0,0);        
1420
    my ($counteditedbiblio,$countunmodifiedbiblio,$counterrors)=(0,0,0);        
1420
    my $dbh=C4::Context->dbh;
1421
    my $dbh=C4::Context->dbh;
1421
    my $authtypecodefrom = GetAuthTypeCode($mergefrom);
1422
    my $authtypecodefrom = GetAuthTypeCode($mergefrom);
Lines 1491-1507 sub merge { Link Here
1491
                my $tag=$field->tag();          
1492
                my $tag=$field->tag();          
1492
                if ($auth_number==$mergefrom) {
1493
                if ($auth_number==$mergefrom) {
1493
                my $field_to=MARC::Field->new(($tag_to?$tag_to:$tag),$field->indicator(1),$field->indicator(2),"9"=>$mergeto);
1494
                my $field_to=MARC::Field->new(($tag_to?$tag_to:$tag),$field->indicator(1),$field->indicator(2),"9"=>$mergeto);
1494
		my $exclude='9';
1495
                my $exclude='9';
1495
                foreach my $subfield (grep {$_->[0] ne '9'} @record_to) {
1496
                foreach my $subfield (grep {$_->[0] ne '9'} @record_to) {
1496
                    $field_to->add_subfields($subfield->[0] =>$subfield->[1]);
1497
                    $field_to->add_subfields($subfield->[0] =>$subfield->[1]);
1497
		    $exclude.= $subfield->[0];
1498
                    $exclude.= $subfield->[0];
1498
                }
1499
                }
1499
		$exclude='['.$exclude.']';
1500
                $exclude='['.$exclude.']';
1500
#		add subfields in $field not included in @record_to
1501
                unless($overwrite) {
1501
		my @restore= grep {$_->[0]!~/$exclude/} $field->subfields();
1502
                    # add subfields in $field not included in @record_to
1502
                foreach my $subfield (@restore) {
1503
                    my @restore= grep {$_->[0]!~/$exclude/} $field->subfields();
1503
                   $field_to->add_subfields($subfield->[0] =>$subfield->[1]);
1504
                    foreach my $subfield (@restore) {
1504
		}
1505
                        $field_to->add_subfields($subfield->[0] =>$subfield->[1]);
1506
                    }
1507
                }
1508
1505
                $marcrecord->delete_field($field);
1509
                $marcrecord->delete_field($field);
1506
                $marcrecord->insert_grouped_field($field_to);            
1510
                $marcrecord->insert_grouped_field($field_to);            
1507
                $update=1;
1511
                $update=1;
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 291-296 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
291
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
291
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
292
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
292
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
293
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
293
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
294
('overwriteSubfieldsOnMerge','0',NULL,'Overwrite the biblio\'s subfields when merging an authority record with a biblio record.','YesNo'),
294
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
295
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
295
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
296
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
296
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
297
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 7953-7958 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
7953
    SetVersion($DBversion);
7953
    SetVersion($DBversion);
7954
}
7954
}
7955
7955
7956
$DBversion = "XXX";
7957
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
7958
    $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')");
7959
    print "Add the overwriteSubfieldsOnMerge preference.\n";
7960
    SetVersion($DBversion);
7961
}
7962
7956
=head1 FUNCTIONS
7963
=head1 FUNCTIONS
7957
7964
7958
=head2 TableExists($table)
7965
=head2 TableExists($table)
(-)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 (fixed length data elements). Do NOT include the date (position 00-05).
54
            - Use the following text for the contents of UNIMARC authority field 100 position (fixed length data elements). Do NOT include the date (position 00-05).
48
            - pref: UNIMARCAuthorityField100
55
            - pref: UNIMARCAuthorityField100
49
              defautl: "afrey50      ba0"
56
              defautl: "afrey50      ba0"
50
- 

Return to bug 11315