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

(-)a/C4/Items.pm (-2 / +2 lines)
Lines 2690-2696 sub PrepareItemrecordDisplay { Link Here
2690
                    #---- branch
2690
                    #---- branch
2691
                    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
2691
                    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
2692
                        if (   ( C4::Context->preference("IndependantBranches") )
2692
                        if (   ( C4::Context->preference("IndependantBranches") )
2693
                            && ( C4::Context->userenv->{flags} % 2 != 1 ) ) {
2693
                            && ( C4::Context->userenv && C4::Context->userenv->{flags} % 2 != 1 ) ) {
2694
                            my $sth = $dbh->prepare( "SELECT branchcode,branchname FROM branches WHERE branchcode = ? ORDER BY branchname" );
2694
                            my $sth = $dbh->prepare( "SELECT branchcode,branchname FROM branches WHERE branchcode = ? ORDER BY branchname" );
2695
                            $sth->execute( C4::Context->userenv->{branch} );
2695
                            $sth->execute( C4::Context->userenv->{branch} );
2696
                            push @authorised_values, ""
2696
                            push @authorised_values, ""
Lines 2710-2716 sub PrepareItemrecordDisplay { Link Here
2710
                            }
2710
                            }
2711
                        }
2711
                        }
2712
2712
2713
                        $defaultvalue = C4::Context->userenv->{branch};
2713
                        $defaultvalue = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
2714
                        if ( $defaultvalues and $defaultvalues->{branchcode} ) {
2714
                        if ( $defaultvalues and $defaultvalues->{branchcode} ) {
2715
                            $defaultvalue = $defaultvalues->{branchcode};
2715
                            $defaultvalue = $defaultvalues->{branchcode};
2716
                        }
2716
                        }
