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

(-)a/C4/Search.pm (-1 / +1 lines)
Lines 1164-1170 sub buildQuery { Link Here
1164
                        $weight_fields, $fuzzy_enabled,
1164
                        $weight_fields, $fuzzy_enabled,
1165
                        $remove_stopwords
1165
                        $remove_stopwords
1166
                    ) = ( 0, 0, 0, 0, 0 );
1166
                    ) = ( 0, 0, 0, 0, 0 );
1167
1167
                    $operand =~ s/-//g if (C4::Context->preference("IsbnIssnRemoveHyphens"));
1168
                }
1168
                }
1169
1169
1170
                if(not $index){
1170
                if(not $index){
(-)a/admin/systempreferences.pl (+1 lines)
Lines 153-158 $tabsysprefs{'item-level_itypes'} = "Cataloging"; Link Here
153
$tabsysprefs{OpacSuppression}             = "Cataloging";
153
$tabsysprefs{OpacSuppression}             = "Cataloging";
154
$tabsysprefs{SpineLabelFormat}            = "Cataloging";
154
$tabsysprefs{SpineLabelFormat}            = "Cataloging";
155
$tabsysprefs{SpineLabelAutoPrint}         = "Cataloging";
155
$tabsysprefs{SpineLabelAutoPrint}         = "Cataloging";
156
$tabsysprefs{IsbnIssnRemoveHyphens}       = "Cataloging";
156
157
157
# Circulation
158
# Circulation
158
$tabsysprefs{maxoutstanding}                 = "Circulation";
159
$tabsysprefs{maxoutstanding}                 = "Circulation";
(-)a/installer/data/mysql/de-DE/mandatory/sysprefs.sql (+1 lines)
Lines 314-316 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
314
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems' ,'','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O    pacHiddenItems.txt for more informations.','','Textarea');
314
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems' ,'','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O    pacHiddenItems.txt for more informations.','','Textarea');
315
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
315
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
316
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
316
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
317
INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo');
(-)a/installer/data/mysql/en/mandatory/sysprefs.sql (+1 lines)
Lines 314-316 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
314
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
314
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
315
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
315
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
316
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
316
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
317
INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo');
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql (+1 lines)
Lines 315-317 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
315
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
315
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
316
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
316
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
317
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
317
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
318
INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo');
(-)a/installer/data/mysql/it-IT/necessari/sysprefs.sql (+1 lines)
Lines 301-303 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
301
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O    pacHiddenItems.txt for more informations.','','Textarea');
301
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O    pacHiddenItems.txt for more informations.','','Textarea');
302
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
302
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
303
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
303
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
304
INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo');
(-)a/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql (+1 lines)
Lines 321-323 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( Link Here
321
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free');
321
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free');
322
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free');
322
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free');
323
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all subdivisions for subject tracings.','1','YesNo');
323
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all subdivisions for subject tracings.','1','YesNo');
324
INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo');
(-)a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql (+1 lines)
Lines 313-315 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
313
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
313
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
314
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
314
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
315
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
315
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
316
INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo');
(-)a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql (+1 lines)
Lines 368-370 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
368
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
368
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
369
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
369
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
370
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
370
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
371
INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo');
(-)a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql (+1 lines)
Lines 393-395 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
393
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O    pacHiddenItems.txt for more informations.','','Textarea');
393
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O    pacHiddenItems.txt for more informations.','','Textarea');
394
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
394
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
395
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
395
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
396
INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 4370-4375 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4370
    SetVersion($DBversion);
4370
    SetVersion($DBversion);
4371
}
4371
}
4372
4372
4373
$DBversion = "3.05.00.XXX";
4374
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4375
    $dbh->do("INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo');");
4376
    print "Upgrade to $DBversion done (Add SysPref to remove hyphens or not into isbn and issn)\n";
4377
    SetVersion($DBversion);
4378
}
4379
4373
=head1 FUNCTIONS
4380
=head1 FUNCTIONS
4374
4381
4375
=head2 DropAllForeignKeys($table)
4382
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (+6 lines)
Lines 84-89 Cataloging: Link Here
84
                  annual: generated in the form &lt;year&gt;-0001, &lt;year&gt;-0002.
84
                  annual: generated in the form &lt;year&gt;-0001, &lt;year&gt;-0002.
85
                  hbyymmincr: generated in the form &lt;branchcode&gt;yymm0001.
85
                  hbyymmincr: generated in the form &lt;branchcode&gt;yymm0001.
86
                  "OFF": not generated automatically.
86
                  "OFF": not generated automatically.
87
        -
88
            - pref: IsbnIssnRemoveHyphens
89
              choices:
90
                  yes: "Remove"
91
                  no: "Don't remove"
