Lines 30-36
GetOptions(
Link Here
|
30 |
'help|?' => \$help, |
30 |
'help|?' => \$help, |
31 |
); |
31 |
); |
32 |
|
32 |
|
33 |
if($help || !$config){ |
33 |
if ( $help || !$config ) { |
34 |
print <<EOF |
34 |
print <<EOF |
35 |
$0 --config=my.conf |
35 |
$0 --config=my.conf |
36 |
Parameters : |
36 |
Parameters : |
Lines 55-65
Config file format:
Link Here
|
55 |
password - koha user password, authentication |
55 |
password - koha user password, authentication |
56 |
match - marc_matchers.code: ISBN or ISSN |
56 |
match - marc_matchers.code: ISBN or ISSN |
57 |
overlay_action - import_batches.overlay_action: replace, create_new or ignore |
57 |
overlay_action - import_batches.overlay_action: replace, create_new or ignore |
|
|
58 |
overlay_framework - if overlaying records - move to a new framework, if blank will use default |
59 |
if not included it will use the framework of the existing record |
58 |
nomatch_action - import_batches.nomatch_action: create_new or ignore |
60 |
nomatch_action - import_batches.nomatch_action: create_new or ignore |
59 |
item_action - import_batches.item_action: always_add, |
61 |
item_action - import_batches.item_action: always_add, |
60 |
add_only_for_matches, add_only_for_new or ignore |
62 |
add_only_for_matches, add_only_for_new or ignore |
61 |
import_mode - stage or direct |
63 |
import_mode - stage or direct |
62 |
framework - to be used if import_mode is direct |
64 |
framework - to be used if import_mode is direct, if blank, will use default |
63 |
connexion_user - User sent from connexion client |
65 |
connexion_user - User sent from connexion client |
64 |
connexion_password - Password sent from connexion client |
66 |
connexion_password - Password sent from connexion client |
65 |
|
67 |
|
Lines 69-75
Config file format:
Link Here
|
69 |
All process related parameters (all but ip and port) have default values as |
71 |
All process related parameters (all but ip and port) have default values as |
70 |
per Koha import process. |
72 |
per Koha import process. |
71 |
EOF |
73 |
EOF |
72 |
; |
74 |
; |
73 |
exit; |
75 |
exit; |
74 |
} |
76 |
} |
75 |
|
77 |
|
Lines 353-381
sub handle_request {
Link Here
|
353 |
} |
355 |
} |
354 |
|
356 |
|
355 |
my $base_url = $self->{koha}; |
357 |
my $base_url = $self->{koha}; |
356 |
my $resp = $ua->post( $base_url.IMPORT_SVC_URI, |
358 |
my $resp = $ua->post( |
357 |
{'nomatch_action' => $self->{params}->{nomatch_action}, |
359 |
$base_url . IMPORT_SVC_URI, |
358 |
'overlay_action' => $self->{params}->{overlay_action}, |
360 |
{ |
359 |
'match' => $self->{params}->{match}, |
361 |
'nomatch_action' => $self->{params}->{nomatch_action}, |
360 |
'import_mode' => $self->{params}->{import_mode}, |
362 |
'overlay_action' => $self->{params}->{overlay_action}, |
361 |
'framework' => $self->{params}->{framework}, |
363 |
'match' => $self->{params}->{match}, |
362 |
'item_action' => $self->{params}->{item_action}, |
364 |
'import_mode' => $self->{params}->{import_mode}, |
363 |
'xml' => $data}); |
365 |
'framework' => $self->{params}->{framework}, |
|
|
366 |
'overlay_framework' => $self->{params}->{overlay_framework}, |
367 |
'item_action' => $self->{params}->{item_action}, |
368 |
'xml' => $data |
369 |
} |
370 |
); |
364 |
|
371 |
|
365 |
my $status = $resp->code; |
372 |
my $status = $resp->code; |
366 |
if ($status == HTTP_UNAUTHORIZED || $status == HTTP_FORBIDDEN) { |
373 |
if ( $status == HTTP_UNAUTHORIZED || $status == HTTP_FORBIDDEN ) { |
367 |
my $user = $self->{user}; |
374 |
my $user = $self->{user}; |
368 |
my $password = $self->{password}; |
375 |
my $password = $self->{password}; |
369 |
$resp = $ua->post( $base_url.AUTH_URI, { userid => $user, password => $password } ); |
376 |
$resp = $ua->post( $base_url . AUTH_URI, { userid => $user, password => $password } ); |
370 |
$resp = $ua->post( $base_url.IMPORT_SVC_URI, |
377 |
$resp = $ua->post( |
371 |
{'nomatch_action' => $self->{params}->{nomatch_action}, |
378 |
$base_url . IMPORT_SVC_URI, |
372 |
'overlay_action' => $self->{params}->{overlay_action}, |
379 |
{ |
373 |
'match' => $self->{params}->{match}, |
380 |
'nomatch_action' => $self->{params}->{nomatch_action}, |
374 |
'import_mode' => $self->{params}->{import_mode}, |
381 |
'overlay_action' => $self->{params}->{overlay_action}, |
375 |
'framework' => $self->{params}->{framework}, |
382 |
'match' => $self->{params}->{match}, |
376 |
'item_action' => $self->{params}->{item_action}, |
383 |
'import_mode' => $self->{params}->{import_mode}, |
377 |
'xml' => $data}) |
384 |
'framework' => $self->{params}->{framework}, |
378 |
if $resp->is_success; |
385 |
'overlay_framework' => $self->{params}->{overlay_framework}, |
|
|
386 |
'item_action' => $self->{params}->{item_action}, |
387 |
'xml' => $data |
388 |
} |
389 |
) if $resp->is_success; |
379 |
} |
390 |
} |
380 |
unless ($resp->is_success) { |
391 |
unless ($resp->is_success) { |
381 |
$self->log("Unsuccessful request", $resp->request->as_string, $resp->as_string); |
392 |
$self->log("Unsuccessful request", $resp->request->as_string, $resp->as_string); |