|
Lines 35-41
use C4::Biblio qw( GetMarcFromKohaField );
Link Here
|
| 35 |
# Option 3: CheckItemsStatus - Check for bibliographic records and items without an item type or with an invalid item type |
35 |
# Option 3: CheckItemsStatus - Check for bibliographic records and items without an item type or with an invalid item type |
| 36 |
# Option 4: CheckItemsFramework - Check for invalid values in fields where the framework limits to an authorized value category |
36 |
# Option 4: CheckItemsFramework - Check for invalid values in fields where the framework limits to an authorized value category |
| 37 |
# Option 5: CheckItemsTitle - Check for bibliographic records without a title |
37 |
# Option 5: CheckItemsTitle - Check for bibliographic records without a title |
| 38 |
# Option 6: CheckRelationshipsLoop - Check for relationships or dependencies between borrowers in a loop |
38 |
# Option 6: CheckAgeForCategory - Check for patrons with invalid age for category |
| 39 |
|
39 |
|
| 40 |
my %methods = ( |
40 |
my %methods = ( |
| 41 |
1 => \&CheckItemsBranch, |
41 |
1 => \&CheckItemsBranch, |
|
Lines 43-49
my %methods = (
Link Here
|
| 43 |
3 => \&CheckItemsStatus, |
43 |
3 => \&CheckItemsStatus, |
| 44 |
4 => \&CheckItemsFramework, |
44 |
4 => \&CheckItemsFramework, |
| 45 |
5 => \&CheckItemsTitle, |
45 |
5 => \&CheckItemsTitle, |
| 46 |
6 => \&CheckRelationshipsLoop, |
46 |
6 => \&CheckAgeForCategory, |
| 47 |
); |
47 |
); |
| 48 |
|
48 |
|
| 49 |
my @methods_to_run; |
49 |
my @methods_to_run; |
|
Lines 113-125
sub CheckItemsAuthHeader {
Link Here
|
| 113 |
while ( my $item = $items_without_itype->next ) { |
113 |
while ( my $item = $items_without_itype->next ) { |
| 114 |
if (defined $item->biblioitem->itemtype && $item->biblioitem->itemtype ne '' ) { |
114 |
if (defined $item->biblioitem->itemtype && $item->biblioitem->itemtype ne '' ) { |
| 115 |
new_item( |
115 |
new_item( |
| 116 |
sprintf "Item with itemnumber=%s does not have a itype value, biblio's item type will be used (%s)", |
116 |
sprintf "Item with itemnumber=%s and biblionumber = %s does not have a itype value, biblio's item type will be used (%s)", |
| 117 |
$item->itemnumber, $item->biblioitem->itemtype |
117 |
$item->itemnumber, $item->biblioitem->biblionumber, $item->biblioitem->itemtype |
| 118 |
); |
118 |
); |
| 119 |
} else { |
119 |
} else { |
| 120 |
new_item( |
120 |
new_item( |
| 121 |
sprintf "Item with itemnumber=%s does not have a itype value, additionally no item type defined for biblionumber=%s", |
121 |
sprintf "Item with itemnumber=%s and biblionumber = %s does not have a itype value, additionally no item type defined for biblionumber=%s", |
| 122 |
$item->itemnumber, $item->biblioitem->biblionumber |
122 |
$item->itemnumber, $item->biblioitem->biblionumber, $item->biblioitem->biblionumber |
| 123 |
); |
123 |
); |
| 124 |
} |
124 |
} |
| 125 |
} |
125 |
} |
|
Lines 307-318
if (%$invalid_av_per_framework) {
Link Here
|
| 307 |
: $table eq 'biblio' |
307 |
: $table eq 'biblio' |
| 308 |
? $i->biblio->$column |
308 |
? $i->biblio->$column |
| 309 |
: $i->biblioitem->$column; |
309 |
: $i->biblioitem->$column; |
| 310 |
$output .= " {" . $i->itemnumber . " => " . $value . "}\n"; |
310 |
$output .= " {" . $i->itemnumber . " and " . $i->biblioitem->biblionumber. " => " . $value . "}\n"; |
| 311 |
} |
311 |
} |
| 312 |
new_item( |
312 |
new_item( |
| 313 |
sprintf( |
313 |
sprintf( |
| 314 |
"The Framework *%s* is using the authorised value's category *%s*, " |
314 |
"The Framework *%s* is using the authorised value's category *%s*, " |
| 315 |
. "but the following %s do not have a value defined ({itemnumber => value }):\n%s", |
315 |
. "but the following %s do not have a value defined ({itemnumber and biblionumber => value }):\n%s", |
| 316 |
$frameworkcode, $av_category, $kohafield, $output |
316 |
$frameworkcode, $av_category, $kohafield, $output |
| 317 |
) |
317 |
) |
| 318 |
); |
318 |
); |
|
Lines 374-470
new_hint("You may change the patron's category automatically with misc/cronjobs/
Link Here
|
| 374 |
} |
374 |
} |
| 375 |
} |
375 |
} |
| 376 |
|
376 |
|
| 377 |
sub CheckRelationshipsLoop { |
|
|
| 378 |
my @loop_borrowers_relationships; |
| 379 |
my @relationships = Koha::Patron::Relationships->search(); |
| 380 |
my @patrons_guarantors = Koha::Patron::Relationships::guarantors(@relationships)->as_list; |
| 381 |
my @patrons_guarantees = Koha::Patron::Relationships::guarantees(@relationships)->as_list; |
| 382 |
|
| 383 |
foreach my $patron_guarantor (@patrons_guarantors) { |
| 384 |
foreach my $patron_guarantee (@patrons_guarantees) { |
| 385 |
if ($patron_guarantor->borrowernumber == $patron_guarantee->borrowernumber) { |
| 386 |
|
| 387 |
my $relationship_id; |
| 388 |
my $guarantee_id; |
| 389 |
my $size_list; |
| 390 |
my $tmp_garantor_id = $patron_guarantor->borrowernumber; |
| 391 |
my @relationship_ids; |
| 392 |
my @guarantor_to_find; |
| 393 |
|
| 394 |
push @guarantor_to_find, $patron_guarantor->borrowernumber; |
| 395 |
|
| 396 |
do { |
| 397 |
my @relationship_for_go = Koha::Patron::Relationships->search( |
| 398 |
{ |
| 399 |
-or => [ |
| 400 |
'guarantor_id' => { '=', $tmp_garantor_id }, |
| 401 |
] |
| 402 |
}, |
| 403 |
)->as_list; |
| 404 |
$size_list = scalar @relationship_for_go; |
| 405 |
|
| 406 |
foreach my $relation (@relationship_for_go) { |
| 407 |
$relationship_id = $relation->id; |
| 408 |
unless (grep { $_ == $relationship_id } @relationship_ids) { |
| 409 |
push @relationship_ids, $relationship_id; |
| 410 |
} |
| 411 |
$guarantee_id = $relation->guarantee_id; |
| 412 |
|
| 413 |
if (grep { $_ eq $guarantee_id } @guarantor_to_find) { |
| 414 |
last; |
| 415 |
} |
| 416 |
|
| 417 |
my @relationship_for_go = Koha::Patron::Relationships->search( |
| 418 |
{ |
| 419 |
-or => [ |
| 420 |
'guarantor_id' => { '=', $guarantee_id }, |
| 421 |
] |
| 422 |
}, |
| 423 |
)->as_list; |
| 424 |
$size_list = scalar @relationship_for_go; |
| 425 |
|
| 426 |
push @guarantor_to_find, $guarantee_id; |
| 427 |
|
| 428 |
foreach my $relation (@relationship_for_go) { |
| 429 |
$relationship_id = $relation->id; |
| 430 |
unless (grep { $_ == $relationship_id } @relationship_ids) { |
| 431 |
push @relationship_ids, $relationship_id; |
| 432 |
} |
| 433 |
$guarantee_id = $relation->guarantee_id; |
| 434 |
|
| 435 |
if (grep { $_ eq $guarantee_id } @guarantor_to_find) { |
| 436 |
last; |
| 437 |
} |
| 438 |
} |
| 439 |
if (grep { $_ eq $guarantee_id } @guarantor_to_find) { |
| 440 |
last; |
| 441 |
} |
| 442 |
} |
| 443 |
|
| 444 |
$tmp_garantor_id = $guarantee_id; |
| 445 |
} while ((!grep { $_ eq $guarantee_id } @guarantor_to_find) && $size_list > 0); |
| 446 |
|
| 447 |
if ($patron_guarantor->borrowernumber == $guarantee_id) { |
| 448 |
unless (grep { join("", sort @$_) eq join("", sort @relationship_ids) } @loop_borrowers_relationships) { |
| 449 |
push @loop_borrowers_relationships, \@relationship_ids; |
| 450 |
} |
| 451 |
} |
| 452 |
} |
| 453 |
} |
| 454 |
} |
| 455 |
|
| 456 |
if (scalar @loop_borrowers_relationships > 0) { |
| 457 |
new_section("The list of relationships id with guarantors who are also guarantee."); |
| 458 |
foreach my $table (@loop_borrowers_relationships) { |
| 459 |
new_item( |
| 460 |
sprintf "Relationships connected : %s |", |
| 461 |
join(" | ", @$table) |
| 462 |
); |
| 463 |
} |
| 464 |
new_hint("Relationships that form guarantor loops must be deleted"); |
| 465 |
} |
| 466 |
} |
| 467 |
|
| 468 |
sub new_section { |
377 |
sub new_section { |
| 469 |
my ( $name ) = @_; |
378 |
my ( $name ) = @_; |
| 470 |
say "\n== $name =="; |
379 |
say "\n== $name =="; |
| 471 |
- |
|
|