@@ -, +, @@
---
C4/Serials.pm | 29 ++-
.../en/modules/serials/subscription-add.tt | 1 +
.../en/modules/serials/subscription-detail.tt | 215 ++++++++++++++++++
.../intranet-tmpl/prog/js/subscription-add.js | 36 ++-
serials/serials-collection.pl | 15 +-
serials/showpredictionpattern.pl | 9 +
serials/subscription-add.pl | 9 +
7 files changed, 308 insertions(+), 6 deletions(-)
--- a/C4/Serials.pm
+++ a/C4/Serials.pm
@@ -840,8 +840,13 @@ sub GetNextSeq {
}
}
- my $numberingmethod = $pattern->{numberingmethod};
my $calculated = "";
+ my $numberingmethod = "";
+ if ($pattern eq "pubdate"){
+ $calculated = dt_from_string( $planneddate )->strftime( '%Y %B %d' );
+ } else {
+ $numberingmethod = $pattern->{numberingmethod};
+ }
if ($numberingmethod) {
$calculated = $numberingmethod;
my $locale = $subscription->{locale};
@@ -922,6 +927,10 @@ the sequence in string format
sub GetSeq {
my ($subscription, $pattern) = @_;
+ if ($pattern->{numberingmethod} eq ''){
+ return "pubdate";
+ }
+
return unless ($subscription and $pattern);
my $locale = $subscription->{locale};
@@ -1126,6 +1135,19 @@ sub ModSerialStatus {
my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern});
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity});
+ my $nextpublisheddate = GetNextDate($subscription, $publisheddate, 1);
+ my ( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3,
+ $newinnerloop1, $newinnerloop2, $newinnerloop3 );
+
+ if (!defined $pattern){
+ $pattern = "pubdate";
+ ( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3,
+ $newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $nextpublisheddate );
+ } else {
+ ( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3,
+ $newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $publisheddate );
+ }
+
# next issue number
my (
$newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3,
@@ -1134,7 +1156,6 @@ sub ModSerialStatus {
= GetNextSeq( $subscription, $pattern, $frequency, $publisheddate );
# next date (calculated from actual date & frequency parameters)
- my $nextpublisheddate = GetNextDate($subscription, $publisheddate, $frequency, 1);
my $nextpubdate = $nextpublisheddate;
$query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=?
WHERE subscriptionid = ?";
@@ -1454,6 +1475,10 @@ sub NewSubscription {
# calculate issue number
my $serialseq = GetSeq($subscription, $pattern) || q{};
+ if ($serialseq eq "pubdate"){
+ $serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d');
+ }
+
Koha::Serial->new(
{
serialseq => $serialseq,
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
@@ -370,6 +370,7 @@ fieldset.rows table { clear: none; margin: 0; }
[% numberpattern.label | html %]
[% END %]
+
Required
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt
@@ -82,6 +82,221 @@
[% END %]
+
+
+
+
+
+ - Beginning date: [% startdate | html %]
+
+ - Frequency:
+ [% frequency.description | html %]
+
+ -
+ Manual history:
+ [% IF ( manualhistory ) %]
+ Enabled Edit history
+ [% ELSE %]
+ Disabled
+ [% END %]
+
+ - Number pattern:
+ [% IF ( numberpattern ) %]
+ [% numberpattern.label | html %]
+ [% ELSE %]
+ Uses publication date
+ [% END %]
+
+ [% IF ( numberpattern ) %]
+
+
+ Starting with: |
+ [% IF (has_X) %]
+ [% lastvalue1 | html %] |
+ [% END %]
+ [% IF (has_Y) %]
+ [% lastvalue2 | html %] |
+ [% END %]
+ [% IF (has_Z) %]
+ [% lastvalue3 | html %] |
+ [% END %]
+
+
+ Rollover: |
+ [% IF (has_X) %]
+ [% numberpattern.whenmorethan1 | html %] |
+ [% END %]
+ [% IF (has_Y) %]
+ [% numberpattern.whenmorethan2 | html %] |
+ [% END %]
+ [% IF (has_Z) %]
+ [% numberpattern.whenmorethan3 | html %] |
+ [% END %]
+
+
+ [% END %]
+ [% IF ( irregular_issues ) %]
+ - Irregularity: [% irregular_issues | html %] issues
+
+ [% END %]
+ - First arrival: [% firstacquidate | html %]
+
+ [% IF ( numberlength ) %]- Number of issues: [% numberlength | html %]
[% END %]
+ [% IF ( weeklength ) %]- Number of weeks: [% weeklength | html %]
[% END %]
+ [% IF ( monthlength ) %]- Number of months: [% monthlength | html %]
[% END %]
+
+
+
+
+
+
+
Numbering calculation
+
[% numberingmethod | html %]
+
+
+ |
+ X |
+ Y |
+ Z |
+
+
+ Add |
+
+ [% add1 | html %]
+ |
+
+ [% add2 | html %]
+ |
+
+ [% add3 | html %]
+ |
+
+
+ once every |
+ [% every1 | html %] |
+ [% every2 | html %] |
+ [% every3 | html %] |
+
+
+ When more than |
+ [% whenmorethan1 | html %] [% IF ( innerloop1 ) %]
+ (is [% innerloop1 | html %])[% END %] |
+ [% whenmorethan2 | html %] [% IF ( innerloop2 ) %]
+ (is [% innerloop2 | html %])[% END %] |
+ [% whenmorethan3 | html %] [% IF ( innerloop3 ) %]
+ (is [% innerloop3 | html %])[% END %] |
+
+
+ Set back to |
+ [% setto1 | html %] |
+ [% setto2 | html %] |
+ [% setto3 | html %] |
+
+
+
+ Inner counter
+ |
+ [% innerloop1 | html %] |
+ [% innerloop2 | html %] |
+ [% innerloop3 | html %] |
+
+
+
+ Last value
+ |
+ [% lastvalue1 | html %] |
+ [% lastvalue2 | html %] |
+ [% lastvalue3 | html %] |
+
+
+
+
+
+
+ Issue number |
+ Planned date |
+ Published date |
+ Published date (text) |
+ Status |
+
+ [% FOREACH serialslis IN serialslist %]
+
+
+ [% serialslis.serialseq | html %]
+ |
+
+ [% IF serialslis.planneddate %]
+ [% serialslis.planneddate | html %]
+ [% ELSE %]
+ Unknown
+ [% END %]
+ |
+
+ [% IF serialslis.publisheddate %]
+ [% serialslis.publisheddate | html %]
+ [% ELSE %]
+ Unknown
+ [% END %]
+ |
+
+ [% serialslis.publisheddatetext | html %]
+ |
+
+ [% IF ( serialslis.status1 ) %]Expected[% END %]
+ [% IF ( serialslis.status2 ) %]Arrived[% END %]
+ [% IF ( serialslis.status3 ) %]Late[% END %]
+ [% IF ( serialslis.status4 ) %]Missing[% END %]
+ [% IF ( serialslis.status41 ) %]Missing (never received)[% END %]
+ [% IF ( serialslis.status42 ) %]Missing (sold out)[% END %]
+ [% IF ( serialslis.status43 ) %]Missing (damaged)[% END %]
+ [% IF ( serialslis.status44 ) %]Missing (lost)[% END %]
+ [% IF ( serialslis.status5 ) %]Not issued[% END %]
+ [% IF ( serialslis.status6 ) %]Delete[% END %]
+ [% IF ( serialslis.status7 ) %]
+ Claimed
+ [% IF ( serialslis.claimdate ) %]
+ [% serialslis.claimdate | html %]
+ [% END %]
+ [% END %]
+ [% IF ( serialslis.status8 ) %]Stopped[% END %]
+ |
+
+ [% END %]
+
+
+
+
+
+
+
+ - Start date: [% startdate | html %]
+ - End date: [% enddate | html %]
+ - History start date: [% histstartdate | html %]
+ - History end date: [% histenddate | html %]
+ - Received issues:[% recievedlist | html | html_line_break %]
+ - Missing issues:[% missinglist | html | html_line_break %]
+ - Nonpublic note:[% internalnotes | html | html_line_break %]
+ - Public note:[% notes | html | html_line_break %]
+ - History staff note:[% librariannote | html | html_line_break %]
+ - History OPAC note:[% opacnote | html | html_line_break %]
+
+
+
+
+
+
+ [% IF orders_grouped.size %]
+
+
Acquisition details
+
+
+
+ Hide already received orders
+ | Show all orders
+ | Expand all
+ | Collapse all
+
+
[% WRAPPER tabs id= "subscription_description" %]
[% WRAPPER tabs_nav %]
--- a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js
+++ a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js
@@ -252,6 +252,24 @@ function modifyAdvancedPattern() {
advancedpatternlocked = 0;
}
+function clearAdvancedPattern() {
+ $("#patternname").prop('readOnly', false).val('');
+ $("#numberingmethod").prop('readOnly', false).val('');
+
+ $("#advancedpredictionpatternt input").each(function() {
+ $(this).prop('readOnly', false).val('');
+ });
+ $("#advancedpredictionpatternt select").each(function() {
+ $(this).prop('disabled', false).val('');
+ });
+
+ $("#restoreadvancedpatternbutton").hide();
+ $("#saveadvancedpatternbutton").hide();
+ $("#modifyadvancedpatternbutton").hide();
+
+ advancedpatternlocked = 1;
+}
+
function restoreAdvancedPattern() {
$("#patternname").prop('readOnly', true).val(globalnumpatterndata.label);
$("#numberingmethod").prop('readOnly', true).val(globalnumpatterndata.numberingmethod);
@@ -553,6 +571,15 @@ function hidePredcitionPatternTest(){
$("#page_2 > div").attr("class","col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2");
}
+function usedatepattern() {
+ $("#more_options").hide();
+ clearAdvancedPattern();
+ if ($("#advancedpredictionpattern").is(":visible")){
+ $("#advancedpredictionpattern").toggle();
+ $(".toggle_advanced_pattern").toggle();
+ }
+}
+
$(document).ready(function() {
if ( mana_enabled == 1 ) {
mana_search();
@@ -585,7 +612,12 @@ $(document).ready(function() {
});
$("select#numberpattern").change(function(){
patternneedtobetested = 1;
- numberpatternload();
+ console.log($("select#numberpattern").val());
+ if ($("select#numberpattern").val() == "0"){
+ usedatepattern();
+ } else {
+ numberpatternload();
+ }
});
$("#subtype").change(function(){
$("input[name='enddate']").val('');
@@ -634,7 +666,7 @@ $(document).ready(function() {
if($("#frequency").val() != ""){
frequencyload();
}
- if($("#numberpattern").val() != ""){
+ if($("#numberpattern").val() != "0" && $("#numberpattern").val() != ""){
numberpatternload();
}
--- a/serials/serials-collection.pl
+++ a/serials/serials-collection.pl
@@ -81,6 +81,10 @@ if($op eq 'gennext' && @subscriptionid){
$newinnerloop1, $newinnerloop2, $newinnerloop3
) = GetNextSeq($subscription, $pattern, $frequency, $expected->{publisheddate});
+ if (!defined $pattern && !defined $newserialseq){
+ $newserialseq = $expected->{publisheddate};
+ }
+
## We generate the next publication date
my $nextpublisheddate = GetNextDate($subscription, $expected->{publisheddate}, $frequency, 1);
my $planneddate = $date_received_today ? dt_from_string : $nextpublisheddate;
@@ -151,8 +155,11 @@ if (@subscriptionid){
$location = $subs->{'location'};
$callnumber = $subs->{callnumber};
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subs->{periodicity});
- my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subs->{numberpattern});
$subs->{frequency} = $frequency;
+ my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subs->{numberpattern});
+ if (!defined $numberpattern){
+ $numberpattern->{label} = "Uses publication date";
+ }
$subs->{numberpattern} = $numberpattern;
$subs->{'hasRouting'} = check_routing($subscriptionid);
push @$subscriptiondescs,$subs;
@@ -171,7 +178,11 @@ if (@subscriptionid){
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($s->{periodicity});
my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($s->{numberpattern});
$s->{frequency} = $frequency;
- $s->{numberpattern} = $numberpattern;
+ if (!defined $numberpattern){
+ $numberpattern->{label} = "pubdate";
+ } else {
+ $s->{numberpattern} = $numberpattern;
+ }
}
my $subscriptioninformation = GetFullSubscriptionsFromBiblionumber($biblionumber);
$subscriptions=PrepareSerialsData($subscriptioninformation);
--- a/serials/showpredictionpattern.pl
+++ a/serials/showpredictionpattern.pl
@@ -35,6 +35,7 @@ use Date::Calc qw( Add_Delta_Days Add_Delta_YM Day_of_Week Delta_Days );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Serials qw( GetSubscription GetFictiveIssueNumber GetSeq GetSubscriptionIrregularities GetNextDate GetNextSeq );
+use POSIX qw(strftime);
use C4::Serials::Frequency;
use Koha::DateUtils qw( dt_from_string );
@@ -119,6 +120,11 @@ if(defined $subscriptionid) {
my @predictions_loop;
my ($calculated) = GetSeq(\%subscription, \%pattern);
+
+if ($calculated eq "pubdate"){
+ $calculated = dt_from_string( $date )->strftime('%Y %B %d');
+}
+
push @predictions_loop, {
number => $calculated,
publicationdate => $date,
@@ -166,6 +172,9 @@ while( $i < 1000 ) {
($calculated, $subscription{'lastvalue1'}, $subscription{'lastvalue2'}, $subscription{'lastvalue3'}, $subscription{'innerloop1'}, $subscription{'innerloop2'}, $subscription{'innerloop3'}) = GetNextSeq(\%subscription, \%pattern, $frequency);
$issuenumber++;
$line{'number'} = $calculated;
+ if ($calculated eq ''){
+ $line{'number'} = dt_from_string( $date )->strftime('%Y %B %d');
+ }
$line{'issuenumber'} = $issuenumber;
if(@irreg && $issuenumber == $irreg[0]){
$line{'not_published'} = 1;
--- a/serials/subscription-add.pl
+++ a/serials/subscription-add.pl
@@ -349,6 +349,11 @@ sub redirect_add_subscription {
$enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength)
}
}
+
+ if ($numberpattern == "0"){ # using publication date as numbering pattern
+ $numberpattern = undef;
+ }
+
my $subscriptionid = NewSubscription(
$auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
$startdate, $periodicity, $numberlength, $weeklength,
@@ -467,6 +472,10 @@ sub redirect_mod_subscription {
$firstissuedate = $nextacquidate if($nextexpected->{isfirstissue});
}
+ if ($numberpattern == "0"){ # using publication date as numbering pattern
+ $numberpattern = undef;
+ }
+
ModSubscription(
$auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
$periodicity, $firstacquidate, join(";",@irregularity),
--