misc/maintenance/sync_items_in_marcbibs enhance
Adding a way do select the biblios you want to update Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
This commit is contained in:
parent
8dd9e34b25
commit
00dac95bdf
1 changed files with 8 additions and 2 deletions
|
@ -18,9 +18,11 @@ $| = 1;
|
|||
# command-line parameters
|
||||
my $want_help = 0;
|
||||
my $do_update = 0;
|
||||
my $wherestrings;
|
||||
|
||||
my $result = GetOptions(
|
||||
'run-update' => \$do_update,
|
||||
'where=s@' => \$wherestrings,
|
||||
'h|help' => \$want_help,
|
||||
);
|
||||
|
||||
|
@ -46,9 +48,12 @@ $dbh->commit();
|
|||
exit 0;
|
||||
|
||||
sub process_bibs {
|
||||
my $sql = "SELECT biblionumber FROM biblio ORDER BY biblionumber ASC";
|
||||
my $sql = "SELECT biblionumber FROM biblio JOIN biblioitems USING (biblionumber)";
|
||||
$sql.="WHERE ". join(" AND ",@$wherestrings) if ($wherestrings);
|
||||
$sql.="ORDER BY biblionumber ASC";
|
||||
my $sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
eval{$sth->execute();};
|
||||
if ($@){ die "error $@";};
|
||||
while (my ($biblionumber) = $sth->fetchrow_array()) {
|
||||
$num_bibs_processed++;
|
||||
process_bib($biblionumber);
|
||||
|
@ -139,6 +144,7 @@ not in sync with the items table.
|
|||
|
||||
Parameters:
|
||||
--run-update run the synchronization
|
||||
--where condition selects the biblios on a criterium (Repeatable)
|
||||
--help or -h show this message.
|
||||
_USAGE_
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue