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

(-)a/t/db_dependent/Members.t (-6 / +6 lines)
Lines 39-44 my $builder = t::lib::TestBuilder->new; Link Here
39
my $dbh = C4::Context->dbh;
39
my $dbh = C4::Context->dbh;
40
$dbh->{RaiseError} = 1;
40
$dbh->{RaiseError} = 1;
41
41
42
# Remove invalid guarantorid's as long as we have no FK
43
$dbh->do("UPDATE borrowers b1 LEFT JOIN borrowers b2 ON b2.borrowernumber=b1.guarantorid SET b1.guarantorid=NULL where b1.guarantorid IS NOT NULL AND b2.borrowernumber IS NULL");
44
42
my $library1 = $builder->build({
45
my $library1 = $builder->build({
43
    source => 'Branch',
46
    source => 'Branch',
44
});
47
});
Lines 263-268 my $borrower1 = $builder->build({ Link Here
263
            categorycode=>'STAFFER',
266
            categorycode=>'STAFFER',
264
            branchcode => $library3->{branchcode},
267
            branchcode => $library3->{branchcode},
265
            dateexpiry => '2015-01-01',
268
            dateexpiry => '2015-01-01',
269
            guarantorid=> undef,
266
        },
270
        },
267
});
271
});
268
my $bor1inlist = $borrower1->{borrowernumber};
272
my $bor1inlist = $borrower1->{borrowernumber};
Lines 272-277 my $borrower2 = $builder->build({ Link Here
272
            categorycode=>'STAFFER',
276
            categorycode=>'STAFFER',
273
            branchcode => $library3->{branchcode},
277
            branchcode => $library3->{branchcode},
274
            dateexpiry => '2015-01-01',
278
            dateexpiry => '2015-01-01',
279
            guarantorid=> undef,
275
        },
280
        },
276
});
281
});
277
282
Lines 281-286 my $guarantee = $builder->build({ Link Here
281
            categorycode=>'KIDclamp',
286
            categorycode=>'KIDclamp',
282
            branchcode => $library3->{branchcode},
287
            branchcode => $library3->{branchcode},
283
            dateexpiry => '2015-01-01',
288
            dateexpiry => '2015-01-01',
289
            guarantorid=> undef, # will be filled later
284
        },
290
        },
285
});
291
});
286
292
Lines 294-304 $builder->build({ Link Here
294
        },
300
        },
295
});
301
});
296
302
297
# In some dirty DB, the guarantorid is set to a non existent patron id
298
# If we pick it, then the tests will fail
299
# This should not be needed, we should have a FK on the guarantorid instead
300
Koha::Patrons->search({ guarantorid => { -in => [ $borrower1->{borrowernumber}, $borrower2->{borrowernumber} ] }})->update({ guarantorid => undef });
301
302
my $owner = AddMember (categorycode => 'STAFFER', branchcode => $library2->{branchcode} );
303
my $owner = AddMember (categorycode => 'STAFFER', branchcode => $library2->{branchcode} );
303
my $list1 = AddPatronList( { name => 'Test List 1', owner => $owner } );
304
my $list1 = AddPatronList( { name => 'Test List 1', owner => $owner } );
304
my @listpatrons = ($bor1inlist, $bor2inlist);
305
my @listpatrons = ($bor1inlist, $bor2inlist);
305
- 

Return to bug 17759