|
Lines 222-235
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
| 222 |
# CanBookBeRenewed tests |
222 |
# CanBookBeRenewed tests |
| 223 |
|
223 |
|
| 224 |
# Generate test biblio |
224 |
# Generate test biblio |
| 225 |
my $biblio = MARC::Record->new(); |
|
|
| 226 |
my $title = 'Silence in the library'; |
225 |
my $title = 'Silence in the library'; |
| 227 |
$biblio->append_fields( |
226 |
my ($biblionumber, $biblioitemnumber) = add_biblio($title, 'Moffat, Steven'); |
| 228 |
MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), |
|
|
| 229 |
MARC::Field->new('245', ' ', ' ', a => $title), |
| 230 |
); |
| 231 |
|
| 232 |
my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, ''); |
| 233 |
|
227 |
|
| 234 |
my $barcode = 'R00000342'; |
228 |
my $barcode = 'R00000342'; |
| 235 |
my $branch = $library2->{branchcode}; |
229 |
my $branch = $library2->{branchcode}; |
|
Lines 911-923
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
| 911 |
my $branch = $library2->{branchcode}; |
905 |
my $branch = $library2->{branchcode}; |
| 912 |
|
906 |
|
| 913 |
#Create another record |
907 |
#Create another record |
| 914 |
my $biblio2 = MARC::Record->new(); |
|
|
| 915 |
my $title2 = 'Something is worng here'; |
908 |
my $title2 = 'Something is worng here'; |
| 916 |
$biblio2->append_fields( |
909 |
my ($biblionumber2, $biblioitemnumber2) = add_biblio($title2, 'Anonymous'); |
| 917 |
MARC::Field->new('100', ' ', ' ', a => 'Anonymous'), |
|
|
| 918 |
MARC::Field->new('245', ' ', ' ', a => $title2), |
| 919 |
); |
| 920 |
my ($biblionumber2, $biblioitemnumber2) = AddBiblio($biblio2, ''); |
| 921 |
|
910 |
|
| 922 |
#Create third item |
911 |
#Create third item |
| 923 |
AddItem( |
912 |
AddItem( |
|
Lines 996-1003
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
| 996 |
my $barcode = '1234567890'; |
985 |
my $barcode = '1234567890'; |
| 997 |
my $branch = $library2->{branchcode}; |
986 |
my $branch = $library2->{branchcode}; |
| 998 |
|
987 |
|
| 999 |
my $biblio = MARC::Record->new(); |
988 |
my ($biblionumber, $biblioitemnumber) = add_biblio(); |
| 1000 |
my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, ''); |
|
|
| 1001 |
|
989 |
|
| 1002 |
#Create third item |
990 |
#Create third item |
| 1003 |
my ( undef, undef, $itemnumber ) = AddItem( |
991 |
my ( undef, undef, $itemnumber ) = AddItem( |
|
Lines 1054-1061
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
| 1054 |
undef, 0, |
1042 |
undef, 0, |
| 1055 |
.10, 1 |
1043 |
.10, 1 |
| 1056 |
); |
1044 |
); |
| 1057 |
my $biblio = MARC::Record->new(); |
1045 |
my ( $biblionumber, $biblioitemnumber ) = add_biblio(); |
| 1058 |
my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $biblio, '' ); |
|
|
| 1059 |
|
1046 |
|
| 1060 |
my $barcode1 = '1234'; |
1047 |
my $barcode1 = '1234'; |
| 1061 |
my ( undef, undef, $itemnumber1 ) = AddItem( |
1048 |
my ( undef, undef, $itemnumber1 ) = AddItem( |
|
Lines 1138-1149
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
| 1138 |
my $branch = $library->{branchcode}; |
1125 |
my $branch = $library->{branchcode}; |
| 1139 |
|
1126 |
|
| 1140 |
#Create another record |
1127 |
#Create another record |
| 1141 |
my $biblio = MARC::Record->new(); |
1128 |
my ($biblionumber, $biblioitemnumber) = add_biblio('A title', 'Anonymous'); |
| 1142 |
$biblio->append_fields( |
|
|
| 1143 |
MARC::Field->new('100', ' ', ' ', a => 'Anonymous'), |
| 1144 |
MARC::Field->new('245', ' ', ' ', a => 'A title'), |
| 1145 |
); |
| 1146 |
my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, ''); |
| 1147 |
|
1129 |
|
| 1148 |
my (undef, undef, $itemnumber) = AddItem( |
1130 |
my (undef, undef, $itemnumber) = AddItem( |
| 1149 |
{ |
1131 |
{ |
|
Lines 1173-1180
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
| 1173 |
{ |
1155 |
{ |
| 1174 |
my $library = $builder->build({ source => 'Branch' }); |
1156 |
my $library = $builder->build({ source => 'Branch' }); |
| 1175 |
|
1157 |
|
| 1176 |
my $biblio = MARC::Record->new(); |
1158 |
my ($biblionumber, $biblioitemnumber) = add_biblio(); |
| 1177 |
my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, ''); |
|
|
| 1178 |
|
1159 |
|
| 1179 |
my $barcode = 'just a barcode'; |
1160 |
my $barcode = 'just a barcode'; |
| 1180 |
my ( undef, undef, $itemnumber ) = AddItem( |
1161 |
my ( undef, undef, $itemnumber ) = AddItem( |
|
Lines 1486-1499
subtest 'CanBookBeIssued + Statistic patrons "X"' => sub {
Link Here
|
| 1486 |
subtest 'MultipleReserves' => sub { |
1467 |
subtest 'MultipleReserves' => sub { |
| 1487 |
plan tests => 3; |
1468 |
plan tests => 3; |
| 1488 |
|
1469 |
|
| 1489 |
my $biblio = MARC::Record->new(); |
|
|
| 1490 |
my $title = 'Silence in the library'; |
1470 |
my $title = 'Silence in the library'; |
| 1491 |
$biblio->append_fields( |
1471 |
my ($biblionumber, $biblioitemnumber) = add_biblio($title, 'Moffat, Steven'); |
| 1492 |
MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), |
|
|
| 1493 |
MARC::Field->new('245', ' ', ' ', a => $title), |
| 1494 |
); |
| 1495 |
|
| 1496 |
my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, ''); |
| 1497 |
|
1472 |
|
| 1498 |
my $branch = $library2->{branchcode}; |
1473 |
my $branch = $library2->{branchcode}; |
| 1499 |
|
1474 |
|
|
Lines 1855-1868
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
| 1855 |
plan tests => 2; |
1830 |
plan tests => 2; |
| 1856 |
|
1831 |
|
| 1857 |
# Generate test biblio |
1832 |
# Generate test biblio |
| 1858 |
my $biblio = MARC::Record->new(); |
|
|
| 1859 |
my $title = 'Koha for Dummies'; |
1833 |
my $title = 'Koha for Dummies'; |
| 1860 |
$biblio->append_fields( |
1834 |
my ( $biblionumber, $biblioitemnumber ) = add_biblio($title, 'Hall, Daria'); |
| 1861 |
MARC::Field->new( '100', ' ', ' ', a => 'Hall, Daria' ), |
|
|
| 1862 |
MARC::Field->new( '245', ' ', ' ', a => $title ), |
| 1863 |
); |
| 1864 |
|
| 1865 |
my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $biblio, '' ); |
| 1866 |
|
1835 |
|
| 1867 |
my $barcode = 'KD123456789'; |
1836 |
my $barcode = 'KD123456789'; |
| 1868 |
my $branchcode = $library2->{branchcode}; |
1837 |
my $branchcode = $library2->{branchcode}; |
|
Lines 1902-1915
subtest '_FixOverduesOnReturn' => sub {
Link Here
|
| 1902 |
plan tests => 6; |
1871 |
plan tests => 6; |
| 1903 |
|
1872 |
|
| 1904 |
# Generate test biblio |
1873 |
# Generate test biblio |
| 1905 |
my $biblio = MARC::Record->new(); |
|
|
| 1906 |
my $title = 'Koha for Dummies'; |
1874 |
my $title = 'Koha for Dummies'; |
| 1907 |
$biblio->append_fields( |
1875 |
my ( $biblionumber, $biblioitemnumber ) = add_biblio($title, 'Hall, Kylie'); |
| 1908 |
MARC::Field->new( '100', ' ', ' ', a => 'Hall, Kylie' ), |
|
|
| 1909 |
MARC::Field->new( '245', ' ', ' ', a => $title ), |
| 1910 |
); |
| 1911 |
|
| 1912 |
my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $biblio, '' ); |
| 1913 |
|
1876 |
|
| 1914 |
my $barcode = 'KD987654321'; |
1877 |
my $barcode = 'KD987654321'; |
| 1915 |
my $branchcode = $library2->{branchcode}; |
1878 |
my $branchcode = $library2->{branchcode}; |
|
Lines 2097-2099
sub str {
Link Here
|
| 2097 |
$s .= %$alert ? ' (alert: ' . join( ' ', keys %$alert ) . ')' : ''; |
2060 |
$s .= %$alert ? ' (alert: ' . join( ' ', keys %$alert ) . ')' : ''; |
| 2098 |
return $s; |
2061 |
return $s; |
| 2099 |
} |
2062 |
} |
| 2100 |
- |
2063 |
|
|
|
2064 |
sub add_biblio { |
| 2065 |
my ($title, $author) = @_; |
| 2066 |
|
| 2067 |
my $marcflavour = C4::Context->preference('marcflavour'); |
| 2068 |
|
| 2069 |
my $biblio = MARC::Record->new(); |
| 2070 |
if ($title) { |
| 2071 |
my $tag = $marcflavour eq 'UNIMARC' ? '200' : '245'; |
| 2072 |
$biblio->append_fields( |
| 2073 |
MARC::Field->new($tag, ' ', ' ', a => $title), |
| 2074 |
); |
| 2075 |
} |
| 2076 |
|
| 2077 |
if ($author) { |
| 2078 |
my ($tag, $code) = $marcflavour eq 'UNIMARC' ? (200, 'f') : (100, 'a'); |
| 2079 |
$biblio->append_fields( |
| 2080 |
MARC::Field->new($tag, ' ', ' ', $code => $author), |
| 2081 |
); |
| 2082 |
} |
| 2083 |
|
| 2084 |
return AddBiblio($biblio, ''); |
| 2085 |
} |