Lines 127-142
sub set_skip_options {
Link Here
|
127 |
# Set all check options to 1 if none are provided, considering skip options |
127 |
# Set all check options to 1 if none are provided, considering skip options |
128 |
sub set_all_check_options_if_none_provided { |
128 |
sub set_all_check_options_if_none_provided { |
129 |
my $any_check_option_provided = grep { $options{$_} } grep { /^check-/ } keys %options; |
129 |
my $any_check_option_provided = grep { $options{$_} } grep { /^check-/ } keys %options; |
130 |
if ( !$any_check_option_provided ) { |
|
|
131 |
foreach my $key ( keys %options ) { |
132 |
if ( $key =~ /^check-/ ) { |
133 |
my $skip_key = $key; |
134 |
$skip_key =~ s/^check-/skip-/; |
135 |
|
130 |
|
136 |
# Set check option to 1 unless the corresponding skip option indicated |
131 |
if ( !$any_check_option_provided ) { |
137 |
$options{$key} = 1 unless $options{$skip_key}; |
132 |
handle_invalid_options("No options selected"); |
138 |
} |
133 |
die; |
139 |
} |
|
|
140 |
} |
134 |
} |
141 |
} |
135 |
} |
142 |
|
136 |
|
Lines 284-297
sub CheckItemsStatus {
Link Here
|
284 |
} else { |
278 |
} else { |
285 |
$biblioitemnumber = $record->subfield( $biblioitem_tag, $biblioitem_subfield ); |
279 |
$biblioitemnumber = $record->subfield( $biblioitem_tag, $biblioitem_subfield ); |
286 |
} |
280 |
} |
287 |
if ( $biblionumber != $biblio->biblionumber ) { |
281 |
if ( not( defined $biblionumber ) and $biblionumber != $biblio->biblionumber ) { |
288 |
push @ids_not_in_marc, |
282 |
push @ids_not_in_marc, |
289 |
{ |
283 |
{ |
290 |
biblionumber => $biblio->biblionumber, |
284 |
biblionumber => $biblio->biblionumber, |
291 |
biblionumber_in_marc => $biblionumber, |
285 |
biblionumber_in_marc => $biblionumber, |
292 |
}; |
286 |
}; |
293 |
} |
287 |
} |
294 |
if ( $biblioitemnumber != $biblio->biblioitem->biblioitemnumber ) { |
288 |
if ( not( defined $biblioitemnumber ) and $biblioitemnumber != $biblio->biblioitem->biblioitemnumber ) { |
295 |
push @ids_not_in_marc, |
289 |
push @ids_not_in_marc, |
296 |
{ |
290 |
{ |
297 |
biblionumber => $biblio->biblionumber, |
291 |
biblionumber => $biblio->biblionumber, |
Lines 731-826
sub CheckRelationshipsLoop {
Link Here
|
731 |
} |
725 |
} |
732 |
} |
726 |
} |
733 |
|
727 |
|
734 |
sub CheckRelationshipsLoop { |
|
|
735 |
my @loop_borrowers_relationships; |
736 |
my @guarantor_ids = Koha::Patron::Relationships->_resultset->get_column('guarantor_id')->all(); |
737 |
my @guarantee_ids = Koha::Patron::Relationships->_resultset->get_column('guarantee_id')->all(); |
738 |
|
739 |
foreach my $guarantor_id (@guarantor_ids) { |
740 |
foreach my $guarantee_id (@guarantee_ids) { |
741 |
if ( $guarantor_id == $guarantee_id ) { |
742 |
|
743 |
my $relation_guarantor_id; |
744 |
my $relation_guarantee_id; |
745 |
my $size_list; |
746 |
my $tmp_garantor_id = $guarantor_id; |
747 |
my @guarantor_ids; |
748 |
|
749 |
do { |
750 |
my @relationship_for_go = Koha::Patron::Relationships->search( |
751 |
{ |
752 |
-or => [ |
753 |
'guarantor_id' => { '=', $tmp_garantor_id }, |
754 |
] |
755 |
}, |
756 |
)->as_list; |
757 |
$size_list = scalar @relationship_for_go; |
758 |
|
759 |
foreach my $relation (@relationship_for_go) { |
760 |
$relation_guarantor_id = $relation->guarantor_id; |
761 |
unless ( grep { $_ == $relation_guarantor_id } @guarantor_ids ) { |
762 |
push @guarantor_ids, $relation_guarantor_id; |
763 |
} |
764 |
$relation_guarantee_id = $relation->guarantee_id; |
765 |
|
766 |
my @relationship_for_go = Koha::Patron::Relationships->search( |
767 |
{ |
768 |
-or => [ |
769 |
'guarantor_id' => { '=', $relation_guarantee_id }, |
770 |
] |
771 |
}, |
772 |
)->as_list; |
773 |
$size_list = scalar @relationship_for_go; |
774 |
|
775 |
if ( $guarantor_id == $relation_guarantee_id ) { |
776 |
last; |
777 |
} |
778 |
|
779 |
foreach my $relation (@relationship_for_go) { |
780 |
$relation_guarantor_id = $relation->guarantor_id; |
781 |
unless ( grep { $_ == $relation_guarantor_id } @guarantor_ids ) { |
782 |
push @guarantor_ids, $relation_guarantor_id; |
783 |
} |
784 |
$relation_guarantee_id = $relation->guarantee_id; |
785 |
|
786 |
if ( $guarantor_id == $relation_guarantee_id ) { |
787 |
last; |
788 |
} |
789 |
} |
790 |
if ( $guarantor_id == $relation_guarantee_id ) { |
791 |
last; |
792 |
} |
793 |
} |
794 |
|
795 |
$tmp_garantor_id = $relation_guarantee_id; |
796 |
} while ( $guarantor_id != $relation_guarantee_id && $size_list > 0 ); |
797 |
|
798 |
if ( $guarantor_id == $relation_guarantee_id ) { |
799 |
unless ( grep { join( "", sort @$_ ) eq join( "", sort @guarantor_ids ) } |
800 |
@loop_borrowers_relationships ) |
801 |
{ |
802 |
push @loop_borrowers_relationships, \@guarantor_ids; |
803 |
} |
804 |
} |
805 |
} |
806 |
} |
807 |
} |
808 |
|
809 |
if ( scalar @loop_borrowers_relationships > 0 ) { |
810 |
new_section("The list of guarantors who are also guarantee."); |
811 |
my $count = 0; |
812 |
foreach my $table (@loop_borrowers_relationships) { |
813 |
$count++; |
814 |
print "Loop $count, borrowers id : "; |
815 |
foreach my $borrower_id (@$table) { |
816 |
print "$borrower_id , "; |
817 |
} |
818 |
print "\n"; |
819 |
} |
820 |
new_hint("Relationships that form guarantor loops must be deleted"); |
821 |
} |
822 |
} |
823 |
|
824 |
sub new_section { |
728 |
sub new_section { |
825 |
my ($name) = @_; |
729 |
my ($name) = @_; |
826 |
say "\n== $name =="; |
730 |
say "\n== $name =="; |
827 |
- |
|
|