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

(-)a/C4/Serials.pm (-12 / +27 lines)
Lines 338-343 sub GetFullSubscription { Link Here
338
            serial.serialseq,
338
            serial.serialseq,
339
            serial.planneddate, 
339
            serial.planneddate, 
340
            serial.publisheddate, 
340
            serial.publisheddate, 
341
            serial.publisheddatetext,
341
            serial.status, 
342
            serial.status, 
342
            serial.notes as notes,
343
            serial.notes as notes,
343
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
344
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 494-499 sub GetFullSubscriptionsFromBiblionumber { Link Here
494
            serial.serialseq,
495
            serial.serialseq,
495
            serial.planneddate, 
496
            serial.planneddate, 
496
            serial.publisheddate, 
497
            serial.publisheddate, 
498
            serial.publisheddatetext,
497
            serial.status, 
499
            serial.status, 
498
            serial.notes as notes,
500
            serial.notes as notes,
499
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
501
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 662-668 sub GetSerials { Link Here
662
    $count = 5 unless ($count);
664
    $count = 5 unless ($count);
663
    my @serials;
665
    my @serials;
664
    my $statuses = join( ',', ( ARRIVED, MISSING_STATUSES, NOT_ISSUED ) );
666
    my $statuses = join( ',', ( ARRIVED, MISSING_STATUSES, NOT_ISSUED ) );
665
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes
667
    my $query = "SELECT serialid,serialseq, status, publisheddate,
668
        publisheddatetext, planneddate,notes, routingnotes
666
                        FROM   serial
669
                        FROM   serial
667
                        WHERE  subscriptionid = ? AND status NOT IN ( $statuses )
670
                        WHERE  subscriptionid = ? AND status NOT IN ( $statuses )
668
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
671
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
Lines 682-688 sub GetSerials { Link Here
682
    }
685
    }
683
686
684
    # OK, now add the last 5 issues arrives/missing
687
    # OK, now add the last 5 issues arrives/missing
685
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
688
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,
689
        publisheddatetext, notes, routingnotes
686
       FROM     serial
690
       FROM     serial
687
       WHERE    subscriptionid = ?
691
       WHERE    subscriptionid = ?
688
       AND      status IN ( $statuses )
692
       AND      status IN ( $statuses )
Lines 731-737 sub GetSerials2 { Link Here
731
735
732
    my $dbh   = C4::Context->dbh;
736
    my $dbh   = C4::Context->dbh;
733
    my $query = qq|
737
    my $query = qq|
734
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
738
                 SELECT serialid,serialseq, status, planneddate, publisheddate,
739
                    publisheddatetext, notes, routingnotes
735
                 FROM     serial 
740
                 FROM     serial 
736
                 WHERE    subscriptionid=$subscription AND status IN ($statuses_string)
741
                 WHERE    subscriptionid=$subscription AND status IN ($statuses_string)
737
                 ORDER BY publisheddate,serialid DESC
742
                 ORDER BY publisheddate,serialid DESC
Lines 1059-1065 sub ModSubscriptionHistory { Link Here
1059
1064
1060
=head2 ModSerialStatus
1065
=head2 ModSerialStatus
1061
1066
1062
ModSerialStatus($serialid,$serialseq, $planneddate,$publisheddate,$status,$notes)
1067
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1068
        $publisheddatetext, $status, $notes);
1063
1069
1064
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1070
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1065
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1071
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1067-1073 Note : if we change from "waited" to something else,then we will have to create Link Here
1067
=cut
1073
=cut
1068
1074
1069
sub ModSerialStatus {
1075
sub ModSerialStatus {
1070
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1076
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1077
        $status, $notes) = @_;
1071
1078
1072
    return unless ($serialid);
1079
    return unless ($serialid);
1073
1080
Lines 1089-1097 sub ModSerialStatus { Link Here
1089
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1096
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1090
    } else {
1097
    } else {
1091
1098
1092
        my $query = 'UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE  serialid = ?';
1099
        my $query = '
1100
            UPDATE serial
1101
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1102
                planneddate = ?, status = ?, notes = ?
1103
            WHERE  serialid = ?
1104
        ';
1093
        $sth = $dbh->prepare($query);
1105
        $sth = $dbh->prepare($query);
1094
        $sth->execute( $serialseq, $publisheddate, $planneddate, $status, $notes, $serialid );
1106
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1107
            $planneddate, $status, $notes, $serialid );
1095
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1108
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1096
        $sth   = $dbh->prepare($query);
1109
        $sth   = $dbh->prepare($query);
1097
        $sth->execute($subscriptionid);
1110
        $sth->execute($subscriptionid);
Lines 1495-1513 returns the serial id Link Here
1495
=cut
1508
=cut
1496
1509
1497
sub NewIssue {
1510
sub NewIssue {
1498
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_;
1511
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1512
        $publisheddate, $publisheddatetext, $notes ) = @_;
1499
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1513
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1500
1514
1501
    return unless ($subscriptionid);
1515
    return unless ($subscriptionid);
1502
1516
1503
    my $dbh   = C4::Context->dbh;
1517
    my $dbh   = C4::Context->dbh;
1504
    my $query = qq|
1518
    my $query = qq|
1505
        INSERT INTO serial
1519
        INSERT INTO serial (serialseq, subscriptionid, biblionumber, status,
1506
            (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes)
1520
            publisheddate, publisheddatetext, planneddate, notes)
1507
        VALUES (?,?,?,?,?,?,?)
1521
        VALUES (?,?,?,?,?,?,?,?)
1508
    |;
1522
    |;
1509
    my $sth = $dbh->prepare($query);
1523
    my $sth = $dbh->prepare($query);
1510
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes );
1524
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status,
1525
        $publisheddate, $publisheddatetext, $planneddate, $notes );
1511
    my $serialid = $dbh->{'mysql_insertid'};
1526
    my $serialid = $dbh->{'mysql_insertid'};
1512
    $query = qq|
1527
    $query = qq|
1513
        SELECT missinglist,recievedlist
1528
        SELECT missinglist,recievedlist
(-)a/installer/data/mysql/atomicupdate/bug_8296.sql (+2 lines)
Line 0 Link Here
1
ALTER TABLE serial
2
ADD COLUMN publisheddatetext VARCHAR(100) DEFAULT NULL AFTER publisheddate
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1957-1962 CREATE TABLE `serial` ( -- issues related to subscriptions Link Here
1957
  `planneddate` date default NULL, -- date expected
1957
  `planneddate` date default NULL, -- date expected
1958
  `notes` text, -- notes
1958
  `notes` text, -- notes
1959
  `publisheddate` date default NULL, -- date published
1959
  `publisheddate` date default NULL, -- date published
1960
  publisheddatetext varchar(100) default NULL, -- date published (descriptive)
1960
  `claimdate` date default NULL, -- date claimed
1961
  `claimdate` date default NULL, -- date claimed
1961
  claims_count int(11) default 0, -- number of claims made related to this issue
1962
  claims_count int(11) default 0, -- number of claims made related to this issue
1962
  `routingnotes` text, -- notes from the routing list
1963
  `routingnotes` text, -- notes from the routing list
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (+14 lines)
Lines 205-210 $(document).ready(function() { Link Here
205
[% END %]
205
[% END %]
206
                <th class="title-string">Date published
206
                <th class="title-string">Date published
207
                </th>
207
                </th>
208
                <th class="title-string">Date published (text)
209
                </th>
208
                <th class="title-string">Date received
210
                <th class="title-string">Date received
209
                </th>
211
                </th>
210
                <th>Number
212
                <th>Number
Lines 251-256 $(document).ready(function() { Link Here
251
                    </span>
253
                    </span>
252
                </td>
254
                </td>
253
                <td>
255
                <td>
256
                    [% publisheddatetext = serial.publisheddatetext || serial.publisheddate %]
257
                    <span title="[% publisheddatetext %]">
258
                      [% IF serial.publisheddatetext %]
259
                        [% publisheddatetext %]
260
                      [% ELSIF serial.publisheddate %]
261
                        [% serial.publisheddate | $KohaDates %]
262
                      [% ELSE %]
263
                        Unknown
264
                      [% END %]
265
                    </span>
266
                </td>
267
                <td>
254
                    <span title="[% serial.planneddate %]">
268
                    <span title="[% serial.planneddate %]">
255
                      [% IF serial.planneddate %]
269
                      [% IF serial.planneddate %]
256
                        [% serial.planneddate | $KohaDates %]
270
                        [% serial.planneddate | $KohaDates %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt (+7 lines)
Lines 114-119 $(document).ready(function() { Link Here
114
	<tr>
114
	<tr>
115
		<th>Numbered</th>
115
		<th>Numbered</th>
116
		<th>Published on</th>
116
		<th>Published on</th>
117
        <th>Published on (text)</th>
117
		<th>Expected on</th>
118
		<th>Expected on</th>
118
		<th>Status</th>
119
		<th>Status</th>
119
		<th>Notes</th>
120
		<th>Notes</th>
Lines 135-140 $(document).ready(function() { Link Here
135
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" class="datepicker" />
136
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" class="datepicker" />
136
        </td>
137
        </td>
137
        <td>
138
        <td>
139
            <input type="text" name="publisheddatetext" value="[% serialslis.publisheddatetext || serialslis.publisheddate %]" size="10" maxlength="15" />
140
        </td>
141
        <td>
138
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" class="datepicker" />
142
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" class="datepicker" />
139
        </td>
143
        </td>
140
        <td>
144
        <td>
Lines 289-294 $(document).ready(function() { Link Here
289
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15"  class="datepicker" />
293
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15"  class="datepicker" />
290
        </td>
294
        </td>
291
        <td>
295
        <td>
296
            <input type="text" name="publisheddatetext" value="[% newserialloo.publisheddatetext || newserialloo.publisheddate %]" size="10" maxlength="15" />
297
        </td>
298
        <td>
292
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" class="datepicker" />
299
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" class="datepicker" />
293
        </td>
300
        </td>
294
        <td>
301
        <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+4 lines)
Lines 251-256 $(document).ready(function() { Link Here
251
            <th>Issue number</th>
251
            <th>Issue number</th>
252
            <th>Planned date</th>
252
            <th>Planned date</th>
253
            <th>Published date</th>
253
            <th>Published date</th>
254
            <th>Published date (text)</th>
254
            <th>Status</th>
255
            <th>Status</th>
255
        </tr>
256
        </tr>
256
        [% FOREACH serialslis IN serialslist %]
257
        [% FOREACH serialslis IN serialslist %]
Lines 273-278 $(document).ready(function() { Link Here
273
                    [% END %]
274
                    [% END %]
274
                </td>
275
                </td>
275
                <td>
276
                <td>
277
                    [% serialslis.publisheddatetext || serialslis.publisheddate %]
278
                </td>
279
                <td>
276
                    [% IF ( serialslis.status1 ) %]Expected[% END %]
280
                    [% IF ( serialslis.status1 ) %]Expected[% END %]
277
                    [% IF ( serialslis.status2 ) %]Arrived[% END %]
281
                    [% IF ( serialslis.status2 ) %]Arrived[% END %]
278
                    [% IF ( serialslis.status3 ) %]Late[% END %]
282
                    [% IF ( serialslis.status3 ) %]Late[% END %]
(-)a/misc/cronjobs/serialsUpdate.pl (-1 / +1 lines)
Lines 131-137 while ( my $issue = $sth->fetchrow_hashref ) { Link Here
131
            {
131
            {
132
                $confirm
132
                $confirm
133
                  and ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
133
                  and ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
134
                    $issue->{planneddate}, $issue->{publisheddate},
134
                    $issue->{planneddate}, $issue->{publisheddate}, $issue->{publisheddatetext},
135
                    3, $note );
135
                    3, $note );
136
                $verbose
136
                $verbose
137
                  and print "Serial issue with id=" . $issue->{serialid} . " updated\n";
137
                  and print "Serial issue with id=" . $issue->{serialid} . " updated\n";
(-)a/serials/serials-collection.pl (-3 / +7 lines)
Lines 55-62 my $subscriptions; Link Here
55
55
56
if($op eq 'gennext' && @subscriptionid){
56
if($op eq 'gennext' && @subscriptionid){
57
    my $subscriptionid = $subscriptionid[0];
57
    my $subscriptionid = $subscriptionid[0];
58
    my $sth = $dbh->prepare("SELECT publisheddate, serialid, serialseq, planneddate
58
    my $sth = $dbh->prepare("
59
							FROM serial WHERE status = 1 AND subscriptionid = ?");
59
        SELECT publisheddate, publisheddatetext, serialid, serialseq,
60
            planneddate
61
        FROM serial
62
        WHERE status = 1 AND subscriptionid = ?
63
    ");
60
    my $status = defined( $nbissues ) ? 2 : 3;
64
    my $status = defined( $nbissues ) ? 2 : 3;
61
    $nbissues ||= 1;
65
    $nbissues ||= 1;
62
    for ( my $i = 0; $i < $nbissues; $i++ ){
66
    for ( my $i = 0; $i < $nbissues; $i++ ){
Lines 65-71 if($op eq 'gennext' && @subscriptionid){ Link Here
65
        if ( my $issue = $sth->fetchrow_hashref ) {
69
        if ( my $issue = $sth->fetchrow_hashref ) {
66
            ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
70
            ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
67
                    $issue->{planneddate}, $issue->{publisheddate},
71
                    $issue->{planneddate}, $issue->{publisheddate},
68
                    $status, "" );
72
                    $issue->{publisheddatetext}, $status, "" );
69
        } else {
73
        } else {
70
            require C4::Serials::Numberpattern;
74
            require C4::Serials::Numberpattern;
71
            my $subscription = GetSubscription($subscriptionid);
75
            my $subscription = GetSubscription($subscriptionid);
(-)a/serials/serials-edit.pl (-1 / +4 lines)
Lines 82-87 my @serialids = $query->param('serialid'); Link Here
82
my @serialseqs      = $query->param('serialseq');
82
my @serialseqs      = $query->param('serialseq');
83
my @planneddates    = $query->param('planneddate');
83
my @planneddates    = $query->param('planneddate');
84
my @publisheddates  = $query->param('publisheddate');
84
my @publisheddates  = $query->param('publisheddate');
85
my @publisheddates  = $query->param('publisheddate');
86
my @publisheddatetexts = $query->param('publisheddatetext');
85
my @status          = $query->param('status');
87
my @status          = $query->param('status');
86
my @notes           = $query->param('notes');
88
my @notes           = $query->param('notes');
87
my @subscriptionids = $query->param('subscriptionid');
89
my @subscriptionids = $query->param('subscriptionid');
Lines 231-236 if ( $op and $op eq 'serialchangestatus' ) { Link Here
231
                    $status[$i],
233
                    $status[$i],
232
                    $plan_date,
234
                    $plan_date,
233
                    $pub_date,
235
                    $pub_date,
236
                    $publisheddatetexts[$i],
234
                    $notes[$i]
237
                    $notes[$i]
235
                );
238
                );
236
            }
239
            }
Lines 241-246 if ( $op and $op eq 'serialchangestatus' ) { Link Here
241
                $serialseqs[$i],
244
                $serialseqs[$i],
242
                $plan_date,
245
                $plan_date,
243
                $pub_date,
246
                $pub_date,
247
                $publisheddatetexts[$i],
244
                $status[$i],
248
                $status[$i],
245
                $notes[$i]
249
                $notes[$i]
246
            );
250
            );
247
- 

Return to bug 8296