92
            - hyphens from ISBN and ISSN
87
    Display:
93
    Display:
88
        -
94
        -
89
            - 'Separate multiple displayed authors, series or subjects with '
95
            - 'Separate multiple displayed authors, series or subjects with '
(-)a/misc/bin/zebraqueue_daemon.pl (+33 lines)
Lines 227-232 sub process_update { Link Here
227
    my $marcxml;
227
    my $marcxml;
228
    if ($server eq "biblioserver") {
228
    if ($server eq "biblioserver") {
229
        my $marc = GetMarcBiblio($record_number);
229
        my $marc = GetMarcBiblio($record_number);
230
	    # 
231
	    if ($marc && C4::Context->preference("IsbnIssnRemoveHyphens")){
232
	           my $isbn;
233
	           my $issn;
234
	           my $encoding = C4::Context->preference("marcflavour");
235
	               if ( $encoding eq 'UNIMARC' ) {
236
	                       foreach my $f010 ($marc->field('010')) {
237
	                               if ( $f010->subfield('a') ) {
238
	                                       $isbn = $f010->subfield('a');
239
	                                       $isbn =~ s/-//g;
240
	                                       $f010->update( 'a' => $isbn );
241
	                               }
242
	                       }
243
	                       foreach my $f011 ($marc->field('011')) {
244
	                               if ( $f011->subfield('a') ) {
245
	                                       $issn = $f011->subfield('a');
246
	                                       $issn =~ s/-//g;
247
	                                       $f011->update( 'a' => $issn );
248
	                               }
249
	                       }
250
	               } elsif ($encoding eq 'MARC21' || $encoding eq 'NORMARC') {
251
	                       foreach my $f020 ($marc->field('020')) {
252
	                               $isbn = $f020->subfield('a');
253
	                               $isbn =~ s/-//g;
254
	                               $f020->update( 'a' => $isbn );
255
	                       }
256
	                       foreach my $f022 ($marc->field('022')) {
257
	                               $issn = $f022->subfield('a');
258
	                               $issn =~ s/-//g;
259
	                               $f022->update( 'a' => $issn );
260
	                       }
261
	               }
262
	    }
230
        $marcxml = $marc->as_xml_record() if $marc;
263
        $marcxml = $marc->as_xml_record() if $marc;
231
    } 
264
    } 
232
    elsif ($server eq "authorityserver") {
265
    elsif ($server eq "authorityserver") {
(-)a/misc/cronjobs/zebraqueue_start.pl (+33 lines)
Lines 58-63 while (($id,$biblionumber,$operation,$server)=$readsth->fetchrow){ Link Here
58
            # get the XML
58
            # get the XML
59
            if ($server eq "biblioserver") {
59
            if ($server eq "biblioserver") {
60
                my $marc = GetMarcBiblio($biblionumber);
60
                my $marc = GetMarcBiblio($biblionumber);
61
			    # 
62
			    if ($marc && C4::Context->preference("IsbnIssnRemoveHyphens")){
63
			           my $isbn;
64
			           my $issn;
65
			           my $encoding = C4::Context->preference("marcflavour");
66
			               if ( $encoding eq 'UNIMARC' ) {
67
			                       foreach my $f010 ($marc->field('010')) {
68
			                               if ( $f010->subfield('a') ) {
69
			                                       $isbn = $f010->subfield('a');
70
			                                       $isbn =~ s/-//g;
71
			                                       $f010->update( 'a' => $isbn );
72
			                               }
73
			                       }
74
			                       foreach my $f011 ($marc->field('011')) {
75
			                               if ( $f011->subfield('a') ) {
76
			                                       $issn = $f011->subfield('a');
77
			                                       $issn =~ s/-//g;
78
			                                       $f011->update( 'a' => $issn );
79
			                               }
80
			                       }
81
			               } elsif ($encoding eq 'MARC21' || $encoding eq 'NORMARC') {
82
			                       foreach my $f020 ($marc->field('020')) {
83
			                               $isbn = $f020->subfield('a');
84
			                               $isbn =~ s/-//g;
85
			                               $f020->update( 'a' => $isbn );
86
			                       }
87
			                       foreach my $f022 ($marc->field('022')) {
88
			                               $issn = $f022->subfield('a');
89
			                               $issn =~ s/-//g;
90
			                               $f022->update( 'a' => $issn );
91
			                       }
92
			               }
93
			    }
61
                $marcxml = $marc->as_xml_record() if $marc;
94
                $marcxml = $marc->as_xml_record() if $marc;
62
            } elsif ($server eq "authorityserver") {
95
            } elsif ($server eq "authorityserver") {
63
                $marcxml =C4::AuthoritiesMarc::GetAuthorityXML($biblionumber);
96
                $marcxml =C4::AuthoritiesMarc::GetAuthorityXML($biblionumber);
(-)a/misc/migration_tools/rebuild_zebra.pl (+63 lines)
Lines 320-325 sub export_marc_records_from_sth { Link Here
320
                          ? GetXmlBiblio( $record_number )
320
                          ? GetXmlBiblio( $record_number )
321
                          : GetAuthorityXML( $record_number );
321
                          : GetAuthorityXML( $record_number );
322
            if ($record_type eq 'biblio'){
322
            if ($record_type eq 'biblio'){
323
            	$marcxml = fix_isbn_hyphens($marcxml, 1) if C4::Context->preference("IsbnIssnRemoveHyphens");
323
                my @items = GetItemsInfo($record_number);
324
                my @items = GetItemsInfo($record_number);
324
                if (@items){
325
                if (@items){
325
                    my $record = MARC::Record->new;
326
                    my $record = MARC::Record->new;
Lines 433-438 sub get_corrected_marc_record { Link Here
433
434
434
    if (defined $marc) {
435
    if (defined $marc) {
435
        fix_leader($marc);
436
        fix_leader($marc);
437
        $marc = fix_isbn_hyphens($marc, 0) if C4::Context->preference("IsbnIssnRemoveHyphens");
436
        if ($record_type eq 'biblio') {
438
        if ($record_type eq 'biblio') {
437
            my $succeeded = fix_biblio_ids($marc, $record_number);
439
            my $succeeded = fix_biblio_ids($marc, $record_number);
438
            return unless $succeeded;
440
            return unless $succeeded;
Lines 572-577 sub fix_unimarc_100 { Link Here
572
    }
574
    }
573
}
575
}
574
576
577
sub fix_isbn_hyphens {
578
    my $data = shift;
579
    my $isxml = shift;
580
581
	my $isbn;
582
	my $issn;
583
	my $encoding = C4::Context->preference("marcflavour");
584
585
	if ( $encoding eq 'UNIMARC' ) {
586
		unless ($isxml){
587
			foreach my $f010 ($data->field('010')) {
588
				$isbn = $f010->subfield('a');
589
				$isbn =~ s/-//g;
590
				$f010->update( 'a' => $isbn );
591
			}
592
			foreach my $f011 ($data->field('011')) {
593
				if ( $f011->subfield('a') ) {
594
					$issn = $f011->subfield('a');
595
					$issn =~ s/-//g;
596
					$f011->update( 'a' => $issn );
597
				}
598
			}
599
		}else{
600
			my $parser = XML::LibXML->new();
601
			$parser->recover_silently(1);
602
			my $xslt = XML::LibXSLT->new();
603
			my $source = $parser->parse_string($data);
604
			
605
			my $style_doc = $parser->parse_file("$kohadir/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensUNIMARC.xsl");
606
			my $stylesheet = $xslt->parse_stylesheet($style_doc);
607
			my $result_parse = $stylesheet->transform($source);
608
			$data = $stylesheet->output_string($result_parse);
609
		}
610
	} elsif ($encoding eq 'MARC21' || $encoding eq 'NORMARC') {
611
		unless ($isxml){
612
			foreach my $f020 ($data->field('020')) {
613
				$isbn = $f020->subfield('a');
614
				$isbn =~ s/-//g;
615
				$f020->update( 'a' => $isbn );
616
			}
617
			foreach my $f022 ($data->field('022')) {
618
				$issn = $f022->subfield('a');
619
				$issn =~ s/-//g;
620
				$f022->update( 'a' => $issn );
621
			}
622
		}else{
623
			my $parser = XML::LibXML->new();
624
			$parser->recover_silently(1);
625
			my $xslt = XML::LibXSLT->new();
626
			my $source = $parser->parse_string($data);
627
			
628
			my $style_doc = $parser->parse_file("$kohadir/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensMARC21.xsl");
629
			my $stylesheet = $xslt->parse_stylesheet($style_doc);
630
			my $result_parse = $stylesheet->transform($source);
631
			$data = $stylesheet->output_string($result_parse);
632
		}
633
	}
634
	
635
	return $data;
636
}
637
575
sub do_indexing {
638
sub do_indexing {
576
    my ($record_type, $op, $record_dir, $reset_index, $noshadow, $record_format, $zebraidx_log_opt) = @_;
639
    my ($record_type, $op, $record_dir, $reset_index, $noshadow, $record_format, $zebraidx_log_opt) = @_;
577
640
(-)a/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensMARC21.xsl (+56 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pz="http://www.indexdata.com/pazpar2/1.0" xmlns:marc="http://www.loc.gov/MARC21/slim">
3
	<xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
4
5
	<xsl:template name="replace-string">
6
		<xsl:param name="text" />
7
		<xsl:param name="from" />
8
		<xsl:param name="to" />
9
10
		<xsl:choose>
11
			<xsl:when test="contains($text, $from)">
12
				<xsl:variable name="before" select="substring-before($text, $from)" />
13
				<xsl:variable name="after" select="substring-after($text, $from)" />
14
				<xsl:variable name="prefix" select="concat($before, $to)" />
15
				<xsl:value-of select="$before" />
16
				<xsl:value-of select="$to" />
17
				<xsl:call-template name="replace-string">
18
					<xsl:with-param name="text" select="$after" />
19
					<xsl:with-param name="from" select="$from" />
20
					<xsl:with-param name="to" select="$to" />
21
				</xsl:call-template>
22
			</xsl:when>
23
			<xsl:otherwise>
24
				<xsl:value-of select="$text" />
25
			</xsl:otherwise>
26
		</xsl:choose>
27
	</xsl:template>
28
29
	<xsl:template match="node()|@*">
30
		<xsl:copy>
31
			<xsl:apply-templates select="node()|@*"/>
32
		</xsl:copy>
33
	</xsl:template>
34
35
	<xsl:template match="marc:record/marc:datafield[@tag='020']/marc:subfield[@code='a']">
36
		<xsl:copy>
37
			<xsl:attribute name="code">a</xsl:attribute>
38
			<xsl:call-template name="replace-string">
39
				<xsl:with-param name="text" select="text()"/>
40
				<xsl:with-param name="from" select="'-'"/>
41
				<xsl:with-param name="to" select="''"/>
42
			</xsl:call-template>
43
		</xsl:copy>
44
	</xsl:template>
45
	
46
	<xsl:template match="marc:record/marc:datafield[@tag='022']/marc:subfield[@code='a']">
47
		<xsl:copy>
48
			<xsl:attribute name="code">a</xsl:attribute>
49
			<xsl:call-template name="replace-string">
50
				<xsl:with-param name="text" select="text()"/>
51
				<xsl:with-param name="from" select="'-'"/>
52
				<xsl:with-param name="to" select="''"/>
53
			</xsl:call-template>
54
		</xsl:copy>
55
	</xsl:template>
56
</xsl:stylesheet>
(-)a/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensUNIMARC.xsl (-1 / +56 lines)
Line 0 Link Here
0
- 
1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pz="http://www.indexdata.com/pazpar2/1.0" xmlns:marc="http://www.loc.gov/MARC21/slim">
3
	<xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
4
5
	<xsl:template name="replace-string">
6
		<xsl:param name="text" />
7
		<xsl:param name="from" />
8
		<xsl:param name="to" />
9
10
		<xsl:choose>
11
			<xsl:when test="contains($text, $from)">
12
				<xsl:variable name="before" select="substring-before($text, $from)" />
13
				<xsl:variable name="after" select="substring-after($text, $from)" />
14
				<xsl:variable name="prefix" select="concat($before, $to)" />
15
				<xsl:value-of select="$before" />
16
				<xsl:value-of select="$to" />
17
				<xsl:call-template name="replace-string">
18
					<xsl:with-param name="text" select="$after" />
19
					<xsl:with-param name="from" select="$from" />
20
					<xsl:with-param name="to" select="$to" />
21
				</xsl:call-template>
22
			</xsl:when>
23
			<xsl:otherwise>
24
				<xsl:value-of select="$text" />
25
			</xsl:otherwise>
26
		</xsl:choose>
27
	</xsl:template>
28
29
	<xsl:template match="node()|@*">
30
		<xsl:copy>
31
			<xsl:apply-templates select="node()|@*"/>
32
		</xsl:copy>
33
	</xsl:template>
34
35
	<xsl:template match="marc:record/marc:datafield[@tag='010']/marc:subfield[@code='a']">
36
		<xsl:copy>
37
			<xsl:attribute name="code">a</xsl:attribute>
38
			<xsl:call-template name="replace-string">
39
				<xsl:with-param name="text" select="text()"/>
40
				<xsl:with-param name="from" select="'-'"/>
41
				<xsl:with-param name="to" select="''"/>
42
			</xsl:call-template>
43
		</xsl:copy>
44
	</xsl:template>
45
	
46
	<xsl:template match="marc:record/marc:datafield[@tag='011']/marc:subfield[@code='a']">
47
		<xsl:copy>
48
			<xsl:attribute name="code">a</xsl:attribute>
49
			<xsl:call-template name="replace-string">
50
				<xsl:with-param name="text" select="text()"/>
51
				<xsl:with-param name="from" select="'-'"/>
52
				<xsl:with-param name="to" select="''"/>
53
			</xsl:call-template>
54
		</xsl:copy>
55
	</xsl:template>
56
</xsl:stylesheet>

Return to bug 6590