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

(-)a/C4/Items.pm (-1 / +16 lines)
Lines 30-35 use MARC::Record; Link Here
30
use C4::ClassSource;
30
use C4::ClassSource;
31
use C4::Log;
31
use C4::Log;
32
use List::MoreUtils qw/any/;
32
use List::MoreUtils qw/any/;
33
use C4::OAI::Sets qw/UpdateOAISetsBiblio/;
33
use Data::Dumper; # used as part of logging item record changes, not just for
34
use Data::Dumper; # used as part of logging item record changes, not just for
34
                  # debugging; so please don't remove this
35
                  # debugging; so please don't remove this
35
36
Lines 269-275 sub AddItem { Link Here
269
    $item->{'itemnumber'} = $itemnumber;
270
    $item->{'itemnumber'} = $itemnumber;
270
271
271
    ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver", undef, undef );
272
    ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver", undef, undef );
272
   
273
274
    if(C4::Context->preference('OAI-PMH:AutoUpdateSets')) {
275
        my $record = GetMarcBiblio($biblionumber, 1);
276
        UpdateOAISetsBiblio($biblionumber, $record);
277
    }
278
273
    logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
279
    logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
274
    
280
    
275
    return ($item->{biblionumber}, $item->{biblioitemnumber}, $itemnumber);
281
    return ($item->{biblionumber}, $item->{biblioitemnumber}, $itemnumber);
Lines 373-378 sub AddItemBatchFromMarc { Link Here
373
        $record->delete_field($item_field);
379
        $record->delete_field($item_field);
374
    }
380
    }
375
381
382
    if(C4::Context->preference('OAI-PMH:AutoUpdateSets')) {
383
        UpdateOAISetsBiblio($biblionumber, $record);
384
    }
385
376
    # update the MARC biblio
386
    # update the MARC biblio
377
 #   $biblionumber = ModBiblioMarc( $record, $biblionumber, $frameworkcode );
387
 #   $biblionumber = ModBiblioMarc( $record, $biblionumber, $frameworkcode );
378
388
Lines 520-525 sub ModItem { Link Here
520
    # item status is possible
530
    # item status is possible
521
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
531
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
522
532
533
    if(C4::Context->preference('OAI-PMH:AutoUpdateSets')) {
534
        my $record = GetMarcBiblio($biblionumber, 1);
535
        UpdateOAISetsBiblio($biblionumber, $record);
536
    }
537
523
    logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog");
538
    logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog");
524
}
539
}
525
540
(-)a/misc/migration_tools/build_oai_sets.pl (-14 / +12 lines)
Lines 17-29 Link Here
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
19
20
=head1 NAME
21
22
build_oai_sets.pl - Build OAI-PMH sets for use with opac/oai.pl
23
24
=head1 SYNOPSIS
25
26
    build_oai_sets.pl -h
27
    build_oai_sets.pl -v -r -i -l 5000 -o 5000
28
20
=head1 DESCRIPTION
29
=head1 DESCRIPTION
21
30
22
This script build OAI-PMH sets (to be used by opac/oai.pl) according to sets
31
This script build OAI-PMH sets (to be used by opac/oai.pl) according to sets
23
and mappings defined in Koha. It reads informations from oai_sets and
32
and mappings defined in Koha. It reads informations from oai_sets and
24
oai_sets_mappings, and then fill table oai_sets_biblios with builded infos.
33
oai_sets_mappings, and then fill table oai_sets_biblios with builded infos.
25
34
26
=head1 USAGE
35
=head1 OPTIONS
27
36
28
    build_oai_sets.pl [-h] [-v] [-r] [-i] [-l LENGTH [-o OFFSET]]
37
    build_oai_sets.pl [-h] [-v] [-r] [-i] [-l LENGTH [-o OFFSET]]
29
        -h          Print help message;
38
        -h          Print help message;
Lines 41-46 use MARC::Record; Link Here
41
use MARC::File::XML;
50
use MARC::File::XML;
42
use List::MoreUtils qw/uniq/;
51
use List::MoreUtils qw/uniq/;
43
use Getopt::Std;
52
use Getopt::Std;
53
use Pod::Usage;
44
54
45
use C4::Context;
55
use C4::Context;
46
use C4::Charset qw/StripNonXmlChars/;
56
use C4::Charset qw/StripNonXmlChars/;
Lines 52-59 $Getopt::Std::STANDARD_HELP_VERSION = 1; Link Here
52
my $go = getopts('vo:l:ihr', \%opts);
62
my $go = getopts('vo:l:ihr', \%opts);
53
63
54
if(!$go or $opts{h}){
64
if(!$go or $opts{h}){
55
    &print_usage;
65
    pod2usage(-verbose => 1);
56
    exit;
57
}
66
}
58
67
59
my $verbose = $opts{v};
68
my $verbose = $opts{v};
Lines 153-165 if($reset) { Link Here
153
}
162
}
154
AddOAISetsBiblios($sets_biblios);
163
AddOAISetsBiblios($sets_biblios);
155
print "done.\n";
164
print "done.\n";
156
157
sub print_usage {
158
    print "build_oai_sets.pl: Build OAI-PMH sets, according to mappings defined in Koha\n";
159
    print "Usage: build_oai_sets.pl [-h] [-v] [-i] [-l LENGTH [-o OFFSET]]\n\n";
160
    print "\t-h\t\tPrint this help and exit\n";
161
    print "\t-v\t\tBe verbose\n";
162
    print "\t-i\t\tEmbed items informations, mandatory if you defined mappings on item fields\n";
163
    print "\t-l LENGTH\tProcess LENGTH biblios\n";
164
    print "\t-o OFFSET\tIf LENGTH is defined, start processing from OFFSET\n\n";
165
}
166
- 

Return to bug 6440