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

(-)a/Koha/Patron.pm (-4 lines)
Lines 202-211 sub store { Link Here
202
            $self->surname( uc($self->surname) )
202
            $self->surname( uc($self->surname) )
203
                if C4::Context->preference("uppercasesurnames");
203
                if C4::Context->preference("uppercasesurnames");
204
204
205
            $self->relationship(undef) # We do not want to store an empty string in this field
206
              if defined $self->relationship
207
                     and $self->relationship eq "";
208
209
            unless ( $self->in_storage ) {    #AddMember
205
            unless ( $self->in_storage ) {    #AddMember
210
206
211
                # Generate a valid userid/login if needed
207
                # Generate a valid userid/login if needed
(-)a/about.pl (-4 lines)
Lines 491-498 $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; Link Here
491
        SELECT COUNT(*)
491
        SELECT COUNT(*)
492
        FROM (
492
        FROM (
493
            SELECT relationship FROM borrower_relationships WHERE relationship='_bad_data'
493
            SELECT relationship FROM borrower_relationships WHERE relationship='_bad_data'
494
            UNION ALL
495
            SELECT relationship FROM borrowers WHERE relationship='_bad_data') a
496
    });
494
    });
497
495
498
    $bad_relationships_count = $bad_relationships_count->[0]->[0];
496
    $bad_relationships_count = $bad_relationships_count->[0]->[0];
Lines 501-508 $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; Link Here
501
          SELECT DISTINCT(relationship)
499
          SELECT DISTINCT(relationship)
502
          FROM (
500
          FROM (
503
              SELECT relationship FROM borrower_relationships WHERE relationship IS NOT NULL
501
              SELECT relationship FROM borrower_relationships WHERE relationship IS NOT NULL
504
              UNION ALL
505
              SELECT relationship FROM borrowers WHERE relationship IS NOT NULL) a
506
    });
502
    });
507
503
508
    my %valid_relationships = map { $_ => 1 } split( /,|\|/, C4::Context->preference('borrowerRelationship') );
504
    my %valid_relationships = map { $_ => 1 } split( /,|\|/, C4::Context->preference('borrowerRelationship') );
(-)a/koha-tmpl/intranet-tmpl/prog/en/columns.def (-1 lines)
Lines 6-12 Link Here
6
<field name="borrowers.initials">Initials</field>
6
<field name="borrowers.initials">Initials</field>
7
<field name="borrowers.othernames">Other name</field>
7
<field name="borrowers.othernames">Other name</field>
8
<field name="borrowers.sex">Gender</field>
8
<field name="borrowers.sex">Gender</field>
9
<field name="borrowers.relationship">Relationship</field>
10
<field name="borrowers.streetnumber">Street number</field>
9
<field name="borrowers.streetnumber">Street number</field>
11
<field name="borrowers.streettype">Street type</field>
10
<field name="borrowers.streettype">Street type</field>
12
<field name="borrowers.address">Address</field>
11
<field name="borrowers.address">Address</field>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt (-2 / +2 lines)
Lines 246-252 Link Here
246
        [% IF warnRelationships %]
246
        [% IF warnRelationships %]
247
            <h2>Patron relationship problems</h2>
247
            <h2>Patron relationship problems</h2>
248
            [% IF bad_relationships_count %]
248
            [% IF bad_relationships_count %]
249
                <p>Your database contained guarantee/guarantor pairs with no defined relationship. They have been set the value '_bad_data' in the [% "borrowers.relationship" | $HtmlTags tag="strong" %] and/or [% "borrower_relationships.relationship" | $HtmlTags tag="strong" %] columns. Fix them manually by recreating those relationships, or have your system's administrator correct the values.</p>
249
                <p>Your database contained guarantee/guarantor pairs with no defined relationship. They have been set the value '_bad_data' in the [% "borrower_relationships.relationship" | $HtmlTags tag="strong" %] column. Fix them manually by recreating those relationships, or have your system's administrator correct the values.</p>
250
            [% END %]
250
            [% END %]
251
251
252
            [% IF wrong_relationships %]
252
            [% IF wrong_relationships %]
Lines 256-262 Link Here
256
                        <li>[% rel.0 | html %]</li>
256
                        <li>[% rel.0 | html %]</li>
257
                    [% END %]
257
                    [% END %]
258
                </ul>
258
                </ul>
259
                <p>If the relationship is one you want, please add it to the 'borrowerRelationship' system preference, otherwise have your system's administrator correct the values in [% "borrowers.relationship" | $HtmlTags tag="strong" %] and/or [% "borrower_relationships.relationship" | $HtmlTags tag="strong" %] in the database.</p>
259
                <p>If the relationship is one you want, please add it to the 'borrowerRelationship' system preference, otherwise have your system's administrator correct the values in [% "borrower_relationships.relationship" | $HtmlTags tag="strong" %] in the database.</p>
260
            [% END %]
260
            [% END %]
261
        [% END %]
261
        [% END %]
262
262
(-)a/t/db_dependent/Koha/Patrons.t (-6 / +1 lines)
Lines 1661-1667 subtest 'Test Koha::Patrons::merge' => sub { Link Here
1661
};
1661
};
1662
1662
1663
subtest '->store' => sub {
1663
subtest '->store' => sub {
1664
    plan tests => 7;
1664
    plan tests => 6;
1665
    my $schema = Koha::Database->new->schema;
1665
    my $schema = Koha::Database->new->schema;
1666
    $schema->storage->txn_begin;
1666
    $schema->storage->txn_begin;
1667
1667
Lines 1700-1709 subtest '->store' => sub { Link Here
1700
    is( $patron_1->surname, $surname,
1700
    is( $patron_1->surname, $surname,
1701
        'Surname remains unchanged on store.');
1701
        'Surname remains unchanged on store.');
1702
1702
1703
    # Test relationship
1704
    $patron_1->relationship("")->store;
1705
    is( $patron_1->relationship, undef, );
1706
1707
    $schema->storage->dbh->{PrintError} = $print_error;
1703
    $schema->storage->dbh->{PrintError} = $print_error;
1708
    $schema->storage->txn_rollback;
1704
    $schema->storage->txn_rollback;
1709
1705
1710
- 

Return to bug 26995