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

(-)a/Koha/Patron.pm (+4 lines)
Lines 202-207 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
205
            unless ( $self->in_storage ) {    #AddMember
209
            unless ( $self->in_storage ) {    #AddMember
206
210
207
                # Generate a valid userid/login if needed
211
                # Generate a valid userid/login if needed
(-)a/about.pl (+4 lines)
Lines 499-504 $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; Link Here
499
        SELECT COUNT(*)
499
        SELECT COUNT(*)
500
        FROM (
500
        FROM (
501
            SELECT relationship FROM borrower_relationships WHERE relationship='_bad_data'
501
            SELECT relationship FROM borrower_relationships WHERE relationship='_bad_data'
502
            UNION ALL
503
            SELECT relationship FROM borrowers WHERE relationship='_bad_data') a
502
    });
504
    });
503
505
504
    $bad_relationships_count = $bad_relationships_count->[0]->[0];
506
    $bad_relationships_count = $bad_relationships_count->[0]->[0];
Lines 507-512 $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; Link Here
507
          SELECT DISTINCT(relationship)
509
          SELECT DISTINCT(relationship)
508
          FROM (
510
          FROM (
509
              SELECT relationship FROM borrower_relationships WHERE relationship IS NOT NULL
511
              SELECT relationship FROM borrower_relationships WHERE relationship IS NOT NULL
512
              UNION ALL
513
              SELECT relationship FROM borrowers WHERE relationship IS NOT NULL) a
510
    });
514
    });
511
515
512
    my %valid_relationships = map { $_ => 1 } split( /,|\|/, C4::Context->preference('borrowerRelationship') );
516
    my %valid_relationships = map { $_ => 1 } split( /,|\|/, C4::Context->preference('borrowerRelationship') );
(-)a/koha-tmpl/intranet-tmpl/prog/en/columns.def (+1 lines)
Lines 6-11 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>
9
<field name="borrowers.streetnumber">Street number</field>
10
<field name="borrowers.streetnumber">Street number</field>
10
<field name="borrowers.streettype">Street type</field>
11
<field name="borrowers.streettype">Street type</field>
11
<field name="borrowers.address">Address</field>
12
<field name="borrowers.address">Address</field>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt (-2 / +2 lines)
Lines 263-269 Link Here
263
        [% IF warnRelationships %]
263
        [% IF warnRelationships %]
264
            <h2>Patron relationship problems</h2>
264
            <h2>Patron relationship problems</h2>
265
            [% IF bad_relationships_count %]
265
            [% IF bad_relationships_count %]
266
                <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>
266
                <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>
267
            [% END %]
267
            [% END %]
268
268
269
            [% IF wrong_relationships %]
269
            [% IF wrong_relationships %]
Lines 273-279 Link Here
273
                        <li>[% rel.0 | html %]</li>
273
                        <li>[% rel.0 | html %]</li>
274
                    [% END %]
274
                    [% END %]
275
                </ul>
275
                </ul>
276
                <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>
276
                <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>
277
            [% END %]
277
            [% END %]
278
        [% END %]
278
        [% END %]
279
279
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +5 lines)
Lines 1774-1780 subtest 'Test Koha::Patrons::merge' => sub { Link Here
1774
};
1774
};
1775
1775
1776
subtest '->store' => sub {
1776
subtest '->store' => sub {
1777
    plan tests => 6;
1777
    plan tests => 7;
1778
    my $schema = Koha::Database->new->schema;
1778
    my $schema = Koha::Database->new->schema;
1779
    $schema->storage->txn_begin;
1779
    $schema->storage->txn_begin;
1780
1780
Lines 1813-1818 subtest '->store' => sub { Link Here
1813
    is( $patron_1->surname, $surname,
1813
    is( $patron_1->surname, $surname,
1814
        'Surname remains unchanged on store.');
1814
        'Surname remains unchanged on store.');
1815
1815
1816
    # Test relationship
1817
    $patron_1->relationship("")->store;
1818
    is( $patron_1->relationship, undef, );
1819
1816
    $schema->storage->dbh->{PrintError} = $print_error;
1820
    $schema->storage->dbh->{PrintError} = $print_error;
1817
    $schema->storage->txn_rollback;
1821
    $schema->storage->txn_rollback;
1818
1822
1819
- 

Return to bug 28490