Test plan:
Run these commands, grep should not return any occurences, prove should
return green:
git grep GetSerialStatusFromSerialId
git grep GetDistributedTo
git grep SetDistributedTo
git grep SetDistributedto
git grep in_array
git grep is_barcode_in_use
kshell
prove t/db_dependent/Serials.t
Signed-off-by: Pierre-Luc Lapointe <pierreluc.lapointe@inLibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
&GetPreviousSerialid
&GetSuppliersWithLateIssues
&GetPreviousSerialid
&GetSuppliersWithLateIssues
- &GetDistributedTo &SetDistributedTo
&getroutinglist &delroutingmember &addroutingmember
&reorder_members
&check_routing &updateClaim
&getroutinglist &delroutingmember &addroutingmember
&reorder_members
&check_routing &updateClaim
-=head2 GetSerialStatusFromSerialId
-
-$sth = GetSerialStatusFromSerialId();
-this function returns a statement handle
-After this function, don't forget to execute it by using $sth->execute($serialid)
-return :
-$sth = $dbh->prepare($query).
-
-=cut
-
-sub GetSerialStatusFromSerialId {
- my $dbh = C4::Context->dbh;
- my $query = qq|
- SELECT status
- FROM serial
- WHERE serialid = ?
- |;
- return $dbh->prepare($query);
-}
-
=head2 GetSerialInformation
$data = GetSerialInformation($serialid);
=head2 GetSerialInformation
$data = GetSerialInformation($serialid);
-
-
-=head2 GetDistributedTo
-
-$distributedto=GetDistributedTo($subscriptionid)
-This function returns the field distributedto for the subscription matching subscriptionid
-
-=cut
-
-sub GetDistributedTo {
- my $dbh = C4::Context->dbh;
- my $distributedto;
- my ($subscriptionid) = @_;
-
- return unless ($subscriptionid);
-
- my $query = "SELECT distributedto FROM subscription WHERE subscriptionid=?";
- my $sth = $dbh->prepare($query);
- $sth->execute($subscriptionid);
- return ($distributedto) = $sth->fetchrow;
-}
-
return 0; # Notice that you'll never get here.
}
return 0; # Notice that you'll never get here.
}
-=head2 SetDistributedto
-
-SetDistributedto($distributedto,$subscriptionid);
-This function update the value of distributedto for a subscription given on input arg.
-
-=cut
-
-sub SetDistributedto {
- my ( $distributedto, $subscriptionid ) = @_;
- my $dbh = C4::Context->dbh;
- my $query = qq|
- UPDATE subscription
- SET distributedto=?
- WHERE subscriptionid=?
- |;
- my $sth = $dbh->prepare($query);
- $sth->execute( $distributedto, $subscriptionid );
- return;
-}
-
=head2 DelSubscription
DelSubscription($subscriptionid)
=head2 DelSubscription
DelSubscription($subscriptionid)
-sub in_array { # used in next sub down
- my ( $val, @elements ) = @_;
- foreach my $elem (@elements) {
- if ( $val == $elem ) {
- return 1;
- }
- }
- return 0;
-}
-
=head2 GetFictiveIssueNumber
$issueno = GetFictiveIssueNumber($subscription, $publishedate);
=head2 GetFictiveIssueNumber
$issueno = GetFictiveIssueNumber($subscription, $publishedate);
-=head2 is_barcode_in_use
-
-Returns number of occurrences of the barcode in the items table
-Can be used as a boolean test of whether the barcode has
-been deployed as yet
-
-=cut
-
-sub is_barcode_in_use {
- my $barcode = shift;
- my $dbh = C4::Context->dbh;
- my $occurrences = $dbh->selectall_arrayref(
- 'SELECT itemnumber from items where barcode = ?',
- {}, $barcode
-
- );
-
- return @{$occurrences};
-}
-
=head2 CloseSubscription
Close a subscription given a subscriptionid
=head2 CloseSubscription
Close a subscription given a subscriptionid
use Koha::Acquisition::Booksellers;
use t::lib::Mocks;
use t::lib::TestBuilder;
use Koha::Acquisition::Booksellers;
use t::lib::Mocks;
use t::lib::TestBuilder;
-use Test::More tests => 48;
+use Test::More tests => 46;
BEGIN {
use_ok('C4::Serials');
BEGIN {
use_ok('C4::Serials');
ok($serials_count > 0, 'Subscription has at least one serial');
my $serial = $serials[0];
ok($serials_count > 0, 'Subscription has at least one serial');
my $serial = $serials[0];
-ok(C4::Serials::GetSerialStatusFromSerialId($serial->{serialid}), 'test getting Serial Status From Serial Id');
-
isa_ok(C4::Serials::GetSerialInformation($serial->{serialid}), 'HASH', 'test getting Serial Information');
subtest 'Values should not be erased on editing' => sub {
isa_ok(C4::Serials::GetSerialInformation($serial->{serialid}), 'HASH', 'test getting Serial Information');
subtest 'Values should not be erased on editing' => sub {
is(C4::Serials::GetLatestSerials(), undef, 'test getting lastest serials');
is(C4::Serials::GetLatestSerials(), undef, 'test getting lastest serials');
-is(C4::Serials::GetDistributedTo(), undef, 'test getting distributed when nothing is entered');
-
is(C4::Serials::GetNextSeq(), undef, 'test getting next seq when you enter nothing');
is(C4::Serials::GetSeq(), undef, 'test getting seq when you enter nothing');
is(C4::Serials::GetNextSeq(), undef, 'test getting next seq when you enter nothing');
is(C4::Serials::GetSeq(), undef, 'test getting seq when you enter nothing');