(-)a/C4/Serials.pm (-55 / +125 lines)
Lines 121-126 name,title,planneddate,serialseq,serial.subscriptionid from tables : subscriptio Link Here
121
121
122
sub GetLateIssues {
122
sub GetLateIssues {
123
    my ($supplierid) = @_;
123
    my ($supplierid) = @_;
124
125
    return unless ($supplierid);
126
124
    my $dbh = C4::Context->dbh;
127
    my $dbh = C4::Context->dbh;
125
    my $sth;
128
    my $sth;
126
    if ($supplierid) {
129
    if ($supplierid) {
Lines 153-162 sub GetLateIssues { Link Here
153
    }
156
    }
154
    my @issuelist;
157
    my @issuelist;
155
    my $last_title;
158
    my $last_title;
156
    my $odd   = 0;
157
    while ( my $line = $sth->fetchrow_hashref ) {
159
    while ( my $line = $sth->fetchrow_hashref ) {
158
        $odd++ unless $line->{title} eq $last_title;
160
        $line->{title} = "" if $last_title and $line->{title} eq $last_title;
159
        $line->{title} = "" if $line->{title} eq $last_title;
160
        $last_title = $line->{title} if ( $line->{title} );
161
        $last_title = $line->{title} if ( $line->{title} );
161
        $line->{planneddate} = format_date( $line->{planneddate} );
162
        $line->{planneddate} = format_date( $line->{planneddate} );
162
        push @issuelist, $line;
163
        push @issuelist, $line;
Lines 287-292 returns the number of rows affected Link Here
287
288
288
sub AddItem2Serial {
289
sub AddItem2Serial {
289
    my ( $serialid, $itemnumber ) = @_;
290
    my ( $serialid, $itemnumber ) = @_;
291
292
    return unless ($serialid and $itemnumber);
293
290
    my $dbh = C4::Context->dbh;
294
    my $dbh = C4::Context->dbh;
291
    my $rq  = $dbh->prepare("INSERT INTO `serialitems` SET serialid=? , itemnumber=?");
295
    my $rq  = $dbh->prepare("INSERT INTO `serialitems` SET serialid=? , itemnumber=?");
292
    $rq->execute( $serialid, $itemnumber );
296
    $rq->execute( $serialid, $itemnumber );
Lines 304-309 Update Claimdate for issues in @$serialids list with date $date Link Here
304
308
305
sub UpdateClaimdateIssues {
309
sub UpdateClaimdateIssues {
306
    my ( $serialids, $date ) = @_;
310
    my ( $serialids, $date ) = @_;
311
312
    return unless ($serialids);
313
307
    my $dbh = C4::Context->dbh;
314
    my $dbh = C4::Context->dbh;
308
    $date = strftime( "%Y-%m-%d", localtime ) unless ($date);
315
    $date = strftime( "%Y-%m-%d", localtime ) unless ($date);
309
    my $query = "
316
    my $query = "
Lines 369-374 sub GetSubscription { Link Here
369
376
370
sub GetFullSubscription {
377
sub GetFullSubscription {
371
    my ($subscriptionid) = @_;
378
    my ($subscriptionid) = @_;
379
380
    return unless ($subscriptionid);
381
372
    my $dbh              = C4::Context->dbh;
382
    my $dbh              = C4::Context->dbh;
373
    my $query            = qq|
383
    my $query            = qq|
374
  SELECT    serial.serialid,
384
  SELECT    serial.serialid,
Lines 415-420 sub GetFullSubscription { Link Here
415
425
416
sub PrepareSerialsData {
426
sub PrepareSerialsData {
417
    my ($lines) = @_;
427
    my ($lines) = @_;
428
429
    return unless ($lines);
430
418
    my %tmpresults;
431
    my %tmpresults;
419
    my $year;
432
    my $year;
420
    my @res;
433
    my @res;
Lines 474-479 startdate, histstartdate,opacnote,missinglist,recievedlist,periodicity,status & Link Here
474
487
475
sub GetSubscriptionsFromBiblionumber {
488
sub GetSubscriptionsFromBiblionumber {
476
    my ($biblionumber) = @_;
489
    my ($biblionumber) = @_;
490
491
    return unless ($biblionumber);
492
477
    my $dbh            = C4::Context->dbh;
493
    my $dbh            = C4::Context->dbh;
478
    my $query          = qq(
494
    my $query          = qq(
479
        SELECT subscription.*,
495
        SELECT subscription.*,
Lines 745-750 FIXME: We should return \@serials. Link Here
745
761
746
sub GetSerials {
762
sub GetSerials {
747
    my ( $subscriptionid, $count ) = @_;
763
    my ( $subscriptionid, $count ) = @_;
764
765
    return unless $subscriptionid;
766
748
    my $dbh = C4::Context->dbh;
767
    my $dbh = C4::Context->dbh;
749
768
750
    # status = 2 is "arrived"
769
    # status = 2 is "arrived"
Lines 811-816 this number is used to see if a subscription can be deleted (=it must have only Link Here
811
830
812
sub GetSerials2 {
831
sub GetSerials2 {
813
    my ( $subscription, $status ) = @_;
832
    my ( $subscription, $status ) = @_;
833
834
    return unless ($subscription and $status);
835
814
    my $dbh   = C4::Context->dbh;
836
    my $dbh   = C4::Context->dbh;
815
    my $query = qq|
837
    my $query = qq|
816
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
838
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
Lines 850-855 a ref to an array which contains all of the latest serials stored into a hash. Link Here
850
872
851
sub GetLatestSerials {
873
sub GetLatestSerials {
852
    my ( $subscriptionid, $limit ) = @_;
874
    my ( $subscriptionid, $limit ) = @_;
875
876
    return unless ($subscriptionid and $limit);
877
853
    my $dbh = C4::Context->dbh;
878
    my $dbh = C4::Context->dbh;
854
879
855
    # status = 2 is "arrived"
880
    # status = 2 is "arrived"
Lines 881-887 This function returns the field distributedto for the subscription matching subs Link Here
881
sub GetDistributedTo {
906
sub GetDistributedTo {
882
    my $dbh = C4::Context->dbh;
907
    my $dbh = C4::Context->dbh;
883
    my $distributedto;
908
    my $distributedto;
884
    my $subscriptionid = @_;
909
    my ($subscriptionid) = @_;
910
911
    return unless ($subscriptionid);
912
885
    my $query          = "SELECT distributedto FROM subscription WHERE subscriptionid=?";
913
    my $query          = "SELECT distributedto FROM subscription WHERE subscriptionid=?";
886
    my $sth            = $dbh->prepare($query);
914
    my $sth            = $dbh->prepare($query);
887
    $sth->execute($subscriptionid);
915
    $sth->execute($subscriptionid);
Lines 906-912 This function get the next issue for the subscription given on input arg Link Here
906
934
907
sub GetNextSeq {
935
sub GetNextSeq {
908
    my ($subscription, $pattern, $planneddate) = @_;
936
    my ($subscription, $pattern, $planneddate) = @_;
909
    my ( $calculated, $newlastvalue1, $newlastvalue2, $newlastvalue3,
937
938
    return unless ($subscription and $pattern);
939
940
    my ( $newlastvalue1, $newlastvalue2, $newlastvalue3,
910
    $newinnerloop1, $newinnerloop2, $newinnerloop3 );
941
    $newinnerloop1, $newinnerloop2, $newinnerloop3 );
911
    my $count = 1;
942
    my $count = 1;
912
943
Lines 924-986 sub GetNextSeq { Link Here
924
    }
955
    }
925
956
926
    my $numberingmethod = $pattern->{numberingmethod};
957
    my $numberingmethod = $pattern->{numberingmethod};
927
    $calculated    = $numberingmethod;
958
    my $calculated = "";
928
    my $locale = $subscription->{locale};
959
    if ($numberingmethod) {
929
    $newlastvalue1 = $subscription->{lastvalue1} || 0;
960
        $calculated    = $numberingmethod;
930
    $newlastvalue2 = $subscription->{lastvalue2} || 0;
961
        my $locale = $subscription->{locale};
931
    $newlastvalue3 = $subscription->{lastvalue3} || 0;
962
        $newlastvalue1 = $subscription->{lastvalue1} || 0;
932
    $newinnerloop1 = $subscription->{innerloop1} || 0;
963
        $newlastvalue2 = $subscription->{lastvalue2} || 0;
933
    $newinnerloop2 = $subscription->{innerloop2} || 0;
964
        $newlastvalue3 = $subscription->{lastvalue3} || 0;
934
    $newinnerloop3 = $subscription->{innerloop3} || 0;
965
        $newinnerloop1 = $subscription->{innerloop1} || 0;
935
    my %calc;
966
        $newinnerloop2 = $subscription->{innerloop2} || 0;
936
    foreach(qw/X Y Z/) {
967
        $newinnerloop3 = $subscription->{innerloop3} || 0;
937
        $calc{$_} = 1 if ($numberingmethod =~ /\{$_\}/);
968
        my %calc;
938
    }
969
        foreach(qw/X Y Z/) {
939
970
            $calc{$_} = 1 if ($numberingmethod =~ /\{$_\}/);
940
    for(my $i = 0; $i < $count; $i++) {
971
        }
941
        if($calc{'X'}) {
972
942
            # check if we have to increase the new value.
973
        for(my $i = 0; $i < $count; $i++) {
943
            $newinnerloop1 += 1;
974
            if($calc{'X'}) {
944
            if ($newinnerloop1 >= $pattern->{every1}) {
975
                # check if we have to increase the new value.
945
                $newinnerloop1  = 0;
976
                $newinnerloop1 += 1;
946
                $newlastvalue1 += $pattern->{add1};
977
                if ($newinnerloop1 >= $pattern->{every1}) {
978
                    $newinnerloop1  = 0;
979
                    $newlastvalue1 += $pattern->{add1};
980
                }
981
                # reset counter if needed.
982
                $newlastvalue1 = $pattern->{setto1} if ($newlastvalue1 > $pattern->{whenmorethan1});
983
            }
984
            if($calc{'Y'}) {
985
                # check if we have to increase the new value.
986
                $newinnerloop2 += 1;
987
                if ($newinnerloop2 >= $pattern->{every2}) {
988
                    $newinnerloop2  = 0;
989
                    $newlastvalue2 += $pattern->{add2};
990
                }
991
                # reset counter if needed.
992
                $newlastvalue2 = $pattern->{setto2} if ($newlastvalue2 > $pattern->{whenmorethan2});
947
            }
993
            }
948
            # reset counter if needed.
994
            if($calc{'Z'}) {
949
            $newlastvalue1 = $pattern->{setto1} if ($newlastvalue1 > $pattern->{whenmorethan1});
995
                # check if we have to increase the new value.
996
                $newinnerloop3 += 1;
997
                if ($newinnerloop3 >= $pattern->{every3}) {
998
                    $newinnerloop3  = 0;
999
                    $newlastvalue3 += $pattern->{add3};
1000
                }
1001
                # reset counter if needed.
1002
                $newlastvalue3 = $pattern->{setto3} if ($newlastvalue3 > $pattern->{whenmorethan3});
1003
            }
1004
        }
1005
        if($calc{'X'}) {
1006
            my $newlastvalue1string = _numeration( $newlastvalue1, $pattern->{numbering1}, $locale );
1007
            $calculated =~ s/\{X\}/$newlastvalue1string/g;
950
        }
1008
        }
951
        if($calc{'Y'}) {
1009
        if($calc{'Y'}) {
952
            # check if we have to increase the new value.
1010
            my $newlastvalue2string = _numeration( $newlastvalue2, $pattern->{numbering2}, $locale );
953
            $newinnerloop2 += 1;
1011
            $calculated =~ s/\{Y\}/$newlastvalue2string/g;
954
            if ($newinnerloop2 >= $pattern->{every2}) {
955
                $newinnerloop2  = 0;
956
                $newlastvalue2 += $pattern->{add2};
957
            }
958
            # reset counter if needed.
959
            $newlastvalue2 = $pattern->{setto2} if ($newlastvalue2 > $pattern->{whenmorethan2});
960
        }
1012
        }
961
        if($calc{'Z'}) {
1013
        if($calc{'Z'}) {
962
            # check if we have to increase the new value.
1014
            my $newlastvalue3string = _numeration( $newlastvalue3, $pattern->{numbering3}, $locale );
963
            $newinnerloop3 += 1;
1015
            $calculated =~ s/\{Z\}/$newlastvalue3string/g;
964
            if ($newinnerloop3 >= $pattern->{every3}) {
965
                $newinnerloop3  = 0;
966
                $newlastvalue3 += $pattern->{add3};
967
            }
968
            # reset counter if needed.
969
            $newlastvalue3 = $pattern->{setto3} if ($newlastvalue3 > $pattern->{whenmorethan3});
970
        }
1016
        }
971
    }
1017
    }
972
    if($calc{'X'}) {
973
        my $newlastvalue1string = _numeration( $newlastvalue1, $pattern->{numbering1}, $locale );
974
        $calculated =~ s/\{X\}/$newlastvalue1string/g;
975
    }
976
    if($calc{'Y'}) {
977
        my $newlastvalue2string = _numeration( $newlastvalue2, $pattern->{numbering2}, $locale );
978
        $calculated =~ s/\{Y\}/$newlastvalue2string/g;
979
    }
980
    if($calc{'Z'}) {
981
        my $newlastvalue3string = _numeration( $newlastvalue3, $pattern->{numbering3}, $locale );
982
        $calculated =~ s/\{Z\}/$newlastvalue3string/g;
983
    }
984
1018
985
    return ($calculated,
1019
    return ($calculated,
986
            $newlastvalue1, $newlastvalue2, $newlastvalue3,
1020
            $newlastvalue1, $newlastvalue2, $newlastvalue3,
Lines 1000-1005 the sequence in string format Link Here
1000
1034
1001
sub GetSeq {
1035
sub GetSeq {
1002
    my ($subscription, $pattern) = @_;
1036
    my ($subscription, $pattern) = @_;
1037
1038
    return unless ($subscription and $pattern);
1039
1003
    my $locale = $subscription->{locale};
1040
    my $locale = $subscription->{locale};
1004
1041
1005
    my $calculated = $pattern->{numberingmethod};
1042
    my $calculated = $pattern->{numberingmethod};
Lines 1031-1036 the enddate or undef Link Here
1031
1068
1032
sub GetExpirationDate {
1069
sub GetExpirationDate {
1033
    my ( $subscriptionid, $startdate ) = @_;
1070
    my ( $subscriptionid, $startdate ) = @_;
1071
1072
    return unless ($subscriptionid);
1073
1034
    my $dbh          = C4::Context->dbh;
1074
    my $dbh          = C4::Context->dbh;
1035
    my $subscription = GetSubscription($subscriptionid);
1075
    my $subscription = GetSubscription($subscriptionid);
1036
    my $enddate;
1076
    my $enddate;
Lines 1080-1085 the number of subscriptions Link Here
1080
1120
1081
sub CountSubscriptionFromBiblionumber {
1121
sub CountSubscriptionFromBiblionumber {
1082
    my ($biblionumber) = @_;
1122
    my ($biblionumber) = @_;
1123
1124
    return unless ($biblionumber);
1125
1083
    my $dbh            = C4::Context->dbh;
1126
    my $dbh            = C4::Context->dbh;
1084
    my $query          = "SELECT count(*) FROM subscription WHERE biblionumber=?";
1127
    my $query          = "SELECT count(*) FROM subscription WHERE biblionumber=?";
1085
    my $sth            = $dbh->prepare($query);
1128
    my $sth            = $dbh->prepare($query);
Lines 1099-1104 returns the number of rows affected Link Here
1099
1142
1100
sub ModSubscriptionHistory {
1143
sub ModSubscriptionHistory {
1101
    my ( $subscriptionid, $histstartdate, $enddate, $receivedlist, $missinglist, $opacnote, $librariannote ) = @_;
1144
    my ( $subscriptionid, $histstartdate, $enddate, $receivedlist, $missinglist, $opacnote, $librariannote ) = @_;
1145
1146
    return unless ($subscriptionid);
1147
1102
    my $dbh   = C4::Context->dbh;
1148
    my $dbh   = C4::Context->dbh;
1103
    my $query = "UPDATE subscriptionhistory 
1149
    my $query = "UPDATE subscriptionhistory 
1104
                    SET histstartdate=?,histenddate=?,recievedlist=?,missinglist=?,opacnote=?,librariannote=?
1150
                    SET histstartdate=?,histenddate=?,recievedlist=?,missinglist=?,opacnote=?,librariannote=?
Lines 1168-1173 Note : if we change from "waited" to something else,then we will have to create Link Here
1168
sub ModSerialStatus {
1214
sub ModSerialStatus {
1169
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1215
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1170
1216
1217
    return unless ($serialid);
1171
1218
1172
    #It is a usual serial
1219
    #It is a usual serial
1173
    # 1st, get previous status :
1220
    # 1st, get previous status :
Lines 1583-1588 sub NewIssue { Link Here
1583
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_;
1630
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_;
1584
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1631
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1585
1632
1633
    return unless ($subscriptionid);
1634
1586
    my $dbh   = C4::Context->dbh;
1635
    my $dbh   = C4::Context->dbh;
1587
    my $query = qq|
1636
    my $query = qq|
1588
        INSERT INTO serial
1637
        INSERT INTO serial
Lines 1635-1640 return : Link Here
1635
1684
1636
sub ItemizeSerials {
1685
sub ItemizeSerials {
1637
    my ( $serialid, $info ) = @_;
1686
    my ( $serialid, $info ) = @_;
1687
1688
    return unless ($serialid);
1689
1638
    my $now = POSIX::strftime( "%Y-%m-%d", localtime );
1690
    my $now = POSIX::strftime( "%Y-%m-%d", localtime );
1639
1691
1640
    my $dbh   = C4::Context->dbh;
1692
    my $dbh   = C4::Context->dbh;
Lines 1769-1774 sub HasSubscriptionStrictlyExpired { Link Here
1769
1821
1770
    # Getting end of subscription date
1822
    # Getting end of subscription date
1771
    my ($subscriptionid) = @_;
1823
    my ($subscriptionid) = @_;
1824
1825
    return unless ($subscriptionid);
1826
1772
    my $dbh              = C4::Context->dbh;
1827
    my $dbh              = C4::Context->dbh;
1773
    my $subscription     = GetSubscription($subscriptionid);
1828
    my $subscription     = GetSubscription($subscriptionid);
1774
    my $expirationdate = $subscription->{enddate} || GetExpirationDate($subscriptionid);
1829
    my $expirationdate = $subscription->{enddate} || GetExpirationDate($subscriptionid);
Lines 1810-1815 return : Link Here
1810
1865
1811
sub HasSubscriptionExpired {
1866
sub HasSubscriptionExpired {
1812
    my ($subscriptionid) = @_;
1867
    my ($subscriptionid) = @_;
1868
1869
    return unless ($subscriptionid);
1870
1813
    my $dbh              = C4::Context->dbh;
1871
    my $dbh              = C4::Context->dbh;
1814
    my $subscription     = GetSubscription($subscriptionid);
1872
    my $subscription     = GetSubscription($subscriptionid);
1815
    my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity});
1873
    my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity});
Lines 1947-1952 name,title,planneddate,serialseq,serial.subscriptionid from tables : subscriptio Link Here
1947
2005
1948
sub GetLateOrMissingIssues {
2006
sub GetLateOrMissingIssues {
1949
    my ( $supplierid, $serialid, $order ) = @_;
2007
    my ( $supplierid, $serialid, $order ) = @_;
2008
2009
    return unless ($supplierid);
2010
1950
    my $dbh = C4::Context->dbh;
2011
    my $dbh = C4::Context->dbh;
1951
    my $sth;
2012
    my $sth;
1952
    my $byserial = '';
2013
    my $byserial = '';
Lines 2021-2026 called when a missing issue is found from the serials-recieve.pl file Link Here
2021
2082
2022
sub removeMissingIssue {
2083
sub removeMissingIssue {
2023
    my ( $sequence, $subscriptionid ) = @_;
2084
    my ( $sequence, $subscriptionid ) = @_;
2085
2086
    return unless ($sequence and $subscriptionid);
2087
2024
    my $dbh = C4::Context->dbh;
2088
    my $dbh = C4::Context->dbh;
2025
    my $sth = $dbh->prepare("SELECT * FROM subscriptionhistory WHERE subscriptionid = ?");
2089
    my $sth = $dbh->prepare("SELECT * FROM subscriptionhistory WHERE subscriptionid = ?");
2026
    $sth->execute($subscriptionid);
2090
    $sth->execute($subscriptionid);
Lines 2106-2111 used to show either an 'add' or 'edit' link Link Here
2106
2170
2107
sub check_routing {
2171
sub check_routing {
2108
    my ($subscriptionid) = @_;
2172
    my ($subscriptionid) = @_;
2173
2174
    return unless ($subscriptionid);
2175
2109
    my $dbh              = C4::Context->dbh;
2176
    my $dbh              = C4::Context->dbh;
2110
    my $sth              = $dbh->prepare(
2177
    my $sth              = $dbh->prepare(
2111
        "SELECT count(routingid) routingids FROM subscription LEFT JOIN subscriptionroutinglist 
2178
        "SELECT count(routingid) routingids FROM subscription LEFT JOIN subscriptionroutinglist 
Lines 2131-2136 of either 1 or highest current rank + 1 Link Here
2131
2198
2132
sub addroutingmember {
2199
sub addroutingmember {
2133
    my ( $borrowernumber, $subscriptionid ) = @_;
2200
    my ( $borrowernumber, $subscriptionid ) = @_;
2201
2202
    return unless ($borrowernumber and $subscriptionid);
2203
2134
    my $rank;
2204
    my $rank;
2135
    my $dbh = C4::Context->dbh;
2205
    my $dbh = C4::Context->dbh;
2136
    my $sth = $dbh->prepare( "SELECT max(ranking) rank FROM subscriptionroutinglist WHERE subscriptionid = ?" );
2206
    my $sth = $dbh->prepare( "SELECT max(ranking) rank FROM subscriptionroutinglist WHERE subscriptionid = ?" );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt (-1 / +1 lines)
Lines 182-188 function show_blocking_subs() { Link Here
182
                        [% END %]
182
                        [% END %]
183
                      </select>
183
                      </select>
184
                    [% END %]
184
                    [% END %]
185
                    <td>Fromatting</td>
185
                    <td>Formatting</td>
186
                    <td>[% PROCESS numbering_select name="numbering1" value=numbering1 %]</td>
186
                    <td>[% PROCESS numbering_select name="numbering1" value=numbering1 %]</td>
187
                    <td>[% PROCESS numbering_select name="numbering2" value=numbering2 %]</td>
187
                    <td>[% PROCESS numbering_select name="numbering2" value=numbering2 %]</td>
188
                    <td>[% PROCESS numbering_select name="numbering3" value=numbering3 %]</td>
188
                    <td>[% PROCESS numbering_select name="numbering3" value=numbering3 %]</td>
(-)a/t/db_dependent/Serials.t (-43 / +72 lines)
Lines 3-15 Link Here
3
# This Koha test module is a stub!
3
# This Koha test module is a stub!
4
# Add more tests here!!!
4
# Add more tests here!!!
5
5
6
use strict;
6
use Modern::Perl;
7
use warnings;
8
use YAML;
7
use YAML;
9
8
9
use CGI;
10
use C4::Serials;
10
use C4::Serials;
11
use C4::Serials::Frequency;
11
use C4::Debug;
12
use C4::Debug;
12
use Test::More tests => 34;
13
use Test::More tests => 35;
13
14
14
BEGIN {
15
BEGIN {
15
    use_ok('C4::Serials');
16
    use_ok('C4::Serials');
Lines 17-99 BEGIN { Link Here
17
18
18
my $subscriptionid = 1;
19
my $subscriptionid = 1;
19
my $subscriptioninformation = GetSubscription( $subscriptionid );
20
my $subscriptioninformation = GetSubscription( $subscriptionid );
20
$debug && warn Dump($subscriptioninformation);
21
21
my @subscriptions = GetSubscriptions( $$subscriptioninformation{bibliotitle} );
22
my @subscriptions = GetSubscriptions( $$subscriptioninformation{bibliotitle} );
22
isa_ok( \@subscriptions, 'ARRAY' );
23
isa_ok( \@subscriptions, 'ARRAY' );
23
$debug && warn scalar(@subscriptions);
24
24
@subscriptions = GetSubscriptions( undef, $$subscriptioninformation{issn} );
25
@subscriptions = GetSubscriptions( undef, $$subscriptioninformation{issn} );
25
isa_ok( \@subscriptions, 'ARRAY' );
26
isa_ok( \@subscriptions, 'ARRAY' );
26
$debug && warn scalar(@subscriptions);
27
27
@subscriptions = GetSubscriptions( undef, undef, $$subscriptioninformation{ean} );
28
@subscriptions = GetSubscriptions( undef, undef, $$subscriptioninformation{ean} );
28
isa_ok( \@subscriptions, 'ARRAY' );
29
isa_ok( \@subscriptions, 'ARRAY' );
29
$debug && warn scalar(@subscriptions);
30
30
@subscriptions = GetSubscriptions( undef, undef, undef, $$subscriptioninformation{bibnum} );
31
@subscriptions = GetSubscriptions( undef, undef, undef, $$subscriptioninformation{bibnum} );
31
isa_ok( \@subscriptions, 'ARRAY' );
32
isa_ok( \@subscriptions, 'ARRAY' );
32
$debug && warn scalar(@subscriptions);
33
33
if ($subscriptioninformation->{periodicity} % 16==0){
34
my $frequency = GetSubscriptionFrequency($subscriptioninformation->{periodicity});
34
	$subscriptioninformation->{periodicity}=7;
35
my $old_frequency;
35
	ModSubscription(@$subscriptioninformation{qw(librarian,           branchcode,      aqbooksellerid,    cost,             aqbudgetid,    startdate,   periodicity,   firstacquidate,
36
if (not $frequency->{unit}) {
36
        dow,             irregularity,    numberpattern,     numberlength,     weeklength,    monthlength, add1,          every1,
37
    $old_frequency = $frequency->{id};
37
        whenmorethan1,   setto1,          lastvalue1,        innerloop1,       add2,          every2,      whenmorethan2, setto2,
38
    $frequency->{unit} = "month";
38
        lastvalue2,      innerloop2,      add3,              every3,           whenmorethan3, setto3,      lastvalue3,    innerloop3,
39
    $frequency->{unitsperissue} = 1;
39
        numberingmethod, status,          biblionumber,      callnumber,       notes,         letter,      hemisphere,    manualhistory,
40
    $frequency->{issuesperunit} = 1;
40
        internalnotes,   serialsadditems, staffdisplaycount, opacdisplaycount, graceperiod,   location,    enddate,       subscriptionid
41
    $frequency->{description} = "Frequency created by t/db_dependant/Serials.t";
41
)});
42
    $subscriptioninformation->{periodicity} = AddSubscriptionFrequency($frequency);
43
44
    ModSubscription( @$subscriptioninformation{qw(
45
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
46
        periodicity firstacquidate irregularity numberpattern locale
47
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
48
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
49
        letter manualhistory internalnotes serialsadditems staffdisplaycount
50
        opacdisplaycount graceperiod location enddate subscriptionid
51
        skip_serialseq
52
    )} );
42
}
53
}
43
my $expirationdate = GetExpirationDate(1) ;
54
my $expirationdate = GetExpirationDate($subscriptionid) ;
44
ok( $expirationdate, "not NULL" );
55
ok( $expirationdate, "not NULL" );
45
$debug && warn "$expirationdate";
46
56
47
is(C4::Serials::GetLateIssues(),"0", 'test getting late issues');
57
is(C4::Serials::GetLateIssues(), undef, 'test getting late issues');
58
59
ok(C4::Serials::GetSubscriptionHistoryFromSubscriptionId($subscriptionid), 'test getting history from sub-scription');
48
60
49
ok(C4::Serials::GetSubscriptionHistoryFromSubscriptionId(), 'test getting history from sub-scription');
61
my ($serials_count, @serials) = GetSerials($subscriptionid);
62
ok($serials_count > 0, 'Subscription has at least one serial');
63
my $serial = $serials[0];
50
64
51
ok(C4::Serials::GetSerialStatusFromSerialId(), 'test getting Serial Status From Serial Id');
65
ok(C4::Serials::GetSerialStatusFromSerialId($serial->{serialid}), 'test getting Serial Status From Serial Id');
52
66
53
ok(C4::Serials::GetSerialInformation(), 'test getting Serial Information');
67
isa_ok(C4::Serials::GetSerialInformation($serial->{serialid}), 'HASH', 'test getting Serial Information');
54
68
55
ok(C4::Serials::AddItem2Serial(), 'test adding item to serial');
69
# Delete created frequency
70
if ($old_frequency) {
71
    my $freq_to_delete = $subscriptioninformation->{periodicity};
72
    $subscriptioninformation->{periodicity} = $old_frequency;
56
73
57
ok(C4::Serials::UpdateClaimdateIssues(), 'test updating claim date');
74
    ModSubscription( @$subscriptioninformation{qw(
75
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
76
        periodicity firstacquidate irregularity numberpattern locale
77
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
78
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
79
        letter manualhistory internalnotes serialsadditems staffdisplaycount
80
        opacdisplaycount graceperiod location enddate subscriptionid
81
        skip_serialseq
82
    )} );
58
83
59
ok(C4::Serials::GetFullSubscription(), 'test getting full subscription');
84
    DelSubscriptionFrequency($freq_to_delete);
85
}
60
86
61
ok(C4::Serials::PrepareSerialsData(), 'test preparing serial data');
62
87
63
ok(C4::Serials::GetSubscriptionsFromBiblionumber(), 'test getting subscriptions form biblio number');
88
# Test calling subs without parameters
89
is(C4::Serials::AddItem2Serial(), undef, 'test adding item to serial');
90
is(C4::Serials::UpdateClaimdateIssues(), undef, 'test updating claim date');
91
is(C4::Serials::GetFullSubscription(), undef, 'test getting full subscription');
92
is(C4::Serials::PrepareSerialsData(), undef, 'test preparing serial data');
93
is(C4::Serials::GetSubscriptionsFromBiblionumber(), undef, 'test getting subscriptions form biblio number');
64
94
65
is(C4::Serials::GetSerials(),"0", 'test getting serials when you enter nothing');
95
is(C4::Serials::GetSerials(), undef, 'test getting serials when you enter nothing');
66
is(C4::Serials::GetSerials2(),"0", 'test getting serials when you enter nothing');
96
is(C4::Serials::GetSerials2(), undef, 'test getting serials when you enter nothing');
67
97
68
ok(C4::Serials::GetLatestSerials(), 'test getting lastest serials');
98
is(C4::Serials::GetLatestSerials(), undef, 'test getting lastest serials');
69
99
70
is(C4::Serials::GetDistributedTo(),"0", 'test getting distributed when nothing is entered');
100
is(C4::Serials::GetDistributedTo(), undef, 'test getting distributed when nothing is entered');
71
101
72
is(C4::Serials::GetNextSeq(),"0", 'test getting next seq when you enter nothing');
102
is(C4::Serials::GetNextSeq(), undef, 'test getting next seq when you enter nothing');
73
103
74
is(C4::Serials::GetSeq(),undef, 'test getting seq when you enter nothing');
104
is(C4::Serials::GetSeq(), undef, 'test getting seq when you enter nothing');
75
105
76
is(C4::Serials::CountSubscriptionFromBiblionumber(),"0", 'test counting subscription when nothing is entered');
106
is(C4::Serials::CountSubscriptionFromBiblionumber(), undef, 'test counting subscription when nothing is entered');
77
107
78
is(C4::Serials::ModSubscriptionHistory(),"0", 'test modding subscription history');
108
is(C4::Serials::ModSubscriptionHistory(), undef, 'test modding subscription history');
79
109
80
is(C4::Serials::ModSerialStatus(),undef, 'test modding serials');
110
is(C4::Serials::ModSerialStatus(),undef, 'test modding serials');
81
111
82
is(C4::Serials::NewIssue(),"0", 'test getting 0 when nothing is entered');
112
is(C4::Serials::NewIssue(), undef, 'test getting 0 when nothing is entered');
83
113
84
is(C4::Serials::ItemizeSerials(),undef, 'test getting nothing when nothing is entered');
114
is(C4::Serials::ItemizeSerials(),undef, 'test getting nothing when nothing is entered');
85
115
86
ok(C4::Serials::HasSubscriptionStrictlyExpired(), 'test if the subscriptions has expired');
116
is(C4::Serials::HasSubscriptionStrictlyExpired(), undef, 'test if the subscriptions has expired');
87
is(C4::Serials::HasSubscriptionExpired(),"0", 'test if the subscriptions has expired');
117
is(C4::Serials::HasSubscriptionExpired(), undef, 'test if the subscriptions has expired');
88
118
89
is(C4::Serials::GetLateOrMissingIssues(),"0", 'test getting last or missing issues');
119
is(C4::Serials::GetLateOrMissingIssues(), undef, 'test getting last or missing issues');
90
120
91
is(C4::Serials::removeMissingIssue(),undef, 'test removing a missing issue');
121
is(C4::Serials::removeMissingIssue(), undef, 'test removing a missing issue');
92
122
93
is(C4::Serials::updateClaim(),undef, 'test updating claim');
123
is(C4::Serials::updateClaim(),undef, 'test updating claim');
94
124
95
is(C4::Serials::getsupplierbyserialid(),undef, 'test getting supplier idea');
125
is(C4::Serials::getsupplierbyserialid(),undef, 'test getting supplier idea');
96
126
97
is(C4::Serials::check_routing(),"0", 'test checking route');
127
is(C4::Serials::check_routing(), undef, 'test checking route');
98
128
99
is(C4::Serials::addroutingmember(),undef, 'test adding route member');
129
is(C4::Serials::addroutingmember(),undef, 'test adding route member');
100
- 

Return to bug 7688