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

(-)a/C4/Serials.pm (-3 / +13 lines)
Lines 1469-1483 sub NewSubscription { Link Here
1469
1469
1470
=head2 ReNewSubscription
1470
=head2 ReNewSubscription
1471
1471
1472
ReNewSubscription($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note)
1472
ReNewSubscription($params);
1473
1474
$params is a hashref with the following keys: subscriptionid, user, startdate, numberlength, weeklength, monthlength, note, branchcode
1473
1475
1474
this function renew a subscription with values given on input args.
1476
this function renew a subscription with values given on input args.
1475
1477
1476
=cut
1478
=cut
1477
1479
1478
sub ReNewSubscription {
1480
sub ReNewSubscription {
1479
    my ( $subscriptionid, $user, $startdate, $numberlength, $weeklength, $monthlength, $note, $branchcode ) = @_;
1481
    my ( $params ) = @_;
1480
    warn $note;
1482
    my $subscriptionid = $params->{subscriptionid};
1483
    my $user           = $params->{user};
1484
    my $startdate      = $params->{startdate};
1485
    my $numberlength   = $params->{numberlength};
1486
    my $weeklength     = $params->{weeklength};
1487
    my $monthlength    = $params->{monthlength};
1488
    my $note           = $params->{note};
1489
    my $branchcode     = $params->{branchcode};
1490
1481
    my $dbh          = C4::Context->dbh;
1491
    my $dbh          = C4::Context->dbh;
1482
    my $subscription = GetSubscription($subscriptionid);
1492
    my $subscription = GetSubscription($subscriptionid);
1483
    my $query        = qq|
1493
    my $query        = qq|
(-)a/serials/subscription-renew.pl (-7 / +18 lines)
Lines 81-99 if ( $op eq "renew" ) { Link Here
81
    output_and_exit( $query, $cookie, $template, 'unknown_subscription') unless $subscription;
81
    output_and_exit( $query, $cookie, $template, 'unknown_subscription') unless $subscription;
82
    my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } );
82
    my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } );
83
    ReNewSubscription(
83
    ReNewSubscription(
84
        $subscriptionid, $loggedinuser,
84
        {
85
        $startdate, scalar $query->param('numberlength'),
85
            subscriptionid => $subscriptionid,
86
        scalar $query->param('weeklength'), scalar $query->param('monthlength'),
86
            user           => $loggedinuser,
87
        scalar $query->param('note'), $branchcode
87
            startdate      => $startdate,
88
            numberlength   => scalar $query->param('numberlength'),
89
            weeklength     => scalar $query->param('weeklength'),
90
            monthlength    => scalar $query->param('monthlength'),
91
            note           => scalar $query->param('note'),
92
            branchcode     => $branchcode
93
        }
88
    );
94
    );
89
} elsif ( $op eq 'multi_renew' ) {
95
} elsif ( $op eq 'multi_renew' ) {
90
    for my $subscriptionid ( @subscriptionids ) {
96
    for my $subscriptionid ( @subscriptionids ) {
91
        my $subscription = GetSubscription( $subscriptionid );
97
        my $subscription = GetSubscription( $subscriptionid );
92
        next unless $subscription;
98
        next unless $subscription;
93
        ReNewSubscription(
99
        ReNewSubscription(
94
            $subscriptionid, $loggedinuser,
100
            {
95
            $subscription->{enddate}, $subscription->{numberlength},
101
                subscriptionid => $subscriptionid,
96
            $subscription->{weeklength}, $subscription->{monthlength},
102
                user           => $loggedinuser,
103
                startdate      => $subscription->{enddate},
104
                numberlength   => $subscription->{numberlength},
105
                weeklength     => $subscription->{weeklength},
106
                monthlength    => $subscription->{monthlength},
107
            }
97
        );
108
        );
98
    }
109
    }
99
} else {
110
} else {
(-)a/t/db_dependent/Serials/ReNewSubscription.t (-2 / +7 lines)
Lines 84-90 my $subscriptionhistory = $builder->build({ Link Here
84
# Actual testing starts here!
84
# Actual testing starts here!
85
85
86
# Renew the subscription and check that enddate has not been set
86
# Renew the subscription and check that enddate has not been set
87
ReNewSubscription($subscription->{subscriptionid},'',"2016-01-01",'','',12,'');
87
ReNewSubscription(
88
    {
89
        subscriptionid => $subscription->{subscriptionid},
90
        startdate      => "2016-01-01",
91
        monthlength    => 12
92
    }
93
);
88
my $history = Koha::Subscription::Histories->find($subscription->{subscriptionid});
94
my $history = Koha::Subscription::Histories->find($subscription->{subscriptionid});
89
95
90
is ( $history->histenddate(), undef, 'subscription history not empty after renewal');
96
is ( $history->histenddate(), undef, 'subscription history not empty after renewal');
91
- 

Return to bug 7047